From a7b9c8a990c8965d81710ffd7b218381ae328ea5 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 22 Apr 2022 12:57:01 +0200 Subject: [PATCH] buildsys: activate `make install`, add CI test for it This only covers installing GAP itself, so the library, kernel, libgap; but not packages. --- .github/workflows/CI.yml | 15 ++++---- Makefile.rules | 36 +++++++++--------- README.buildsys.md | 24 +++++------- dev/ci.sh | 79 ++++++++++++++++++++++++++++++++++++---- 4 files changed, 105 insertions(+), 49 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5e62fd75b7f..a292337f647 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -60,19 +60,18 @@ jobs: # compile packages and run GAP tests # don't use --enable-debug to prevent the tests from taking too long "testpackages testinstall-loadall", - - # test creating the manual - # TODO: make the resulting HTML and PDF files available as build - # artifacts so that one can read the latest documentation (or even - # preview doc changes for PRs). Use the `upload-artifact` action and - # make it conditional. Or perhaps move the `makemanuals` job into - # a separate workflow job? - "makemanuals", ] extra: [""] # add a few extra tests include: + # test creating the manual + # also test `make install` here, as that wants the manual, too + - os: ubuntu-18.04 + shell: bash + test-suites: "makemanuals testmakeinstall" + extra: "GAPPREFIX=/tmp/gapprefix CONFIGFLAGS=\"--prefix=/tmp/gapprefix\"" + - os: ubuntu-18.04 shell: bash test-suites: "teststandard" diff --git a/Makefile.rules b/Makefile.rules index fefd817d653..f705edcac14 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -548,28 +548,28 @@ clean: # # WARNING !!! WARNING !!! WARNING !!! WARNING !!! WARNING # -# The following code is incomplete. Parts of it may already be useful -# for people who want to package GAP for their favorite software -# distribution. This is why install-bin etc. are exposed as separate -# targets. However, these have not yet been tested very extensively, so -# use at your own peril -- that said, if you find any issues with them -# NOT COVERED BELOW or have suggestions for improvements, please contact -# us. +# The following code has not yet been tested very extensively, so use at your +# own peril -- that said, if you find any issues with them NOT COVERED BELOW +# or have suggestions for improvements, please contact us. +# +# The main thing that is missing (no need to inform us about it) is that it +# does not install packages -- doing so is tricky, depending on what +# assumptions one is willing to make or require; we may never support this +# *here*; instead individual packages may gain a `make install`. How to +# go about this exactly has not yet been decided. # -# Among the things that are known to be missing (no need to inform us -# about it) are: -# - installing the `gac` script -# - installing packages (this one is tricky, depending on what assumptions -# one is willing to make or require; we may never support this here) -# - the installed sysinfo.gap is not yet fully adapted, and will be -# tweaked further ######################################################################## LTINSTALL=$(LIBTOOL) --mode=install $(INSTALL) -install: - @echo "Error, 'make install' has not yet been implemented" - exit 1 +install: install-bin install-doc install-gaproot install-sysinfo install-headers install-libgap + @echo "+--------------------------------------------------------------------------+" + @echo "| WARNING, 'make install' support is still experimental, and may be buggy. |" + @echo "| It also does not take care of installing GAP packages (and may never). |" + @echo "| |" + @echo "| If you observe any issues with 'make install', please report them to us |" + @echo "| via support@gap-system.org or https://github.com/gap-system/gap/issues |" + @echo "+--------------------------------------------------------------------------+" # the following is wrapper script which is installed by the install-bin target define gap_wrapper @@ -639,7 +639,7 @@ install-gaproot: CITATION install-sysinfo: SYSINFO_CPPFLAGS = -I${includedir}/gap $(GAP_DEFINES) install-sysinfo: SYSINFO_LDFLAGS = $(ABI_CFLAGS) install-sysinfo: SYSINFO_LIBS = -install-sysinfo: SYSINFO_GAP = $(bindir)/gap +install-sysinfo: SYSINFO_GAP = $(libdir)/gap/gap install-sysinfo: SYSINFO_GAC = $(bindir)/gac install-sysinfo: $(INSTALL) -d -m 0755 $(DESTDIR)$(libdir)/gap diff --git a/README.buildsys.md b/README.buildsys.md index 0379f7a9193..08217c48b23 100644 --- a/README.buildsys.md +++ b/README.buildsys.md @@ -27,10 +27,8 @@ run the `autogen.sh` script first, which will generate the `configure` script. Afterwards, or if you are using a release version of GAP, you can follow the standard procedure: -``` -./configure -make -``` + ./configure + make == Overview of the files constituting the GAP build system @@ -93,23 +91,19 @@ in your filesystem. A typical setup places the out-of-tree dirs into subdirectories of a "build" directory inside the srcdir. So you might have directories -``` - srcdir/build/default - srcdir/build/default32 - srcdir/build/hpcgap - srcdir/build/hpcgap32 - ... -``` + srcdir/build/default + srcdir/build/default32 + srcdir/build/hpcgap + srcdir/build/hpcgap32 + ... We will refer to this directory from now on as the "builddir". To initialize the out-of-tree build, change into the builddir and execute the configure script from the srcdir, like this: -``` -cd $builddir -$srcdir/configure -``` + cd $builddir + $srcdir/configure You can pass any additional options you like to configure, e.g. `ABI=32` or `--enable-hpcgap`. diff --git a/dev/ci.sh b/dev/ci.sh index 7dfbf70d06d..d77c7d57a2f 100755 --- a/dev/ci.sh +++ b/dev/ci.sh @@ -25,6 +25,22 @@ COVDIR=coverage mkdir -p $COVDIR +testmockpkg () { + # Try building and loading the mockpkg kernel extension + gap="$1" + gaproot="$2" + mockpkg_dir="$PWD" + + ./configure "$gaproot" + make V=1 + # trick to make it easy to load the package in GAP + rm -f pkg && ln -sf . pkg + # try to load the kernel extension + cd "$gaproot" + $gap -A -l "$mockpkg_dir;" "$mockpkg_dir/tst/testall.g" +} + + for TEST_SUITE in $TEST_SUITES do # restore current directory before each test suite @@ -190,6 +206,58 @@ GAPInput make check-manuals ;; + testmakeinstall) + # at this point GAPPREFIX should be set + test -n $GAPPREFIX || (echo "GAPPREFIX must be set" ; exit 1) + + # verify $GAPPREFIX does not yet exist + test ! -d $GAPPREFIX + + # perform he installation + make install + + # verify $GAPPREFIX now exists + test -d $GAPPREFIX + + # change directory to prevent the installed GAP from accidentally picking + # up files from the GAP source resp. build directory (wherever we are + # right now) + cd / + + # test for the presence of bunch of important files + test -f $GAPPREFIX/bin/gap + test -f $GAPPREFIX/bin/gac + test -f $GAPPREFIX/include/gap/gap_all.h + test -f $GAPPREFIX/include/gap/version.h + test -f $GAPPREFIX/include/gap/src/compiled.h # for backwards compatibility + test -f $GAPPREFIX/lib/gap/sysinfo.gap + test -f $GAPPREFIX/share/gap/doc/ref/chap0_mj.html + test -f $GAPPREFIX/share/gap/grp/basic.gd + test -f $GAPPREFIX/share/gap/hpcgap/lib/hpc/tasks.g + test -f $GAPPREFIX/share/gap/lib/init.g + + # check for references to the build, source or home directories + badfiles=$(grep -r "\($SRCDIR\|$BUILDDIR\|$HOME\)" $GAPPREFIX || :) + if [[ -n "${badfiles}" ]] + then + echo "Installed files contains references to SRCDIR or BUILDDIR or HOME:" + echo ${badfiles} + exit 1 + fi + + # HACK: symlink packages so we can start GAP + ln -s $SRCDIR/pkg $GAPPREFIX/share/gap/pkg + + # test building and loading package kernel extension + cd "$SRCDIR/tst/mockpkg" + testmockpkg "$GAPPREFIX/bin/gap" "$GAPPREFIX/lib/gap" + + # run testsuite for the resulting GAP, via a little HACK + # TODO: should we install the GAP test suite??? + cp -R $SRCDIR/tst $GAPPREFIX/share/gap/ + $GAPPREFIX/bin/gap $GAPPREFIX/share/gap/tst/testinstall.g + ;; + testmanuals) # Start GAP with -O option to disable obsoletes. The test # will fail if there will be an error message, but warnings @@ -238,15 +306,10 @@ GAPInput testmockpkg) # for debugging it is useful to know what sysinfo.gap contains at this point cat "$BUILDDIR/sysinfo.gap" - # test building a package kernel extension + + # test building and loading a package kernel extension cd "$SRCDIR/tst/mockpkg" - ./configure "$BUILDDIR" - make - # trick to make it easy to load the package in GAP - ln -s . pkg - # try to load the kernel extension - cd "$BUILDDIR" - $GAP -A --cover $COVDIR/testmockpkg.coverage -l "$SRCDIR/tst/mockpkg;" "$SRCDIR/tst/mockpkg/tst/testall.g" + testmockpkg "$GAP --cover $COVDIR/testmockpkg.coverage" "$BUILDDIR" ;; testexpect)