Commit 31355336 authored by robtsuk's avatar robtsuk Committed by Commit bot

Fix android_arm build hosted on Mac

Fixes for misnamed toolchain from https://github.com/appcelerator/v8_titanium.

Added a way to specify the NDK path since the Mac versions of the NDK aren't checked into the tools repo.

Disabled a few dependencies which do not build on the Mac but which aren't needed for building usable V8 static libraries.

Made the including of libdl and librt omitted for Mac hosted builds.

BUG=

Review URL: https://codereview.chromium.org/1879793002

Cr-Commit-Position: refs/heads/master@{#35456}
parent 1d37d421
......@@ -227,6 +227,11 @@ ifeq ($(no_omit_framepointer), on)
GYPFLAGS += -Drelease_extra_cflags=-fno-omit-frame-pointer
endif
ifdef android_ndk_root
GYPFLAGS += -Dandroid_ndk_root=$(android_ndk_root)
export ANDROID_NDK_ROOT = $(android_ndk_root)
endif
# ----------------- available targets: --------------------
# - "grokdump": rebuilds heap constants lists used by grokdump
# - any arch listed in ARCHES (see below)
......
......@@ -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)/$@"
......
......@@ -8,11 +8,7 @@
'target_name': 'All',
'type': 'none',
'dependencies': [
'../samples/samples.gyp:*',
'../src/d8.gyp:d8',
'../test/cctest/cctest.gyp:*',
'../test/fuzzer/fuzzer.gyp:*',
'../test/unittests/unittests.gyp:*',
],
'conditions': [
['component!="shared_library"', {
......@@ -20,6 +16,15 @@
'../tools/parser-shell.gyp:parser-shell',
],
}],
# These items don't compile for Android on Mac.
['host_os!="mac" or OS!="android"', {
'dependencies': [
'../samples/samples.gyp:*',
'../test/cctest/cctest.gyp:*',
'../test/fuzzer/fuzzer.gyp:*',
'../test/unittests/unittests.gyp:*',
],
}],
['test_isolation_mode != "noop"', {
'dependencies': [
'../test/bot_default.gyp:*',
......
......@@ -259,44 +259,50 @@
'android_ndk_root%': '<(base_dir)/third_party/android_tools/ndk/',
'android_host_arch%': "<!(uname -m | sed -e 's/i[3456]86/x86/')",
'host_os%': "<!(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')",
'os_folder_name%': "<!(uname -s | sed -e 's/Linux/linux/;s/Darwin/darwin/')",
},
# Copy conditionally-set variables out one scope.
'android_ndk_root%': '<(android_ndk_root)',
'host_os%': '<(host_os)',
'os_folder_name%': '<(os_folder_name)',
'conditions': [
['target_arch == "ia32"', {
'android_toolchain%': '<(android_ndk_root)/toolchains/x86-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
'android_toolchain%': '<(android_ndk_root)/toolchains/x86-4.9/prebuilt/<(os_folder_name)-<(android_host_arch)/bin',
'android_target_arch%': 'x86',
'android_target_platform%': '16',
'arm_version%': 'default',
}],
['target_arch == "x64"', {
'android_toolchain%': '<(android_ndk_root)/toolchains/x86_64-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
'android_toolchain%': '<(android_ndk_root)/toolchains/x86_64-4.9/prebuilt/<(os_folder_name)-<(android_host_arch)/bin',
'android_target_arch%': 'x86_64',
'android_target_platform%': '21',
'arm_version%': 'default',
}],
['target_arch=="arm"', {
'android_toolchain%': '<(android_ndk_root)/toolchains/arm-linux-androideabi-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
'android_toolchain%': '<(android_ndk_root)/toolchains/arm-linux-androideabi-4.9/prebuilt/<(os_folder_name)-<(android_host_arch)/bin',
'android_target_arch%': 'arm',
'android_target_platform%': '16',
'arm_version%': 7,
}],
['target_arch == "arm64"', {
'android_toolchain%': '<(android_ndk_root)/toolchains/aarch64-linux-android-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
'android_toolchain%': '<(android_ndk_root)/toolchains/aarch64-linux-android-4.9/prebuilt/<(os_folder_name)-<(android_host_arch)/bin',
'android_target_arch%': 'arm64',
'android_target_platform%': '21',
'arm_version%': 'default',
}],
['target_arch == "mipsel"', {
'android_toolchain%': '<(android_ndk_root)/toolchains/mipsel-linux-android-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
'android_toolchain%': '<(android_ndk_root)/toolchains/mipsel-linux-android-4.9/prebuilt/<(os_folder_name)-<(android_host_arch)/bin',
'android_target_arch%': 'mips',
'android_target_platform%': '16',
'arm_version%': 'default',
}],
['target_arch == "mips64el"', {
'android_toolchain%': '<(android_ndk_root)/toolchains/mips64el-linux-android-4.9/prebuilt/<(host_os)-<(android_host_arch)/bin',
'android_toolchain%': '<(android_ndk_root)/toolchains/mips64el-linux-android-4.9/prebuilt/<(os_folder_name)-<(android_host_arch)/bin',
'android_target_arch%': 'mips64',
'android_target_platform%': '21',
'arm_version%': 'default',
}],
],
},
......@@ -348,6 +354,12 @@
'android_libcpp_library': 'c++_static',
}], # OS=="android"
['host_clang==1', {
'conditions':[
['OS=="android"', {
'host_ld': '<!(which ld)',
'host_ranlib': '<!(which ranlib)',
}],
],
'host_cc': '<(clang_dir)/bin/clang',
'host_cxx': '<(clang_dir)/bin/clang++',
}, {
......@@ -1185,8 +1197,12 @@
# Hardcode the compiler names in the Makefile so that
# it won't depend on the environment at make time.
'make_global_settings': [
['LD', '<!(/bin/echo -n <(android_toolchain)/../*/bin/ld)'],
['RANLIB', '<!(/bin/echo -n <(android_toolchain)/../*/bin/ranlib)'],
['CC', '<!(/bin/echo -n <(android_toolchain)/*-gcc)'],
['CXX', '<!(/bin/echo -n <(android_toolchain)/*-g++)'],
['LD.host', '<(host_ld)'],
['RANLIB.host', '<(host_ranlib)'],
['CC.host', '<(host_cc)'],
['CXX.host', '<(host_cxx)'],
],
......
......@@ -1694,11 +1694,12 @@
],
'link_settings': {
'target_conditions': [
['_toolset=="host"', {
['_toolset=="host" and host_os!="mac"', {
# Only include libdl and librt on host builds because they
# are included by default on Android target builds, and we
# don't want to re-include them here since this will change
# library order and break (see crbug.com/469973).
# These libraries do not exist on Mac hosted builds.
'libraries': [
'-ldl',
'-lrt'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment