build: Support --srcdir build.
[mes.git] / build-aux / pre-inst-env.in
index 6ad5835b6865280cbc75963e55cebe67149fcf15..7aab6b74b7dbaf3306e19dfa8bfc55882d3b6fd8 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! @BASH@
 
 # Mes --- Maxwell Equations of Software
 # Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 # You should have received a copy of the GNU General Public License
 # along with Mes.  If not, see <http://www.gnu.org/licenses/>.
 
-abs_top_srcdir="$(cd "@abs_top_srcdir@" > /dev/null; pwd -P)"
-abs_top_builddir="$(cd "@abs_top_builddir@" > /dev/null; pwd -P)"
+top_builddest="@top_builddest@"
+abs_top_srcdir="@abs_top_srcdir@"
+abs_top_builddir="@abs_top_builddir@"
 
 MES_PREFIX=mes
 export MES_PREFIX
 
 GUILE_LOAD_COMPILED_PATH="$abs_top_builddir/module${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
 GUILE_LOAD_PATH="$abs_top_srcdir/module${GUILE_LOAD_PATH:+:}$GUILE_LOAD_PATH"
+if [ -n "$top_builddest" ]; then
+    GUILE_LOAD_PATH="$abs_top_buildir/module:$GUILE_LOAD_PATH"
+fi
 export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
 
-PATH="$abs_top_builddir/scripts:$PATH"
+PATH="$abs_top_builddir/scripts:$abs_top_builddir/src:$abs_top_builddir/build-aux:$PATH"
 export PATH
 
+MES=${MES-${top_builddest}src/mes}
+export MES
+
+GUIX_PACKAGE_PATH="$abs_top_srcdir/guix${GUIX_PACKAGE_PATH:+:}$GUIX_PACKAGE_PATH"
+export GUIX_PACKAGE_PATH
+
 LANG=
 LC_ALL=