-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.sh
More file actions
66 lines (49 loc) · 1.09 KB
/
build.sh
File metadata and controls
66 lines (49 loc) · 1.09 KB
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
#!/bin/bash
set -e
build_dir="build"
version=$(grep 'const VERSION' source/*.go | awk -F"[ \"]+" '/VERSION/{print $4}')
# START
rm -rf $build_dir/*
printf "[building]\n"
build() {
name="$1_$2"
ext=""
echo $name
if [ $1 = 'darwin' ]; then
name="macos_"
if [ $2 = 'arm64' ]; then
name+="silicon"
else
name+="intel"
fi
fi
if [ $1 = 'windows' ]; then
ext=".exe"
fi
mkdir -p "$build_dir/$name"
env GOOS="$1" GOARCH="$2" go build -ldflags "-s -w" -trimpath -o "$build_dir/$name/meander$ext" ./source
}
build windows amd64
build linux amd64
build linux arm64
build darwin amd64
build darwin arm64
build freebsd amd64
printf "\n[packaging]\n"
for f in $build_dir/*; do
base=$(basename $f)
echo $base
name=meander_${base}_$version
cp license $f/license.txt
cp readme.md $f/readme.txt
pushd $f > /dev/null
zip -r "../$name.zip" * > /dev/null
popd > /dev/null
pushd $build_dir > /dev/null
sha512sum "$name.zip" > "$name.sha512sum"
popd > /dev/null
done
printf "\n[checksums]\n"
pushd $build_dir > /dev/null
sha512sum -c *.sha512sum | column -t
popd > /dev/null