-
Notifications
You must be signed in to change notification settings - Fork 279
/
install_libraries.sh
executable file
·360 lines (282 loc) · 10.7 KB
/
install_libraries.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
#!/bin/bash
# This script installs all the libraries to be used by Compiler Explorer
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=common.inc
. "${SCRIPT_DIR}/common.inc"
export PATH=$PATH:/opt/compiler-explorer/cmake/bin
if install_nightly; then
echo "Installing trunk versions"
else
echo "Skipping install of trunk versions"
fi
#########################
# C++
ce_install 'libraries'
ce_squash 'libraries'
#########################
# cs50
install_cs50_v9() {
for VERSION in "$@"; do
local DEST1=${OPT}/libs/cs50/${VERSION}/x86_64/lib
local DEST2=${OPT}/libs/cs50/${VERSION}/x86/lib
local INC=${OPT}/libs/cs50/${VERSION}/include
if [[ ! -d ${DEST1} ]]; then
rm -rf /tmp/cs50
mkdir -p /tmp/cs50
pushd /tmp/cs50
fetch "https://github.com/cs50/libcs50/archive/v${VERSION}.tar.gz" | tar zxf - --strip-components 1
env CFLAGS="-Wall -Wextra -Werror -pedantic -std=c99 -march=native" make -e
mkdir -p "${DEST1}"
mv build/lib/* "${DEST1}"
mkdir -p "${INC}"
cp -Rf build/include/* "${INC}"
env CFLAGS="-Wall -Wextra -Werror -pedantic -std=c99 -m32" make -e
mkdir -p "${DEST2}"
mv build/lib/* "${DEST2}"
cd "${DEST1}"
ln -s "libcs50.so.${VERSION}" libcs50.so.9
cd "${DEST2}"
ln -s "libcs50.so.${VERSION}" libcs50.so.9
popd
rm -rf /tmp/cs50
fi
done
}
install_cs50_v9 9.1.0
#########################
# libuv
install_libuv() {
for VERSION in "$@"; do
local DEST1=${OPT}/libs/libuv/v${VERSION}/x86_64/lib
local DEST2=${OPT}/libs/libuv/v${VERSION}/x86/lib
if [[ ! -d ${DEST1} ]]; then
rm -rf /tmp/libuv
mkdir -p /tmp/libuv
pushd /tmp/libuv
fetch "https://github.com/libuv/libuv/archive/v${VERSION}.tar.gz" | tar zxf - --strip-components 1
mkdir -p build
pushd build
cmake -DCMAKE_BUILD_TYPE=Release ..
popd
cmake --build build --target uv
mkdir -p "${DEST1}"
mv build/libuv.so* "${DEST1}"
rm -Rf build
mkdir -p build
pushd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=-m32 ..
popd
cmake --build build --target uv
mkdir -p "${DEST2}"
mv build/libuv.so* "${DEST2}"
popd
rm -rf /tmp/libuv
fi
done
}
#########################
# lua
install_lua() {
for VERSION in "$@"; do
local DEST1=${OPT}/libs/lua/${VERSION}/lib/x86_64
local DEST2=${OPT}/libs/lua/${VERSION}/lib/x86
local DEST3=${OPT}/libs/lua/${VERSION}/include
if [[ ! -d ${DEST1} ]]; then
rm -rf /tmp/lua
mkdir -p /tmp/lua
pushd /tmp/lua
git clone -b "${VERSION}" https://github.com/lua/lua
cd lua
mkdir -p "${DEST3}"
cp -- *.h "${DEST3}"
rm -f onelua.c
local cfiles
cfiles=$(find . -maxdepth 1 -iname '*.c' -o -iname '*.h')
echo -e "cmake_minimum_required(VERSION 3.10)\n" >CMakeLists.txt
# shellcheck disable=SC2129
echo -e "project(lua LANGUAGES C)\n" >>CMakeLists.txt
echo -e "add_library(lua SHARED\n" >>CMakeLists.txt
echo -e "${cfiles}" >>CMakeLists.txt
echo -e ")\n" >>CMakeLists.txt
mkdir -p build
pushd build
cmake "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_C_FLAGS_DEBUG=-std=gnu99 -O2 -Wall -Wl,-E -ldl -DLUA_USE_POSIX -DLUA_USE_DLOPEN" ..
make
mkdir -p "${DEST1}"
cp liblua.so "${DEST1}"
popd
rm -Rf build
mkdir -p build
cd build
cmake "-DCMAKE_BUILD_TYPE=Debug" "-DCMAKE_C_FLAGS_DEBUG=-std=gnu99 -O2 -Wall -Wl,-E -ldl -m32 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" ..
make
mkdir -p" ${DEST2}"
cp liblua.so "${DEST2}"
popd
rm -rf /tmp/lua
fi
done
}
install_lua v5.3.5 v5.4.0
# Following are minimal runtime dependencies for Crystal
#########################
# pcre
install_pcre() {
for VERSION in "$@"; do
local DEST1=${OPT}/libs/libpcre/${VERSION}/x86_64/lib
if [[ ! -d ${DEST1} ]]; then
rm -rf /tmp/pcre
mkdir -p /tmp/pcre
pushd /tmp/pcre
fetch "https://ftp.pcre.org/pub/pcre/pcre-${VERSION}.tar.gz" | tar zxf - --strip-components 1
./configure --disable-shared --enable-utf --enable-unicode-properties
make
mkdir -p "${DEST1}"
cp .libs/libpcre.a "${DEST1}"
popd
rm -rf /tmp/pcre
fi
done
}
install_pcre 8.45
#########################
# pcre2
install_pcre2() {
for VERSION in "$@"; do
local DEST1=${OPT}/libs/libpcre2/${VERSION}/x86_64/lib
if [[ ! -d ${DEST1} ]]; then
rm -rf /tmp/pcre2
mkdir -p /tmp/pcre2
pushd /tmp/pcre2
fetch "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-${VERSION}/pcre2-${VERSION}.tar.gz" | tar zxf - --strip-components 1
mkdir -p build
pushd build
cmake "-DCMAKE_BUILD_TYPE=Release" "-DPCRE2_BUILD_PCRE2GREP=OFF" "-DPCRE2_BUILD_TESTS=OFF" "-DPCRE2_SUPPORT_UNICODE=ON" "-DPCRE2_SUPPORT_JIT=ON" ..
make
mkdir -p "${DEST1}"
cp libpcre2-8.a "${DEST1}"
popd
rm -rf build
popd
rm -rf /tmp/pcre
fi
done
}
install_pcre2 10.42
#########################
# libevent
install_libevent() {
for VERSION in "$@"; do
local DEST1=${OPT}/libs/libevent/${VERSION}/x86_64/lib
if [[ ! -d "${DEST1}" ]]; then
rm -rf /tmp/libevent
mkdir -p /tmp/libevent
pushd /tmp/libevent
fetch "https://github.com/libevent/libevent/releases/download/release-${VERSION}-stable/libevent-${VERSION}-stable.tar.gz" | tar zxf - --strip-components 1
export PKG_CONFIG_PATH=/opt/compiler-explorer/libs/openssl/openssl_1_1_1g/x86_64/opt/lib/pkgconfig
./configure --disable-shared
make
mkdir -p "${DEST1}"
cp .libs/libevent.a "${DEST1}"
popd
rm -rf /tmp/libevent
fi
done
}
install_libevent 2.1.12
#########################
# nsimd
install_nsimd() {
for VERSION in "$@"; do
local DEST=${OPT}/libs/nsimd/${VERSION}
if [[ ! -d ${DEST} ]]; then
rm -rf /tmp/nsimd
mkdir -p /tmp/nsimd
pushd /tmp/nsimd
git clone -b "${VERSION}" https://github.com/agenium-scale/nsimd.git
cd nsimd
python3 egg/hatch.py -l
bash scripts/setup.sh
mkdir build
cd build
## x86_64
(
# shellcheck disable=SC2030
export PATH=${OPT}/gcc-10.2.0/bin:${PATH}
../nstools/nsconfig/nsconfig .. -Dsimd=avx512_skylake \
-prefix="${DEST}/x86_64" \
-Ggnumake \
-suite=gcc
make
make install
)
## CUDA
(
# shellcheck disable=SC2031
export PATH=${OPT}/cuda/9.1.85/bin:${OPT}/gcc-6.1.0/bin:${PATH}
../nstools/nsconfig/nsconfig .. -Dsimd=cuda \
-prefix="${DEST}/cuda" \
-Ggnumake \
-Dstatic_libstdcpp=true \
-suite=cuda
make
make install
)
## ARM32 (armel)
(
local COMP_ROOT=${OPT}/arm/gcc-8.2.0/arm-unknown-linux-gnueabi/bin/
local CCOMP=${COMP_ROOT}/arm-unknown-linux-gnueabi-gcc
local CPPCOMP=${COMP_ROOT}/arm-unknown-linux-gnueabi-g++
../nstools/nsconfig/nsconfig .. -Dsimd=neon128 \
-prefix="${DEST}/arm/neon128" \
-Ggnumake \
-comp=cc,gcc,"${CCOMP}",8.2.0,armel \
-comp=c++,gcc,"${CPPCOMP}",8.2.0,armel
make
make install
)
## ARM64
(
local COMP_ROOT=${OPT}/arm64/gcc-8.2.0/aarch64-unknown-linux-gnu/bin
local CCOMP=${COMP_ROOT}/aarch64-unknown-linux-gnu-gcc
local CPPCOMP=${COMP_ROOT}/aarch64-unknown-linux-gnu-g++
../nstools/nsconfig/nsconfig .. -Dsimd=aarch64 \
-prefix="${DEST}/arm/aarch64" \
-Ggnumake \
-comp=cc,gcc,"${CCOMP}",8.2.0,aarch64 \
-comp=c++,gcc,"${CPPCOMP}",8.2.0,aarch64
make
make install
)
## PowerPC
(
local COMP_ROOT=${OPT}/powerpc64le/gcc-at13/powerpc64le-unknown-linux-gnu/bin
local CCOMP=${COMP_ROOT}/powerpc64le-unknown-linux-gnu-gcc
local CPPCOMP=${COMP_ROOT}/powerpc64le-unknown-linux-gnu-g++
../nstools/nsconfig/nsconfig .. -Dsimd=vsx \
-prefix="${DEST}/powerpc" \
-Ggnumake \
-comp=cc,gcc,"${CCOMP}",9,ppc64el \
-comp=c++,gcc,"${CPPCOMP}",9,ppc64el
make
make install
)
## SVE 512
(
local COMP_ROOT=${OPT}/arm64/gcc-11.1.0/aarch64-unknown-linux-gnu/bin
local CCOMP=${COMP_ROOT}/aarch64-unknown-linux-gnu-gcc
local CPPCOMP=${COMP_ROOT}/aarch64-unknown-linux-gnu-g++
../nstools/nsconfig/nsconfig .. -Dsimd=sve512 \
-prefix="${DEST}/sve/sve512" \
-Ggnumake \
-comp=cc,gcc,"${CCOMP}",8.2.0,aarch64 \
-comp=c++,gcc,"${CPPCOMP}",8.2.0,aarch64
make
make install
)
popd
rm -rf /tmp/nsimd
fi
done
}
install_nsimd v3.0.1