Skip to content

Commit

Permalink
Switch NDK from r10e to r12b
Browse files Browse the repository at this point in the history
This CL completely removes --android_compiler option since we now only
support Clang toolchain for Android target binaries.  GCC toolchain
bundled in Android NDK is going to be deprecated shortly [1].

This Cl also adds following build targets on Travis-CI.
 - Android (arm64)
 - Android (x86)
 - Android (x86_64)
 - Android (mips)
 - Android (mips64)

Closes #273.

 [1]: https://android.googlesource.com/platform/ndk.git/+/fb83ea8bf716ef262ca9f03b2102ebcbb147b38a

BUG=#273
TEST=compile
REF_BUG=
REF_CL=131555947,133352265,134314373
REF_TIME=2016-08-28T22:29:30-07:00
REF_TIME_RAW=1472448570 -0700
  • Loading branch information
yukawa committed Aug 29, 2016
1 parent d44d064 commit 5ce7fa6
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 110 deletions.
43 changes: 29 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ language: cpp
compiler: clang

env:
- TARGET_PLATFORM=Android
- TARGET_PLATFORM=Android_arm
- TARGET_PLATFORM=Android_arm64
- TARGET_PLATFORM=Android_x86
- TARGET_PLATFORM=Android_x86_64
- TARGET_PLATFORM=Android_mips
- TARGET_PLATFORM=Android_mips64
- TARGET_PLATFORM=Linux
- TARGET_PLATFORM=NaCl
- TARGET_PLATFORM=Mac
Expand All @@ -49,7 +54,7 @@ before_install:
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -y clang python pkg-config curl bzip2 unzip make; fi
- if [ $TARGET_PLATFORM == Linux ]; then sudo apt-get install -y libibus-1.0-dev libglib2.0-dev libqt4-dev libgtk2.0-dev libxcb-xfixes0-dev; fi
- if [ $TARGET_PLATFORM == NaCl ]; then sudo apt-get install -y libc6-i386 lib32stdc++6; fi
- if [ $TARGET_PLATFORM == Android ]; then sudo apt-get install --no-install-recommends openjdk-7-jdk openjdk-7-jre-headless libjsr305-java ant zip libc6-i386 lib32stdc++6 lib32ncurses5 lib32z1; fi
- if [ ${TARGET_PLATFORM:0:7} == Android ]; then sudo apt-get install --no-install-recommends openjdk-7-jdk openjdk-7-jre-headless libjsr305-java ant zip libc6-i386 lib32stdc++6 lib32ncurses5 lib32z1; fi

install:
- if [ $TRAVIS_OS_NAME == linux ]; then git -C src/third_party clone https://chromium.googlesource.com/chromium/tools/depot_tools.git; fi
Expand All @@ -59,20 +64,20 @@ install:
- if [ $TARGET_PLATFORM == Mac ]; then git -C src/third_party clone https://chromium.googlesource.com/chromium/tools/depot_tools.git; fi
- if [ $TARGET_PLATFORM == Mac ]; then export PATH="$PATH":`pwd`/src/third_party/depot_tools; fi
- if [ $TARGET_PLATFORM == NaCl ]; then cd src/third_party && curl -LO http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/nacl_sdk.zip && unzip nacl_sdk.zip && rm nacl_sdk.zip && cd nacl_sdk && ./naclsdk install pepper_45 && cd ../../../; fi
- if [ $TARGET_PLATFORM == Android ]; then jdk_switcher use openjdk7; fi
- if [ $TARGET_PLATFORM == Android ]; then cd src/third_party && curl -L http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin -O && chmod u+x android-ndk-r10e-linux-x86_64.bin && ./android-ndk-r10e-linux-x86_64.bin > /dev/null && rm android-ndk-r10e-linux-x86_64.bin && curl -L http://dl.google.com/android/android-sdk_r24.1.2-linux.tgz | tar -zx && cd ../../; fi
- if [ $TARGET_PLATFORM == Android ]; then export ANDROID_NDK_HOME=`pwd`/src/third_party/android-ndk-r10e ; fi
- if [ $TARGET_PLATFORM == Android ]; then export ANDROID_HOME=`pwd`/src/third_party/android-sdk-linux ; fi
- if [ $TARGET_PLATFORM == Android ]; then export PATH="$PATH":${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${ANDROID_NDK_HOME}; fi
- if [ $TARGET_PLATFORM == Android ]; then echo y | android update sdk --all --force --no-ui --filter android-22; fi
- if [ $TARGET_PLATFORM == Android ]; then echo y | android update sdk --all --force --no-ui --filter build-tools-22.0.0; fi
- if [ $TARGET_PLATFORM == Android ]; then echo y | android update sdk --all --force --no-ui --filter extra-android-support; fi
- if [ $TARGET_PLATFORM == Android ]; then echo y | android update sdk --all --force --no-ui --filter platform-tool; fi
- if [ ${TARGET_PLATFORM:0:7} == Android ]; then jdk_switcher use openjdk7; fi
- if [ ${TARGET_PLATFORM:0:7} == Android ]; then cd src/third_party && curl -LO http://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip && unzip -q android-ndk-r12b-linux-x86_64.zip && rm android-ndk-r12b-linux-x86_64.zip && curl -L http://dl.google.com/android/android-sdk_r24.1.2-linux.tgz | tar -zx && cd ../../; fi
- if [ ${TARGET_PLATFORM:0:7} == Android ]; then export ANDROID_NDK_HOME=`pwd`/src/third_party/android-ndk-r12b ; fi
- if [ ${TARGET_PLATFORM:0:7} == Android ]; then export ANDROID_HOME=`pwd`/src/third_party/android-sdk-linux ; fi
- if [ ${TARGET_PLATFORM:0:7} == Android ]; then export PATH="$PATH":${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${ANDROID_NDK_HOME}; fi
- if [ ${TARGET_PLATFORM:0:7} == Android ]; then echo y | android update sdk --all --force --no-ui --filter android-22; fi
- if [ ${TARGET_PLATFORM:0:7} == Android ]; then echo y | android update sdk --all --force --no-ui --filter build-tools-22.0.0; fi
- if [ ${TARGET_PLATFORM:0:7} == Android ]; then echo y | android update sdk --all --force --no-ui --filter extra-android-support; fi
- if [ ${TARGET_PLATFORM:0:7} == Android ]; then echo y | android update sdk --all --force --no-ui --filter platform-tool; fi

script:
- cd ./src
- if [ $TARGET_PLATFORM == Android ]; then python build_mozc.py gyp --target_platform=Android; fi
- if [ $TARGET_PLATFORM == Android ]; then python build_mozc.py build -c Release package; fi
- if [ ${TARGET_PLATFORM:0:7} == Android ]; then python build_mozc.py gyp --target_platform=Android --android_arch=${TARGET_PLATFORM:8:6}; fi
- if [ ${TARGET_PLATFORM:0:7} == Android ]; then python build_mozc.py build -c Release package; fi
- if [ $TARGET_PLATFORM == Linux ]; then python build_mozc.py gyp --target_platform=Linux; fi
- if [ $TARGET_PLATFORM == Linux ]; then python build_mozc.py build -c Release package; fi
- if [ $TARGET_PLATFORM == Linux ]; then python build_mozc.py runtests -c Release; fi
Expand All @@ -87,7 +92,17 @@ matrix:
- os: linux
env: TARGET_PLATFORM=Mac
- os: osx
env: TARGET_PLATFORM=Android
env: TARGET_PLATFORM=Android_arm
- os: osx
env: TARGET_PLATFORM=Android_arm64
- os: osx
env: TARGET_PLATFORM=Android_x86
- os: osx
env: TARGET_PLATFORM=Android_x86_64
- os: osx
env: TARGET_PLATFORM=Android_mips
- os: osx
env: TARGET_PLATFORM=Android_mips64
- os: osx
env: TARGET_PLATFORM=Linux
- os: osx
Expand Down
4 changes: 2 additions & 2 deletions docker/ubuntu14.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ RUN mkdir -p /home/mozc_builder/work
WORKDIR /home/mozc_builder/work

## Android SDK/NDK
RUN curl -L http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin -O && chmod u+x android-ndk-r10e-linux-x86_64.bin && ./android-ndk-r10e-linux-x86_64.bin && rm android-ndk-r10e-linux-x86_64.bin
RUN curl -LO http://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip && unzip android-ndk-r12b-linux-x86_64.zip && rm android-ndk-r12b-linux-x86_64.zip
RUN curl -L http://dl.google.com/android/android-sdk_r24.1.2-linux.tgz | tar -zx
ENV ANDROID_NDK_HOME /home/mozc_builder/work/android-ndk-r10e
ENV ANDROID_NDK_HOME /home/mozc_builder/work/android-ndk-r12b
ENV ANDROID_HOME /home/mozc_builder/work/android-sdk-linux
ENV PATH $PATH:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${ANDROID_NDK_HOME}
RUN echo y | android update sdk --all --force --no-ui --filter android-22
Expand Down
11 changes: 6 additions & 5 deletions src/android/android.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,13 @@
'type': 'none',
'variables': {
'make_standalone_toolchain_commands': [
'bash',
'<(android_ndk_home)/build/tools/make-standalone-toolchain.sh',
'--toolchain=<(toolchain)',
'--stl=libcxx',
'python',
'<(android_ndk_home)/build/tools/make_standalone_toolchain.py',
'--force',
'--arch=<(android_arch)',
'--stl=libc++',
'--install-dir=<(mozc_build_tools_dir)/ndk-standalone-toolchain/<(android_arch)',
'--platform=<(platform)',
'--api=<(ndk_target_api_level)',
],
'make_standalone_toolchain_result': '<!(<(make_standalone_toolchain_commands))',
},
Expand Down
72 changes: 12 additions & 60 deletions src/android/android_env.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -83,88 +83,40 @@
'font_dir': '<(third_party_dir)/noto_font',
},
}],
['android_arch=="arm" and android_compiler=="gcc"', {
['android_arch=="arm"', {
'variables': {
'abi': 'armeabi-v7a',
'toolchain': 'arm-linux-androideabi-4.9',
'platform': 'android-14',
'ndk_target_api_level': '14',
},
}],
['android_arch=="arm" and android_compiler=="clang"', {
'variables': {
'abi': 'armeabi-v7a',
'toolchain': 'arm-linux-androideabi-clang3.5',
'platform': 'android-14',
},
}],
['android_arch=="x86" and android_compiler=="gcc"', {
'variables': {
'abi': 'x86',
'toolchain': 'x86-4.9',
'platform': 'android-14',
},
}],
['android_arch=="x86" and android_compiler=="clang"', {
['android_arch=="x86"', {
'variables': {
'abi': 'x86',
'toolchain': 'x86-clang3.5',
'platform': 'android-14',
},
}],
['android_arch=="mips" and android_compiler=="gcc"', {
'variables': {
'abi': 'mips',
'toolchain': 'mipsel-linux-android-4.9',
'platform': 'android-14',
'ndk_target_api_level': '14',
},
}],
['android_arch=="mips" and android_compiler=="clang"', {
['android_arch=="mips"', {
'variables': {
'abi': 'mips',
'toolchain': 'mipsel-linux-android-clang3.5',
'platform': 'android-14',
'ndk_target_api_level': '14',
},
}],
['android_arch=="arm64" and android_compiler=="gcc"', {
['android_arch=="arm64"', {
'variables': {
'abi': 'arm64-v8a',
'toolchain': 'aarch64-linux-android-4.9',
'platform': 'android-21',
'ndk_target_api_level': '21',
},
}],
['android_arch=="arm64" and android_compiler=="clang"', {
'variables': {
'abi': 'arm64-v8a',
'toolchain': 'aarch64-linux-android-clang3.5',
'platform': 'android-21',
},
}],
['android_arch=="x86_64" and android_compiler=="gcc"', {
'variables': {
'abi': 'x86_64',
'toolchain': 'x86_64-4.9',
'platform': 'android-21',
},
}],
['android_arch=="x86_64" and android_compiler=="clang"', {
['android_arch=="x86_64"', {
'variables': {
'abi': 'x86_64',
'toolchain': 'x86_64-clang3.5',
'platform': 'android-21',
},
}],
['android_arch=="mips64" and android_compiler=="gcc"', {
'variables': {
'abi': 'mips64',
'toolchain': 'mips64el-linux-android-4.9',
'platform': 'android-21',
'ndk_target_api_level': '21',
},
}],
['android_arch=="mips64" and android_compiler=="clang"', {
['android_arch=="mips64"', {
'variables': {
'abi': 'mips64',
'toolchain': 'mips64el-linux-android-4.9',
'platform': 'android-21',
'ndk_target_api_level': '21',
},
}],
],
Expand Down
6 changes: 0 additions & 6 deletions src/build_mozc.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,6 @@ def ParseGypOptions(args):
default='arm',
help='[Android build only] Android architecture '
'(arm, x86, mips)')
parser.add_option('--android_compiler', dest='android_compiler',
type='choice',
choices=('gcc', 'clang'),
default='gcc',
help='[Android build only] Compiler')
parser.add_option('--android_application_id', dest='android_application_id',
default='org.mozc.android.inputmethod.japanese',
help='[Android build only] Android\'s application id'
Expand Down Expand Up @@ -642,7 +637,6 @@ def GypMain(options, unused_args):

gyp_options.extend(['-D', 'android_home=%s' % android_home])
gyp_options.extend(['-D', 'android_arch=%s' % options.android_arch])
gyp_options.extend(['-D', 'android_compiler=%s' % options.android_compiler])
gyp_options.extend(['-D', 'android_ndk_home=%s' % android_ndk_home])
gyp_options.extend(['-D', 'android_application_id=%s' %
options.android_application_id])
Expand Down
2 changes: 1 addition & 1 deletion src/data/version/mozc_version_template.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

MAJOR=2
MINOR=18
BUILD=2598
BUILD=2599
REVISION=102
# This version represents the version of Mozc IME engine (converter, predictor,
# etc.). This version info is included both in the Mozc server and in the Mozc
Expand Down
27 changes: 5 additions & 22 deletions src/gyp/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,9 @@
'compiler_host': 'clang',
'compiler_host_version_int': 303, # Clang 3.3 or higher
}],
['target_platform=="Android" and android_compiler=="clang"', {
['target_platform=="Android"', {
'compiler_target': 'clang',
'compiler_target_version_int': 305, # Clang 3.5 or higher
'compiler_host': 'clang',
'compiler_host_version_int': 304, # Clang 3.4 or higher
}],
['target_platform=="Android" and android_compiler=="gcc"', {
'compiler_target': 'gcc',
'compiler_target_version_int': 409, # GCC 4.9 or higher
'compiler_target_version_int': 308, # Clang 3.8 or higher
'compiler_host': 'clang',
'compiler_host_version_int': 304, # Clang 3.4 or higher
}],
Expand Down Expand Up @@ -312,6 +306,7 @@
],
'ldflags': [
'-llog',
'-static-libstdc++',
],
'conditions': [
['android_arch=="arm"', {
Expand Down Expand Up @@ -494,25 +489,13 @@
'toolchain_prefix': 'mips64el-linux-android',
},
}],
['android_compiler=="gcc"', {
'variables': {
'c_compiler': 'gcc',
'cxx_compiler': 'g++',
}
}],
['android_compiler=="clang"', {
'variables': {
'c_compiler': 'clang',
'cxx_compiler': 'clang++',
}
}],
],
# To use clang only CC and CXX should point clang directly.
# c.f., https://android.googlesource.com/platform/ndk/+/tools_ndk_r9d/docs/text/STANDALONE-TOOLCHAIN.text
'make_global_settings': [
['AR', '<(ndk_bin_dir)/<(toolchain_prefix)-ar'],
['CC', '<(ndk_bin_dir)/<(toolchain_prefix)-<(c_compiler)'],
['CXX', '<(ndk_bin_dir)/<(toolchain_prefix)-<(cxx_compiler)'],
['CC', '<(ndk_bin_dir)/<(toolchain_prefix)-clang'],
['CXX', '<(ndk_bin_dir)/<(toolchain_prefix)-clang++'],
['LD', '<(ndk_bin_dir)/<(toolchain_prefix)-ld'],
['NM', '<(ndk_bin_dir)/<(toolchain_prefix)-nm'],
['READELF', '<(ndk_bin_dir)/<(toolchain_prefix)-readelf'],
Expand Down

0 comments on commit 5ce7fa6

Please sign in to comment.