-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·49 lines (42 loc) · 1.1 KB
/
build.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
#!/bin/env sh
echo
set -eu
sh -n tarb.sh
TMPDIR=build
BIN_LINE=$(awk '/^#binaries.tgz.base64/ { print NR + 1; exit 0; }' tarb.sh)
offline=false
[ .${1-} != .o ] || {
shift
offline=true
}
ver="$(head -n1 CHANGELOG)"
echo "$ver" | cut -d ' ' -f 2 > build/VERSION
sed -i"" "/^VERSION=/s/=.*/=\"$ver\"/" tarb.sh
mkdir -p $TMPDIR
[ -n "${1-}" ] || set -- arm arm64 x86 x64
for i in $*; do
echo tarb-$i
rm -rf $TMPDIR/$i 2>/dev/null || :
mkdir -p $TMPDIR/$i
$offline || {
echo
cd bin
for j in $(grep -E "[_-]${i#x}-|[_-]$i-|-$i$" LINKS); do
mv -f ${j##/} $TMPDIR/$i/ 2>/dev/null || :
wget -N $j || { sleep 5; wget -N $j; } || mv -f $TMPDIR/$i/${j##/} ./ 2>/dev/null || :
done
cd ..
echo
}
for b in $(echo bin/* | xargs -n1 | grep -E "[_-]${i#x}-|[_-]$i-|-$i$"); do
c=${b##*/}
c=${c%%-*}
ln -f $b $TMPDIR/$i/$c 2>/dev/null || cp -f $b $TMPDIR/$i/$c
done
sed "s/BINLINENO/$BIN_LINE/" tarb.sh > $TMPDIR/tarb-$i
tar -cf - -C $TMPDIR/$i . | gzip -9 | base64 >> $TMPDIR/tarb-$i
sed -i"" "/^ABI=/s/=.*/=$i/" $TMPDIR/tarb-$i
rm -rf $TMPDIR/$i
echo
done
exit