mirror of
https://github.com/jwinterm/grim.git
synced 2026-10-17 06:11:26 +02:00
build: use zig linker for macos and linux for arm on x86
This commit is contained in:
@@ -4,7 +4,7 @@ case $2 in
|
|||||||
x86_64|arm)
|
x86_64|arm)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: release_linux.sh [version] [platform]\n - platform: 'x86_64', 'arm'" >&2
|
echo "Usage: release_linux.sh [platform] [version]\n - platform: 'x86_64', 'arm'" >&2
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -17,9 +17,11 @@ cd ..
|
|||||||
[[ $2 == "x86_64" ]] && arch+=(x86_64-unknown-linux-gnu)
|
[[ $2 == "x86_64" ]] && arch+=(x86_64-unknown-linux-gnu)
|
||||||
[[ $2 == "arm" ]] && arch+=(aarch64-unknown-linux-gnu)
|
[[ $2 == "arm" ]] && arch+=(aarch64-unknown-linux-gnu)
|
||||||
|
|
||||||
cargo build --release --target ${arch}
|
rustup target add ${arch}
|
||||||
|
cargo install cargo-zigbuild
|
||||||
|
cargo zigbuild --release --target ${arch}
|
||||||
|
|
||||||
# Create AppImage with https://github.com/AppImage/appimagetool
|
# Create AppImage with https://github.com/AppImage/appimagetool
|
||||||
cp target/${arch}/release/grim linux/Grim.AppDir/AppRun
|
cp target/${arch}/release/grim linux/Grim.AppDir/AppRun
|
||||||
rm target/${arch}/release/*.AppImage
|
rm target/${arch}/release/*.AppImage
|
||||||
appimagetool linux/Grim.AppDir target/${arch}/release/grim-v$1-linux-$2.AppImage
|
appimagetool linux/Grim.AppDir target/${arch}/release/grim-v$2-linux-$1.AppImage
|
||||||
@@ -27,23 +27,11 @@ cd ..
|
|||||||
[[ $1 == "x86_64" ]] && arch+=(x86_64-apple-darwin)
|
[[ $1 == "x86_64" ]] && arch+=(x86_64-apple-darwin)
|
||||||
[[ $1 == "arm" ]] && arch+=(aarch64-apple-darwin)
|
[[ $1 == "arm" ]] && arch+=(aarch64-apple-darwin)
|
||||||
|
|
||||||
if [[ "$OSTYPE" != "darwin"* ]]; then
|
|
||||||
# Start release build on non-MacOS with zig linker, requires zig 0.12.1
|
|
||||||
rustup target add x86_64-apple-darwin
|
rustup target add x86_64-apple-darwin
|
||||||
rustup target add aarch64-apple-darwin
|
rustup target add aarch64-apple-darwin
|
||||||
[[ $1 == "universal" ]]; arch+=(universal2-apple-darwin)
|
[[ $1 == "universal" ]]; arch+=(universal2-apple-darwin)
|
||||||
cargo install cargo-zigbuild
|
cargo install cargo-zigbuild
|
||||||
cargo zigbuild --release --target ${arch}
|
cargo zigbuild --release --target ${arch}
|
||||||
else
|
|
||||||
rustup target add ${arch}
|
|
||||||
if [[ $1 == "universal" ]]; then
|
|
||||||
cargo build --release --target x86_64-apple-darwin
|
|
||||||
cargo build --release --target aarch64-apple-darwin
|
|
||||||
lipo -create -output target/grim target/aarch64-apple-darwin/release/grim target/x86_64-apple-darwin/release/grim
|
|
||||||
else
|
|
||||||
cargo build --release --target ${arch}
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f .intentionally-empty-file.o
|
rm -f .intentionally-empty-file.o
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user