Skip to content

Instantly share code, notes, and snippets.

@MartinMReed
Last active August 11, 2022 22:05
Show Gist options
  • Save MartinMReed/6393153 to your computer and use it in GitHub Desktop.
Save MartinMReed/6393153 to your computer and use it in GitHub Desktop.
Compile ICU for Android NDK
#!/bin/sh
NDK_ROOT=/tools/android/android-ndk-r6b
NDK_TOOLCHAIN_BIN=$NDK_ROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin
SDK_ROOT=$NDK_ROOT/platforms/android-8/arch-arm
ICU_PATH=/Users/mreed/Desktop/icu
ICU_FLAGS="-I$ICU_PATH/source/common/ -I$ICU_PATH/source/tools/tzcode/"
export CPPFLAGS="--sysroot=$SDK_ROOT -D__STDC_INT64__ $ICU_FLAGS -I$SDK_ROOT/usr/include/ -I$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/include/ -I$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/"
export LDFLAGS="--sysroot=$SDK_ROOT -L$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/libs/armeabi/"
export CC=$NDK_TOOLCHAIN_BIN/arm-linux-androideabi-gcc-4.4.3
export CXX=$NDK_TOOLCHAIN_BIN/arm-linux-androideabi-g++
export RANLIB=$NDK_TOOLCHAIN_BIN/arm-linux-androideabi-ranlib
export AR=$NDK_TOOLCHAIN_BIN/arm-linux-androideabi-ar
sh $ICU_PATH/source/configure --host=armv6-google-linux --enable-static --disable-shared -with-cross-build=$ICU_PATH/hostbuild
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment