Skip to content

Commit 1c6779f

Browse files
committed
Android: Make buildscript work on m1 (arm64) macOS
Requires a newer NDK version which drops support for older Android SDKs <19. Though this is no problem for us as we already require API Level 20.
1 parent 3ab42df commit 1c6779f

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

android/1_download_library.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ else
3838
exit 1
3939
fi
4040

41-
SDK_VERSION="9477386_latest"
41+
SDK_VERSION="11076708_latest"
4242
SDK_URL="https://dl.google.com/android/repository/commandlinetools-${SDK_PLATFORM}-${SDK_VERSION}.zip"
4343
curl -sSLOR "$SDK_URL"
4444
unzip commandlinetools-${SDK_PLATFORM}-${SDK_VERSION}.zip
@@ -53,12 +53,12 @@ msg " [2] Installing SDK and Platform-tools"
5353
# Otherwise installed to the wrong directory
5454
cd android-sdk
5555

56-
# Android SDK Build-tools, revision 33.0.0
57-
echo "y" | ./cmdline-tools/latest/bin/sdkmanager --verbose "build-tools;33.0.0"
56+
# Android SDK Build-tools, revision 36.0.0
57+
echo "y" | ./cmdline-tools/latest/bin/sdkmanager --verbose "build-tools;36.0.0"
5858
# Android SDK Platform-tools
5959
echo "y" | ./cmdline-tools/latest/bin/sdkmanager --verbose "platform-tools"
60-
# SDK Platform Android 13, API 33
61-
echo "y" | ./cmdline-tools/latest/bin/sdkmanager --verbose "platforms;android-33"
60+
# SDK Platform Android 15, API 35
61+
echo "y" | ./cmdline-tools/latest/bin/sdkmanager --verbose "platforms;android-35"
6262
# Android Support Library Repository
6363
echo "y" | ./cmdline-tools/latest/bin/sdkmanager --verbose "extras;android;m2repository"
6464
# Google Repository
@@ -68,7 +68,7 @@ echo "y" | ./cmdline-tools/latest/bin/sdkmanager --verbose "cmake;3.22.1"
6868

6969
msg " [3] Installing Android NDK"
7070

71-
echo "y" | ./cmdline-tools/latest/bin/sdkmanager --verbose "ndk;21.4.7075529"
71+
echo "y" | ./cmdline-tools/latest/bin/sdkmanager --verbose "ndk;24.0.8215888"
7272

7373
cd ..
7474

android/2_build_toolchain.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,12 @@ function build() {
5959
# $2: Toolchain architecture
6060
# $3: Android arch
6161
# $4: host for configure
62-
# $5: additional CPP flags
6362

6463
cd $WORKSPACE
6564

6665
echo "Preparing $1 toolchain"
6766

68-
export TARGET_API=16
67+
export TARGET_API=19
6968
if [ "$3" = "arm64" ]; then
7069
# Minimum API 21 on ARM64
7170
export TARGET_API=21
@@ -84,7 +83,7 @@ function build() {
8483
export NM=$NDK_PATH/llvm-nm
8584
export RANLIB=$NDK_PATH/llvm-ranlib
8685

87-
export CFLAGS="-no-integrated-as -g0 -O2 -fPIC $5"
86+
export CFLAGS="-g0 -O2 -fPIC"
8887
export CXXFLAGS="$CFLAGS"
8988
export CPPFLAGS="-I$PLATFORM_PREFIX/include -I$ANDROID_NDK/sources/android/cpufeatures"
9089
export LDFLAGS="-L$PLATFORM_PREFIX/lib"
@@ -125,7 +124,7 @@ function build() {
125124
}
126125

127126
export SDK_ROOT=$WORKSPACE/android-sdk
128-
export ANDROID_NDK=$SDK_ROOT/ndk/21.4.7075529
127+
export ANDROID_NDK=$SDK_ROOT/ndk/24.0.8215888
129128

130129
export MAKEFLAGS="-j${nproc:-2}"
131130

@@ -147,13 +146,13 @@ export ac_cv_func_mmap_fixed_mapped=yes
147146
export CMAKE_SYSTEM_NAME=Android
148147

149148
# ARMeabi-v7a
150-
build "ARMeabi-v7a" "armeabi-v7a" "arm" "armv7a-linux-androideabi" "-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3"
149+
build "ARMeabi-v7a" "armeabi-v7a" "arm" "armv7a-linux-androideabi"
151150

152151
# arm64-v8a
153-
build "AArch64" "arm64-v8a" "arm64" "aarch64-linux-android" ""
152+
build "AArch64" "arm64-v8a" "arm64" "aarch64-linux-android"
154153

155154
# x86
156-
build "x86" "x86" "x86" "i686-linux-android" ""
155+
build "x86" "x86" "x86" "i686-linux-android"
157156

158157
# x86_64
159-
build "x86_64" "x86_64" "x86_64" "x86_64-linux-android" ""
158+
build "x86_64" "x86_64" "x86_64" "x86_64-linux-android"

0 commit comments

Comments
 (0)