From 3221c057206ca22c2da599c8c76bbcbb0f36e794 Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Sun, 16 Aug 2015 15:55:35 +0200 Subject: build: Compile and install '.go' files. * configure.ac: Set and substitute 'mcronmoduledir'. Check for 'guild' which requires Guile >= 2.0.7. Use 'AC_CANONICAL_HOST'. * scm/mcron/makefile.am (.scm.go): New target. (MODULES, GEN_MODULES, GOBJECTS, CLEANFILES, SUFFIXES) (dist_mcronmodule_DATA, mcronmodule_DATA): New variables. (pkgdata_DATA, EXTRA_DIST): Remove variables. * .gitignore: Adjust accordingly. --- scm/mcron/main.scm | 2 ++ scm/mcron/makefile.am | 48 +++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 45 insertions(+), 5 deletions(-) (limited to 'scm') diff --git a/scm/mcron/main.scm b/scm/mcron/main.scm index 1d8c87b..6ac2116 100644 --- a/scm/mcron/main.scm +++ b/scm/mcron/main.scm @@ -343,6 +343,8 @@ comes in on the above socket." (unless (option-ref options 'schedule #f) (with-output-to-file config-pid-file noop)) (setenv "MAILTO" #f) + ;; XXX: At compile time, this yields a "possibly unbound variable" + ;; warning, but this is OK since it is bound in the C wrapper. (c-set-cron-signals)) ;; Now we have the procedures in place for dealing with the contents of diff --git a/scm/mcron/makefile.am b/scm/mcron/makefile.am index 931b03b..ab6cae2 100644 --- a/scm/mcron/makefile.am +++ b/scm/mcron/makefile.am @@ -1,10 +1,48 @@ -EXTRA_DIST = main.scm mcron-core.scm vixie-specification.scm \ - crontab.scm environment.scm job-specifier.scm redirect.scm \ - vixie-time.scm +MODULES = \ + environment.scm \ + job-specifier.scm \ + main.scm \ + redirect.scm \ + vixie-specification.scm \ + vixie-time.scm -pkgdata_DATA = core.scm environment.scm job-specifier.scm redirect.scm \ - vixie-time.scm vixie-specification.scm config.scm +GEN_MODULES = \ + config.scm \ + core.scm +GOBJECTS = \ + $(GEN_MODULES:%.scm=%.go) \ + $(MODULES:%.scm=%.go) + +mcronmodule_DATA = \ + $(GOBJECTS) \ + $(GEN_MODULES) + +dist_mcronmodule_DATA = \ + $(MODULES) \ + crontab.scm \ + mcron-core.scm + +# Unset 'GUILE_LOAD_COMPILED_PATH' altogether while compiling. Otherwise, if +# $GUILE_LOAD_COMPILED_PATH contains $(mcronmoduledir), we may find .go files +# in there that are newer than the local .scm files (for instance because the +# user ran 'make install' recently). When that happens, we end up loading +# those previously-installed .go files, which may be stale, thereby breaking +# the whole thing. +# +# XXX: Use the C locale for when Guile lacks +# . +.scm.go: + unset GUILE_LOAD_COMPILED_PATH ; \ + LC_ALL=C \ + $(GUILD) compile \ + --load-path="$(top_builddir)/scm" \ + --load-path="$(top_srcdir)/scm" \ + --warn=format --warn=unbound-variable --warn=arity-mismatch \ + --target="$(host)" --output="$@" "$<" + +SUFFIXES = .go +CLEANFILES = $(GOBJECTS) # If you're wondering, the configure script keeps deleting all files with a name # like core.*, so we have to keep re-making it (I lost a good day's work because -- cgit v1.2.3