File tree 5 files changed +44
-22
lines changed
components/support/rc_crypto/nss/nss_build_common/src 5 files changed +44
-22
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,15 @@ fn link_nss_libs(kind: LinkingKind) {
89
89
} else {
90
90
println ! ( "cargo:rustc-link-lib=c++" ) ;
91
91
}
92
+ let target_arch = env:: var ( "CARGO_CFG_TARGET_ARCH" ) . unwrap ( ) ;
93
+ if target_arch == "x86_64" && target_os == "android" {
94
+ let android_home = env:: var ( "ANDROID_HOME" ) . expect ( "ANDROID_HOME not set" ) ;
95
+ const ANDROID_NDK_VERSION : & str = "25.2.9519653" ;
96
+ const LINUX_X86_64_LIB_DIR : & str =
97
+ "/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/14.0.7/lib/linux/" ;
98
+ println ! ( "cargo:rustc-link-search={android_home}/ndk/{ANDROID_NDK_VERSION}/{LINUX_X86_64_LIB_DIR}" ) ;
99
+ println ! ( "cargo:rustc-link-lib=static=clang_rt.builtins-x86_64-android" ) ;
100
+ }
92
101
}
93
102
94
103
fn get_nss_libs ( kind : LinkingKind ) -> Vec < & ' static str > {
Original file line number Diff line number Diff line change
1
+ Here's how to upgrade the Android NDK version:
2
+
3
+ * Update the version number in:
4
+ * ` build.gradle ` (search for ` ndkVersion ` )
5
+ * ` taskcluster/docker/linux/Dockerfile ` (search for ` ANDROID_NDK_VERSION ` )
6
+ * ` components/support/rc_crypto/nss/nss_build_common/src/lib.rs ` (search for ` ANDROID_NDK_VERSION ` )
7
+ * Update these docs by replacing the old version with the new one:
8
+ * docs/building.md
9
+ * docs/howtos/locally-building-jna.md
10
+ * These may need updating if the directory structure changed between this version and the last
11
+ * ` libs/build-android-common.sh ` : ensure the paths to the various binaries are correct.
12
+ * ` components/support/rc_crypto/nss/nss_build_common/src/lib.rs ` : search for
13
+ ` LINUX_X86_64_LIB_DIR ` and ensure this correctly points to the correct lib directory containing
14
+ ` libclang_rt.builtins-x86_64-android.a ` .
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # This script is sourced by the `build-*-android.sh` scripts. The shbang above
3
+ # is to make shellcheck happy.
4
+
5
+ export AR=" ${TOOLCHAIN_PATH} /bin/llvm-ar"
6
+ export CC=" ${TOOLCHAIN_PATH} /bin/${TOOLCHAIN}${ANDROID_NDK_API_VERSION} -clang"
7
+ export CXX=" ${TOOLCHAIN_PATH} /bin/${TOOLCHAIN}${ANDROID_NDK_API_VERSION} -clang++"
8
+ # For 32-bit ARM, the compiler is prefixed with armv7a-linux-androideabi
9
+ if [[ " ${TOOLCHAIN} " == " arm-linux-androideabi" ]]; then
10
+ export CC=" ${TOOLCHAIN_PATH} /bin/armv7a-linux-androideabi${ANDROID_NDK_API_VERSION} -clang"
11
+ export CXX=" ${TOOLCHAIN_PATH} /bin/armv7a-linux-androideabi${ANDROID_NDK_API_VERSION} -clang++"
12
+ fi
13
+ export LD=" ${TOOLCHAIN_PATH} /bin/ld"
14
+ export NM=" ${TOOLCHAIN_PATH} /bin/llvm-nm"
15
+ export RANLIB=" ${TOOLCHAIN_PATH} /bin/llvm-ranlib"
16
+ export READELF=" ${TOOLCHAIN_PATH} /bin/llvm-readelf"
17
+
Original file line number Diff line number Diff line change 42
42
fi
43
43
NSPR_64=" ${NSPR_64:- " " } "
44
44
45
- export AR=" ${TOOLCHAIN_PATH} /bin/llvm-ar"
46
- export CC=" ${TOOLCHAIN_PATH} /bin/${TOOLCHAIN}${ANDROID_NDK_API_VERSION} -clang"
47
- export CXX=" ${TOOLCHAIN_PATH} /bin/${TOOLCHAIN}${ANDROID_NDK_API_VERSION} -clang++"
48
- # For 32-bit ARM, the compiler is prefixed with armv7a-linux-androideabi
49
- if [[ " ${TOOLCHAIN} " == " arm-linux-androideabi" ]]; then
50
- export CC=" ${TOOLCHAIN_PATH} /bin/armv7a-linux-androideabi${ANDROID_NDK_API_VERSION} -clang"
51
- export CXX=" ${TOOLCHAIN_PATH} /bin/armv7a-linux-androideabi${ANDROID_NDK_API_VERSION} -clang++"
52
- fi
53
- export LD=" ${TOOLCHAIN_PATH} /bin/ld"
54
- export NM=" ${TOOLCHAIN_PATH} /bin/llvm-nm"
55
- export RANLIB=" ${TOOLCHAIN_PATH} /bin/llvm-ranlib"
56
- export READELF=" ${TOOLCHAIN_PATH} /bin/llvm-readelf"
45
+ # shellcheck source=libs/build-android-common.sh
46
+ source ./build-android-common.sh
57
47
58
48
# Build NSPR
59
49
NSPR_BUILD_DIR=$( mktemp -d)
Original file line number Diff line number Diff line change @@ -23,16 +23,8 @@ if [[ -d "${DIST_DIR}" ]]; then
23
23
exit 0
24
24
fi
25
25
26
- export AR=" ${TOOLCHAIN_PATH} /bin/llvm-ar"
27
- export CC=" ${TOOLCHAIN_PATH} /bin/${TOOLCHAIN}${ANDROID_NDK_API_VERSION} -clang"
28
- export CXX=" ${TOOLCHAIN_PATH} /bin/${TOOLCHAIN}${ANDROID_NDK_API_VERSION} -clang++"
29
- # For 32-bit ARM, the compiler is prefixed with armv7a-linux-androideabi
30
- if [[ " ${TOOLCHAIN} " == " arm-linux-androideabi" ]]; then
31
- export CC=" ${TOOLCHAIN_PATH} /bin/armv7a-linux-androideabi${ANDROID_NDK_API_VERSION} -clang"
32
- export CXX=" ${TOOLCHAIN_PATH} /bin/armv7a-linux-androideabi${ANDROID_NDK_API_VERSION} -clang++"
33
- fi
34
- export LD=" ${TOOLCHAIN_PATH} /bin/ld"
35
- export RANLIB=" ${TOOLCHAIN_PATH} /bin/llvm-ranlib"
26
+ # shellcheck source=libs/build-android-common.sh
27
+ source ./build-android-common.sh
36
28
37
29
if [[ " ${TOOLCHAIN} " == " x86_64-linux-android" ]]
38
30
then
You can’t perform that action at this time.
0 commit comments