forked from rshimoda/icu4darwin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
create-xcframework.sh
executable file
·85 lines (72 loc) · 2.96 KB
/
create-xcframework.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh
source "prefix.sh"
echo "-- Cleaning up..."
./clear.sh
echo "-- Building for macOS..."
./mac/build.sh
echo "Building for iOS..."
./ios/build.sh
echo "-- Creating static XCFramework..."
xcodebuild -create-xcframework \
-library "mac/fat-lib-macosx/libicu.a" -headers "${MAC_INSTALL_DIR}/include" \
-library "ios/fat-lib-iphoneos/libicu.a" -headers "${MAC_INSTALL_DIR}/include" \
-library "ios/fat-lib-iphonesimulator/libicu.a" -headers "${MAC_INSTALL_DIR}/include" \
-library "ios/fat-lib-macosx/libicu.a" -headers "${MAC_INSTALL_DIR}/include" \
-output "XCFramework/Static/icu.xcframework"
ICU_FRAMEWORK_VERSION=${ICU_VERSION_MAJOR}.${ICU_VERSION_MINOR}
ICU_FRAMEWORK_COMPATIBILITY_VERSION=${ICU_VERSION_MAJOR}.0
echo "-- Building macOS framework"
xcodebuild archive \
-project unicode/unicode.xcodeproj \
-scheme unicode-macOS \
-configuration Release \
-arch arm64 \
-arch x86_64 \
-sdk macosx \
-archivePath Archive/unicode-macosx.xcarchive \
DYLIB_COMPATIBILITY_VERSION=${ICU_FRAMEWORK_COMPATIBILITY_VERSION} DYLIB_CURRENT_VERSION=${ICU_FRAMEWORK_VERSION}
echo "-- Building iOS framework"
xcodebuild archive \
-project unicode/unicode.xcodeproj \
-scheme unicode-iOS \
-configuration Release \
-arch arm64 \
-arch armv7 \
-arch armv7s \
-sdk iphoneos \
-archivePath Archive/unicode-iphoneos.xcarchive \
DYLIB_COMPATIBILITY_VERSION=${ICU_FRAMEWORK_COMPATIBILITY_VERSION} DYLIB_CURRENT_VERSION=${ICU_FRAMEWORK_VERSION}
echo "-- Building iOS Simulator framework"
xcodebuild archive \
-project unicode/unicode.xcodeproj \
-scheme unicode-iOS \
-configuration Release \
-arch arm64 \
-arch x86_64 \
-sdk iphonesimulator \
-archivePath Archive/unicode-iphonesimulator.xcarchive \
DYLIB_COMPATIBILITY_VERSION=${ICU_FRAMEWORK_COMPATIBILITY_VERSION} DYLIB_CURRENT_VERSION=${ICU_FRAMEWORK_VERSION}
echo "-- Building Mac Catalyst framework"
xcodebuild archive \
-project unicode/unicode.xcodeproj \
-scheme unicode-iOS \
-configuration Release \
-arch x86_64 \
-arch arm64 \
-sdk macosx \
-archivePath Archive/unicode-maccatalyst.xcarchive \
SUPPORTS_MACCATALYST=YES DYLIB_COMPATIBILITY_VERSION=${ICU_FRAMEWORK_COMPATIBILITY_VERSION} DYLIB_CURRENT_VERSION=${ICU_FRAMEWORK_VERSION}
echo "-- Creating XCFramework..."
xcodebuild -create-xcframework \
-framework "Archive/unicode-macosx.xcarchive/Products/Library/Frameworks/unicode.framework" \
-framework "Archive/unicode-iphoneos.xcarchive/Products/Library/Frameworks/unicode.framework" \
-framework "Archive/unicode-iphonesimulator.xcarchive/Products/Library/Frameworks/unicode.framework" \
-framework "Archive/unicode-maccatalyst.xcarchive/Products/Library/Frameworks/unicode.framework" \
-output "XCFramework/icu.xcframework"
echo "-- Compressing XCFramework..."
cd XCFramework
zip -ry icu${ICU_VERSION_MAJOR}-${ICU_VERSION_MINOR}-darwin-xcframework-dynamic.zip icu.xcframework
cd Static
zip -ry ../icu${ICU_VERSION_MAJOR}-${ICU_VERSION_MINOR}-darwin-xcframework-static.zip icu.xcframework
cd ../..
echo "-- Done"