CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
#!/bin/sh -e
2
#
3
# This helper script compiles Normaliz for you.
4
# To use it, pass the location of your GAP installation
5
# to it:
6
#
7
# ./build-normaliz.sh GAPDIR
8
#
9
# Then you can compile NormalizInterface as follows:
10
#
11
# ./configure --with-gaproot=GAPDIR
12
# make
13
#
14
15
if [ "$#" -ge 1 ]; then
16
GAPDIR=$1
17
shift
18
else
19
GAPDIR=../..
20
fi
21
22
# make path absolut
23
SCRIPTDIR=$PWD
24
cd $GAPDIR
25
GAPDIR=$PWD
26
cd $SCRIPTDIR
27
28
# check for presence of GAP and determine value of GAParch
29
if [ ! -f "$GAPDIR/sysinfo.gap" ]; then
30
echo "ERROR: could not locate GAP in directory $GAPDIR"
31
exit 1
32
fi;
33
. "$GAPDIR/sysinfo.gap"
34
35
echo "Found GAP in directory $GAPDIR"
36
echo "GAParch = $GAParch"
37
38
# check if GAP was built with its own GMP (this is kind of a hack...)
39
GAP_GMP="$GAPDIR/bin/$GAParch/extern/gmp"
40
if [ -f "$GAP_GMP/MAKE_CHECK_PASSED" -a -f "$GAP_GMP/include/gmp.h" ]; then
41
echo "GAP was built with its own GMP"
42
if [ -f "$GAP_GMP/include/gmpxx.h" ]; then
43
echo "GAP's GMP includes C++ support"
44
GMP_FLAG="$GAP_GMP"
45
else
46
echo "ERROR: GAP's GMP was built without C++ support"
47
exit 1
48
fi
49
else
50
echo "GAP was built with external GMP"
51
# TODO: actually, now we should figure out somehow which
52
# external GMP library was used to build GAP. But that's not really
53
# possible: While we could e.g. scan the "internal" sysinfo.gap
54
# file for the "gap_config_options" string, and in there
55
# look for an "--with-gmp", this is not entirely reliable by
56
# itself (partially due to bugs in the GAP build system).
57
#
58
# So, we do not even try to figure out details, and instead
59
# cross our fingers and hope for the best.
60
#
61
# Expert users can help with that, of course, by setting
62
# the GMP_DIR variable manually.
63
fi
64
65
NORMALIZ_VERSION=v3.4.0
66
67
# needs git 1.8 or newer
68
if [ ! -d Normaliz.git ]; then
69
echo "Fetching Normaliz source code"
70
git clone --depth 1 --branch $NORMALIZ_VERSION -- https://github.com/Normaliz/Normaliz Normaliz.git
71
fi
72
cd Normaliz.git
73
# get a new version
74
if [ `git describe --tags` != $NORMALIZ_VERSION ]; then
75
git fetch origin $NORMALIZ_VERSION
76
git fetch origin
77
git checkout $NORMALIZ_VERSION
78
fi
79
80
rm -rf DST
81
mkdir -p DST
82
83
# The cmake build process honors environment variables like
84
# GMP_DIR and BOOST_ROOT. So if you need to tell the build
85
# process where to find GMP and Boost, you can invoke this
86
# script like this:
87
#
88
# GMP_DIR=/some/path BOOST_ROOT=/another/path ./build-normaliz.sh $GAPROOT
89
90
# If GAP was build for 32 bit, also do it for normaliz
91
if [ x$GAParch_abi = x"32-bit" ] || [ x$GAP_ABI = x32 ]; then
92
echo "GAP was build for 32 bit"
93
export CXXFLAGS="-m32"
94
fi
95
96
## use the libtool build system
97
98
PREFIX="$PWD/DST"
99
./bootstrap.sh
100
if [ "x$GMP_FLAG" != "x" ]; then
101
./configure --prefix=$PREFIX --with-gmp=$GMP_FLAG $@
102
else
103
./configure --prefix=$PREFIX $@
104
fi
105
make
106
make install
107
108