-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction_build_gcc.sh
executable file
·73 lines (52 loc) · 1.48 KB
/
action_build_gcc.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
#!/usr/bin/env bash
set -eu
set +u # scl_source has unbound vars, disable check
source scl_source enable devtoolset-10 || true
set -u
BUILDS=$1
dry=false
# shellcheck disable=SC2206
builds_array=(${BUILDS//;/ }) # split by ws
git init gcc
cd gcc
git remote add origin https://github.com/gcc-mirror/gcc.git
git config --local gc.auto 0
for build in "${builds_array[@]}"; do
dest_dir="/tmp/$build"
dest_archive="/host/$build.tar.xz"
hash=$(jq -r ".\"$build\" | .hash" "/host/builds.json")
echo "Build : $build"
echo "Commit : $hash"
git -c protocol.version=2 fetch \
--quiet \
--no-tags \
--prune \
--progress \
--no-recurse-submodules \
--depth=1 \
origin "$hash"
git reset
git checkout FETCH_HEAD
echo "Source cloned, starting build step..."
if $dry; then
echo "Dry run, creating dummy artefact..."
mkdir -p "$dest_dir"
echo "$build" >"$dest_dir/data.txt"
else
pwd
ls -lah
rm -rf build
mkdir -p build
time ./contrib/download_prerequisites --no-isl --no-verify
(
cd build
../configure --prefix="/opt/$build" --enable-languages=c,c++ --disable-bootstrap --disable-multilib --disable-libvtv --without-isl
)
time make -C build -j "$(nproc)"
time make -C build -j "$(nproc)" install DESTDIR="$dest_dir"
fi
XZ_OPT='-T0 -2' tar cfJ "$dest_archive" --checkpoint=.1000 --totals -C "$dest_dir" .
# zip -r "$dest_archive" "$dest_dir"
du -sh "$dest_dir"
du -sh "$dest_archive"
done