-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcompile-all-targets.sh
executable file
·37 lines (31 loc) · 1.24 KB
/
compile-all-targets.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
# WARNING: This script is NOT meant for normal installation, it's dedicated
# to the compilation of all supported targets, from a linux machine.
H1="\n\e[30;104;1m\e[2K\n\e[A" # style first header
H2="\n\e[30;104m\e[1K\n\e[A" # style second header
EH="\e[00m\n\e[2K" # end header
version=$(sed 's/version = "\([0-9.]\{1,\}\(-[a-z]\+\)\?\)"/\1/;t;d' Cargo.toml | head -1)
echo -e "${H1}Compilation of all targets for backdown $version${EH}"
# clean previous build
rm -rf build
mkdir build
echo " build cleaned"
# build the linux version
echo -e "${H2}Compiling the linux version${EH}"
cargo clean
cargo build --release
strip target/release/backdown
mkdir build/x86_64-linux/
cp target/release/backdown build/x86_64-linux/
# build a musl version
echo -e "${H2}Compiling the MUSL version${EH}"
cargo clean
cross build --release --target x86_64-unknown-linux-musl
mkdir build/x86_64-unknown-linux-musl
cp target/x86_64-unknown-linux-musl/release/backdown build/x86_64-unknown-linux-musl
# build the windows version
# use cargo cross
echo -e "${H2}Compiling the Windows version${EH}"
cargo clean
cross build --target x86_64-pc-windows-gnu --release
mkdir build/x86_64-pc-windows-gnu
cp target/x86_64-pc-windows-gnu/release/backdown.exe build/x86_64-pc-windows-gnu/