Skip to content

Commit 81ebb7a

Browse files
authored
Merge pull request #9785 from amraboelela/android-build_toolchain
Added android/build-toolchain
2 parents b9836e6 + 5184488 commit 81ebb7a

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

utils/android/build-toolchain

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
#
3+
# android/build-toolchain
4+
#
5+
# This source file is part of the Swift.org open source project
6+
#
7+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
8+
# Licensed under Apache License v2.0 with Runtime Library Exception
9+
#
10+
# See https://swift.org/LICENSE.txt for license information
11+
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
12+
13+
set -e
14+
15+
cd "$(dirname $0)/../.." || exit
16+
SRC_DIR=$PWD
17+
18+
ANDROID_NDK_DIR="${ANDROID_NDK_DIR:?Please set the Android NDK directory in the ANDROID_NDK_DIR environment variable}"
19+
ANDROID_ICU_DIR="${ANDROID_ICU_DIR:?Please set the libiconv-libicu-android directory in the ANDROID_ICU_DIR environment variable}"
20+
21+
SWIFT_TOOLCHAIN_DIR="${SRC_DIR}/../swift-android-toolchain"
22+
SWIFT_LINUX_DIR="${SRC_DIR}/../build/Ninja-ReleaseAssert/swift-linux-x86_64"
23+
24+
./utils/build-script \
25+
-R \
26+
--android \
27+
--android-ndk "${ANDROID_NDK_DIR}" \
28+
--android-api-level 21 \
29+
--android-icu-uc "${ANDROID_ICU_DIR}/armeabi-v7a" \
30+
--android-icu-uc-include "${ANDROID_ICU_DIR}/armeabi-v7a/icu/source/common" \
31+
--android-icu-i18n "${ANDROID_ICU_DIR}/armeabi-v7a" \
32+
--android-icu-i18n-include "${ANDROID_ICU_DIR}/armeabi-v7a/icu/source/i18n" || exit
33+
34+
test -e ${SWIFT_LINUX_DIR} || exit
35+
rm -rf ${SWIFT_TOOLCHAIN_DIR}
36+
mkdir -p ${SWIFT_TOOLCHAIN_DIR}/usr
37+
38+
cp -r ${SWIFT_LINUX_DIR}/{bin,lib,include} ${SWIFT_TOOLCHAIN_DIR}/usr

0 commit comments

Comments
 (0)