forked from xyproto/algernon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease
executable file
·60 lines (56 loc) · 1.75 KB
/
release
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
#!/bin/sh
#
# Create release tarballs/zip for 64-bit linux, BSD and Plan9 + 64-bit ARM + raspberry pi 2/3 + Windows
#
name=algernon
version=$(grep -i version main.go | head -1 | cut -d' ' -f4 | cut -d'"' -f1)
echo 'Compiling...'
export GOARCH=amd64
echo '* Linux'
GOOS=linux go build -o $name.linux
echo '* macOS'
GOOS=darwin go build -o $name.macos
echo '* FreeBSD'
GOOS=freebsd go build -o $name.freebsd
echo '* NetBSD'
GOOS=netbsd go build -o $name.netbsd
echo '* Dragonfly'
GOOS=dragonfly go build -o $name.dragonfly
echo '* OpenBSD'
GOOS=openbsd go build -o $name.openbsd
echo '* Windows'
GOOS=windows go build -o $name.exe
echo '* Linux ARM64'
GOOS=linux GOARCH=arm64 go build -o $name.linux_arm64
echo '* RPI 2/3'
GOOS=linux GOARCH=arm GOARM=6 go build -o $name.rpi
# Currently does not build for plan9 because of the fsnotify package
#echo '* Plan9'
#GOOS=plan9 go build -o $name.plan9
# Compress the Windows release
echo "Compressing $name-$version.zip"
mkdir "$name-$version"
cp $name.exe LICENSE "$name-$version/"
zip -q -r "$name-$version.zip" "$name-$version/"
rm -r "$name-$version"
rm $name.exe
# Compress the Linux releases with xz
for p in linux linux_arm64 rpi; do
echo "Compressing $name-$version.$p.tar.xz"
mkdir "$name-$version-$p"
cp $name.$p LICENSE "$name-$version-$p/"
tar Jcf "$name-$version-$p.tar.xz" "$name-$version-$p/"
rm -r "$name-$version-$p"
rm $name.$p
done
# Compress the other tarballs with gz
for p in macos freebsd netbsd dragonfly openbsd; do
echo "Compressing $name-$version.$p.tar.gz"
mkdir "$name-$version-$p"
#cp $name.1 "$name-$version-$p/"
#gzip "$name-$version-$p/$name.1"
cp $name.$p LICENSE "$name-$version-$p/"
tar zcf "$name-$version-$p.tar.gz" "$name-$version-$p/"
rm -r "$name-$version-$p"
rm $name.$p
done