forked from mathinstitut/goemaxima
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildscript.sh
47 lines (40 loc) · 1.44 KB
/
buildscript.sh
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
#!/bin/sh
# This script build SBCL and Maxima from source.
# It also compiles maxima_fork.c.
set -e
echo ${MAXIMA_VERSION?Error \$MAXIMA_VERSION is not defined} \
${SBCL_VERSION?Error \$SBCL_VERSION is not defined}
apt-get update
apt-get install -y bzip2 make wget python3 gcc texinfo curl libcap2-bin
mkdir -p ${SRC}
wget "https://github.com/mathinstitut/maxima-mirror/releases/download/${MAXIMA_VERSION}/maxima-${MAXIMA_VERSION}.tar.gz" -O "${SRC}/maxima-${MAXIMA_VERSION}.tar.gz"
wget "https://github.com/sbcl/sbcl/archive/refs/tags/sbcl-${SBCL_VERSION}.tar.gz" -O "${SRC}/sbcl-${SBCL_VERSION}.tar.gz"
# Compile sbcl (installs and removes debian sbcl for bootstrapping)
apt install -y sbcl
cd ${SRC}
tar -xzf sbcl-${SBCL_VERSION}.tar.gz
rm sbcl-${SBCL_VERSION}.tar.gz
cd sbcl-sbcl-${SBCL_VERSION}
echo "\"$SBCL_VERSION\"" > version.lisp-expr
./make.sh
apt remove -y sbcl
./install.sh
# Compile maxima
cd ${SRC}
tar -xf maxima-${MAXIMA_VERSION}.tar.gz
rm maxima-${MAXIMA_VERSION}.tar.gz
cd maxima-${MAXIMA_VERSION}
./configure
make
make install
make clean
# runtime dependencies
apt-get install -y gnuplot-nox gettext-base libbsd-dev tini
cd /
test -n "$MAX_USER" || MAX_USER=32
gcc -shared maxima_fork.c -lbsd -fPIC -Wall -Wextra -DN_SLOT="${MAX_USER}" -o libmaximafork.so
mv libmaximafork.so /usr/lib
rm -r ${SRC} /maxima_fork.c
mkdir -p ${LIB} ${LOG} ${TMP} ${PLOT} ${ASSETS} ${BIN}
apt-get purge -y bzip2 make wget python3 gcc texinfo
apt-get autoremove -y