Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve build.sh #150

Merged
merged 5 commits into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ XCFRAMEWORK_DIR="./apple_xcframework"
# buildStatic iphoneos -mios-version-min=15.0 arm64
buildStatic()
{
echo "build for '$1', '$2', '$3'"
echo "build for $1, $2, min version $3"

local MIN_VERSION="-m$1-version-min=$3"
make PP="xcrun --sdk $1 --toolchain $1 clang" \
CC="xcrun --sdk $1 --toolchain $1 clang" \
CFLAGS="-arch $2 $3" \
LFLAGS="-arch $2 $3 -Wl,-Bsymbolic-functions" static
CFLAGS="-arch $2 $MIN_VERSION" \
LFLAGS="-arch $2 $MIN_VERSION -Wl,-Bsymbolic-functions" static

local OUTPUT_DIR="$XCFRAMEWORK_DIR/$1-$2"
mkdir -p $OUTPUT_DIR
Expand All @@ -26,7 +27,7 @@ buildStatic()

mergeStatic()
{
echo "merge for '$1', '$2', '$3'"
echo "merge for $1, $2, $3"
local FIRST_LIB_FILE="$XCFRAMEWORK_DIR/$1-$2/libhev-socks5-tunnel.a"
local SECOND_LIB_FILE="$XCFRAMEWORK_DIR/$1-$3/libhev-socks5-tunnel.a"
local OUTPUT_DIR="$XCFRAMEWORK_DIR/$1-$2-$3"
Expand All @@ -42,19 +43,19 @@ rm -rf $XCFRAMEWORK_DIR
rm -rf HevSocks5Tunnel.xcframework
mkdir $XCFRAMEWORK_DIR

buildStatic iphoneos arm64 -mios-version-min=15.0
buildStatic iphonesimulator x86_64 -miphonesimulator-version-min=15.0
buildStatic iphonesimulator arm64 -miphonesimulator-version-min=15.0
buildStatic iphoneos arm64 15.0
buildStatic iphonesimulator x86_64 15.0
buildStatic iphonesimulator arm64 15.0
mergeStatic iphonesimulator x86_64 arm64

# keep same with flutter
buildStatic macosx x86_64 -mmacosx-version-min=10.14
buildStatic macosx arm64 -mmacosx-version-min=10.14
buildStatic macosx x86_64 10.14
buildStatic macosx arm64 10.14
mergeStatic macosx x86_64 arm64

buildStatic appletvos arm64 -mappletvos-version-min=17.0
buildStatic appletvsimulator x86_64 -mappletvsimulator-version-min=17.0
buildStatic appletvsimulator arm64 -mappletvsimulator-version-min=17.0
buildStatic appletvos arm64 17.0
buildStatic appletvsimulator x86_64 17.0
buildStatic appletvsimulator arm64 17.0
mergeStatic appletvsimulator x86_64 arm64

INCLUDE_DIR="$XCFRAMEWORK_DIR/include"
Expand Down