Skip to content

Commit 26b63c3

Browse files
committed
Update Swift compiler to 5.4.3
1 parent 7d4b8d1 commit 26b63c3

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

.github/workflows/sdks.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ jobs:
151151
if [ ! -d ${{ steps.version.outputs.tag }}-ubuntu20.04 ]; then
152152
tar xf ~/${{ steps.version.outputs.tag }}-ubuntu20.04.tar.gz
153153
fi
154-
sed -i "s%/home/butta/swift-5.4.2-RELEASE%`pwd`/${{ steps.version.outputs.tag }}%" android-${{ matrix.arch }}.json
154+
sed -i "s%/home/butta/swift-5.4.3-RELEASE%`pwd`/${{ steps.version.outputs.tag }}%" android-${{ matrix.arch }}.json
155155
156156
tar xf ~/swift-${{ matrix.version }}*-android-${{ matrix.arch }}*-${ANDROID_API_LEVEL}-sdk.tar.xz
157157
SDK_NAME=$(ls | grep swift-${{ matrix.version }}.*-sdk)

README.md

+24-24
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
All patches used to build these SDKs are open source and listed below.
44

55
To build with a Swift 5.4.2 SDK, first download [the latest Android LTS NDK
6-
23](https://developer.android.com/ndk/downloads) and [Swift 5.4.2
6+
23](https://developer.android.com/ndk/downloads) and [Swift 5.4.3
77
compiler](https://swift.org/download/#releases) (make sure to install the Swift
88
compiler's dependencies listed there). Unpack these archives and the SDK.
99

@@ -27,7 +27,7 @@ path where you unpacked this SDK, such as `/home/yourname/swift-5.4.2-android-aa
2727
to point to the clang headers next to your swift compiler, eg
2828

2929
```
30-
ln -sf /home/yourname/swift-5.4.2-RELEASE-ubuntu20.04/usr/lib/clang/10.0.0
30+
ln -sf /home/yourname/swift-5.4.3-RELEASE-ubuntu20.04/usr/lib/clang/10.0.0
3131
swift-5.4.2-android-aarch64-24-sdk/usr/lib/swift/clang
3232
```
3333
The new NDK 23 needs to have a header modified: change the line from this file,
@@ -44,8 +44,8 @@ Finally, modify the cross-compilation JSON file in this repo similarly:
4444
1. All paths to the NDK should change from `/home/butta/android-ndk-r23`
4545
to the path to your NDK, `/home/yourname/android-ndk-r23`.
4646

47-
2. The path to the compiler should change from `/home/butta/swift-5.4.2-RELEASE-ubuntu20.04`
48-
to the path to your Swift compiler, `/home/yourname/swift-5.4.2-RELEASE-centos8`.
47+
2. The path to the compiler should change from `/home/butta/swift-5.4.3-RELEASE-ubuntu20.04`
48+
to the path to your Swift compiler, `/home/yourname/swift-5.4.3-RELEASE-centos8`.
4949

5050
3. The path to the Android SDK should change from `/home/butta/swift-5.4.2-android-aarch64-24-sdk`
5151
to the path where you unpacked the Android SDK, `/home/yourname/swift-5.4.2-android-aarch64-24-sdk`.
@@ -56,7 +56,7 @@ I'll demonstrate with the swift-argument-parser package:
5656
```
5757
git clone --depth 1 https://github.com/apple/swift-argument-parser.git
5858
cd swift-argument-parser/
59-
/home/yourname/swift-5.4.2-RELEASE-ubuntu20.04/usr/bin/swift build --build-tests
59+
/home/yourname/swift-5.4.3-RELEASE-ubuntu20.04/usr/bin/swift build --build-tests
6060
--enable-test-discovery --destination ~/swift-android-sdk/android-aarch64.json
6161
-Xlinker -rpath -Xlinker \$ORIGIN/swift-5.4.2-android-aarch64-24-sdk/usr/lib/swift/android
6262
```
@@ -109,9 +109,9 @@ mode.
109109

110110
# Building the Android SDKs
111111

112-
Download the Swift 5.4.2 compiler and Android NDK 23 as above. Check out this
112+
Download the Swift 5.4.3 compiler and Android NDK 23 as above. Check out this
113113
repo and run
114-
`SWIFT_TAG=swift-5.4.2-RELEASE ANDROID_ARCH=aarch64 swift get-packages-and-swift-source.swift`
114+
`SWIFT_TAG=swift-5.4.3-RELEASE ANDROID_ARCH=aarch64 swift get-packages-and-swift-source.swift`
115115
to get some prebuilt Android libraries and the Swift source to build the SDK. If
116116
you pass in a different tag like `swift-5.5-DEVELOPMENT-SNAPSHOT-2021-08-28-a`
117117
for the latest Swift 5.5 snapshot and pass in the path to the corresponding
@@ -124,18 +124,18 @@ substituted instead:
124124
```
125125
./swift/utils/build-script -RA --skip-build-cmark --build-llvm=0 --android
126126
--android-ndk /home/butta/android-ndk-r23/ --android-arch aarch64 --android-api-level 24
127-
--android-icu-uc /home/butta/swift-5.4.2-android-aarch64-24-sdk/usr/lib/libicuuc.so
128-
--android-icu-uc-include /home/butta/swift-5.4.2-android-aarch64-24-sdk/usr/include/
129-
--android-icu-i18n /home/butta/swift-5.4.2-android-aarch64-24-sdk/usr/lib/libicui18n.so
130-
--android-icu-i18n-include /home/butta/swift-5.4.2-android-aarch64-24-sdk/usr/include/
131-
--android-icu-data /home/butta/swift-5.4.2-android-aarch64-24-sdk/usr/lib/libicudata.so
132-
--build-swift-tools=0 --native-swift-tools-path=/home/butta/swift-5.4.2-RELEASE-ubuntu20.04/usr/bin/
127+
--android-icu-uc /home/butta/swift-5.4.3-android-aarch64-24-sdk/usr/lib/libicuuc.so
128+
--android-icu-uc-include /home/butta/swift-5.4.3-android-aarch64-24-sdk/usr/include/
129+
--android-icu-i18n /home/butta/swift-5.4.3-android-aarch64-24-sdk/usr/lib/libicui18n.so
130+
--android-icu-i18n-include /home/butta/swift-5.4.3-android-aarch64-24-sdk/usr/include/
131+
--android-icu-data /home/butta/swift-5.4.3-android-aarch64-24-sdk/usr/lib/libicudata.so
132+
--build-swift-tools=0 --native-swift-tools-path=/home/butta/swift-5.4.3-RELEASE-ubuntu20.04/usr/bin/
133133
--native-clang-tools-path=/home/butta/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/bin
134134
--host-cc=/usr/bin/clang-11 --host-cxx=/usr/bin/clang++-11
135-
--cross-compile-hosts=android-aarch64 --cross-compile-deps-path=/home/butta/swift-5.4.2-android-aarch64-24-sdk
135+
--cross-compile-hosts=android-aarch64 --cross-compile-deps-path=/home/butta/swift-5.4.3-android-aarch64-24-sdk
136136
--skip-local-build --xctest --swift-install-components='clang-resource-dir-symlink;license;stdlib;sdk-overlay'
137137
--install-swift --install-libdispatch --install-foundation --install-xctest
138-
--install-destdir=/home/butta/swift-5.4.2-android-aarch64-24-sdk
138+
--install-destdir=/home/butta/swift-5.4.3-android-aarch64-24-sdk
139139
--common-swift-flags="-Xlinker -rpath -Xlinker \\\$\$ORIGIN/../.."
140140
--swift-cmake-options=-DCMAKE_SHARED_LINKER_FLAGS='-Wl,-rpath,"\$ORIGIN/../.."' -j9
141141
```
@@ -148,8 +148,8 @@ into these two commands to build for those architectures instead.
148148
Finally, copy `libc++_shared.so` from the NDK and modify the cross-compiled
149149
`libdispatch.so` to include `$ORIGIN` in its rpath:
150150
```
151-
cp /home/yourname/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so swift-5.4.2-android-aarch64-24-sdk/usr/lib
152-
patchelf --set-rpath \$ORIGIN swift-5.4.2-android-aarch64-24-sdk/usr/lib/swift/android/libdispatch.so
151+
cp /home/yourname/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so swift-5.4.3-android-aarch64-24-sdk/usr/lib
152+
patchelf --set-rpath \$ORIGIN swift-5.4.3-android-aarch64-24-sdk/usr/lib/swift/android/libdispatch.so
153153
```
154154

155155
Here is a description of what the above Swift script is doing:
@@ -162,18 +162,18 @@ libcurl, and libxml2 packages from the [Termux package
162162
repository](https://packages.termux.org/apt/termux-main/pool/main/).
163163

164164
Each one is unpacked with `ar x libicu_68.2-1_aarch64.deb; tar xf data.tar.xz` and
165-
the resulting files moved to a newly-created Swift 5.4.2 SDK directory:
165+
the resulting files moved to a newly-created Swift 5.4.3 SDK directory:
166166
```
167-
mkdir swift-5.4.2-android-aarch64-24-sdk
168-
mv data/data/com.termux/files/usr swift-5.4.2-android-aarch64-24-sdk
167+
mkdir swift-5.4.3-android-aarch64-24-sdk
168+
mv data/data/com.termux/files/usr swift-5.4.3-android-aarch64-24-sdk
169169
```
170170
It removes two config scripts in `usr/bin`, runs `patchelf` to remove the
171171
Termux rpath from all Termux shared libraries, and modifies the ICU libraries
172172
to get rid of the versioning and symlinks (three libicu libraries are removed
173173
since they're unused by Swift):
174174
```
175-
rm swift-5.4.2-android-aarch64-24-sdk/usr/bin/*-config
176-
cd swift-5.4.2-android-aarch64-24-sdk/usr/lib
175+
rm swift-5.4.3-android-aarch64-24-sdk/usr/bin/*-config
176+
cd swift-5.4.3-android-aarch64-24-sdk/usr/lib
177177
178178
rm libicu{io,test,tu}*
179179
patchelf --set-rpath \$ORIGIN libandroid-spawn.so libcurl.so libicu*so.68.2 libxml2.so
@@ -203,12 +203,12 @@ instead, so this Swift SDK for Android could be built without using
203203
any prebuilt Termux packages, if you're willing to put in the effort to
204204
cross-compile them yourself, for example, against a different Android API.
205205

206-
Next, it gets [the 5.4.2 source](https://github.com/apple/swift/releases/tag/swift-5.4.2-RELEASE)
206+
Next, it gets [the 5.4.3 source](https://github.com/apple/swift/releases/tag/swift-5.4.3-RELEASE)
207207
tarballs for five Swift repos and renames them to `llvm-project/`, `swift/`,
208208
`swift-corelibs-libdispatch`, `swift-corelibs-foundation`, and
209209
`swift-corelibs-xctest`, as required by the Swift `build-script`. After creating
210210
an empty directory, `mkdir cmark`, it downloads six patches that have been
211-
backported to build the Termux package for Swift 5.4.2 (all Termux patches are
211+
backported to build the Termux package for Swift 5.4.3 (all Termux patches are
212212
available under the [same license as the Termux package, the Apache license used
213213
by Swift in this case](https://github.com/termux/termux-packages/blob/master/LICENSE.md#license-for-package-patches))
214214
and applies each of them:

android-aarch64.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"version": 1,
33
"target": "aarch64-unknown-linux-android",
4-
"toolchain-bin-dir": "/home/butta/swift-5.4.2-RELEASE-ubuntu20.04/usr/bin",
4+
"toolchain-bin-dir": "/home/butta/swift-5.4.3-RELEASE-ubuntu20.04/usr/bin",
55
"sdk": "/home/butta/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/sysroot",
66
"extra-cc-flags": [
77
"-fPIC"

android-armv7.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"version": 1,
33
"target": "armv7-unknown-linux-androideabi",
4-
"toolchain-bin-dir": "/home/butta/swift-5.4.2-RELEASE-ubuntu20.04/usr/bin",
4+
"toolchain-bin-dir": "/home/butta/swift-5.4.3-RELEASE-ubuntu20.04/usr/bin",
55
"sdk": "/home/butta/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/sysroot",
66
"extra-cc-flags": [
77
"-fPIC"

android-x86_64.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"version": 1,
33
"target": "x86_64-unknown-linux-android",
4-
"toolchain-bin-dir": "/home/butta/swift-5.4.2-RELEASE-ubuntu20.04/usr/bin",
4+
"toolchain-bin-dir": "/home/butta/swift-5.4.3-RELEASE-ubuntu20.04/usr/bin",
55
"sdk": "/home/butta/android-ndk-r23/toolchains/llvm/prebuilt/linux-x86_64/sysroot",
66
"extra-cc-flags": [
77
"-fPIC"

0 commit comments

Comments
 (0)