Skip to content

Commit

Permalink
version 74.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
apotocki committed Feb 1, 2024
1 parent 1459255 commit 1de915e
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 17 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## ICU for iOS and Mac OS X (Intel & Apple Silicon M1) & Catalyst - arm64 / x86_64
## ICU for iOS, visionOS, macOS (Intel & Apple Silicon M1) & Catalyst - arm64 / x86_64

Supported versions: 74.2

This repo provides a universal script for building static ICU libraries for use in iOS and Mac OS X applications. The repo contains "icu" submodule that is taken from https://github.com/unicode-org/icu . The repo branches correspond to the suitable branches of ICU repo. E.g. "74" branch corresponds to "maint/maint-74" branch.
This repo provides a universal script for building static ICU libraries for use in iOS, visionOS, and macOS applications. The repo contains "icu" submodule that is taken from https://github.com/unicode-org/icu . The repo branches correspond to the suitable branches of ICU repo. E.g. "74" branch corresponds to "maint/maint-74" branch.

## Prerequisites
1) Xcode must be installed because xcodebuild is used to create xcframeworks
Expand All @@ -26,7 +26,7 @@ This repo provides a universal script for building static ICU libraries for use
use_frameworks!
pod 'icu4c-iosx', '~> 74.2'
# or optionally more precisely
# pod 'icu4c-iosx', :git => 'https://github.com/apotocki/icu4c-iosx', :tag => '74.2.7', :submodules => 'true'
# pod 'icu4c-iosx', :git => 'https://github.com/apotocki/icu4c-iosx', :tag => '74.2.8', :submodules => 'true'
```
install new dependency:
```
Expand Down
6 changes: 4 additions & 2 deletions icu4c-iosx.podspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
Pod::Spec.new do |s|
s.name = "icu4c-iosx"
s.version = "74.2.7"
s.summary = "ICU XCFramework for macOS and iOS, including both arm64 and x86_64 builds for macOS, Mac Catalyst and Simulator."
s.version = "74.2.8"
s.summary = "ICU XCFramework for macOS, iOS, and visionOS, including both arm64 and x86_64 builds for macOS, Mac Catalyst, iOS Simulator, and visionOS Simulator."
s.homepage = "https://github.com/apotocki/icu4c-iosx"
s.license = "BSD"
s.author = { "Alexander Pototskiy" => "alex.a.potocki@gmail.com" }
s.social_media_url = "https://www.linkedin.com/in/alexander-pototskiy"
s.ios.deployment_target = "13.4"
s.osx.deployment_target = "11.0"
s.visionos.deployment_target = "1.0"
s.osx.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' }
s.ios.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' }
s.visionos.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' }
s.static_framework = true
s.prepare_command = "sh scripts/build.sh"
s.source = { :git => "https://github.com/apotocki/icu4c-iosx.git", :tag => "#{s.version}", :submodules => "true" }
Expand Down
53 changes: 41 additions & 12 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ IOS_VERSION=13.4
IOS_SIM_VERSION=13.4
CATALYST_VERSION=13.4
################## SETUP END
DEVSYSROOT=$XCODE_ROOT/Platforms/iPhoneOS.platform/Developer
SIMSYSROOT=$XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer
IOSSYSROOT=$XCODE_ROOT/Platforms/iPhoneOS.platform/Developer
IOSSIMSYSROOT=$XCODE_ROOT/Platforms/iPhoneSimulator.platform/Developer
MACSYSROOT=$XCODE_ROOT/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
XROSSYSROOT=$XCODE_ROOT/Platforms/XROS.platform/Developer
XROSSIMSYSROOT=$XCODE_ROOT/Platforms/XRSimulator.platform/Developer

ICU_VER_NAME=icu4c-${ICU_VER//\//-}
BUILD_DIR="$( cd "$( dirname "./" )" >/dev/null 2>&1 && pwd )"
Expand Down Expand Up @@ -100,12 +102,18 @@ build_catalyst_libs()
# "--target=arm-apple-ios13.4-macabi" "--target=x86_64-apple-ios13.4-macabi" "-L$MACSYSROOT/System/iOSSupport/usr/lib/"
}

build_sim_libs()
build_iossim_libs()
{
CFLAGS="-isysroot $SIMSYSROOT/SDKs/iPhoneSimulator.sdk -mios-simulator-version-min=$IOS_SIM_VERSION "
CFLAGS="-isysroot $IOSSIMSYSROOT/SDKs/iPhoneSimulator.sdk -mios-simulator-version-min=$IOS_SIM_VERSION "
generic_double_build ios.sim "$CFLAGS"
}

build_xrossim_libs()
{
CFLAGS="-isysroot $XROSSIMSYSROOT/SDKs/XRSimulator.sdk "
generic_double_build xros.sim "$CFLAGS"
}

################### BUILD FOR MAC OSX
ICU_BUILD_FOLDER=$ICU_VER_NAME-build
if [ ! -f $ICU_BUILD_FOLDER.success ]; then
Expand Down Expand Up @@ -145,19 +153,40 @@ lipo -create $INSTALL_DIR/lib/libicuio.a $ICU_VER_NAME-macos-$FOREIGN_ARC-build/
lipo -create $INSTALL_DIR/lib/libicuuc.a $ICU_VER_NAME-macos-$FOREIGN_ARC-build/source/lib/libicuuc.a -output $ICU_VER_NAME-macos-build/source/lib/libicuuc.a

build_catalyst_libs
build_sim_libs
build_iossim_libs

generic_build ios arm64 arm "-fembed-bitcode -isysroot $DEVSYSROOT/SDKs/iPhoneOS.sdk -mios-version-min=$IOS_VERSION"
if [ -d $XROSSIMSYSROOT/SDKs/XRSimulator.sdk ]; then
build_xrossim_libs
fi

generic_build ios arm64 arm "-fembed-bitcode -isysroot $IOSSYSROOT/SDKs/iPhoneOS.sdk -mios-version-min=$IOS_VERSION"

if [ -d $XROSSYSROOT ]; then
generic_build xros arm64 arm "-fembed-bitcode -isysroot $XROSSYSROOT/SDKs/XROS.sdk"
fi

if [ -d $INSTALL_DIR/frameworks ]; then
rm -rf $INSTALL_DIR/frameworks
fi
mkdir $INSTALL_DIR/frameworks

xcodebuild -create-xcframework -library $ICU_VER_NAME-macos-build/source/lib/libicudata.a -library $ICU_VER_NAME-catalyst-build/source/lib/libicudata.a -library $ICU_VER_NAME-ios.sim-build/source/lib/libicudata.a -library $ICU_VER_NAME-ios-arm64-build/source/lib/libicudata.a -output $INSTALL_DIR/frameworks/icudata.xcframework

xcodebuild -create-xcframework -library $ICU_VER_NAME-macos-build/source/lib/libicui18n.a -library $ICU_VER_NAME-catalyst-build/source/lib/libicui18n.a -library $ICU_VER_NAME-ios.sim-build/source/lib/libicui18n.a -library $ICU_VER_NAME-ios-arm64-build/source/lib/libicui18n.a -output $INSTALL_DIR/frameworks/icui18n.xcframework

xcodebuild -create-xcframework -library $ICU_VER_NAME-macos-build/source/lib/libicuio.a -library $ICU_VER_NAME-catalyst-build/source/lib/libicuio.a -library $ICU_VER_NAME-ios.sim-build/source/lib/libicuio.a -library $ICU_VER_NAME-ios-arm64-build/source/lib/libicuio.a -output $INSTALL_DIR/frameworks/icuio.xcframework
create_xcframework()
{
PARAMS="-library $ICU_VER_NAME-macos-build/source/lib/lib$1.a \
-library $ICU_VER_NAME-catalyst-build/source/lib/lib$1.a \
-library $ICU_VER_NAME-ios.sim-build/source/lib/lib$1.a \
-library $ICU_VER_NAME-ios-arm64-build/source/lib/lib$1.a"

if [ -d $XROSSIMSYSROOT/SDKs/XRSimulator.sdk ]; then
PARAMS="$PARAMS -library $ICU_VER_NAME-xros.sim-build/source/lib/lib$1.a"
fi
if [ -d $XROSSYSROOT ]; then
PARAMS="$PARAMS -library $ICU_VER_NAME-xros-arm64-build/source/lib/lib$1.a"
fi
xcodebuild -create-xcframework $PARAMS -output $INSTALL_DIR/frameworks/$1.xcframework
}

xcodebuild -create-xcframework -library $ICU_VER_NAME-macos-build/source/lib/libicuuc.a -library $ICU_VER_NAME-catalyst-build/source/lib/libicuuc.a -library $ICU_VER_NAME-ios.sim-build/source/lib/libicuuc.a -library $ICU_VER_NAME-ios-arm64-build/source/lib/libicuuc.a -output $INSTALL_DIR/frameworks/icuuc.xcframework
create_xcframework icudata
create_xcframework icui18n
create_xcframework icuio
create_xcframework icuuc

0 comments on commit 1de915e

Please sign in to comment.