aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2016-01-04 21:56:33 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-01-04 21:56:33 +0000
commitc32a88b5e411b684a694cc64328d06420e12373d (patch)
tree3e95a9476fe0fe4050a6de4cae9883ece367abe2
parenta918691aeede82953f3068e4f442fccd0467a5de (diff)
parent7eaf9b9686e899bb69a151a5d30a0ac0e451f375 (diff)
downloadndk-c32a88b5e411b684a694cc64328d06420e12373d.tar.gz
Merge "Restore the old package layout."
am: 7eaf9b9686 * commit '7eaf9b9686e899bb69a151a5d30a0ac0e451f375': Restore the old package layout.
-rw-r--r--build/core/build-binary.mk2
-rw-r--r--build/core/init.mk4
-rw-r--r--build/core/setup-toolchain.mk2
-rwxr-xr-xbuild/ndk-build2
-rwxr-xr-xbuild/ndk-build.cmd6
-rwxr-xr-xbuild/tools/make-standalone-toolchain.sh22
-rwxr-xr-xbuild/tools/package.py49
-rw-r--r--sources/cxx-stl/gnu-libstdc++/Android.mk16
-rw-r--r--tests/ndk.py14
9 files changed, 92 insertions, 25 deletions
diff --git a/build/core/build-binary.mk b/build/core/build-binary.mk
index 1f7768e05..4964be15e 100644
--- a/build/core/build-binary.mk
+++ b/build/core/build-binary.mk
@@ -391,7 +391,7 @@ endif
#
ifneq (,$(call module-has-c++-features,$(LOCAL_MODULE),rtti exceptions))
ifeq (system,$(NDK_APP_STL))
- LOCAL_LDLIBS := $(LOCAL_LDLIBS) $(call host-path,$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/$(TARGET_ARCH_ABI)/libsupc++$(TARGET_LIB_EXTENSION))
+ LOCAL_LDLIBS := $(LOCAL_LDLIBS) $(call host-path,$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(TARGET_ARCH_ABI)/libsupc++$(TARGET_LIB_EXTENSION))
endif
endif
diff --git a/build/core/init.mk b/build/core/init.mk
index 809315e75..f6daa3ff2 100644
--- a/build/core/init.mk
+++ b/build/core/init.mk
@@ -106,7 +106,7 @@ endif
# Returns : The parent path of all toolchains for this host. Note that
# HOST_TAG64 == HOST_TAG for 32-bit systems.
# -----------------------------------------------------------------------------
-host-toolchain-path = $1/toolchains
+host-toolchain-path = $1/prebuilt/$(HOST_TAG64)
# -----------------------------------------------------------------------------
# Function : get-toolchain-root
@@ -114,7 +114,7 @@ host-toolchain-path = $1/toolchains
# 2: Toolchain name
# Returns : Path to the given prebuilt toolchain.
# -----------------------------------------------------------------------------
-get-toolchain-root = $(call host-toolchain-path,$1)/$2
+get-toolchain-root = $(call host-toolchain-path,$1/toolchains/$2)
# -----------------------------------------------------------------------------
# Function : get-binutils-root
diff --git a/build/core/setup-toolchain.mk b/build/core/setup-toolchain.mk
index 3e2cc9345..ca5a3cd39 100644
--- a/build/core/setup-toolchain.mk
+++ b/build/core/setup-toolchain.mk
@@ -143,7 +143,7 @@ TOOLCHAIN_PREFIX := $(call merge,-,$(call chop,$(call split,-,$(TOOLCHAIN_NAME))
TOOLCHAIN_PREFIX := $(TOOLCHAIN_PREBUILT_ROOT)/bin/$(TOOLCHAIN_PREFIX)
# We expect the gdbserver binary for this toolchain to be located at its root.
-TARGET_GDBSERVER := $(NDK_ROOT)/gdbserver/$(TARGET_ARCH)/gdbserver
+TARGET_GDBSERVER := $(NDK_ROOT)/prebuilt/android-$(TARGET_ARCH)/gdbserver/gdbserver
# compute NDK_APP_DST_DIR as the destination directory for the generated files
NDK_APP_DST_DIR := $(NDK_APP_LIBS_OUT)/$(TARGET_ARCH_ABI)
diff --git a/build/ndk-build b/build/ndk-build
index 4f2dee20f..d3700b430 100755
--- a/build/ndk-build
+++ b/build/ndk-build
@@ -179,7 +179,7 @@ else
# Otherwise use the prebuilt version for our host tag, if it exists
# Note: we intentionally do not provide prebuilt make binaries for Cygwin
# or MSys.
- GNUMAKE=$PROGDIR/host-tools/bin/make
+ GNUMAKE=$PROGDIR/prebuilt/$HOST_TAG/bin/make
if [ ! -f "$GNUMAKE" ]; then
# Otherwise, use 'make' and check that it is available
GNUMAKE=`which make 2> /dev/null`
diff --git a/build/ndk-build.cmd b/build/ndk-build.cmd
index b43819bd9..237ec6450 100755
--- a/build/ndk-build.cmd
+++ b/build/ndk-build.cmd
@@ -1,3 +1,7 @@
@echo off
set NDK_ROOT=%~dp0\..
-"%NDK_ROOT%\host-tools\bin\make.exe" -f "%NDK_ROOT%\build\core\build-local.mk" SHELL=cmd %*
+set PREBUILT_PATH=%NDK_ROOT%\prebuilt\windows-x86_64
+if exist %PREBUILT_PATH% goto FOUND
+set PREBUILT_PATH=%NDK_ROOT%\prebuilt\windows
+:FOUND
+"%PREBUILT_PATH%\bin\make.exe" -f "%NDK_ROOT%\build\core\build-local.mk" SHELL=cmd %*
diff --git a/build/tools/make-standalone-toolchain.sh b/build/tools/make-standalone-toolchain.sh
index c4ff1a7fa..1316f8a6f 100755
--- a/build/tools/make-standalone-toolchain.sh
+++ b/build/tools/make-standalone-toolchain.sh
@@ -165,8 +165,14 @@ if [ ! -d "$NDK_DIR/platforms/$PLATFORM" ] ; then
exit 1
fi
+if [ -d "$NDK_DIR/prebuilt/$HOST_TAG" ]; then
+ SYSTEM=$HOST_TAG
+else
+ SYSTEM=$HOST_TAG32
+fi
+
# Check toolchain name
-TOOLCHAIN_PATH="$NDK_DIR/toolchains/$TOOLCHAIN_NAME"
+TOOLCHAIN_PATH="$NDK_DIR/toolchains/$TOOLCHAIN_NAME/prebuilt/$SYSTEM"
if [ ! -d "$TOOLCHAIN_PATH" ] ; then
echo "Could not find toolchain: $TOOLCHAIN_PATH"
echo "Please use --toolchain=<name> with the name of a toolchain supported by the source NDK."
@@ -219,7 +225,7 @@ if [ ! -f "$TOOLCHAIN_GCC" ] ; then
fi
if [ "$USE_LLVM" = "yes" ]; then
- LLVM_TOOLCHAIN_PATH="$NDK_DIR/toolchains/llvm"
+ LLVM_TOOLCHAIN_PATH="$NDK_DIR/toolchains/llvm/prebuilt/$SYSTEM"
# Check that we have any prebuilts LLVM toolchain here
if [ ! -d "$LLVM_TOOLCHAIN_PATH" ] ; then
echo "LLVM Toolchain is missing prebuilt files"
@@ -246,16 +252,16 @@ copy_directory "$TOOLCHAIN_PATH" "$TMPDIR"
PYTHON=python
PYTHON_x=python$(echo "$DEFAULT_PYTHON_VERSION" | cut -d . -f 1)
PYTHON_xdotx=python$(echo "$DEFAULT_PYTHON_VERSION" | cut -d . -f 1-2)
-copy_directory "$NDK_DIR/host-tools/include/$PYTHON_xdotx" "$TMPDIR/include/$PYTHON_xdotx"
-copy_directory "$NDK_DIR/host-tools/lib/$PYTHON_xdotx" "$TMPDIR/lib/$PYTHON_xdotx"
-copy_file_list "$NDK_DIR/host-tools/bin" "$TMPDIR/bin" "$PYTHON$HOST_EXE" "$PYTHON_x$HOST_EXE" "$PYTHON_xdotx$HOST_EXE"
+copy_directory "$NDK_DIR/prebuilt/$SYSTEM/include/$PYTHON_xdotx" "$TMPDIR/include/$PYTHON_xdotx"
+copy_directory "$NDK_DIR/prebuilt/$SYSTEM/lib/$PYTHON_xdotx" "$TMPDIR/lib/$PYTHON_xdotx"
+copy_file_list "$NDK_DIR/prebuilt/$SYSTEM/bin" "$TMPDIR/bin" "$PYTHON$HOST_EXE" "$PYTHON_x$HOST_EXE" "$PYTHON_xdotx$HOST_EXE"
if [ "$HOST_TAG32" = "windows" ]; then
- copy_file_list "$NDK_DIR/host-tools/bin" "$TMPDIR/bin" lib$PYTHON_xdotx.dll
+ copy_file_list "$NDK_DIR/prebuilt/$SYSTEM/bin" "$TMPDIR/bin" lib$PYTHON_xdotx.dll
fi
# Copy yasm for x86
if [ "$ARCH" = "x86" ]; then
- copy_file_list "$NDK_DIR/host-tools/bin" "$TMPDIR/bin" "yasm$HOST_EXE"
+ copy_file_list "$NDK_DIR/prebuilt/$SYSTEM/bin" "$TMPDIR/bin" "yasm$HOST_EXE"
fi
# Clang stuff
@@ -401,7 +407,7 @@ case "$ARCH" in
;;
esac
-GNUSTL_DIR=$NDK_DIR/$GNUSTL_SUBDIR
+GNUSTL_DIR=$NDK_DIR/$GNUSTL_SUBDIR/4.9
GNUSTL_LIBS=$GNUSTL_DIR/libs
STLPORT_DIR=$NDK_DIR/$STLPORT_SUBDIR
diff --git a/build/tools/package.py b/build/tools/package.py
index 0e51a7494..5b788e483 100755
--- a/build/tools/package.py
+++ b/build/tools/package.py
@@ -36,6 +36,12 @@ import build_support # pylint: disable=import-error
THIS_DIR = os.path.dirname(__file__)
ANDROID_TOP = os.path.realpath(os.path.join(THIS_DIR, '../../..'))
+# Note that we can't actually support creating both layouts from the same
+# sources because changes are needed in gnustl's Android.mk and in the build
+# system. The various "USE_NEW_LAYOUT" blocks are so we can more easily undo
+# this change when we finalize a new layout.
+USE_NEW_LAYOUT = False
+
def expand_packages(package, host, arches):
"""Expands package definition tuple into list of full package names.
@@ -78,7 +84,7 @@ def expand_packages(package, host, arches):
def get_all_packages(host, arches):
- packages = [
+ new_layout = [
('binutils-{arch}-{host}', 'binutils/{triple}'),
('build', 'build'),
('cpufeatures', 'sources/android/cpufeatures'),
@@ -100,6 +106,33 @@ def get_all_packages(host, arches):
('system-stl', 'sources/cxx-stl/system'),
]
+ old_layout = [
+ ('binutils-{arch}-{host}', 'binutils/{triple}'),
+ ('build', 'build'),
+ ('cpufeatures', 'sources/android/cpufeatures'),
+ ('gabixx', 'sources/cxx-stl/gabi++'),
+ ('gcc-{arch}-{host}', 'toolchains/{toolchain}-4.9/prebuilt/{host}'),
+ ('gcclibs-{arch}', 'gcclibs/{triple}'),
+ ('gdbserver-{arch}', 'prebuilt/android-{arch}/gdbserver'),
+ ('gnustl-4.9', 'sources/cxx-stl/gnu-libstdc++/4.9'),
+ ('gtest', 'sources/third_party/googletest'),
+ ('host-tools-{host}', 'prebuilt/{host}'),
+ ('libandroid_support', 'sources/android/support'),
+ ('libcxx', 'sources/cxx-stl/llvm-libc++'),
+ ('libcxxabi', 'sources/cxx-stl/llvm-libc++abi'),
+ ('llvm-{host}', 'toolchains/llvm/prebuilt/{host}'),
+ ('native_app_glue', 'sources/android/native_app_glue'),
+ ('ndk_helper', 'sources/android/ndk_helper'),
+ ('python-packages', 'python-packages'),
+ ('stlport', 'sources/cxx-stl/stlport'),
+ ('system-stl', 'sources/cxx-stl/system'),
+ ]
+
+ if USE_NEW_LAYOUT:
+ packages = new_layout
+ else:
+ packages = old_layout
+
platforms_path = 'development/ndk/platforms'
for platform_dir in os.listdir(build_support.android_path(platforms_path)):
if not platform_dir.startswith('android-'):
@@ -159,10 +192,22 @@ def extract_all(path, packages, out_dir):
parent_dir = os.path.dirname(install_dir)
if not os.path.exists(parent_dir):
os.makedirs(parent_dir)
- os.rename(os.path.join(extract_dir, dirs[0]), install_dir)
+ shutil.move(os.path.join(extract_dir, dirs[0]), install_dir)
finally:
shutil.rmtree(extract_dir)
+ if not USE_NEW_LAYOUT:
+ # FIXME(danalbert): OMG HACK
+ # The old package layout had libstdc++'s Android.mk at
+ # sources/cxx-stl/gnu-libstdc++/Android.mk. The gnustl package doesn't
+ # include the version in the path. To mimic the old package layout, we
+ # extract the gnustl package to sources/cxx-stl/gnu-libstdc++/4.9. As
+ # such, the Android.mk ends up in the 4.9 directory. We need to pull it
+ # up a directory.
+ gnustl_path = os.path.join(out_dir, 'sources/cxx-stl/gnu-libstdc++')
+ shutil.move(os.path.join(gnustl_path, '4.9/Android.mk'),
+ os.path.join(gnustl_path, 'Android.mk'))
+
def make_ndk_build_shortcut(out_dir, host):
if host.startswith('windows'):
diff --git a/sources/cxx-stl/gnu-libstdc++/Android.mk b/sources/cxx-stl/gnu-libstdc++/Android.mk
index 2b94a8a41..5bb29d1ae 100644
--- a/sources/cxx-stl/gnu-libstdc++/Android.mk
+++ b/sources/cxx-stl/gnu-libstdc++/Android.mk
@@ -10,17 +10,17 @@ gnustl_exported_cppflags := $(strip \
# Include path to export
gnustl_exported_c_includes := \
- $(LOCAL_PATH)/include \
- $(LOCAL_PATH)/libs/$(TARGET_ARCH_ABI)/include \
- $(LOCAL_PATH)/include/backward
+ $(LOCAL_PATH)/4.9/include \
+ $(LOCAL_PATH)/4.9/libs/$(TARGET_ARCH_ABI)/include \
+ $(LOCAL_PATH)/4.9/include/backward
include $(CLEAR_VARS)
LOCAL_MODULE := gnustl_static
-LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libgnustl_static$(TARGET_LIB_EXTENSION)
+LOCAL_SRC_FILES := 4.9/libs/$(TARGET_ARCH_ABI)/libgnustl_static$(TARGET_LIB_EXTENSION)
# For armeabi*, choose thumb mode unless LOCAL_ARM_MODE := arm
ifneq (,$(filter armeabi%,$(TARGET_ARCH_ABI)))
ifneq (arm,$(LOCAL_ARM_MODE))
-LOCAL_SRC_FILES:= libs/$(TARGET_ARCH_ABI)/thumb/libgnustl_static$(TARGET_LIB_EXTENSION)
+LOCAL_SRC_FILES:= 4.9/libs/$(TARGET_ARCH_ABI)/thumb/libgnustl_static$(TARGET_LIB_EXTENSION)
endif
endif
LOCAL_EXPORT_CPPFLAGS := $(gnustl_exported_cppflags)
@@ -29,14 +29,14 @@ include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := gnustl_shared
-LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libgnustl_shared$(TARGET_SONAME_EXTENSION)
+LOCAL_SRC_FILES := 4.9/libs/$(TARGET_ARCH_ABI)/libgnustl_shared$(TARGET_SONAME_EXTENSION)
# For armeabi*, choose thumb mode unless LOCAL_ARM_MODE := arm
ifneq (,$(filter armeabi%,$(TARGET_ARCH_ABI)))
ifneq (arm,$(LOCAL_ARM_MODE))
-LOCAL_SRC_FILES:= libs/$(TARGET_ARCH_ABI)/thumb/libgnustl_shared$(TARGET_SONAME_EXTENSION)
+LOCAL_SRC_FILES:= 4.9/libs/$(TARGET_ARCH_ABI)/thumb/libgnustl_shared$(TARGET_SONAME_EXTENSION)
endif
endif
LOCAL_EXPORT_CPPFLAGS := $(gnustl_exported_cppflags)
LOCAL_EXPORT_C_INCLUDES := $(gnustl_exported_c_includes)
-LOCAL_EXPORT_LDLIBS := $(call host-path,$(LOCAL_PATH)/libs/$(TARGET_ARCH_ABI)/libsupc++$(TARGET_LIB_EXTENSION))
+LOCAL_EXPORT_LDLIBS := $(call host-path,$(LOCAL_PATH)/4.9/libs/$(TARGET_ARCH_ABI)/libsupc++$(TARGET_LIB_EXTENSION))
include $(PREBUILT_SHARED_LIBRARY)
diff --git a/tests/ndk.py b/tests/ndk.py
index 39a06ab80..73960afe0 100644
--- a/tests/ndk.py
+++ b/tests/ndk.py
@@ -30,7 +30,19 @@ def get_tool(tool):
ext = ''
if sys.platform == 'win32':
ext = '.exe'
- return os.path.join(os.environ['NDK'], 'host-tools', 'bin', tool) + ext
+
+ if sys.platform.startswith('linux'):
+ host_tag = 'linux-x86_64'
+ elif sys.platform == 'darwin':
+ host_tag = 'darwin-x86_64'
+ elif sys.platform == 'win32':
+ host_tag = 'windows-x86_64'
+ test_path = os.path.join(os.environ['NDK'], 'prebuilt', host_tag)
+ if not os.path.exists(test_path):
+ host_tag = 'windows'
+
+ prebuilt_path = os.path.join(os.environ['NDK'], 'prebuilt', host_tag)
+ return os.path.join(prebuilt_path, 'bin', tool) + ext
def build(build_flags):