diff options
author | Canop <cano.petrole@gmail.com> | 2022-04-13 22:00:13 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2022-04-13 22:00:13 +0200 |
commit | eb56488b123fabb682ec687b0149e149de644957 (patch) | |
tree | 92b059b7d7b2d9839d1f3c254821a924147145af /compile-all-targets.sh | |
parent | e737f692ffaa4808813b37c6c51b06e6195cb875 (diff) |
added compilation target: older GLIBC
This one has no support for clipboard (yet).
Fix #531
Diffstat (limited to 'compile-all-targets.sh')
-rwxr-xr-x | compile-all-targets.sh | 88 |
1 files changed, 53 insertions, 35 deletions
diff --git a/compile-all-targets.sh b/compile-all-targets.sh index 2249834..68f1491 100755 --- a/compile-all-targets.sh +++ b/compile-all-targets.sh @@ -1,5 +1,5 @@ #WARNING: This script is NOT meant for normal installation, it's dedicated -# to the compilation of all supported targets, from a linux machine. +# to the compilation of all supported targets. # This is a long process and it involves specialized toolchains. # For usual compilation do # cargo build --release @@ -9,25 +9,27 @@ 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 - +NAME=broot version=$(./version.sh) -echo -e "${H1}Compilation of all targets for broot $version${EH}" + +echo -e "${H1}Compilation of all targets for $NAME $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}" + +# build the default linux version (with clipboard support) +# recent glibc +echo -e "${H2}Compiling the standard linux version${EH}" cargo build --release --features "clipboard" -strip target/release/broot +strip "target/release/$NAME" mkdir build/x86_64-linux/ -cp target/release/broot build/x86_64-linux/ +cp "target/release/$NAME" build/x86_64-linux/ -# find and copy the completion scripts -# (they're built as part of the normal compilation so must come after the linux version) -echo -e "${H2}copying completion scripts${EH}" +# build, find, and copy the completion scripts +# (they're built as part of the normal compilation) +echo -e "${H2}building and copying completion scripts${EH}" mkdir build/completion cp "$(broot -c ":gi;release;:focus;broot.bash;:parent;:pp" target)/"* build/completion echo " Done" @@ -36,7 +38,7 @@ echo " Done" echo -e "${H2}copying default configuration${EH}" cp resources/default-conf.hjson build echo " Done" - + # add the resource (the icons font) echo -e "${H2}copying vscode-icon font${EH}" mkdir build/resources @@ -44,29 +46,45 @@ cp resources/icons/vscode/vscode.ttf build/resources echo "the font file comes from https://github.com/vscode-icons/vscode-icons/ and is licensed as MIT" > build/resources/README.md echo " Done" -# build the windows version -# use cargo cross -echo -e "${H2}Compiling the Windows version${EH}" -cross build +1.58 --target x86_64-pc-windows-gnu --release --features "clipboard" -mkdir build/x86_64-pc-windows-gnu -cp target/x86_64-pc-windows-gnu/release/broot.exe build/x86_64-pc-windows-gnu/ +# build versions for other platforms using cargo cross +cross_build() { + target_name="$1" + target="$2" + features="$3" + echo -e "${H2}Compiling the $target_name version (target=$target, features='$features')${EH}" + if [[ -n $features ]] + then + cross build --target "$target" --release --features "$features" + else + cross build --target "$target" --release + fi + mkdir "build/$target" + if [[ $target_name == 'Windows' ]] + then + exec="$NAME.exe" + else + exec="$NAME" + fi + cp "target/$target/release/$exec" "build/$target/" +} +cross_build "Android" "aarch64-linux-android" "clipboard" +cross_build "Linux GLIBC" "x86_64-unknown-linux-gnu" "" +cross_build "MUSL" "x86_64-unknown-linux-musl" "" +cross_build "Raspberry 32" "armv7-unknown-linux-gnueabihf" "" +cross_build "Windows" "x86_64-pc-windows-gnu" "clipboard" + +# add a summary of content +echo ' +This archive contains pre-compiled binaries: -# build the Raspberry version -# use cargo cross -echo -e "${H2}Compiling the Raspberry version${EH}" -cross build +1.58 --target armv7-unknown-linux-gnueabihf --release -mkdir build/armv7-unknown-linux-gnueabihf -cp target/armv7-unknown-linux-gnueabihf/release/broot build/armv7-unknown-linux-gnueabihf/ +x86_64-linux/broot : standard Linux, clipboard support, most optimized +aarch64-linux-android/broot : Android, clipboard support +x86_64-unknown-linux-gnu : Linux/glibc, no clipboard support, compatible with older GLIBC +x86_64-unknown-linux-musl : Linux/musl, no clipboard support +armv7-unknown-linux-gnueabihf : Raspberry | no clipboard support +x86_64-pc-windows-gnu : Windows 10+, clipboard support -# build the Android version -# use cargo cross -echo -e "${H2}Compiling the Android version${EH}" -cross build +1.58 --target aarch64-linux-android --release --features "clipboard" -mkdir build/aarch64-linux-android -cp target/aarch64-linux-android/release/broot build/aarch64-linux-android/ +For more information, or if you prefer to compile yourself, see https://dystroy.org/broot/install +' > build/install.md -# build a musl version -echo -e "${H2}Compiling the MUSL version${EH}" -cross build +1.58 --release --target x86_64-unknown-linux-musl -mkdir build/x86_64-unknown-linux-musl -cp target/x86_64-unknown-linux-musl/release/broot build/x86_64-unknown-linux-musl +echo -e "${H1}FINISHED${EH}" |