Added build scripts for multiple platforms (#47)

This commit is contained in:
Thomas Schönauer
2022-10-21 18:41:09 +00:00
committed by GitHub
parent b724aa0f58
commit 08813259a8
2 changed files with 44 additions and 0 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
/target /target
/build
**/*.rs.bk **/*.rs.bk

43
build-all.sh Executable file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env sh
build_function() {
rustup update
cargo install cross
cross build --release --target x86_64-unknown-linux-gnu
cross build --release --target x86_64-unknown-linux-musl
cross build --release --target x86_64-unknown-freebsd
cross build --release --target aarch64-unknown-linux-gnu
cross build --release --target aarch64-unknown-linux-musl
cross build --release --target x86_64-pc-windows-gnu
}
package_function() {
tar -czvf build/topgrade-${ans}-x86_64-linux-gnu.tar.gz target/x86_64-unknown-linux-gnu/release/topgrade-rs
tar -czvf build/topgrade-${ans}-x86_64-linux-musl.tar.gz target/x86_64-unknown-linux-musl/release/topgrade-rs
tar -czvf build/topgrade-${ans}-x86_64-freebsd.tar.gz target/x86_64-unknown-freebsd/release/topgrade-rs
tar -czvf build/topgrade-${ans}-aarch64-linux-gnu.tar.gz target/aarch64-unknown-linux-gnu/release/topgrade-rs
tar -czvf build/topgrade-${ans}-aarch64-linux-musl.tar.gz target/aarch64-unknown-linux-musl/release/topgrade-rs
tar -czvf build/topgrade-${ans}-x86_64-windows.tar.gz target/x86_64-pc-windows-gnu/release/topgrade-rs.exe
}
while true; do
echo "You should always have a look on scripts you download from the internet."
read -p "Do you still want to proceed? (y/n) " yn
echo -n "Input version number: "
read ans
mkdir build
case $yn in
y ) build_function
package_function
break;;
n ) echo exiting...;
exit;;
* ) echo invalid response;;
esac
done