From aa50be9fc24a05e47e6bcef683fa8b4c966089e5 Mon Sep 17 00:00:00 2001 From: Administrator <julien.garderon@gmail.com> Date: Sun, 26 May 2024 18:41:54 +0200 Subject: [PATCH] Modification de l'installeur --- install.sh | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 59e40db..6dd28b2 100755 --- a/install.sh +++ b/install.sh @@ -1,11 +1,32 @@ #!/usr/bin/env bash -ARCHI="x86_64-unknown-linux-gnu" +# Source : https://github.com/johnthagen/min-sized-rust?tab=readme-ov-file -RUSTFLAGS="-Zlocation-detail=none" cargo +nightly build -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target "$ARCHI" --release +ARCHI=${ARCHI:-"x86_64-unknown-linux-gnu"} -upx --best --lzma "target/$ARCHI/release/moustache" +if ! type cargo &>/dev/null; then + echo "The Cargo program must be installed on your system to compile." + echo "See : https://www.rust-lang.org/learn/get-started" +fi -# cp "target/$ARCHI/release/moustache" ~/.local/bin/moustache -sudo cp "target/$ARCHI/release/moustache" /usr/bin/moustache -sudo chmod 775 /usr/bin/moustache +echo "--> COMPILATION step" +RUSTFLAGS="-Zlocation-detail=none" \ + cargo +nightly build \ + -Z build-std=std,panic_abort \ + -Z build-std-features=panic_immediate_abort \ + --target "$ARCHI" \ + --release + +echo "--> SIZE REDUCTION step" +if type upx &>/dev/null; then + upx --best --lzma "target/$ARCHI/release/moustache" +else + echo "The UPX program must be installed on your system to reduce size." + echo "See : https://linux.die.net/man/1/upx" +fi + +echo "--> INSTALLATION step" +# sudo cp "target/$ARCHI/release/moustache" /usr/bin/moustache +# sudo chmod 775 /usr/bin/moustache +cp "target/$ARCHI/release/moustache" ~/.local/bin/moustache +echo "Installation in your local bin directory" -- GitLab