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.
This commit is contained in:
Mathieu Lirzin 2015-08-16 15:55:35 +02:00
commit 3221c05720
4 changed files with 58 additions and 7 deletions

3
.gitignore vendored
View file

@ -1,9 +1,12 @@
*~
*.go
.deps
INSTALL
aclocal.m4
autom4te.cache
/build-aux/compile
/build-aux/config.guess
/build-aux/config.sub
/build-aux/depcomp
/build-aux/install-sh
/build-aux/mdate-sh

View file

@ -26,6 +26,8 @@ AC_INIT([GNU Mcron], [1.0.8], [bug-mcron@gnu.org])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE
mcronmoduledir="${datarootdir}/guile/site/2.0/mcron"
AC_SUBST([mcronmoduledir])
AC_MSG_CHECKING([whether debugging is requested])
AC_ARG_ENABLE(debug,
@ -45,12 +47,18 @@ AC_SUBST(CONFIG_DEBUG)
# We have no interest (hence a no-op), but Debian wants this.
AC_ARG_ENABLE(maintainer-mode)
AC_CANONICAL_HOST
AC_PROG_AWK
AC_PROG_EGREP
AM_PROG_CC_C_O
PKG_CHECK_MODULES(GUILE, guile-2.0)
PKG_CHECK_MODULES([GUILE], [guile-2.0 >= 2.0.7])
AC_PATH_PROG([GUILE], [guile])
# search guild
AC_PATH_PROG([GUILD], [guild])
AS_IF([test -z "$ac_cv_path_GUILD"],
[AC_MSG_ERROR(['guild' program cannot be found.])])
# Checks for programs.

View file

@ -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

View file

@ -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
# <http://git.sv.gnu.org/cgit/guile.git/commit/?h=stable-2.0&id=e2c6bf3866d1186c60bacfbd4fe5037087ee5e3f>.
.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