Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-24297] Add NDK r13c and r14 compatibility #19

Merged
merged 3 commits into from
May 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ install:
- export PATH=`pwd`/depot_tools:"$PATH"
- git apply 0000-hack-gclient-for-travis.patch
- cd v8
- git apply ../ndk14_5.7.patch
- gclient sync
- cd ..
- git apply 0001-Fix-cross-compilation-for-Android-from-a-Mac.patch
- git apply 0002-Create-standalone-static-libs.patch
- wget http://dl.google.com/android/repository/android-ndk-r11c-linux-x86_64.zip
- unzip -q android-ndk-r11c-linux-x86_64.zip
- export ANDROID_NDK=${PWD}/android-ndk-r11c
- wget http://dl.google.com/android/repository/android-ndk-r14b-linux-x86_64.zip
- unzip -q android-ndk-r14b-linux-x86_64.zip
- export ANDROID_NDK=${PWD}/android-ndk-r14b

script:
- ./build_v8.sh -j4
Expand Down
16 changes: 8 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def build(arch, mode) {
// FIXME Technically we could build on linux as well!
node('osx && git && android-ndk') {
unstash 'sources'
sh "./build_v8.sh -n /opt/android-ndk-r11c -j8 -l ${arch} -m ${mode}"
sh "./build_v8.sh -n ${env.ANDROID_NDK_R14B} -j8 -l ${arch} -m ${mode}"
stash includes: "build/${mode}/**", name: "results-${arch}-${mode}"
}
}
Expand All @@ -13,7 +13,7 @@ def build(arch, mode) {
timestamps {
def gitRevision = '' // we calculate this later for the v8 repo
// FIXME How do we get the current branch in a detached state?
def gitBranch = '5.7-lkgr'
def gitBranch = '5.7.54'
def timestamp = '' // we generate this later
def v8Version = '' // we calculate this later from the v8 repo
def modes = ['release', 'debug']
Expand Down Expand Up @@ -43,6 +43,7 @@ timestamps {
} // stage

stage('Setup') {

// Grab some values we need for the libv8.json file when we package at the end
dir('v8') {
gitRevision = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
Expand All @@ -55,15 +56,14 @@ timestamps {
v8Version = "${MAJOR}.${MINOR}.${BUILD}.${PATCH}"
}

// FIXME Don't hack this and let it grab the Android SDK/NDK it's configured to be built with, then pass that along!
sh 'git apply 0000-hack-gclient-for-travis.patch'
// patch v8 and sync dependencies
withEnv(["PATH+DEPOT_TOOLS=${env.WORKSPACE}/depot_tools"]) {
dir('v8') {
sh 'git apply ../ndk14_5.7.patch'
sh '../depot_tools/gclient sync --shallow --no-history --reset --force' // needs python
} // dir
} // withEnv
sh 'git apply 0001-Fix-cross-compilation-for-Android-from-a-Mac.patch'
sh 'git apply 0002-Create-standalone-static-libs.patch'
}
}

// stash everything but depot_tools in 'sources'
stash excludes: 'depot_tools/**', name: 'sources'
stash includes: 'v8/include/**', name: 'include'
Expand Down
11 changes: 5 additions & 6 deletions build_mac_v8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"
git apply 0000-hack-gclient-for-travis.patch
cd v8
git apply ../ndk14_5.7.patch
gclient sync
cd ..
git apply 0001-Fix-cross-compilation-for-Android-from-a-Mac.patch
git apply 0002-Create-standalone-static-libs.patch
wget http://dl.google.com/android/repository/android-ndk-r11c-darwin-x86_64.zip
unzip android-ndk-r11c-darwin-x86_64.zip
export ANDROID_NDK=${PWD}/android-ndk-r11c
./build_v8.sh -j4
wget http://dl.google.com/android/repository/android-ndk-r14b-darwin-x86_64.zip
unzip android-ndk-r14b-darwin-x86_64.zip
export ANDROID_NDK=${PWD}/android-ndk-r14b
./build_v8.sh -j8
4 changes: 2 additions & 2 deletions build_v8.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Appcelerator Titanium Mobile
# Copyright (c) 2011-2015 by Appcelerator, Inc. All Rights Reserved.
# Copyright (c) 2011-2017 by Appcelerator, Inc. All Rights Reserved.
# Licensed under the terms of the Apache Public License
# Please see the LICENSE included with this distribution for details.
#
Expand Down Expand Up @@ -115,7 +115,7 @@ buildV8()

# Build V8
MAKE_TARGET="android_$BUILD_LIB_VERSION.$BUILD_MODE"
make $MAKE_TARGET -j$NUM_CPUS snapshot=$SNAPSHOT GYPFLAGS="-Dandroid_ndk_root=$NDK_DIR -Dv8_use_snapshot='$SNAPSHOT_TRUTHY' -Dv8_enable_i18n_support=0" ANDROID_NDK_ROOT=$NDK_DIR
make $MAKE_TARGET -j$NUM_CPUS snapshot=$SNAPSHOT i18nsupport=off inspector=off android_ndk_root=$NDK_DIR

# Copy the static libraries to our staging area.
DEST_DIR="$BUILD_DIR/$BUILD_MODE"
Expand Down
210 changes: 210 additions & 0 deletions ndk14_5.7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
From a40a8f37cd4c546084fdfe6ebc46299ff1c90f3f Mon Sep 17 00:00:00 2001
From: Gary Mathews <gmathews@appcelerator.com>
Date: Mon, 1 May 2017 13:52:17 +0100
Subject: [PATCH] NDK14

---
DEPS | 2 --
Makefile | 7 +++++++
Makefile.android | 10 ++++++++++
gypfiles/standalone.gypi | 17 +++++++----------
src/v8.gyp | 12 ++++++++++--
5 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/DEPS b/DEPS
index 161015d..abc7071 100644
--- a/DEPS
+++ b/DEPS
@@ -44,6 +44,4 @@ deps = {

deps_os = {
"android": {
- "v8/third_party/android_tools":
- Var("chromium_url") + "/android_tools.git" + "@" + "25d57ead05d3dfef26e9c19b13ed10b0a69829cf",
"v8/third_party/catapult":
diff --git a/Makefile b/Makefile
index 6eeac09..66ed3e5 100644
--- a/Makefile
+++ b/Makefile
@@ -36,6 +36,13 @@ ANDROID_V8 ?= /data/local/tmp/v8

# Special build flags. Use them like this: "make library=shared"

+# inspector=on/off
+ifeq ($(inspector), on)
+ GYPFLAGS += -Dv8_enable_inspector=1
+endif
+ifeq ($(inspector), off)
+ GYPFLAGS += -Dv8_enable_inspector=0
+endif
# library=shared || component=shared_library
ifeq ($(library), shared)
GYPFLAGS += -Dcomponent=shared_library
diff --git a/Makefile.android b/Makefile.android
index 4171521..e129be6 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -35,18 +35,27 @@ MODES = release debug
ANDROID_BUILDS = $(foreach mode,$(MODES), \
$(addsuffix .$(mode),$(ANDROID_ARCHES)))

+HOST_OS = $(shell uname -s | sed -e 's/Linux/linux/;s/Darwin/darwin/')
+HOST_ARCH = $(shell uname -m | sed -e 's/i[3456]86/x86/')
+
ifeq ($(ARCH), android_arm)
DEFINES = target_arch=arm v8_target_arch=arm
+ ANDROID_TOOLCHAIN = $(ANDROID_NDK_ROOT)/toolchains/arm-linux-androideabi-4.9/prebuilt/$(HOST_OS)-$(HOST_ARCH)/arm-linux-androideabi/bin
else ifeq ($(ARCH), android_arm64)
DEFINES = target_arch=arm64 v8_target_arch=arm64
+ ANDROID_TOOLCHAIN = $(ANDROID_NDK_ROOT)/toolchains/aarch64-linux-android-4.9/prebuilt/$(HOST_OS)-$(HOST_ARCH)/aarch64-linux-android/bin
else ifeq ($(ARCH), android_mipsel)
DEFINES = target_arch=mipsel v8_target_arch=mipsel
+ ANDROID_TOOLCHAIN = $(ANDROID_NDK_ROOT)/toolchains/mipsel-linux-android-4.9/prebuilt/$(HOST_OS)-$(HOST_ARCH)/mipsel-linux-android/bin
else ifeq ($(ARCH), android_ia32)
DEFINES = target_arch=ia32 v8_target_arch=ia32
+ ANDROID_TOOLCHAIN = $(ANDROID_NDK_ROOT)/toolchains/x86-4.9/prebuilt/$(HOST_OS)-$(HOST_ARCH)/i686-linux-android/bin
else ifeq ($(ARCH), android_x64)
DEFINES = target_arch=x64 v8_target_arch=x64
+ ANDROID_TOOLCHAIN = $(ANDROID_NDK_ROOT)/toolchains/x86_64-4.9/prebuilt/$(HOST_OS)-$(HOST_ARCH)/x86_64-linux-android/bin
else ifeq ($(ARCH), android_x87)
DEFINES = target_arch=ia32 v8_target_arch=x87
+ ANDROID_TOOLCHAIN = $(ANDROID_NDK_ROOT)/toolchains/x86-4.9/prebuilt/$(HOST_OS)-$(HOST_ARCH)/i686-linux-android/bin
else
$(error Target architecture "${ARCH}" is not supported)
endif
@@ -57,6 +66,7 @@ DEFINES += OS=android
.SECONDEXPANSION:
$(ANDROID_BUILDS): $(OUTDIR)/Makefile.$$@
@$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \
+ AR="$(ANDROID_TOOLCHAIN)/ar" \
BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
python -c "print raw_input().capitalize()") \
builddir="$(shell pwd)/$(OUTDIR)/$@"
diff --git a/gypfiles/standalone.gypi b/gypfiles/standalone.gypi
index d438a5a..e2e169f 100644
--- a/gypfiles/standalone.gypi
+++ b/gypfiles/standalone.gypi
@@ -395,8 +395,8 @@
'android_lib': '<(android_sysroot)/usr/lib',
}],
],
- 'android_libcpp_include': '<(android_stl)/llvm-libc++/libcxx/include',
- 'android_libcpp_abi_include': '<(android_stl)/llvm-libc++abi/libcxxabi/include',
+ 'android_libcpp_include': '<(android_stl)/llvm-libc++/include',
+ 'android_libcpp_abi_include': '<(android_stl)/llvm-libc++abi/include',
'android_libcpp_libs': '<(android_stl)/llvm-libc++/libs',
'android_support_include': '<(android_toolchain)/sources/android/support/include',
'android_sysroot': '<(android_sysroot)',
@@ -412,8 +412,8 @@
'android_lib': '<(android_sysroot)/usr/lib',
}],
],
- 'android_libcpp_include': '<(android_stl)/llvm-libc++/libcxx/include',
- 'android_libcpp_abi_include': '<(android_stl)/llvm-libc++abi/libcxxabi/include',
+ 'android_libcpp_include': '<(android_stl)/llvm-libc++/include',
+ 'android_libcpp_abi_include': '<(android_stl)/llvm-libc++abi/include',
'android_libcpp_libs': '<(android_stl)/llvm-libc++/libs',
'android_support_include': '<(android_ndk_root)/sources/android/support/include',
'android_sysroot': '<(android_sysroot)',
@@ -1129,13 +1129,13 @@
'configurations': {
'Release': {
'cflags': [
- '-fomit-frame-pointer',
+ '-fomit-frame-pointer', '-O2'
],
}, # Release
}, # configurations
'cflags': [ '-Wno-abi', '-Wall', '-W', '-Wno-unused-parameter'],
'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-fno-exceptions',
'-std=gnu++11' ],
'target_conditions': [
['_toolset=="target"', {
'cflags!': [
@@ -1247,10 +1247,7 @@
}],
['(target_arch=="arm" or target_arch=="arm64" or target_arch=="x64" or target_arch=="ia32") and component!="shared_library"', {
'cflags': [
- '-fPIE',
- ],
- 'ldflags': [
- '-pie',
+ '-fPIC',
],
}],
],
diff --git a/src/v8.gyp b/src/v8.gyp
index 043500b..2cb1ebd 100644
--- a/src/v8.gyp
+++ b/src/v8.gyp
@@ -137,6 +137,7 @@
{
'target_name': 'v8_snapshot',
'type': 'static_library',
+ 'standalone_static_library': 1,
'conditions': [
['want_separate_host_toolset==1', {
'toolsets': ['host', 'target'],
@@ -221,6 +222,7 @@
{
'target_name': 'v8_nosnapshot',
'type': 'static_library',
+ 'standalone_static_library': 1,
'dependencies': [
'v8_base',
],
@@ -253,6 +255,7 @@
{
'target_name': 'v8_external_snapshot',
'type': 'static_library',
+ 'standalone_static_library': 1,
'conditions': [
[ 'v8_use_external_startup_data==1', {
'conditions': [
@@ -370,6 +373,7 @@
{
'target_name': 'v8_base',
'type': 'static_library',
+ 'standalone_static_library': 1,
'dependencies': [
'v8_libbase',
'v8_libsampler',
@@ -1767,7 +1771,7 @@
},
{
'target_name': 'v8_libbase',
- 'type': '<(component)',
+ 'type': 'static_library',
'variables': {
'optimize': 'max',
},
@@ -1856,6 +1860,8 @@
'USING_V8_BASE_SHARED',
],
},
+ }, {
+ 'standalone_static_library': 1,
}],
['OS=="linux"', {
'link_settings': {
@@ -2064,7 +2070,8 @@
},
{
'target_name': 'v8_libplatform',
- 'type': '<(component)',
+ 'type': 'static_library',
+ 'standalone_static_library': 1,
'variables': {
'optimize': 'max',
},
@@ -2116,6 +2123,7 @@
{
'target_name': 'v8_libsampler',
'type': 'static_library',
+ 'standalone_static_library': 1,
'variables': {
'optimize': 'max',
},
--
2.9.3 (Apple Git-75)