This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
spkg-install
executable file
·113 lines (97 loc) · 3.19 KB
/
spkg-install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/usr/bin/env bash
###########################################
## GAP
###########################################
if [ -z "$SAGE_LOCAL" ]; then
echo >&2 "SAGE_LOCAL undefined ... exiting"
echo >&2 "Maybe run 'sage --sh'?"
exit 1
fi
# Read gap-version, which was written by spkg-src
VERSION=`cat src/gap-version`
GAP_DIR="gap-$VERSION"
SAGE_GAP="$SAGE_LOCAL/gap"
INSTALL_DIR="$SAGE_GAP/$GAP_DIR"
echo "spkg-install is using"
echo "VERSION = $VERSION"
echo "GAP_DIR = $GAP_DIR"
echo "INSTALL_DIR = $INSTALL_DIR"
if [[ "$SAGE64" = yes ]]; then
if [[ -z $CFLAG64 ]]; then
CFLAG64=-m64
fi
CFLAGS="$CFLAGS $CFLAG64"
CXXFLAGS="$CXXFLAGS $CFLAG64"
echo "Building a 64-bit version of GAP (with '$CFLAG64')."
fi
# Enable debug info if requested.
# Note that -g3 allows you to use preprocessor macros in gdb which are widely used
if [ "$SAGE_DEBUG" = yes ] ; then
export CFLAGS="-O0 -g3 -DDEBUG_MASTERPOINTERS -DDEBUG_GLOBAL_BAGS -DDEBUG_FUNCTIONS_BAGS $CFLAGS"
else
# Default flags
export CFLAGS="-O2 -g $CFLAGS"
fi
cd src
# Use newer version of config.guess and config.sub (see Trac #19726)
cp "$SAGE_ROOT"/config/config.* cnf
# Configure
echo "Configuring GAP..."
./configure \
--prefix="$SAGE_LOCAL" PREFIX="$SAGE_LOCAL" \
--with-gmp="$SAGE_LOCAL" \
CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS"
if [[ $? -ne 0 ]]; then
echo >&2 "Error configuring GAP."
exit 1
fi
echo "Building GAP..."
# Building config only works with 1 thread
$MAKE -j1 config && $MAKE
if [[ $? -ne 0 ]]; then
echo >&2 "Error building GAP."
exit 1
fi
if [[ ! -f bin/gap.sh ]]; then
echo "Error building GAP ('gap.sh' not found)."
exit 1
fi
# Wipe the installation directory.
# This fixes https://trac.sagemath.org/ticket/22272
echo "Removing previous installation of GAP..."
rm -rf "$INSTALL_DIR"
echo "Installing (copying) files..."
# gap has no notion of installing itself (similar to sage), copy everything
# See http://trac.sagemath.org/13211 for rationale of the filesystem layout
mkdir -p "$SAGE_GAP" && mkdir "$INSTALL_DIR" && cp -R * "$INSTALL_DIR"
if [[ $? -ne 0 ]]; then
echo >&2 "Error copying built GAP files."
exit 1
fi
echo "Creating symlink to new GAP installation..."
rm -f "$SAGE_LOCAL/gap/latest"
ln -s "$GAP_DIR" "$SAGE_LOCAL/gap/latest"
echo "Copying GAP startup script..."
rm -f "$SAGE_LOCAL/bin/gap"
cp bin/gap.sh "$SAGE_LOCAL/bin/gap"
if [[ $? -ne 0 ]]; then
echo >&2 "Error copying customized GAP startup script."
exit 1
fi
if [[ "$SAGE_SPKG_INSTALL_DOCS" = yes ]]; then
# The (pre-built) HTML documentation is currently (GAP 4.6.3)
# included, so we don't have to /build/ it here.
# echo "Now building GAP's documentation..."
# <COMMAND TO BUILD THE [HTML] DOCUMENTATION>
echo "Now copying GAP's (HTML) documentation..."
mkdir -p "$SAGE_LOCAL/share/doc/gap" &&
cp -R doc/ref doc/tut "$SAGE_LOCAL/share/doc/gap/"
if [[ $? -ne 0 ]]; then
echo >&2 "Error copying GAP's HTML documentation."
exit 1
fi
fi
# Delete tests that rely on the non-GPL small group library
rm "$INSTALL_DIR"/tst/testinstall/ctblsolv.tst
rm "$INSTALL_DIR"/tst/testinstall/grppc.tst
rm "$INSTALL_DIR"/tst/testinstall/morpheus.tst