From fe9e617d9979afcc4b8986fee790aa1fe8da4394 Mon Sep 17 00:00:00 2001 From: Pariring Date: Sun, 13 Nov 2022 15:48:46 +0900 Subject: [PATCH] fix: build script --- build.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/build.sh b/build.sh index 47f52d1..3f22d80 100755 --- a/build.sh +++ b/build.sh @@ -6,18 +6,24 @@ platform=$(uname) echo Current platform: $platform -mkdir -p out/x86_64 -mkdir -p out/aarch64 -mkdir -p out/i686 - if [[ $platform == 'Linux' ]]; then + mkdir -p out/x86_64 + mkdir -p out/i686 + cargo build --release --target x86_64-unknown-linux-gnu cp target/x86_64-unknown-linux-gnu/release/libskyhook.so out/x86_64 elif [[ $platform == 'Darwin' ]]; then - cargo build --release --target x86_64-apple-darwin - cargo build --release --target aarch64-apple-darwin + TARGET_X86=x86_64-apple-darwin + TARGET_ARM=aarch64-apple-darwin - cp target/x86_64-apple-darwin/release/libskyhook.dylib out/x86_64 - cp target/aarch64-apple-darwin/release/libskyhook.dylib out/aarch64 + cargo build --release --target $TARGET_X86 + cargo build --release --target $TARGET_ARM + + lipo -create -output out/skyhook.bundle \ + target/${TARGET_X86}/release/libskyhook.dylib \ + target/${TARGET_ARM}/release/libskyhook.dylib + + # cp target/x86_64-apple-darwin/release/libskyhook.dylib out/x86_64 + # cp target/aarch64-apple-darwin/release/libskyhook.dylib out/aarch64 fi