macos: platform build

This commit is contained in:
ardocrat 2024-09-13 18:57:09 +03:00
parent bcf821c06a
commit 17545c1b7c
3 changed files with 12 additions and 9 deletions

1
.gitignore vendored
View file

@ -13,7 +13,6 @@ android/keystore.properties
target target
.cargo/ .cargo/
app/src/main/jniLibs app/src/main/jniLibs
macos/Grim.app/Contents/MacOS/grim
macos/cert.pem macos/cert.pem
linux/Grim.AppDir/AppRun linux/Grim.AppDir/AppRun
.intentionally-empty-file.o .intentionally-empty-file.o

View file

@ -0,0 +1 @@
!.gitignore

View file

@ -27,16 +27,20 @@ cd ..
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
rm -rf target/x86_64-apple-darwin
rm -rf target/aarch64-apple-darwin
[[ $2 == "x86_64" ]] && arch+=(x86_64-apple-darwin) [[ $2 == "x86_64" ]] && arch+=(x86_64-apple-darwin)
[[ $2 == "arm" ]] && arch+=(aarch64-apple-darwin) [[ $2 == "arm" ]] && arch+=(aarch64-apple-darwin)
[[ $2 == "universal" ]] && arch+=(universal2-apple-darwin)
if [[ "$OSTYPE" != "darwin"* ]]; then if [[ "$OSTYPE" != "darwin"* ]]; then
# Start release build with zig linker for cross-compilation rustup target add x86_64h-apple-darwin
# zig 0.12+ required [[ $2 == "universal" ]] && arch+=(x86_64h-apple-darwin)
else
[[ $2 == "universal" ]] && arch+=(universal2-apple-darwin)
rm -rf target/x86_64-apple-darwin
rm -rf target/aarch64-apple-darwin
fi
# Start release build with zig linker on non-MacOS systems
if [[ "$OSTYPE" != "darwin"* ]]; then
cargo install cargo-zigbuild cargo install cargo-zigbuild
cargo zigbuild --release --target ${arch} cargo zigbuild --release --target ${arch}
rm -rf .intentionally-empty-file.o rm -rf .intentionally-empty-file.o
@ -44,10 +48,9 @@ else
cargo build --release --target ${arch} cargo build --release --target ${arch}
fi fi
mkdir macos/Grim.app/Contents/MacOS
yes | cp -rf target/${arch}/release/grim macos/Grim.app/Contents/MacOS yes | cp -rf target/${arch}/release/grim macos/Grim.app/Contents/MacOS
### Sign .app resources on change: # Sign .app resources on change:
#rcodesign generate-self-signed-certificate #rcodesign generate-self-signed-certificate
#rcodesign sign --pem-file cert.pem macos/Grim.app #rcodesign sign --pem-file cert.pem macos/Grim.app