forked from ChrisJefferson/sage-windows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release_gap.sh
executable file
·127 lines (101 loc) · 3.95 KB
/
release_gap.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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/sh
set -ex
# Path to the Inno Setup executable
ISCC="/cygdrive/c/Program Files (x86)/Inno Setup 6/ISCC.exe"
# Resource paths
CYGWIN_EXTRAS=cygwin_extras
ENV_BUILD_DIR=envs/build-${GAP_VERSION}-x86_64
ENV_RUNTIME_DIR=envs/runtime-${GAP_VERSION}-x86_64
GAP_ROOT=/opt/gap-${GAP_VERSION}
GAP_ROOT_BUILD=${ENV_BUILD_DIR}${GAP_ROOT}
GAP_ROOT_RUNTIME=${ENV_RUNTIME_DIR}${GAP_ROOT}
# URL to download the Cygwin setup.exe
CYGWIN_MIRROR=http://mirrors.kernel.org/sourceware/cygwin/
# download
echo "::group::download"
mkdir -p download
(cd download && wget https://www.cygwin.com/setup-x86_64.exe)
chmod +x download/setup-x86_64.exe
echo "::endgroup::"
# cygwin setup
echo "::group::cygwin setup build"
mkdir -p envs
packages=$(for x in $(cat cygwin-gap-build.list) ; do printf "%s," $x ; done)
download/setup-x86_64.exe --site ${CYGWIN_MIRROR} \
--root "$(cygpath -w -a envs/build-${GAP_VERSION}-x86_64)" \
--packages $packages \
--arch x86_64 --no-admin --no-shortcuts --quiet-mode
# Install symlinks for CCACHE
if [ -x envs/build-${GAP_VERSION}-x86_64/usr/bin/ccache ]; then
ln -s /usr/bin/ccache envs/build-${GAP_VERSION}-x86_64/usr/local/bin/gcc
ln -s /usr/bin/ccache envs/build-${GAP_VERSION}-x86_64/usr/local/bin/g++
fi
# A bit of cleanup
rm -f envs/build-${GAP_VERSION}-x86_64/Cygwin*.{bat,ico}
echo "::endgroup::"
# cygwin setup
echo "::group::cygwin setup runtime"
mkdir -p envs
packages=$(for x in $(cat cygwin-gap-runtime.list) ; do printf "%s," $x ; done)
download/setup-x86_64.exe --site ${CYGWIN_MIRROR} \
--root "$(cygpath -w -a envs/runtime-${GAP_VERSION}-x86_64)" \
--packages $packages \
--arch x86_64 --no-admin --no-shortcuts --quiet-mode
# Install symlinks for CCACHE
if [ -x envs/runtime-${GAP_VERSION}-x86_64/usr/bin/ccache ]; then
ln -s /usr/bin/ccache envs/runtime-${GAP_VERSION}-x86_64/usr/local/bin/gcc
ln -s /usr/bin/ccache envs/runtime-${GAP_VERSION}-x86_64/usr/local/bin/g++
fi
# A bit of cleanup
rm -f envs/runtime-${GAP_VERSION}-x86_64/Cygwin*.{bat,ico}
echo "::endgroup::"
echo "::group::get-gap"
mkdir -p $(dirname ${GAP_ROOT_BUILD})
mv ../gap-${GAP_VERSION} ${GAP_ROOT_BUILD};
echo "::endgroup::"
echo "::group::configure"
tools/subcyg "${ENV_BUILD_DIR}" "cd ${GAP_ROOT} && ./configure"
echo "::endgroup::"
echo "::group::make"
tools/subcyg "${ENV_BUILD_DIR}" "cd ${GAP_ROOT} && make -j2"
echo "::endgroup::"
# get GAP packages (if not already present)
echo "::group::Get Packages"
tools/subcyg "${ENV_BUILD_DIR}" "cd ${GAP_ROOT} && make bootstrap-pkg-full"
tools/subcyg "${ENV_BUILD_DIR}" "cd ${GAP_ROOT} && rm -f packages.tar.gz"
echo "::endgroup::"
# build GAP packages
echo "::group::Build Packages"
tools/subcyg "${ENV_BUILD_DIR}" "cd ${GAP_ROOT}/pkg && (../bin/BuildPackages.sh --parallel || true)"
echo "::endgroup::"
# gap-prep-runtime
echo "::group::gap-prep-runtime"
mkdir -p $(dirname ${GAP_ROOT_RUNTIME})
cp -rp ${GAP_ROOT_BUILD} $(dirname ${GAP_ROOT_RUNTIME})
# Prepare / compactify runtime environment
tools/gap-prep-runtime "${GAP_ROOT_RUNTIME}" "${GAP_ROOT}"
echo "::endgroup::"
# gap-prep-runtime-extras
echo "::group::gap-prep-runtime-extras"
cp -r "${CYGWIN_EXTRAS}"/* "${ENV_RUNTIME_DIR}"
# Set the package download cache to something sensible; otherwise it
# will hard-code the package download cache used when building the
# environment in the installer, which is not what we want
# See https://github.com/sagemath/sage-windows/issues/24
sed -i '/^last-cache/{n;s|.*|\t/tmp|;}' "${ENV_RUNTIME_DIR}/etc/setup/setup.rc"
echo "::endgroup::"
# apt-cyg mirror
# Set apt-cyg to use a non-local mirror in the runtime env
echo "::group::apt-cyg mirror"
tools/subcyg "${ENV_RUNTIME_DIR}" "apt-cyg mirror ${CYGWIN_MIRROR}"
echo "::endgroup::"
# fixup-symlinks
echo "::group::fixup-symlinks"
tools/fixup-symlinks ${ENV_RUNTIME_DIR} > ${ENV_RUNTIME_DIR}/etc/symlinks.lst
echo "::endgroup::"
# ISCC
echo "::group::ISCC"
mkdir -p dist
#cd ${CUDIR}
"${ISCC}" /DGapVersion=${GAP_VERSION} /DGapArch=x86_64 /Q gap.iss
echo "::endgroup::"