-
Notifications
You must be signed in to change notification settings - Fork 38
/
build-release.sh
executable file
·37 lines (28 loc) · 970 Bytes
/
build-release.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
#!/bin/sh
# Generate zip file(s) to be uploaded to Github release page
BIN_NAME=tere
rm -rf release
mkdir release
# from https://github.com/Canop/broot/blob/master/version.sh
version=$(sed 's/^version = "\([^\"]*\)"/\1/;t;d' Cargo.toml | head -1)
echo "Building $BIN_NAME version $version"
#cargo clean
for target in \
"x86_64-unknown-linux-gnu" \
"x86_64-unknown-linux-musl" \
"x86_64-pc-windows-gnu" \
"aarch64-unknown-linux-gnu" #\
# TODO: mac support requires a lot of fiddling and getting the Apple SDK. see https://wapl.es/rust/2019/02/17/rust-cross-compile-linux-to-macos.html
#"x86_64-apple-darwin"
do
echo "Building $target"
cargo build --target=$target --release
cd target/$target/release
zip_name=$BIN_NAME-$version-$target.zip
case "$target" in
*windows*) zip $zip_name $BIN_NAME.exe ;;
*) zip $zip_name $BIN_NAME
esac
cd -
mv -v target/$target/release/$zip_name release/
done