Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for make install (still somewhat experimental, but ready to be tested by downstream packagers) #4492

Merged
merged 2 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ concurrency:
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

env:
CFLAGS: "--coverage -O2 -g"
CXXFLAGS: "--coverage -O2 -g"
LDFLAGS: "--coverage"
# default config flags: enable debug asserts
CONFIGFLAGS: "--enable-debug"
# CHERE_INVOKING=1 lets us start a 'login shell' (to set paths) in Windows without changing directory
Expand Down Expand Up @@ -60,19 +57,20 @@ 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;
# and set NO_COVERAGE=1 to ensure the installed GAP binaries don't
# contain references to the build directory
- os: ubuntu-18.04
shell: bash
test-suites: "makemanuals testmakeinstall"
extra: "GAPPREFIX=/tmp/gapprefix CONFIGFLAGS=\"--prefix=/tmp/gapprefix\" NO_COVERAGE=1"

- os: ubuntu-18.04
shell: bash
test-suites: "teststandard"
Expand Down Expand Up @@ -167,6 +165,18 @@ jobs:
- uses: gap-actions/setup-cygwin@v1
if: ${{ runner.os == 'Windows' }}

- name: "Set up compiler and linker flags"
run: |
${{ matrix.extra }}
if [[ -n ${NO_COVERAGE} ]] ; then
echo "No coverage reporting"
else
echo "Coverage reporting, updating compiler and linker flags"
echo "CFLAGS=--coverage -O2 -g" >> $GITHUB_ENV
echo "CXXFLAGS=--coverage -O2 -g" >> $GITHUB_ENV
echo "LDFLAGS=--coverage" >> $GITHUB_ENV
fi

- name: "Install dependencies"
run: |
${{ matrix.extra }}
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
80 changes: 72 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,59 @@ 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

# verify `make install DESTDIR=...` produces identical content, just
# in a different directory
make install DESTDIR=/tmp/DESTDIR
diff -ru $DESTDIR/$GAPPREFIX $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
fgrep -r $BUILDDIR $GAPPREFIX && exit 1
fgrep -r $SRCDIR $GAPPREFIX && exit 1
fgrep -r $HOME $GAPPREFIX && exit 1

# 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 +307,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