Skip to content

Commit

Permalink
buildsys: activate make install, add CI test for it
Browse files Browse the repository at this point in the history
This only covers installing GAP itself, so the library, kernel, libgap;
but not packages.
  • Loading branch information
fingolfin committed Jul 11, 2022
1 parent 0c8c653 commit a7b9c8a
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 49 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
36 changes: 18 additions & 18 deletions Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
24 changes: 9 additions & 15 deletions README.buildsys.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`.
Expand Down
79 changes: 71 additions & 8 deletions dev/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a7b9c8a

Please sign in to comment.