-
Notifications
You must be signed in to change notification settings - Fork 123
/
Copy pathbuild.sh
executable file
·53 lines (41 loc) · 1.05 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
50
51
52
53
#!/bin/bash
command_exists() {
type "$1" &> /dev/null
}
echo '+ building stathub start'
rm -rf stathub.*.tar.gz
git add .
sed -ie "s/DEBUG\([^\=]*\)= true/DEBUG\1= false/g" src/const.go
rm -rf src/const.goe
for i in "i686" "x86_64"; do
rm -rf tmp && mkdir tmp
cp LICENSE tmp
cp README.md tmp
cp README-ZH.md tmp
echo "building the $i stathub"
cd src
make $i
if [ $? -ne 0 ]; then
echo "building the $i stathub failed"
echo '+ building stathub failed'
exit 1
fi
cd ..
mv bin/stathub tmp/stathub
cp service.sh tmp/service
echo "doing upx to binary files"
cd tmp
if command_exists upx; then
upx stathub >/dev/null 2>&1
fi
echo "packaging the $i stathub"
tar zcf stathub.$i.tar.gz *
cd ..
cp tmp/stathub.$i.tar.gz .
rm -rf tmp
done
git checkout .
VERSION=`grep -C1 'func Version' src/version.go | grep 'return ' | awk -F'"' '{print $2}'`
sed -ie "s/VERSION=\".*\"/VERSION=\"$VERSION\"/g" setup.sh
rm -rf setup.she
echo '+ building stathub done'