From 17545c1b7c4cdb125fc49b12a5d71433babce137 Mon Sep 17 00:00:00 2001 From: ardocrat Date: Fri, 13 Sep 2024 18:57:09 +0300 Subject: [PATCH] macos: platform build --- .gitignore | 1 - macos/Grim.app/Contents/MacOS/.gitignore | 1 + macos/build_release.sh | 19 +++++++++++-------- 3 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 macos/Grim.app/Contents/MacOS/.gitignore diff --git a/.gitignore b/.gitignore index af26ef6..ea10035 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,6 @@ android/keystore.properties target .cargo/ app/src/main/jniLibs -macos/Grim.app/Contents/MacOS/grim macos/cert.pem linux/Grim.AppDir/AppRun .intentionally-empty-file.o \ No newline at end of file diff --git a/macos/Grim.app/Contents/MacOS/.gitignore b/macos/Grim.app/Contents/MacOS/.gitignore new file mode 100644 index 0000000..b722e9e --- /dev/null +++ b/macos/Grim.app/Contents/MacOS/.gitignore @@ -0,0 +1 @@ +!.gitignore \ No newline at end of file diff --git a/macos/build_release.sh b/macos/build_release.sh index b1e94fd..da4722e 100755 --- a/macos/build_release.sh +++ b/macos/build_release.sh @@ -27,16 +27,20 @@ cd .. rustup target add x86_64-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 == "arm" ]] && arch+=(aarch64-apple-darwin) -[[ $2 == "universal" ]] && arch+=(universal2-apple-darwin) if [[ "$OSTYPE" != "darwin"* ]]; then - # Start release build with zig linker for cross-compilation - # zig 0.12+ required + rustup target add x86_64h-apple-darwin + [[ $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 zigbuild --release --target ${arch} rm -rf .intentionally-empty-file.o @@ -44,10 +48,9 @@ else cargo build --release --target ${arch} fi -mkdir 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 sign --pem-file cert.pem macos/Grim.app