From 946cde4367efe0c5709790634bb2721e09877173 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 3 Jun 2020 23:54:03 +0200 Subject: [PATCH] sysinfo.gap: add GAP and GAC variables ... and use them in `bin/BuildPackages.sh` and `etc/Makefile.gappkg`. This strengthen the purpose of sysinfo.gap: that in order to build a package (or anything that wants to interact with GAP), you just point it at the sysinfo.gap of the target GAP installation, and it extracts all it needs from there, including the location of a GAP and GAC executable. Note that sysinfo.gap can be directly included from POSIX shell scripts and Makefiles, and it is also fairly easy to parse for other systems. --- Makefile.rules | 3 +++ bin/BuildPackages.sh | 20 ++++++++++++++++---- etc/Makefile.gappkg | 3 --- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Makefile.rules b/Makefile.rules index f3de568b23..07103a78df 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -724,6 +724,9 @@ GAP_KERNEL_MINOR_VERSION=$(GAP_KERNEL_MINOR_VERSION) GAP_BIN_DIR="$(abs_builddir)" GAP_LIB_DIR="$(abs_srcdir)" +GAP="$(abs_builddir)/bin/gap.sh" +GAC="$(abs_builddir)/gac" + GAP_CC="$(CC)" GAP_CXX="$(CXX)" GAP_CFLAGS="$(GAP_CFLAGS)" diff --git a/bin/BuildPackages.sh b/bin/BuildPackages.sh index 7ae2b734e4..b1269bdcaa 100755 --- a/bin/BuildPackages.sh +++ b/bin/BuildPackages.sh @@ -48,8 +48,8 @@ while [[ "$#" -ge 1 ]]; do --with-gaproot=*) GAPROOT=${option#--with-gaproot=}; ;; --parallel) PARALLEL=yes; ;; - --with-gap) GAP="$1"; shift ;; - --with-gap=*) GAP=${option#--with-gap=}; ;; + --with-gap) GAP_EXE="$1"; shift ;; + --with-gap=*) GAP_EXE=${option#--with-gap=}; ;; --no-color) COLORS=no ;; --color) COLORS=yes ;; @@ -63,8 +63,6 @@ while [[ "$#" -ge 1 ]]; do esac done -GAP="${GAP:-$GAPROOT/bin/gap.sh}" - if [ "x$PARALLEL" = "xyes" ]; then export MAKEFLAGS="${MAKEFLAGS:--j3}" fi; @@ -110,6 +108,20 @@ fi # read in sysinfo source "$GAPROOT/sysinfo.gap" +# determine the GAP executable to call: +# - if the user specified one explicitly via the `--gap` option, then +# GAP_EXE is set and we should use that +# - otherwise if sysinfo.gap set the GAP variable, use that +# - otherwise fall back to $GAPROOT/bin/gap.sh +if [[ -n $GAP_EXE ]] +then + GAP="$GAP_EXE" +else + GAP="${GAP:-$GAPROOT/bin/gap.sh}" +fi + + + # detect whether GAP was built in 32bit mode # TODO: once all packages have adapted to the new build system, # this should no longer be necessary, as package build systems should diff --git a/etc/Makefile.gappkg b/etc/Makefile.gappkg index 30351af17a..e6c94e1fe6 100644 --- a/etc/Makefile.gappkg +++ b/etc/Makefile.gappkg @@ -50,9 +50,6 @@ endif KEXT_BINARCHDIR = bin/$(GAParch) KEXT_SO = $(KEXT_BINARCHDIR)/$(KEXT_NAME).so -GAP = $(GAPPATH)/gap -GAC = $(GAPPATH)/gac - # override KEXT_RECONF if your package needs a different invocation # for reconfiguring (e.g. `./config.status --recheck` for autoconf) ifdef KEXT_USE_AUTOCONF