Skip to content

Commit d8df63a

Browse files
committed
version 76.1.1
1 parent 42a7dca commit d8df63a

File tree

6 files changed

+281
-115
lines changed

6 files changed

+281
-115
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
submodules: 'true'
1717
- name: Build
1818
run: |
19-
scripts/build.sh
19+
scripts/build.sh -p=macosx-both,ios,iossim-both,catalyst-both,xros,xrossim-both,watchos,watchossim-both,tvos,tvossim-both
2020
for i in product/frameworks/*.xcframework/; do cd product/frameworks && zip -9 -r -r "$(basename -- $i).zip" $(basename -- $i) & done; wait
2121
cd product
2222
zip -9 -r include.zip include

.gitmodules

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.md

Lines changed: 59 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
## ICU for iOS, visionOS, macOS (Intel & Apple Silicon M1) & Catalyst - arm64 / x86_64
1+
## ICU for iOS, watchOS, tvOS, visionOS, macOS, Catalyst, Simulators - Intel(x86_64) / Apple Silicon(arm64)
22

33
Supported versions: 76.1
44

5-
This repo provides a universal script for building static ICU libraries for use in iOS, visionOS, and macOS applications. The actual ICU library version is taken from https://github.com/unicode-org/icu . The repo branches correspond to the suitable branches of ICU repo. E.g. "76" branch corresponds to "maint/maint-76" branch.
5+
This repo provides a universal script for building static ICU libraries for use in iOS, watchOS, tvOS, visionOS, and macOS applications. The actual ICU library version is taken from https://github.com/unicode-org/icu . The branches of the repository generally correspond to the branches of the ICU repository. E.g. "76" branch corresponds to "maint/maint-76" branch.
66

7-
## Prerequisites
8-
1) Xcode must be installed because xcodebuild is used to create xcframeworks
9-
2) ```xcode-select -p``` must point to Xcode app developer directory (by default e.g. /Applications/Xcode.app/Contents/Developer). If it points to CommandLineTools directory you should execute:
7+
# Prerequisites
8+
1) Xcode must be installed as xcodebuild is used to create xcframeworks
9+
2) ```xcode-select -p``` must point to the Xcode app developer directory (by default e.g. /Applications/Xcode.app/Contents/Developer). If it points to the CommandLineTools directory you should run:
1010
```sudo xcode-select --reset``` or ```sudo xcode-select -s /Applications/Xcode.app/Contents/Developer```
1111

12-
## How to build?
13-
- Manually
12+
# Build Manually
1413
```
1514
# clone the repo
1615
git clone -b 76 https://github.com/apotocki/icu4c-iosx
@@ -20,13 +19,63 @@ This repo provides a universal script for building static ICU libraries for use
2019
scripts/build.sh
2120
2221
# have fun, the result artifacts will be located in 'product' folder.
23-
```
24-
- Use cocoapods. Add the following lines into your project's Podfile:
22+
```
23+
# Selecting Platforms and Architectures
24+
build.sh without arguments will build xcframeworks for iOS, macOS, and also for watchOS, tvOS, visionOS if their SDKs are installed on the system. It will also build xcframeworks for their simulators with the architecture (arm64 or x86_64) depending on the current host.
25+
If you are interested in a specific set of platforms and architectures, you can specify them explicitly using the -p argument, for example:
26+
```
27+
scripts/build.sh -p=ios,iossim-x86_64
28+
# builts xcframeworks only for iOS and iOS Simulator with x86_64 architecture
29+
```
30+
Here is a list of all possible values for '-p' option:
31+
```
32+
macosx,macosx-arm64,macosx-x86_64,macosx-both,ios,iossim,iossim-arm64,iossim-x86_64,iossim-both,catalyst,catalyst-arm64,catalyst-x86_64,catalyst-both,xros,xrossim,xrossim-arm64,xrossim-x86_64,xrossim-both,tvos,tvossim,tvossim-both,tvossim-arm64,tvossim-x86_64,watchos,watchossim,watchossim-both,watchossim-arm64,watchossim-x86_64
33+
```
34+
Suffix '-both' means that xcframeworks will be built for both arm64 and x86_64 architectures.
35+
36+
# ICU Data Archive
37+
The build.sh script builds the following xcframeworks: icudata, icui18n, icuio, and icuuc.
38+
By default, 'icudata' is built with the --with-data-packaging=static option (see https://unicode-org.github.io/icu/userguide/icu_data/). So all the metadata (locales, tables, etc) is placed into icudata library making it quite large (~32MB). Since xcframework may contain libraries for multiple platforms and architectures this metadata is duplicated multiple times wasting space. Therefore, ICU allows to move the metadata to a separate platform-independent file that must be loaded during the library initialization. To activate this option you can specify -d=archive :
39+
```
40+
scripts/build.sh -p=ios,iossim-x86_64 -d=archive
41+
# builts xcframeworks for iOS and iOS Simulator with x86_64 architecture
42+
# datafile path is product/share/icu/76.1/icudt76l.dat
43+
```
44+
In that case, during the ICU initialization procedure you have to specify ICU data directory before u_init() call:
45+
46+
```
47+
#include <unicode/putil.h>
48+
49+
... // somewhere in ICU initialization procedure before u_init call
50+
u_setDataDirectory("PATH TO THE DIRECTORY WHERE icudt76l.dat is located");
51+
52+
u_init(code)
53+
...
54+
```
55+
56+
## ICU Data Filtering
57+
ICU metadata is a rather large set of different locales, tables, rules and so on. It's very likely that you won't need all of them in your application. Fortunately, we can filter the data we need when building the icudata library by specifying the filter with the -f option:
58+
```
59+
scripts/build.sh -p=ios,iossim-x86_64 -f=path_to_filter.json
60+
# builts xcframeworks for iOS and iOS Simulator with x86_64 architecture
61+
```
62+
The format of the filter is described at https://unicode-org.github.io/icu/userguide/icu_data/buildtool.html
63+
64+
## Rebuild option
65+
To rebuild the library without using the results of previous builds, use the --rebuild option
66+
```
67+
scripts/build.sh -p=ios,iossim-x86_64 --rebuild
68+
69+
```
70+
71+
# Build Using Cocoapods.
72+
Add the following lines into your project's Podfile:
2573
```
2674
use_frameworks!
2775
pod 'icu4c-iosx', '~> 76.1'
76+
2877
# or optionally more precisely
29-
# pod 'icu4c-iosx', :git => 'https://github.com/apotocki/icu4c-iosx', :tag => '76.1.0'
78+
# pod 'icu4c-iosx', :git => 'https://github.com/apotocki/icu4c-iosx', :tag => '76.1.1'
3079
```
3180
install new dependency:
3281
```

demo/Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ install! 'cocoapods', :deterministic_uuids => false
66
target 'icu4c-demo (iOS)' do
77
use_frameworks!
88
pod 'icu4c-iosx'
9-
#pod 'icu4c-iosx', :git => 'https://github.com/apotocki/icu4c-iosx', :branch => '73', :submodules => 'true'
9+
#pod 'icu4c-iosx', :git => 'https://github.com/apotocki/icu4c-iosx', :branch => '76'
1010
end
1111

1212
target 'icu4c-demo (macOS)' do
1313
use_frameworks!
1414
pod 'icu4c-iosx'
15-
#pod 'icu4c-iosx', :git => 'https://github.com/apotocki/icu4c-iosx', :branch => '73', :submodules => 'true'
15+
#pod 'icu4c-iosx', :git => 'https://github.com/apotocki/icu4c-iosx', :branch => '76'
1616
end

icu4c-iosx.podspec

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
Pod::Spec.new do |s|
22
s.name = "icu4c-iosx"
3-
s.version = "76.1.0"
4-
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."
3+
s.version = "76.1.1"
4+
s.summary = "ICU XCFramework for macOS, iOS, watchOS, tvOS, and visionOS, including builds for Mac Catalyst, iOS Simulator, watchOS Simulator, tvOS Simulator, and visionOS Simulator."
55
s.homepage = "https://github.com/apotocki/icu4c-iosx"
66
s.license = "BSD"
77
s.author = { "Alexander Pototskiy" => "[email protected]" }
88
s.social_media_url = "https://www.linkedin.com/in/alexander-pototskiy"
9+
s.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' }
910
s.ios.deployment_target = "13.4"
1011
s.osx.deployment_target = "11.0"
12+
s.tvos.deployment_target = "13.0"
13+
s.watchos.deployment_target = "11.0"
1114
s.visionos.deployment_target = "1.0"
12-
s.osx.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' }
13-
s.ios.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' }
14-
s.visionos.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES' }
1515
s.static_framework = true
16-
s.prepare_command = "sh scripts/build.sh"
17-
s.source = { :git => "https://github.com/apotocki/icu4c-iosx.git", :tag => "#{s.version}", :submodules => "true" }
16+
s.source = { :git => "https://github.com/apotocki/icu4c-iosx.git", :tag => "#{s.version}" }
1817
s.source_files = "product/include/**/*.{h}"
1918
s.header_mappings_dir = "product/include"
19+
s.prepare_command = "sh scripts/build.sh"
2020
s.public_header_files = "product/include/**/*.{h}"
2121
s.vendored_frameworks = "product/frameworks/icudata.xcframework", "product/frameworks/icui18n.xcframework", "product/frameworks/icuio.xcframework", "product/frameworks/icuuc.xcframework"
2222
end

0 commit comments

Comments
 (0)