aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2020-03-17 15:34:32 -0700
committerDan Albert <danalbert@google.com>2020-03-17 15:44:07 -0700
commit90538e1c7d8c9e01201185a4d0bb712bbb7da5fa (patch)
tree2109b2a410d0b66fc538db0f1561cc73d3774e13
parentbc13174bc2fbdf7cd3128394e929e3d48d22ac0b (diff)
downloadndk-90538e1c7d8c9e01201185a4d0bb712bbb7da5fa.tar.gz
Remove platforms and sysroot directories.
These were deprecated in r19. Removing these saves 600MB in the installed NDK. Test: treehugger Bug: None Change-Id: I6c127ade030b9c580e57b3a4695831fab14cfb78
-rw-r--r--build/core/add-platform.mk33
-rw-r--r--build/core/init.mk35
-rw-r--r--build/core/setup-app-platform.mk8
-rw-r--r--build/tools/dev-defaults.sh8
-rw-r--r--docs/changelogs/Changelog-r22.md10
-rw-r--r--ndk/builds.py10
-rwxr-xr-xndk/checkbuild.py3
-rwxr-xr-xtests/build/libc_no_atexit/build.sh7
-rw-r--r--tests/build/no_platform_gaps/test.py16
9 files changed, 39 insertions, 91 deletions
diff --git a/build/core/add-platform.mk b/build/core/add-platform.mk
deleted file mode 100644
index da83717bc..000000000
--- a/build/core/add-platform.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2009 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-$(call assert-defined,_platform NDK_PLATFORMS_ROOT)
-
-# For each platform, determine the corresponding supported ABIs
-# And record them in NDK_PLATFORM_$(platform)_ABIS
-#
-_abis := $(strip $(notdir $(wildcard $(NDK_PLATFORMS_ROOT)/$(_platform)/arch-*)))
-_abis := $(_abis:arch-%=%)
-
-$(call ndk_log,PLATFORM $(_platform) supports: $(_abis))
-
-NDK_PLATFORM_$(_platform)_ABIS := $(_abis)
-
-# Record the sysroots for each supported ABI
-#
-$(foreach _abi,$(_abis),\
- $(eval NDK_PLATFORM_$(_platform)_$(_abi)_SYSROOT := $(NDK_PLATFORMS_ROOT)/$(_platform)/arch-$(_abi))\
- $(call ndk_log, ABI $(_abi) sysroot is: $(NDK_PLATFORM_$(_platform)_$(_abi)_SYSROOT))\
-)
diff --git a/build/core/init.mk b/build/core/init.mk
index 69e5bebf0..5e7a79035 100644
--- a/build/core/init.mk
+++ b/build/core/init.mk
@@ -400,41 +400,6 @@ include $(BUILD_SYSTEM)/definitions.mk
#
# ====================================================================
-# The platform files were moved in the Android source tree from
-# $TOP/ndk/build/platforms to $TOP/development/ndk/platforms. However,
-# the official NDK release packages still place them under the old
-# location for now, so deal with this here
-#
-NDK_PLATFORMS_ROOT := $(strip $(NDK_PLATFORMS_ROOT))
-ifndef NDK_PLATFORMS_ROOT
- NDK_PLATFORMS_ROOT := $(strip $(wildcard $(NDK_ROOT)/platforms))
- ifndef NDK_PLATFORMS_ROOT
- NDK_PLATFORMS_ROOT := $(strip $(wildcard $(NDK_ROOT)/build/platforms))
- endif
-
- ifndef NDK_PLATFORMS_ROOT
- $(call __ndk_info,Could not find platform files (headers and libraries))
- $(if $(strip $(wildcard $(NDK_ROOT)/RELEASE.TXT)),\
- $(call __ndk_info,Please define NDK_PLATFORMS_ROOT to point to a valid directory.)\
- )
- $(call __ndk_error,Aborting)
- endif
-
- $(call ndk_log,Found platform root directory: $(NDK_PLATFORMS_ROOT))
-endif
-ifeq ($(strip $(wildcard $(NDK_PLATFORMS_ROOT)/android-*)),)
- $(call __ndk_info,Your NDK_PLATFORMS_ROOT points to an invalid directory)
- $(call __ndk_info,Current value: $(NDK_PLATFORMS_ROOT))
- $(call __ndk_error,Aborting)
-endif
-
-NDK_ALL_PLATFORMS := $(strip $(notdir $(wildcard $(NDK_PLATFORMS_ROOT)/android-*)))
-$(call ndk_log,Found supported platforms: $(NDK_ALL_PLATFORMS))
-
-$(foreach _platform,$(NDK_ALL_PLATFORMS),\
- $(eval include $(BUILD_SYSTEM)/add-platform.mk)\
-)
-
# ====================================================================
#
# Read all toolchain-specific configuration files.
diff --git a/build/core/setup-app-platform.mk b/build/core/setup-app-platform.mk
index 9326f9716..c5ed8aea0 100644
--- a/build/core/setup-app-platform.mk
+++ b/build/core/setup-app-platform.mk
@@ -101,14 +101,6 @@ ifneq ($(call gt,$(APP_PLATFORM_LEVEL),$(NDK_MAX_PLATFORM_LEVEL)),)
$(call __ndk_error,Aborting.)
endif
-# We pull low values up, fill in gaps, replace platform code names, replace
-# "latest", and error out on high values. Anything left is either a gap or
-# codename we missed, or user error.
-ifneq (,$(strip $(filter-out $(NDK_ALL_PLATFORMS),$(APP_PLATFORM))))
- $(call __ndk_info,APP_PLATFORM set to unknown platform: $(APP_PLATFORM).)
- $(call __ndk_error,Aborting)
-endif
-
ifneq (null,$(APP_PROJECT_PATH))
# Check platform level (after adjustment) against android:minSdkVersion in AndroidManifest.xml
diff --git a/build/tools/dev-defaults.sh b/build/tools/dev-defaults.sh
index 97f357fbd..7516f6490 100644
--- a/build/tools/dev-defaults.sh
+++ b/build/tools/dev-defaults.sh
@@ -66,7 +66,7 @@ DEFAULT_PYTHON_VERSION=2.7.5
DEFAULT_PERL_VERSION=5.16.2
# The list of default CPU architectures we support
-DEFAULT_ARCHS="arm x86 mips arm64 x86_64 mips64"
+DEFAULT_ARCHS="arm x86 arm64 x86_64"
# Default toolchain names and prefix
#
@@ -84,12 +84,6 @@ DEFAULT_ARCH_TOOLCHAIN_PREFIX_x86=i686-linux-android
DEFAULT_ARCH_TOOLCHAIN_NAME_x86_64=x86_64
DEFAULT_ARCH_TOOLCHAIN_PREFIX_x86_64=x86_64-linux-android
-DEFAULT_ARCH_TOOLCHAIN_NAME_mips=mips64el-linux-android
-DEFAULT_ARCH_TOOLCHAIN_PREFIX_mips=mips64el-linux-android
-
-DEFAULT_ARCH_TOOLCHAIN_NAME_mips64=mips64el-linux-android
-DEFAULT_ARCH_TOOLCHAIN_PREFIX_mips64=mips64el-linux-android
-
# The build number of clang used to build pieces of the NDK (like platforms).
DEFAULT_LLVM_VERSION="2455903"
diff --git a/docs/changelogs/Changelog-r22.md b/docs/changelogs/Changelog-r22.md
index 6ff2c2f66..0b102a579 100644
--- a/docs/changelogs/Changelog-r22.md
+++ b/docs/changelogs/Changelog-r22.md
@@ -30,6 +30,16 @@ For Android Studio issues, follow the docs on the [Android Studio site].
* [Issue 1139]: `native_app_glue` now hooks up the `APP_CMD_WINDOW_RESIZED`,
`APP_CMD_WINDOW_REDRAW_NEEDED`, and `APP_CMD_CONTENT_RECT_CHANGED` messages.
+* The deprecated `<NDK>/platforms` and `<NDK>/sysroot` directories have been
+ removed. These directories were merged and relocated into the toolchain during
+ r19. The location of these contents should not be relevant to anyone,
+ including build systems, since the toolchain handles them implicitly. If you
+ are using a build system that hasn't adapted to the changes introduced in NDK
+ r19, file a bug with your build system maintainer. See the [Build System
+ Maintainers Guide] for information on using the NDK in your own build system.
+
+[Build System Maintainers Guide]: https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md
+
## Known Issues
* This is not intended to be a comprehensive list of all outstanding bugs.
diff --git a/ndk/builds.py b/ndk/builds.py
index a32b1200d..2ac430ed8 100644
--- a/ndk/builds.py
+++ b/ndk/builds.py
@@ -101,6 +101,12 @@ class Module:
split_build_by_arch = False
build_arch: Optional[ndk.abis.Arch] = None
+ # Set to True if this module is merely a build convenience and not intented
+ # to be shipped. For example, Platforms has its own build steps but is
+ # shipped within the Toolchain module. If this value is set, the module's
+ # install directory will not be within the NDK.
+ intermediate_module = False
+
def __init__(self) -> None:
self.context: Optional[BuildContext] = None
if self.notice is None:
@@ -237,6 +243,8 @@ class Module:
self.name, self.path, self.host, self.arches)
install_base = ndk.paths.get_install_path(self.out_dir, self.host)
+ if self.intermediate_module:
+ install_base = str(self.intermediate_out_dir / 'install')
for package_name, package_install in package_installs:
assert self.context is not None
install_path = os.path.join(install_base, package_install)
@@ -251,6 +259,8 @@ class Module:
"""Returns the install paths for the given archiectures."""
install_subdirs = ndk.packaging.expand_paths(self.path, host, arches)
install_base = ndk.paths.get_install_path(self.out_dir, host)
+ if self.intermediate_module:
+ install_base = str(self.intermediate_out_dir / 'install')
return [os.path.join(install_base, d) for d in install_subdirs]
def get_install_path(self, host: Optional[ndk.hosts.Host] = None,
diff --git a/ndk/checkbuild.py b/ndk/checkbuild.py
index 93e45c302..85ba3c6a4 100755
--- a/ndk/checkbuild.py
+++ b/ndk/checkbuild.py
@@ -946,6 +946,8 @@ class Platforms(ndk.builds.Module):
# will be the end state when we merge the two anyway.
notice = ndk.paths.android_path('prebuilts/ndk/platform/sysroot/NOTICE')
+ intermediate_module = True
+
def prebuilt_path(self, *args: str) -> str: # pylint: disable=no-self-use
return ndk.paths.android_path('prebuilts/ndk/platform', *args)
@@ -1737,6 +1739,7 @@ class Sysroot(ndk.builds.Module):
name = 'sysroot'
path = 'sysroot'
notice = ndk.paths.android_path('prebuilts/ndk/platform/sysroot/NOTICE')
+ intermediate_module = True
def build(self) -> None:
temp_dir = tempfile.mkdtemp()
diff --git a/tests/build/libc_no_atexit/build.sh b/tests/build/libc_no_atexit/build.sh
index f18099a2c..cceda69f3 100755
--- a/tests/build/libc_no_atexit/build.sh
+++ b/tests/build/libc_no_atexit/build.sh
@@ -9,7 +9,8 @@ echo DEFAULT_ARCHS=$DEFAULT_ARCHS
LIBRARIES=
for ARCH in $DEFAULT_ARCHS; do
- LIB=$(cd $NDK && find platforms -name "libc.so" | sed -e 's!^!'$NDK'/!' | grep arch-$ARCH)
+ TRIPLE=$(get_default_toolchain_prefix_for_arch $ARCH)
+ LIB=$(cd $NDK && find toolchains -name "libc.so" | grep $TRIPLE)
LIBRARIES=$LIBRARIES" $LIB"
done
@@ -20,12 +21,12 @@ for LIB in $LIBRARIES; do
echo "Checking: $LIB"
readelf -s $LIB | grep -q -F " atexit"
if [ $? = 0 ]; then
- echo "ERROR: $NDK/$LIB exposes 'atexit'!" >&2
+ echo "ERROR: $LIB exposes 'atexit'!" >&2
FAILURE=true
fi
readelf -s $LIB | grep -q -F " __dso_handle"
if [ $? = 0 ]; then
- echo "ERROR: $NDK/$LIB exposes '__dso_handle'!" >&2
+ echo "ERROR: $LIB exposes '__dso_handle'!" >&2
FAILURE=true
fi
done
diff --git a/tests/build/no_platform_gaps/test.py b/tests/build/no_platform_gaps/test.py
index 47c830061..a52fb1d4d 100644
--- a/tests/build/no_platform_gaps/test.py
+++ b/tests/build/no_platform_gaps/test.py
@@ -25,9 +25,13 @@ This test is a Python driven test specifically to avoid the test runner's
meddling.
"""
import os
+from pathlib import Path
import subprocess
import sys
+import ndk.abis
+import ndk.hosts
+
def build(ndk_dir, abi, platform, linker, build_flags):
ndk_build = os.path.join(ndk_dir, 'ndk-build')
@@ -51,14 +55,16 @@ def run_test(ndk_path, abi, _platform, linker, build_flags):
min_api = None
max_api = None
apis = []
- for name in os.listdir(os.path.join(ndk_path, 'platforms')):
- if not name.startswith('android-'):
+ host = ndk.hosts.host_to_tag(ndk.hosts.get_default_host())
+ triple = ndk.abis.arch_to_triple(ndk.abis.abi_to_arch(abi))
+ toolchain_dir = Path(ndk_path) / f'toolchains/llvm/prebuilt/{host}'
+ lib_dir = toolchain_dir / f'sysroot/usr/lib/{triple}'
+ for path in lib_dir.iterdir():
+ if not path.is_dir():
continue
- _, api_str = name.split('-')
-
try:
- api = int(api_str)
+ api = int(path.name)
except ValueError:
# Must have been a lettered release. Not relevant.
continue