aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am36
-rw-r--r--bin/cuirass.in5
-rw-r--r--bin/evaluate.in3
-rw-r--r--build-aux/pre-inst-env.in4
-rw-r--r--configure.ac2
5 files changed, 39 insertions, 11 deletions
diff --git a/Makefile.am b/Makefile.am
index cde4f67..d194029 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,9 @@
## Process this file with automake to produce Makefile.in.
+# Guile local load paths.
+local_load_path = "$(abs_top_builddir)/src:$(abs_top_srcdir)/src"
+local_load_compiled_path = "$(abs_top_builddir)/src"
+
bin_SCRIPTS = bin/cuirass bin/evaluate
noinst_SCRIPTS = pre-inst-env
@@ -26,7 +30,9 @@ TEST_EXTENSIONS = .scm .sh
AM_TESTS_ENVIRONMENT = \
env GUILE_AUTO_COMPILE='0' \
testsrcdir='$(abs_top_srcdir)/tests' \
- testbuilddir='$(abs_top_builddir)/tests'
+ testbuilddir='$(abs_top_builddir)/tests' \
+ GUILE_LOAD_PATH="$(local_load_path)$${GUILE_LOAD_PATH:+:}$$GUILE_LOAD_PATH" \
+ GUILE_LOAD_COMPILED_PATH="$(local_load_compiled_path)$${GUILE_LOAD_COMPILED_PATH:+:}$$GUILE_LOAD_COMPILED_PATH"
SCM_LOG_DRIVER = \
$(builddir)/pre-inst-env $(GUILE) \
@@ -85,6 +91,8 @@ sql-check: src/schema.sql
EXTRA_DIST = \
.dir-locals.el \
+ bin/cuirass.in \
+ bin/evaluate.in \
bootstrap \
src/cuirass/config.scm.in \
tests/gnu-system.scm \
@@ -93,7 +101,7 @@ EXTRA_DIST = \
tests/hello-subset.scm \
$(TESTS)
-MOSTLYCLEANFILES = src/cuirass/config.scm
+MOSTLYCLEANFILES = $(bin_SCRIPTS) src/cuirass/config.scm
CLEANFILES = \
$(nodist_guilesite_DATA) \
$(dist_pkgmodule_DATA:%.scm=%.go) \
@@ -113,7 +121,11 @@ CLEANFILES = \
do_subst = ( $(SED) \
-e "s,@configure_input[@],Generated from $$in. Do not edit by hand.,g" \
-e 's,@datadir[@],$(datadir),g' \
+ -e 's,@datadir[@],$(datadir),g' \
+ -e 's,@GUILE[@],$(GUILE),g' \
-e 's,@localstatedir[@],$(localstatedir),g' \
+ -e 's,@PACKAGE_LOAD_COMPILED_PATH[@],$(local_load_compiled_path),g' \
+ -e 's,@PACKAGE_LOAD_PATH[@],$(local_load_path),g' \
| $(SHELL) ./config.status --file=- )
# Generic instructions to perform the substitution. Generated files shouldn't
@@ -130,8 +142,12 @@ generate_file = \
fi; \
chmod a-w $@-t; mv -f $@-t $@
-# This file depends on Makefile so it is rebuilt if $(VERSION),
+# These files depend on Makefile so they are rebuilt if $(VERSION),
# $(datadir) or other do_subst'ituted variables change.
+bin/cuirass: $(srcdir)/bin/cuirass.in
+bin/evaluate: $(srcdir)/bin/evaluate.in
+$(bin_SCRIPTS): Makefile
+ $(generate_file); chmod +x $@
src/cuirass/config.scm: $(srcdir)/src/cuirass/config.scm.in Makefile
$(generate_file)
@@ -141,6 +157,20 @@ go_files = $(nodist_guilesite_DATA) $(dist_pkgmodule_DATA:%.scm=%.go)
$(go_files): src/cuirass/config.scm
## -------------- ##
+## Installation. ##
+## -------------- ##
+
+# Relocate the script---i.e., have them refer to the installed module
+# directory.
+install-exec-hook:
+ $(SED) \
+## XXX: Beware of the order of these two substitutions, because one is a
+## substring of the other.
+ -e 's,$(local_load_path),$(guilesitedir),g' \
+ -e 's,$(local_load_compiled_path),$(guilesitedir),g' \
+ -i $(DESTDIR)$(bindir)/cuirass
+
+## -------------- ##
## Silent rules. ##
## -------------- ##
diff --git a/bin/cuirass.in b/bin/cuirass.in
index a5a11b6..6ab7349 100644
--- a/bin/cuirass.in
+++ b/bin/cuirass.in
@@ -1,8 +1,11 @@
#!/bin/sh
# -*- scheme -*-
+# @configure_input@
+GUILE_LOAD_PATH="@PACKAGE_LOAD_PATH@${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
+GUILE_LOAD_COMPILED_PATH="@PACKAGE_LOAD_COMPILED_PATH@${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
!#
-;;; cuirass -- continuous integration tool
+;;;; cuirass -- continuous integration tool
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
;;;
;;; This file is part of Cuirass.
diff --git a/bin/evaluate.in b/bin/evaluate.in
index 872d0b0..c8a45ce 100644
--- a/bin/evaluate.in
+++ b/bin/evaluate.in
@@ -1,10 +1,11 @@
#!/bin/sh
# -*- scheme -*-
+# @configure_input@
GUILE_LOAD_PATH="$1${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
export GUILE_LOAD_PATH
exec ${GUILE:-@GUILE@} --no-auto-compile -e main -s "$0" "$@"
!#
-;;; evaluate -- convert a specification to a job list
+;;;; evaluate -- convert a specification to a job list
;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
;;;
diff --git a/build-aux/pre-inst-env.in b/build-aux/pre-inst-env.in
index c8deb2d..abf9c35 100644
--- a/build-aux/pre-inst-env.in
+++ b/build-aux/pre-inst-env.in
@@ -20,10 +20,6 @@
abs_top_srcdir="`cd "@abs_top_srcdir@" > /dev/null; pwd`"
abs_top_builddir="`cd "@abs_top_builddir@" > /dev/null; pwd`"
-GUILE_LOAD_COMPILED_PATH="$abs_top_builddir/src${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
-GUILE_LOAD_PATH="$abs_top_builddir/src:$abs_top_srcdir/src${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
-export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
-
CUIRASS_DATADIR="$abs_top_srcdir/src"
export CUIRASS_DATADIR
diff --git a/configure.ac b/configure.ac
index ce246fa..ed022f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,8 +22,6 @@ GUILE_MODULE_REQUIRED([json])
GUILE_MODULE_REQUIRED([sqlite3])
AC_CONFIG_FILES([Makefile])
-AC_CONFIG_FILES([bin/cuirass], [chmod +x bin/cuirass])
-AC_CONFIG_FILES([bin/evaluate], [chmod +x bin/evaluate])
AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
[chmod +x pre-inst-env])
AC_OUTPUT