build-apple-debug.sh

This commit is contained in:
ssrlive 2024-03-24 17:20:51 +08:00
parent 715a85920c
commit eab795e61c

27
build-apple-debug.sh Executable file
View file

@ -0,0 +1,27 @@
#! /bin/sh
echo "Setting up the rust environment..."
rustup target add aarch64-apple-ios
cargo install cbindgen
echo "Building target aarch64-apple-ios..."
cargo build --target aarch64-apple-ios
echo "Generating includes..."
mkdir -p target/include/
rm -rf target/include/*
cbindgen --config cbindgen.toml -l C -o target/include/tun2proxy.h
cat > target/include/module.modulemap <<EOF
framework module tun2proxy {
umbrella header "tun2proxy.h"
export *
module * { export * }
}
EOF
echo "Creating XCFramework"
rm -rf ./tun2proxy.xcframework
xcodebuild -create-xcframework \
-library ./target/aarch64-apple-ios/debug/libtun2proxy.a -headers ./target/include/ \
-output ./tun2proxy.xcframework