Snap for 7255932 from 223438a205a4e52fc6e9a57a5d84443ffeae8a3e to ndk-r23-release
Change-Id: Ia51349aee1fe7da7715f1a0f3aa5a58c0ab81740
diff --git a/build/cmake/android-legacy.toolchain.cmake b/build/cmake/android-legacy.toolchain.cmake
index 8683905..aac7750 100644
--- a/build/cmake/android-legacy.toolchain.cmake
+++ b/build/cmake/android-legacy.toolchain.cmake
@@ -331,17 +331,6 @@
set(ANDROID_LINKER_FLAGS)
set(ANDROID_LINKER_FLAGS_EXE)
-# Don't re-export libgcc symbols in every binary.
-list(APPEND ANDROID_LINKER_FLAGS -Wl,--exclude-libs,libgcc.a)
-# arm32 currently uses a linker script in place of libgcc to ensure that
-# libunwind is linked in the correct order. --exclude-libs does not propagate to
-# the contents of the linker script and can't be specified within the linker
-# script. Hide both regardless of architecture to future-proof us in case we
-# move other architectures to a linker script (which we may want to do so we
-# automatically link libclangrt on other architectures).
-list(APPEND ANDROID_LINKER_FLAGS -Wl,--exclude-libs,libgcc_real.a)
-list(APPEND ANDROID_LINKER_FLAGS -Wl,--exclude-libs,libatomic.a)
-
# STL.
set(ANDROID_CXX_STANDARD_LIBRARIES)
if(ANDROID_STL STREQUAL system)
@@ -488,13 +477,6 @@
list(APPEND ANDROID_COMPILER_FLAGS -D_FORTIFY_SOURCE=2)
-# STL specific flags.
-if(ANDROID_STL MATCHES "^c\\+\\+_")
- if(ANDROID_ABI MATCHES "^armeabi")
- list(APPEND ANDROID_LINKER_FLAGS "-Wl,--exclude-libs,libunwind.a")
- endif()
-endif()
-
set(CMAKE_C_STANDARD_LIBRARIES_INIT "-latomic -lm")
set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
if(ANDROID_CXX_STANDARD_LIBRARIES)
diff --git a/build/cmake/flags.cmake b/build/cmake/flags.cmake
index af0d88c..0d3fc00 100644
--- a/build/cmake/flags.cmake
+++ b/build/cmake/flags.cmake
@@ -21,17 +21,6 @@
set(_ANDROID_NDK_INIT_LDFLAGS)
set(_ANDROID_NDK_INIT_LDFLAGS_EXE)
-# Don't re-export libgcc symbols in every binary.
-string(APPEND _ANDROID_NDK_INIT_LDFLAGS " -Wl,--exclude-libs,libgcc.a")
-# arm32 currently uses a linker script in place of libgcc to ensure that
-# libunwind is linked in the correct order. --exclude-libs does not propagate to
-# the contents of the linker script and can't be specified within the linker
-# script. Hide both regardless of architecture to future-proof us in case we
-# move other architectures to a linker script (which we may want to do so we
-# automatically link libclangrt on other architectures).
-string(APPEND _ANDROID_NDK_INIT_LDFLAGS " -Wl,--exclude-libs,libgcc_real.a")
-string(APPEND _ANDROID_NDK_INIT_LDFLAGS " -Wl,--exclude-libs,libatomic.a")
-
# Generic flags.
string(APPEND _ANDROID_NDK_INIT_CFLAGS
" -DANDROID"
@@ -68,13 +57,6 @@
string(APPEND _ANDROID_NDK_INIT_CFLAGS " -D_FORTIFY_SOURCE=2")
-# STL specific flags.
-if(CMAKE_ANDROID_STL_TYPE MATCHES "^c\\+\\+_")
- if(CMAKE_ANDROID_ARCH_ABI MATCHES "^armeabi")
- string(APPEND _ANDROID_NDK_INIT_LDFLAGS " -Wl,--exclude-libs,libunwind.a")
- endif()
-endif()
-
if(CMAKE_ANDROID_ARCH_ABI MATCHES "armeabi")
# Clang does not set this up properly when using -fno-integrated-as.
# https://github.com/android-ndk/ndk/issues/906
diff --git a/build/core/build-binary.mk b/build/core/build-binary.mk
index c55005a..958ef27 100644
--- a/build/core/build-binary.mk
+++ b/build/core/build-binary.mk
@@ -535,7 +535,6 @@
$(call generate-file-dir,$(LOCAL_BUILT_MODULE))
$(LOCAL_BUILT_MODULE): PRIVATE_OBJECTS := $(LOCAL_OBJECTS)
-$(LOCAL_BUILT_MODULE): PRIVATE_LIBGCC := $(TARGET_LIBGCC)
$(LOCAL_BUILT_MODULE): PRIVATE_LIBATOMIC := $(TARGET_LIBATOMIC)
$(LOCAL_BUILT_MODULE): PRIVATE_LD := $(TARGET_LD)
@@ -681,8 +680,6 @@
# The list of object/static/shared libraries passed to the linker when
# building shared libraries and executables. order is important.
-#
-# Cannot use immediate evaluation because PRIVATE_LIBGCC may not be defined at this point.
linker_objects_and_libraries = $(strip $(call TARGET-get-linker-objects-and-libraries,\
$(LOCAL_OBJECTS), \
$(static_libs), \
diff --git a/build/core/default-build-commands.mk b/build/core/default-build-commands.mk
index 8cf40dc..e9687f8 100644
--- a/build/core/default-build-commands.mk
+++ b/build/core/default-build-commands.mk
@@ -31,7 +31,6 @@
$(call host-path, $1) \
$(call link-whole-archives,$3) \
$(call host-path, $2) \
- $(PRIVATE_LIBGCC) \
$(PRIVATE_LIBATOMIC) \
$(call host-path, $4) \
@@ -42,15 +41,6 @@
# This flag disables the above security checks
TARGET_DISABLE_FORMAT_STRING_CFLAGS := -Wno-error=format-security
-# NOTE: Ensure that TARGET_LIBGCC is placed after all private objects
-# and static libraries, but before any other library in the link
-# command line when generating shared libraries and executables.
-#
-# This ensures that all libgcc.a functions required by the target
-# will be included into it, instead of relying on what's available
-# on other libraries like libc.so, which may change between system
-# releases due to toolchain or library changes.
-#
define cmd-build-shared-library
$(PRIVATE_CXX) \
-Wl,-soname,$(notdir $(LOCAL_BUILT_MODULE)) \
@@ -90,8 +80,7 @@
# script. Hide both regardless of architecture to future-proof us in case we
# move other architectures to a linker script (which we may want to do so we
# automatically link libclangrt on other architectures).
-TARGET_LIBGCC = -lgcc -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a
-TARGET_LIBATOMIC = -latomic -Wl,--exclude-libs,libatomic.a
+TARGET_LIBATOMIC = -latomic
TARGET_LDLIBS := -lc -lm
TOOLCHAIN_ROOT := $(NDK_ROOT)/toolchains/llvm/prebuilt/$(HOST_TAG64)
diff --git a/build/core/definitions.mk b/build/core/definitions.mk
index 66204e4..1e065c4 100644
--- a/build/core/definitions.mk
+++ b/build/core/definitions.mk
@@ -718,9 +718,7 @@
$(call import-module,cxx-stl/llvm-libc++abi)\
$(call module-add-c++-deps,$(__module),c++abi)\
$(if $(filter true,$(NDK_PLATFORM_NEEDS_ANDROID_SUPPORT)),\
- $(call module-add-c++-deps,$(__module),android_support))\
- $(if $(filter armeabi-v7a,$(TARGET_ARCH_ABI)),\
- $(call module-add-c++-deps,$(__module),unwind,,-ldl))))\
+ $(call module-add-c++-deps,$(__module),android_support))))\
)
diff --git a/build/tools/builder-funcs.sh b/build/tools/builder-funcs.sh
deleted file mode 100644
index 3597a82..0000000
--- a/build/tools/builder-funcs.sh
+++ /dev/null
@@ -1,273 +0,0 @@
-#
-# Copyright (C) 2011 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.
-#
-# This file contains various shell function definitions that can be
-# used to either build a static and shared libraries from sources, or
-# generate a Makefile to do it in parallel.
-#
-
-_BUILD_TAB=$(echo " " | tr ' ' '\t')
-
-builder_command ()
-{
- if [ -z "$_BUILD_MK" ]; then
- echo "$@"
- "$@"
- else
- echo "${_BUILD_TAB}$@" >> $_BUILD_MK
- fi
-}
-
-
-builder_log ()
-{
- if [ "$_BUILD_MK" ]; then
- echo "${_BUILD_TAB}echo $@" >> $_BUILD_MK
- else
- log "$@"
- fi
-}
-
-# $1: Build directory
-# $2: Optional Makefile name
-builder_begin ()
-{
- _BUILD_DIR_NEW=
- _BUILD_DIR=$1
- if [ ! -d "$_BUILD_DIR" ]; then
- mkdir -p "$_BUILD_DIR"
- fail_panic "Can't create build directory: $_BUILD_DIR"
- _BUILD_DIR_NEW=true
- else
- rm -rf "$_BUILD_DIR/*"
- fail_panic "Can't cleanup build directory: $_BUILD_DIR"
- fi
- _BUILD_TARGETS=
- _BUILD_PREFIX=
- _BUILD_MK=$2
- if [ -n "$_BUILD_MK" ]; then
- log "Creating temporary build Makefile: $_BUILD_MK"
- rm -f $_BUILD_MK &&
- echo "# Auto-generated by $0 - do not edit!" > $_BUILD_MK
- echo ".PHONY: all" >> $_BUILD_MK
- echo "all:" >> $_BUILD_MK
- fi
-
- builder_begin_module
-}
-
-# $1: Variable name
-# out: Variable value
-_builder_varval ()
-{
- eval echo "\$$1"
-}
-
-_builder_varadd ()
-{
- local _varname="$1"
- local _varval="$(_builder_varval $_varname)"
- shift
- if [ -z "$_varval" ]; then
- eval $_varname=\"$@\"
- else
- eval $_varname=\$$_varname\" $@\"
- fi
-}
-
-
-builder_set_prefix ()
-{
- _BUILD_PREFIX="$@"
-}
-
-builder_begin_module ()
-{
- _BUILD_CC=
- _BUILD_CXX=
- _BUILD_AR=
- _BUILD_C_INCLUDES=
- _BUILD_CFLAGS=
- _BUILD_CXXFLAGS=
- _BUILD_LDFLAGS_BEGIN_SO=
- _BUILD_LDFLAGS_END_SO=
- _BUILD_LDFLAGS_BEGIN_EXE=
- _BUILD_LDFLAGS_END_EXE=
- _BUILD_LDFLAGS=
- _BUILD_BINPREFIX=
- _BUILD_DSTDIR=
- _BUILD_SRCDIR=.
- _BUILD_OBJECTS=
- _BUILD_STATIC_LIBRARIES=
- _BUILD_SHARED_LIBRARIES=
- _BUILD_COMPILER_RUNTIME_LDFLAGS=-lgcc
-}
-
-builder_set_binprefix ()
-{
- _BUILD_BINPREFIX=$1
- _BUILD_CC=${1}gcc
- _BUILD_CXX=${1}g++
- _BUILD_AR=${1}ar
-}
-
-builder_set_builddir ()
-{
- _BUILD_DIR=$1
-}
-
-builder_set_srcdir ()
-{
- _BUILD_SRCDIR=$1
-}
-
-builder_set_dstdir ()
-{
- _BUILD_DSTDIR=$1
-}
-
-builder_cflags ()
-{
- _builder_varadd _BUILD_CFLAGS "$@"
-}
-
-builder_sources ()
-{
- local src srcfull obj cc cflags text
- if [ -z "$_BUILD_DIR" ]; then
- panic "Build directory not set!"
- fi
- if [ -z "$_BUILD_CC" ]; then
- _BUILD_CC=${CC:-gcc}
- fi
- if [ -z "$_BUILD_CXX" ]; then
- _BUILD_CXX=${CXX:-g++}
- fi
- for src in "$@"; do
- srcfull=$_BUILD_SRCDIR/$src
- if [ ! -f "$srcfull" ]; then
- echo "ERROR: Missing source file: $srcfull"
- exit 1
- fi
- obj=$src
- cflags=""
- for inc in $_BUILD_C_INCLUDES; do
- cflags=$cflags" -I$inc"
- done
- cflags=$cflags" -I$_BUILD_SRCDIR"
- case $obj in
- *.c)
- obj=${obj%%.c}
- text="C"
- cc=$_BUILD_CC
- cflags="$cflags $_BUILD_CFLAGS"
- ;;
- *.cpp)
- obj=${obj%%.cpp}
- text="C++"
- cc=$_BUILD_CXX
- cflags="$cflags $_BUILD_CXXFLAGS"
- ;;
- *.cc)
- obj=${obj%%.cc}
- text="C++"
- cc=$_BUILD_CXX
- cflags="$cflags $_BUILD_CXXFLAGS"
- ;;
- *.S|*.s)
- obj=${obj%%.$obj}
- text="ASM"
- cc=$_BUILD_CC
- cflags="$cflags $_BUILD_CFLAGS"
- ;;
- *)
- echo "Unknown source file extension: $obj"
- exit 1
- ;;
- esac
-
- # Source file path can include ../ path items, ensure
- # that the generated object do not back up the output
- # directory by translating them to __/
- obj=$(echo "$obj" | tr '../' '__/')
-
- # Ensure we have unwind tables in the generated machine code
- # This is useful to get good stack traces
- cflags=$cflags" -funwind-tables"
-
- obj=$_BUILD_DIR/$obj.o
- if [ "$_BUILD_MK" ]; then
- echo "$obj: $srcfull" >> $_BUILD_MK
- fi
- builder_log "${_BUILD_PREFIX}$text: $src"
- builder_command mkdir -p $(dirname "$obj")
- builder_command $cc -c -o "$obj" "$srcfull" $cflags
- fail_panic "Could not compile ${_BUILD_PREFIX}$src"
- _BUILD_OBJECTS=$_BUILD_OBJECTS" $obj"
- done
-}
-
-builder_host_executable ()
-{
- local exe exename
- exename=$1
- exe=$_BUILD_DSTDIR/$exename$HOST_EXE
- if [ "$_BUILD_MK" ]; then
- _BUILD_TARGETS=$_BUILD_TARGETS" $exe"
- echo "$exe: $_BUILD_OBJECTS" >> $_BUILD_MK
- fi
- builder_log "${_BUILD_PREFIX}Executable: $exename$HOST_EXE"
-
- if [ -z "$_BUILD_CXX" ]; then
- _BUILD_CXX=${CXX:-g++}
- fi
-
- # Important: -lgcc must appear after objects and static libraries,
- # but before shared libraries for Android. It doesn't hurt
- # for other platforms.
- builder_command ${_BUILD_CXX} \
- -s \
- $_BUILD_OBJECTS \
- $_BUILD_STATIC_LIBRARIES \
- $_BUILD_SHARED_LIBRARIES \
- $_BUILD_LDFLAGS \
- -o $exe
- fail_panic "Could not create ${_BUILD_PREFIX}executable $libname"
-}
-
-
-builder_end ()
-{
- if [ "$_BUILD_MK" ]; then
- echo "all: $_BUILD_TARGETS" >> $_BUILD_MK
- run make -j$NUM_JOBS -f $_BUILD_MK
- fail_panic "Could not build project!"
- fi
-
- if [ "$_BUILD_DIR_NEW" ]; then
- log "Cleaning up build directory: $_BUILD_DIR"
- rm -rf "$_BUILD_DIR"
- _BUILD_DIR_NEW=
- fi
-}
-
-# $1: Build directory
-# $2: Optional Makefile name
-builder_begin_host ()
-{
- prepare_host_build
- builder_begin "$1" "$2"
- builder_set_prefix "$HOST_TAG "
-}
diff --git a/build/tools/common-build-host-funcs.sh b/build/tools/common-build-host-funcs.sh
deleted file mode 100644
index 5088ab5..0000000
--- a/build/tools/common-build-host-funcs.sh
+++ /dev/null
@@ -1,791 +0,0 @@
-# Copyright (C) 2012 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.
-#
-
-# A set of function shared by the 'build-host-xxxx.sh' scripts.
-# They are mostly related to building host libraries.
-#
-# NOTE: This script uses various prefixes:
-#
-# BH_ Used for public macros
-# bh_ Use for public functions
-#
-# _BH_ Used for private macros
-# _bh_ Used for private functions
-#
-# Callers should only rely on the public macros and functions defined here.
-#
-
-# List of macros defined by the functions here:
-#
-# defined by 'bh_set_build_tag'
-#
-# BH_BUILD_CONFIG Generic GNU config triplet for build system
-# BH_BUILD_OS NDK system name
-# BH_BUILD_ARCH NDK arch name
-# BH_BUILD_TAG NDK system tag ($OS-$ARCH)
-# BH_BUILD_BITS build system bitness (32 or 64)
-#
-# defined by 'bh_set_host_tag'
-# 7
-# BH_HOST_CONFIG
-# BH_HOST_OS
-# BH_HOST_ARCH
-# BH_HOST_TAG
-# BH_HOST_BITS
-#
-# defined by 'bh_set_target_tag'
-#
-# BH_TARGET_CONFIG
-# BH_TARGET_OS
-# BH_TARGET_ARCH
-# BH_TARGET_TAG
-# BH_TARGET_BITS
-#
-#
-
-
-# The values of HOST_OS/ARCH/TAG will be redefined during the build to
-# match those of the system the generated compiler binaries will run on.
-#
-# Save the original ones into BUILD_XXX variants, corresponding to the
-# machine where the build happens.
-#
-BH_BUILD_OS=$HOST_OS
-BH_BUILD_ARCH=$HOST_ARCH
-BH_BUILD_TAG=$HOST_TAG
-
-# Map an NDK system tag to an OS name
-# $1: system tag (e.g. linux-x86)
-# Out: system name (e.g. linux)
-bh_tag_to_os ()
-{
- local RET
- case $1 in
- android-*) RET="android";;
- linux-*) RET="linux";;
- darwin-*) RET="darwin";;
- windows|windows-*) RET="windows";;
- *) echo "ERROR: Unknown tag $1" >&2; echo "INVALID"; exit 1;;
- esac
- echo $RET
-}
-
-# Map an NDK system tag to an architecture name
-# $1: system tag (e.g. linux-x86)
-# Out: arch name (e.g. x86)
-bh_tag_to_arch ()
-{
- local RET
- case $1 in
- *-arm) RET=arm;;
- *-arm64) RET=arm64;;
- *-mips) RET=mips;;
- *-mips64) RET=mips64;;
- windows|*-x86) RET=x86;;
- *-x86_64) RET=x86_64;;
- *) echo "ERROR: Unknown tag $1" >&2; echo "INVALID"; exit 1;;
- esac
- echo $RET
-}
-
-# Map an NDK system tag to a bit number
-# $1: system tag (e.g. linux-x86)
-# Out: bit number (32 or 64)
-bh_tag_to_bits ()
-{
- local RET
- case $1 in
- windows|*-x86|*-arm|*-mips) RET=32;;
- *-x86_64|*-arm64|*-mips64) RET=64;;
- *) echo "ERROR: Unknown tag $1" >&2; echo "INVALID"; exit 1;;
- esac
- echo $RET
-}
-
-# Map an NDK system tag to the corresponding GNU configuration triplet.
-# $1: NDK system tag
-# Out: GNU configuration triplet
-bh_tag_to_config_triplet ()
-{
- local RET
- case $1 in
- linux-x86) RET=i686-linux-gnu;;
- linux-x86_64) RET=x86_64-linux-gnu;;
- darwin-x86) RET=i686-apple-darwin;;
- darwin-x86_64) RET=x86_64-apple-darwin;;
- windows|windows-x86) RET=i686-w64-mingw32;;
- windows-x86_64) RET=x86_64-w64-mingw32;;
- android-arm) RET=arm-linux-androideabi;;
- android-arm64) RET=aarch64-linux-android;;
- android-x86) RET=i686-linux-android;;
- android-x86_64) RET=x86_64-linux-android;;
- android-mips) RET=mipsel-linux-android;;
- android-mips64) RET=mips64el-linux-android;;
- *) echo "ERROR: Unknown tag $1" >&2; echo "INVALID"; exit 1;;
- esac
- echo "$RET"
-}
-
-
-bh_set_build_tag ()
-{
- SAVED_OPTIONS=$(set +o)
- set -e
- BH_BUILD_OS=$(bh_tag_to_os $1)
- BH_BUILD_ARCH=$(bh_tag_to_arch $1)
- BH_BUILD_BITS=$(bh_tag_to_bits $1)
- BH_BUILD_TAG=$BH_BUILD_OS-$BH_BUILD_ARCH
- BH_BUILD_CONFIG=$(bh_tag_to_config_triplet $1)
- eval "$SAVED_OPTIONS"
-}
-
-# Set default BH_BUILD macros.
-bh_set_build_tag $HOST_TAG
-
-bh_set_host_tag ()
-{
- SAVED_OPTIONS=$(set +o)
- set -e
- BH_HOST_OS=$(bh_tag_to_os $1)
- BH_HOST_ARCH=$(bh_tag_to_arch $1)
- BH_HOST_BITS=$(bh_tag_to_bits $1)
- BH_HOST_TAG=$BH_HOST_OS-$BH_HOST_ARCH
- BH_HOST_CONFIG=$(bh_tag_to_config_triplet $1)
- eval "$SAVED_OPTIONS"
-}
-
-bh_set_target_tag ()
-{
- SAVED_OPTIONS=$(set +o)
- set -e
- BH_TARGET_OS=$(bh_tag_to_os $1)
- BH_TARGET_ARCH=$(bh_tag_to_arch $1)
- BH_TARGET_BITS=$(bh_tag_to_bits $1)
- BH_TARGET_TAG=$BH_TARGET_OS-$BH_TARGET_ARCH
- BH_TARGET_CONFIG=$(bh_tag_to_config_triplet $1)
- eval "$SAVED_OPTIONS"
-}
-
-bh_sort_systems_build_first ()
-{
- local IN_SYSTEMS="$1"
- local OUT_SYSTEMS
- # Pull out the host if there
- for IN_SYSTEM in $IN_SYSTEMS; do
- if [ "$IN_SYSTEM" = "$BH_BUILD_TAG" ]; then
- OUT_SYSTEMS=$IN_SYSTEM
- fi
- done
- # Append the rest
- for IN_SYSTEM in $IN_SYSTEMS; do
- if [ ! "$IN_SYSTEM" = "$BH_BUILD_TAG" ]; then
- OUT_SYSTEMS=$OUT_SYSTEMS" $IN_SYSTEM"
- fi
- done
- echo $OUT_SYSTEMS
-}
-
-# $1 is the string to search for
-# $2... is the list to search in
-# Returns first, yes or no.
-bh_list_contains ()
-{
- local SEARCH="$1"
- shift
- # For dash, this has to be split over 2 lines.
- # Seems to be a bug with dash itself:
- # https://bugs.launchpad.net/ubuntu/+source/dash/+bug/141481
- local LIST
- LIST=$@
- local RESULT=first
- # Pull out the host if there
- for ELEMENT in $LIST; do
- if [ "$ELEMENT" = "$SEARCH" ]; then
- echo $RESULT
- return 0
- fi
- RESULT=yes
- done
- echo no
- return 1
-}
-
-
-# Use this function to enable/disable colored output
-# $1: 'true' or 'false'
-bh_set_color_mode ()
-{
- local DO_COLOR=
- case $1 in
- on|enable|true) DO_COLOR=true
- ;;
- esac
- if [ "$DO_COLOR" ]; then
- _BH_COLOR_GREEN="\033[32m"
- _BH_COLOR_PURPLE="\033[35m"
- _BH_COLOR_CYAN="\033[36m"
- _BH_COLOR_END="\033[0m"
- else
- _BH_COLOR_GREEN=
- _BH_COLOR_PURPLE=
- _BH_COLOR_CYAN=
- _BH_COLOR_END=
- fi
-}
-
-# By default, enable color mode
-bh_set_color_mode true
-
-# Pretty printing with colors!
-bh_host_text ()
-{
- printf "[${_BH_COLOR_GREEN}${BH_HOST_TAG}${_BH_COLOR_END}]"
-}
-
-bh_toolchain_text ()
-{
- printf "[${_BH_COLOR_PURPLE}${BH_TOOLCHAIN}${_BH_COLOR_END}]"
-}
-
-bh_target_text ()
-{
- printf "[${_BH_COLOR_CYAN}${BH_TARGET_TAG}${_BH_COLOR_END}]"
-}
-
-bh_arch_text ()
-{
- # Print arch name in cyan
- printf "[${_BH_COLOR_CYAN}${BH_TARGET_ARCH}${_BH_COLOR_END}]"
-}
-
-# Check that a given compiler generates code correctly
-#
-# This is to detect bad/broken toolchains, e.g. amd64-mingw32msvc
-# is totally broken on Ubuntu 10.10 and 11.04
-#
-# $1: compiler
-# $2: optional extra flags
-#
-bh_check_compiler ()
-{
- local CC="$1"
- local TMPC=$TMPDIR/build-host-$USER-$$.c
- local TMPE=${TMPC%%.c}
- local TMPL=$TMPC.log
- local RET
- shift
- cat > $TMPC <<EOF
-int main(void) { return 0; }
-EOF
- log_n "Checking compiler code generation ($CC)... "
- $CC -o $TMPE $TMPC "$@" >$TMPL 2>&1
- RET=$?
- rm -f $TMPC $TMPE $TMPL
- if [ "$RET" = 0 ]; then
- log "yes"
- else
- log "no"
- fi
- return $RET
-}
-
-
-# $1: toolchain install dir
-# $2: toolchain prefix, no trailing dash (e.g. arm-linux-androideabi)
-# $3: optional -m32 or -m64.
-_bh_try_host_fullprefix ()
-{
- local PREFIX="$1/bin/$2"
- shift; shift;
- if [ -z "$HOST_FULLPREFIX" ]; then
- local GCC="$PREFIX-gcc"
- if [ -f "$GCC" ]; then
- if bh_check_compiler "$GCC" "$@"; then
- HOST_FULLPREFIX="${GCC%%gcc}"
- dump "$(bh_host_text) Using host gcc: $GCC $@"
- else
- dump "$(bh_host_text) Ignoring broken host gcc: $GCC $@"
- fi
- fi
- fi
-}
-
-# $1: host prefix, no trailing slash (e.g. i686-linux-android)
-# $2: optional compiler args (should be empty, -m32 or -m64)
-_bh_try_host_prefix ()
-{
- local PREFIX="$1"
- shift
- if [ -z "$HOST_FULLPREFIX" ]; then
- local GCC="$(which $PREFIX-gcc 2>/dev/null)"
- if [ "$GCC" -a -e "$GCC" ]; then
- if bh_check_compiler "$GCC" "$@"; then
- HOST_FULLPREFIX=${GCC%%gcc}
- dump "$(bh_host_text) Using host gcc: ${HOST_FULLPREFIX}gcc $@"
- else
- dump "$(bh_host_text) Ignoring broken host gcc: $GCC $@"
- fi
- fi
- fi
-}
-
-# Used to determine the minimum possible Darwin version that a Darwin SDK
-# can target. This actually depends from the host architecture.
-# $1: Host architecture name
-# out: SDK version number (e.g. 10.4 or 10.5)
-_bh_darwin_arch_to_min_version ()
-{
- if [ "$1" = "x86" ]; then
- echo "10.4"
- else
- echo "10.5"
- fi
-}
-
-# Use the check for the availability of a compatibility SDK in Darwin
-# this can be used to generate binaries compatible with either Tiger or
-# Leopard.
-#
-# $1: SDK root path
-# $2: Darwin compatibility minimum version
-_bh_check_darwin_sdk ()
-{
- if [ -d "$1" -a -z "$HOST_CFLAGS" ] ; then
- HOST_CFLAGS="-isysroot $1 -mmacosx-version-min=$2 -DMAXOSX_DEPLOYEMENT_TARGET=$2"
- HOST_CXXFLAGS=$HOST_CFLAGS
- HOST_LDFLAGS="-syslibroot $1 -mmacosx-version-min=$2"
- dump "Generating $2-compatible binaries."
- return 0 # success
- fi
- return 1
-}
-
-# Check that a given compiler generates 32 or 64 bit code.
-# $1: compiler full path (.e.g /path/to/fullprefix-gcc)
-# $2: 32 or 64
-# $3: extract compiler flags
-# Return: success iff the compiler generates $2-bits code
-_bh_check_compiler_bitness ()
-{
- local CC="$1"
- local BITS="$2"
- local TMPC=$TMPDIR/build-host-gcc-bits-$USER-$$.c
- local TMPL=$TMPC.log
- local RET
- shift; shift;
- cat > $TMPC <<EOF
-/* this program will fail to compile if the compiler doesn't generate BITS-bits code */
-int tab[1-2*(sizeof(void*)*8 != BITS)];
-EOF
- dump_n "$(bh_host_text) Checking that the compiler generates $BITS-bits code ($@)... "
- $CC -c -DBITS=$BITS -o /dev/null $TMPC $HOST_CFLAGS "$@" > $TMPL 2>&1
- RET=$?
- rm -f $TMPC $TMPL
- if [ "$RET" = 0 ]; then
- dump "yes"
- else
- dump "no"
- fi
- return $RET
-}
-
-# This function probes the system to find the best toolchain or cross-toolchain
-# to build binaries that run on a given host system. After that, it generates
-# a wrapper toolchain under $2 with a prefix of ${BH_HOST_CONFIG}-
-# where $BH_HOST_CONFIG is a GNU configuration name.
-#
-# Important: this script might redefine $BH_HOST_CONFIG to a different value!
-# (This behavior previously happened with MinGW, but doesn't anymore.)
-#
-# $1: NDK system tag (e.g. linux-x86)
-#
-# The following can be defined, otherwise they'll be auto-detected and set.
-#
-# DARWIN_MIN_VERSION -> Darwmin minimum compatibility version
-# DARWIN_SDK_VERSION -> Darwin SDK version
-#
-# The following can be defined for extra features:
-#
-# DARWIN_TOOLCHAIN -> Path to Darwin cross-toolchain (cross-compile only).
-# DARWIN_SYSROOT -> Path to Darwin SDK sysroot (cross-compile only).
-# ANDROID_NDK_ROOT -> Top-level NDK directory, for automatic probing
-# of prebuilt platform toolchains.
-#
-_bh_select_toolchain_for_host ()
-{
- local HOST_CFLAGS HOST_CXXFLAGS HOST_LDFLAGS
- local HOST_ASFLAGS HOST_WINDRES_FLAGS
- local HOST_FULLPREFIX
- local DARWIN_ARCH DARWIN_SDK_SUBDIR
-
- # We do all the complex auto-detection magic in the setup phase,
- # then save the result in host-specific global variables.
- #
- # In the build phase, we will simply restore the values into the
- # global HOST_FULLPREFIX / HOST_BUILD_DIR
- # variables.
- #
-
- # Try to find the best toolchain to do that job, assuming we are in
- # a full Android platform source checkout, we can look at the prebuilts/
- # directory.
- case $1 in
- linux-x86)
- panic "Sorry, this script does not support building 32-bit Linux binaries."
- ;;
-
- linux-x86_64)
- local LINUX_GLIBC_PREBUILT=x86_64-linux-glibc2.15-4.8
- _bh_try_host_fullprefix "$(dirname $ANDROID_NDK_ROOT)/prebuilts/gcc/linux-x86/host/$LINUX_GLIBC_PREBUILT" x86_64-linux
- if [ -z "$HOST_FULLPREFIX" ]; then
- dump "Cannot find the x86_64 Linux-targeting compiler. Make sure the"
- dump "$LINUX_GLIBC_PREBUILT prebuilt is checked out."
- exit 1
- fi
- ;;
-
- darwin-*)
- DARWIN_ARCH=$(bh_tag_to_arch $1)
- if [ -z "$DARWIN_MIN_VERSION" ]; then
- DARWIN_MIN_VERSION=$(_bh_darwin_arch_to_min_version $DARWIN_ARCH)
- fi
- case $BH_BUILD_OS in
- darwin)
- if [ "$DARWIN_SDK_VERSION" ]; then
- # Compute SDK subdirectory name
- case $DARWIN_SDK_VERSION in
- 10.4) DARWIN_SDK_SUBDIR=$DARWIN_SDK.sdku;;
- *) DARWIN_SDK_SUBDIR=$DARWIN_SDK.sdk;;
- esac
- # Since xCode moved to the App Store the SDKs have been 'sandboxed' into the Xcode.app folder.
- _bh_check_darwin_sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$DARWIN_SDK_SUBDIR $DARWIN_MIN_VERSION
- _bh_check_darwin_sdk /Developer/SDKs/MacOSX$DARWIN_SDK_SUBDIR $DARWIN_MIN_VERSION
- else
- # Since xCode moved to the App Store the SDKs have been 'sandboxed' into the Xcode.app folder.
- _bh_check_darwin_sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk $DARWIN_MIN_VERSION
- _bh_check_darwin_sdk /Developer/SDKs/MacOSX10.7.sdk $DARWIN_MIN_VERSION
- _bh_check_darwin_sdk /Developer/SDKs/MacOSX10.6.sdk $DARWIN_MIN_VERSION
- # NOTE: The 10.5.sdk on Lion is buggy and cannot build basic C++ programs
- #_bh_check_darwin_sdk /Developer/SDKs/MacOSX10.5.sdk $DARWIN_ARCH
- # NOTE: The 10.4.sdku is not available anymore and could not be tested.
- #_bh_check_darwin_sdk /Developer/SDKs/MacOSX10.4.sdku $DARWIN_ARCH
- fi
- if [ -z "$HOST_CFLAGS" ]; then
- local version="$(sw_vers -productVersion)"
- log "Generating $version-compatible binaries!"
- fi
- ;;
- *)
- if [ -z "$DARWIN_TOOLCHAIN" -o -z "$DARWIN_SYSROOT" ]; then
- dump "If you want to build Darwin binaries on a non-Darwin machine,"
- dump "Please define DARWIN_TOOLCHAIN to name it, and DARWIN_SYSROOT to point"
- dump "to the SDK. For example:"
- dump ""
- dump " DARWIN_TOOLCHAIN=\"i686-apple-darwin11\""
- dump " DARWIN_SYSROOT=\"~/darwin-cross/MacOSX10.7.sdk\""
- dump " export DARWIN_TOOLCHAIN DARWIN_SYSROOT"
- dump ""
- exit 1
- fi
- _bh_check_darwin_sdk $DARWIN_SYSROOT $DARWIN_MIN_VERSION
- _bh_try_host_prefix "$DARWIN_TOOLCHAIN" -m$(bh_tag_to_bits $1) --sysroot "$DARWIN_SYSROOT"
- if [ -z "$HOST_FULLPREFIX" ]; then
- dump "It looks like $DARWIN_TOOLCHAIN-gcc is not in your path, or does not work correctly!"
- exit 1
- fi
- dump "Using darwin cross-toolchain: ${HOST_FULLPREFIX}gcc"
- ;;
- esac
- ;;
-
- windows|windows-x86)
- case $BH_BUILD_OS in
- linux)
- # Prefer the prebuilt cross-compiler.
- _bh_try_host_fullprefix "$(dirname $ANDROID_NDK_ROOT)/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8" x86_64-w64-mingw32 -m32
- # We favor these because they are more recent, and because
- # we have a script to rebuild them from scratch. See
- # build-mingw64-toolchain.sh. Typically provided by the
- # 'mingw-w64' package on Debian and Ubuntu systems.
- _bh_try_host_prefix i686-w64-mingw32
- _bh_try_host_prefix x86_64-w64-mingw32 -m32
- # Special note for Fedora: this distribution used
- # to have a mingw32-gcc package that provided a 32-bit
- # only cross-toolchain named i686-pc-mingw32.
- # Later versions of the distro now provide a new package
- # named mingw-gcc which provides i686-w64-mingw32 and
- # x86_64-w64-mingw32 instead.
- if [ -z "$HOST_FULLPREFIX" ]; then
- dump "There is no Windows cross-compiler. Ensure that you"
- dump "have one of these installed and in your path:"
- dump " i686-w64-mingw32-gcc (see build-mingw64-toolchain.sh)"
- dump " x86_64-w64-mingw32-gcc (see build-mingw64-toolchain.sh)"
- dump ""
- exit 1
- fi
- if [ "$BH_HOST_CONFIG" != i686-w64-mingw32 ]; then
- panic "Unexpected value of BH_HOST_CONFIG: $BH_HOST_CONFIG"
- fi
- # If the 32-bit wrappers call a 64-bit toolchain, add flags
- # to default ld/as/windres to 32 bits.
- case "$HOST_FULLPREFIX" in
- *x86_64-w64-mingw32-)
- HOST_LDFLAGS="-m i386pe"
- HOST_ASFLAGS="--32"
- HOST_WINDRES_FLAGS="-F pe-i386"
- ;;
- *)
- ;;
- esac
- ;;
- *) panic "Sorry, this script only supports building windows binaries on Linux."
- ;;
- esac
- HOST_CFLAGS=$HOST_CFLAGS" -D__USE_MINGW_ANSI_STDIO=1"
- HOST_CXXFLAGS=$HOST_CXXFLAGS" -D__USE_MINGW_ANSI_STDIO=1"
- ;;
-
- windows-x86_64)
- case $BH_BUILD_OS in
- linux)
- # Prefer the prebuilt cross-compiler.
- # See comments above for windows-x86.
- _bh_try_host_fullprefix "$(dirname $ANDROID_NDK_ROOT)/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8" x86_64-w64-mingw32
- _bh_try_host_prefix x86_64-w64-mingw32
- if [ -z "$HOST_FULLPREFIX" ]; then
- dump "There is no Windows cross-compiler in your path. Ensure you"
- dump "have one of these installed and in your path:"
- dump " x86_64-w64-mingw32-gcc (see build-mingw64-toolchain.sh)"
- dump ""
- exit 1
- fi
- if [ "$BH_HOST_CONFIG" != x86_64-w64-mingw32 ]; then
- panic "Unexpected value of BH_HOST_CONFIG: $BH_HOST_CONFIG"
- fi
- ;;
-
- *) panic "Sorry, this script only supports building windows binaries on Linux."
- ;;
- esac
- HOST_CFLAGS=$HOST_CFLAGS" -D__USE_MINGW_ANSI_STDIO=1"
- HOST_CXXFLAGS=$HOST_CXXFLAGS" -D__USE_MINGW_ANSI_STDIO=1"
- ;;
- esac
-
- # Determine the default bitness of our compiler. It it doesn't match
- # HOST_BITS, tries to see if it supports -m32 or -m64 to change it.
- if ! _bh_check_compiler_bitness ${HOST_FULLPREFIX}gcc $BH_HOST_BITS; then
- local TRY_CFLAGS
- case $BH_HOST_BITS in
- 32) TRY_CFLAGS=-m32;;
- 64) TRY_CFLAGS=-m64;;
- esac
- if ! _bh_check_compiler_bitness ${HOST_FULLPREFIX}gcc $BH_HOST_BITS $TRY_CFLAGS; then
- panic "Can't find a way to generate $BH_HOST_BITS binaries with this compiler: ${HOST_FULLPREFIX}gcc"
- fi
- HOST_CFLAGS=$HOST_CFLAGS" "$TRY_CFLAGS
- HOST_CXXFLAGS=$HOST_CXXFLAGS" "$TRY_CFLAGS
- fi
-
- # We're going to generate a wrapper toolchain with the $HOST prefix
- # i.e. if $HOST is 'i686-linux-gnu', then we're going to generate a
- # wrapper toolchain named 'i686-linux-gnu-gcc' that will redirect
- # to whatever HOST_FULLPREFIX points to, with appropriate modifier
- # compiler/linker flags.
- #
- # This helps tremendously getting stuff to compile with the GCC
- # configure scripts.
- #
- run mkdir -p "$BH_WRAPPERS_DIR" &&
- run $NDK_BUILDTOOLS_PATH/gen-toolchain-wrapper.sh "$BH_WRAPPERS_DIR" \
- --src-prefix="$BH_HOST_CONFIG-" \
- --dst-prefix="$HOST_FULLPREFIX" \
- --cflags="$HOST_CFLAGS" \
- --cxxflags="$HOST_CXXFLAGS" \
- --ldflags="$HOST_LDFLAGS" \
- --asflags="$HOST_ASFLAGS" \
- --windres-flags="$HOST_WINDRES_FLAGS"
-}
-
-
-# Setup the build directory, i.e. a directory where all intermediate
-# files will be placed.
-#
-# $1: Build directory. Required.
-#
-# $2: Either 'preserve' or 'remove'. Indicates what to do of
-# existing files in the build directory, if any.
-#
-# $3: Either 'release' or 'debug'. Compilation mode.
-#
-bh_setup_build_dir ()
-{
- BH_BUILD_DIR="$1"
- if [ -z "$BH_BUILD_DIR" ]; then
- panic "bh_setup_build_dir received no build directory"
- fi
- mkdir -p "$BH_BUILD_DIR"
- fail_panic "Could not create build directory: $BH_BUILD_DIR"
-
- if [ "$_BH_OPTION_FORCE" ]; then
- rm -rf "$BH_BUILD_DIR"/*
- fi
-
- if [ "$_BH_OPTION_NO_STRIP" ]; then
- BH_BUILD_MODE=debug
- else
- BH_BUILD_MODE=release
- fi
-
- # The directory that will contain our toolchain wrappers
- BH_WRAPPERS_DIR=$BH_BUILD_DIR/toolchain-wrappers
- rm -rf "$BH_WRAPPERS_DIR" && mkdir "$BH_WRAPPERS_DIR"
- fail_panic "Could not create wrappers dir: $BH_WRAPPERS_DIR"
-
- # The directory that will contain our timestamps
- BH_STAMPS_DIR=$BH_BUILD_DIR/timestamps
- mkdir -p "$BH_STAMPS_DIR"
- fail_panic "Could not create timestamps dir"
-}
-
-# Call this before anything else to setup a few important variables that are
-# used consistently to build any host-specific binaries.
-#
-# $1: Host system name (e.g. linux-x86), this is the name of the host system
-# where the generated GCC binaries will run, not the current machine's
-# type (this one is in $ORIGINAL_HOST_TAG instead).
-#
-bh_setup_build_for_host ()
-{
- local HOST_VARNAME=$(dashes_to_underscores $1)
- local HOST_VAR=_BH_HOST_${HOST_VARNAME}
-
- # Determine the host configuration triplet in $HOST
- bh_set_host_tag $1
-
- # Note: since _bh_select_toolchain_for_host can change the value of
- # $BH_HOST_CONFIG, we need to save it in a variable to later get the
- # correct one when this function is called again.
- if [ -z "$(var_value ${HOST_VAR}_SETUP)" ]; then
- _bh_select_toolchain_for_host $1
- var_assign ${HOST_VAR}_CONFIG $BH_HOST_CONFIG
- var_assign ${HOST_VAR}_SETUP true
- else
- BH_HOST_CONFIG=$(var_value ${HOST_VAR}_CONFIG)
- fi
-}
-
-# This function is used to setup the build environment whenever we
-# generate host-specific binaries. You should call it before invoking
-# a configure script or make.
-#
-# It assume sthat bh_setup_build_for_host was called with the right
-# host system tag and wrappers directory.
-#
-bh_setup_host_env ()
-{
- CC=$BH_HOST_CONFIG-gcc
- CXX=$BH_HOST_CONFIG-g++
- LD=$BH_HOST_CONFIG-ld
- AR=$BH_HOST_CONFIG-ar
- AS=$BH_HOST_CONFIG-as
- RANLIB=$BH_HOST_CONFIG-ranlib
- NM=$BH_HOST_CONFIG-nm
- STRIP=$BH_HOST_CONFIG-strip
- STRINGS=$BH_HOST_CONFIG-strings
- export CC CXX LD AR AS RANLIB NM STRIP STRINGS
-
- CFLAGS=
- CXXFLAGS=
- LDFLAGS=
- case $BH_BUILD_MODE in
- release)
- CFLAGS="-O2 -Os -fomit-frame-pointer -s"
- CXXFLAGS=$CFLAGS
- ;;
- debug)
- CFLAGS="-O0 -g"
- CXXFLAGS=$CFLAGS
- ;;
- esac
- export CFLAGS CXXFLAGS LDFLAGS
-
- export PATH=$BH_WRAPPERS_DIR:$PATH
-}
-
-_bh_option_no_color ()
-{
- bh_set_color_mode off
-}
-
-# This function is used to register a few command-line options that
-# impact the build of host binaries. Call it before invoking
-# extract_parameters to add them automatically.
-#
-bh_register_options ()
-{
- BH_HOST_SYSTEMS="$BH_BUILD_TAG"
- register_var_option "--systems=<list>" BH_HOST_SYSTEMS "Build binaries that run on these systems."
-
- _BH_OPTION_FORCE=
- register_var_option "--force" _BH_OPTION_FORCE "Force rebuild."
-
- _BH_OPTION_NO_STRIP=
- register_var_option "--no-strip" _BH_OPTION_NO_STRIP "Don't strip generated binaries."
-
- register_option "--no-color" _bh_option_no_color "Don't output colored text."
-
- if [ "$HOST_OS" = darwin ]; then
- DARWIN_SDK_VERSION=
- register_var_option "--darwin-sdk-version=<version>" DARWIN_SDK "Select Darwin SDK version."
-
- DARWIN_MIN_VERSION=
- register_var_option "--darwin-min-version=<version>" DARWIN_MIN_VERSION "Select minimum OS X version of generated host toolchains."
- fi
-}
-
-# Execute a given command.
-#
-# NOTE: The command is run in its own sub-shell to avoid environment
-# contamination.
-#
-# $@: command
-bh_do ()
-{
- ("$@")
- fail_panic
-}
-
-# Return the build install directory of a given Python version
-#
-# $1: host system tag
-# $2: python version
-# The suffix of this has to match python_ndk_install_dir
-# as I package them from the build folder, substituting
-# the end part of python_build_install_dir matching
-# python_ndk_install_dir with nothing.
-python_build_install_dir ()
-{
- echo "$BH_BUILD_DIR/$1/install/host-tools"
-}
-
-# Same as python_build_install_dir, but for the final NDK installation
-# directory. Relative to $NDK_DIR.
-#
-# $1: host system tag
-python_ndk_install_dir ()
-{
- echo "host-tools"
-}
diff --git a/build/tools/dev-defaults.sh b/build/tools/dev-defaults.sh
deleted file mode 100644
index 7516f64..0000000
--- a/build/tools/dev-defaults.sh
+++ /dev/null
@@ -1,268 +0,0 @@
-# Default values used by several dev-scripts.
-#
-
-# This script is imported while building the NDK, while running the tests, and
-# when running make-standalone-toolchain.sh. Check if we have our own platforms
-# tree (as we would in an installed NDK) first, and fall back to prebuilts/ndk.
-PLATFORMS_DIR=$ANDROID_NDK_ROOT/platforms
-if [ ! -d "$PLATFORMS_DIR" ]; then
- PLATFORMS_DIR=$ANDROID_NDK_ROOT/../prebuilts/ndk/current/platforms
-fi
-API_LEVELS=$(ls $PLATFORMS_DIR | sed 's/android-//' | sort -n)
-
-# The latest API level is the last one in the list.
-LATEST_API_LEVEL=$(echo $API_LEVELS | awk '{ print $NF }')
-
-FIRST_API64_LEVEL=21
-
-# Default ABIs for the target prebuilt binaries.
-PREBUILT_ABIS="armeabi armeabi-v7a x86 mips arm64-v8a x86_64 mips64"
-
-# Location of the STLport sources, relative to the NDK root directory
-STLPORT_SUBDIR=sources/cxx-stl/stlport
-
-# Location of the GAbi++ sources, relative to the NDK root directory
-GABIXX_SUBDIR=sources/cxx-stl/gabi++
-
-# Location of the GNU libstdc++ headers and libraries, relative to the NDK
-# root directory.
-GNUSTL_SUBDIR=sources/cxx-stl/gnu-libstdc++
-
-# Location of the LLVM libc++ headers and libraries, relative to the NDK
-# root directory.
-LIBCXX_SUBDIR=sources/cxx-stl/llvm-libc++
-
-# Location of the LLVM libc++abi headers, relative to the NDK # root directory.
-LIBCXXABI_SUBDIR=sources/cxx-stl/llvm-libc++abi/libcxxabi
-
-# Location of the gccunwind sources, relative to the NDK root directory
-GCCUNWIND_SUBDIR=sources/android/gccunwind
-
-# Location of the support sources for libc++, relative to the NDK root directory
-SUPPORT_SUBDIR=sources/android/support
-
-# The date to use when downloading toolchain sources from AOSP servers
-# Leave it empty for tip of tree.
-TOOLCHAIN_GIT_DATE=now
-
-# The space-separated list of all GCC versions we support in this NDK
-DEFAULT_GCC_VERSION_LIST="4.9"
-
-DEFAULT_GCC32_VERSION=4.9
-DEFAULT_GCC64_VERSION=4.9
-FIRST_GCC32_VERSION=4.9
-FIRST_GCC64_VERSION=4.9
-DEFAULT_LLVM_GCC32_VERSION=4.9
-DEFAULT_LLVM_GCC64_VERSION=4.9
-
-DEFAULT_BINUTILS_VERSION=2.27
-DEFAULT_MPFR_VERSION=3.1.1
-DEFAULT_GMP_VERSION=5.0.5
-DEFAULT_MPC_VERSION=1.0.1
-DEFAULT_CLOOG_VERSION=0.18.0
-DEFAULT_ISL_VERSION=0.11.1
-DEFAULT_PPL_VERSION=1.0
-DEFAULT_PYTHON_VERSION=2.7.5
-DEFAULT_PERL_VERSION=5.16.2
-
-# The list of default CPU architectures we support
-DEFAULT_ARCHS="arm x86 arm64 x86_64"
-
-# Default toolchain names and prefix
-#
-# This is used by get_default_toolchain_name_for_arch and get_default_toolchain_prefix_for_arch
-# defined below
-DEFAULT_ARCH_TOOLCHAIN_NAME_arm=arm-linux-androideabi
-DEFAULT_ARCH_TOOLCHAIN_PREFIX_arm=arm-linux-androideabi
-
-DEFAULT_ARCH_TOOLCHAIN_NAME_arm64=aarch64-linux-android
-DEFAULT_ARCH_TOOLCHAIN_PREFIX_arm64=aarch64-linux-android
-
-DEFAULT_ARCH_TOOLCHAIN_NAME_x86=x86
-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
-
-# The build number of clang used to build pieces of the NDK (like platforms).
-DEFAULT_LLVM_VERSION="2455903"
-
-# The default URL to download the LLVM tar archive
-DEFAULT_LLVM_URL="http://llvm.org/releases"
-
-# The list of default host NDK systems we support
-DEFAULT_SYSTEMS="linux-x86 windows darwin-x86"
-
-# The default issue tracker URL
-DEFAULT_ISSUE_TRACKER_URL="http://source.android.com/source/report-bugs.html"
-
-# Return the default gcc version for a given architecture
-# $1: Architecture name (e.g. 'arm')
-# Out: default arch-specific gcc version
-get_default_gcc_version_for_arch ()
-{
- case $1 in
- *64) echo $DEFAULT_GCC64_VERSION ;;
- *) echo $DEFAULT_GCC32_VERSION ;;
- esac
-}
-
-# Return the first gcc version for a given architecture
-# $1: Architecture name (e.g. 'arm')
-# Out: default arch-specific gcc version
-get_first_gcc_version_for_arch ()
-{
- case $1 in
- *64) echo $FIRST_GCC64_VERSION ;;
- *) echo $FIRST_GCC32_VERSION ;;
- esac
-}
-
-# Return default NDK ABI for a given architecture name
-# $1: Architecture name
-# Out: ABI name
-get_default_abi_for_arch ()
-{
- local RET
- case $1 in
- arm)
- RET="armeabi"
- ;;
- arm64)
- RET="arm64-v8a"
- ;;
- x86|x86_64|mips|mips64)
- RET="$1"
- ;;
- mips32r6)
- RET="mips"
- ;;
- *)
- 2> echo "ERROR: Unsupported architecture name: $1, use one of: arm arm64 x86 x86_64 mips mips64"
- exit 1
- ;;
- esac
- echo "$RET"
-}
-
-
-# Retrieve the list of default ABIs supported by a given architecture
-# $1: Architecture name
-# Out: space-separated list of ABI names
-get_default_abis_for_arch ()
-{
- local RET
- case $1 in
- arm)
- RET="armeabi armeabi-v7a"
- ;;
- arm64)
- RET="arm64-v8a"
- ;;
- x86|x86_64|mips|mips32r6|mips64)
- RET="$1"
- ;;
- *)
- 2> echo "ERROR: Unsupported architecture name: $1, use one of: arm arm64 x86 x86_64 mips mips64"
- exit 1
- ;;
- esac
- echo "$RET"
-}
-
-# Return toolchain name for given architecture and GCC version
-# $1: Architecture name (e.g. 'arm')
-# $2: optional, GCC version (e.g. '4.8')
-# Out: default arch-specific toolchain name (e.g. 'arm-linux-androideabi-$GCC_VERSION')
-# Return empty for unknown arch
-get_toolchain_name_for_arch ()
-{
- if [ ! -z "$2" ] ; then
- eval echo \"\${DEFAULT_ARCH_TOOLCHAIN_NAME_$1}-$2\"
- else
- eval echo \"\${DEFAULT_ARCH_TOOLCHAIN_NAME_$1}\"
- fi
-}
-
-# Return the default toolchain name for a given architecture
-# $1: Architecture name (e.g. 'arm')
-# Out: default arch-specific toolchain name (e.g. 'arm-linux-androideabi-$GCCVER')
-# Return empty for unknown arch
-get_default_toolchain_name_for_arch ()
-{
- local GCCVER=$(get_default_gcc_version_for_arch $1)
- eval echo \"\${DEFAULT_ARCH_TOOLCHAIN_NAME_$1}-$GCCVER\"
-}
-
-# Return the default toolchain program prefix for a given architecture
-# $1: Architecture name
-# Out: default arch-specific toolchain prefix (e.g. arm-linux-androideabi)
-# Return empty for unknown arch
-get_default_toolchain_prefix_for_arch ()
-{
- eval echo "\$DEFAULT_ARCH_TOOLCHAIN_PREFIX_$1"
-}
-
-# Get the list of all toolchain names for a given architecture
-# $1: architecture (e.g. 'arm')
-# $2: comma separated versions (optional)
-# Out: list of toolchain names for this arch (e.g. arm-linux-androideabi-4.8 arm-linux-androideabi-4.9)
-# Return empty for unknown arch
-get_toolchain_name_list_for_arch ()
-{
- local PREFIX VERSION RET ADD FIRST_GCC_VERSION VERSIONS
- PREFIX=$(eval echo \"\$DEFAULT_ARCH_TOOLCHAIN_NAME_$1\")
- if [ -z "$PREFIX" ]; then
- return 0
- fi
- RET=""
- FIRST_GCC_VERSION=$(get_first_gcc_version_for_arch $1)
- ADD=""
- VERSIONS=$(commas_to_spaces $2)
- if [ -z "$VERSIONS" ]; then
- VERSIONS=$DEFAULT_GCC_VERSION_LIST
- else
- ADD="yes" # include everything we passed explicitly
- fi
- for VERSION in $VERSIONS; do
- if [ -z "$ADD" -a "$VERSION" = "$FIRST_GCC_VERSION" ]; then
- ADD="yes"
- fi
- if [ -z "$ADD" ]; then
- continue
- fi
- RET=$RET" $PREFIX-$VERSION"
- done
- RET=${RET## }
- echo "$RET"
-}
-
-# Return the binutils version to be used by default when
-# building a given version of GCC. This is needed to ensure
-# we use binutils-2.19 when building gcc-4.4.3 for ARM and x86,
-# and later binutils in other cases (mips, or gcc-4.6+).
-#
-# Note that technically, we could use latest binutils for all versions of
-# GCC, however, in NDK r7, we did build GCC 4.4.3 with binutils-2.20.1
-# and this resulted in weird C++ debugging bugs. For NDK r7b and higher,
-# binutils was reverted to 2.19, to ensure at least
-# feature/bug compatibility.
-#
-# $1: toolchain with version number (e.g. 'arm-linux-androideabi-4.8')
-#
-get_default_binutils_version_for_gcc ()
-{
- echo "$DEFAULT_BINUTILS_VERSION"
-}
-
-# Return the binutils version to be used by default when
-# building a given version of llvm. For llvm-3.4 or later,
-# we use binutils-2.23+ to ensure the LLVMgold.so could be
-# built properly. For llvm-3.3, we use binutils-2.21 as default.
-#
-# $1: toolchain with version numer (e.g. 'llvm-3.3')
-#
-get_default_binutils_version_for_llvm ()
-{
- echo "$DEFAULT_BINUTILS_VERSION"
-}
diff --git a/build/tools/gen-toolchain-wrapper.sh b/build/tools/gen-toolchain-wrapper.sh
deleted file mode 100755
index d4cc7f3..0000000
--- a/build/tools/gen-toolchain-wrapper.sh
+++ /dev/null
@@ -1,179 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2012 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.
-#
-# This shell script is used to rebuild the gcc and toolchain binaries
-# for the Android NDK.
-#
-
-PROGDIR=$(dirname "$0")
-. "$PROGDIR/prebuilt-common.sh"
-
-PROGRAM_PARAMETERS="<dst-dir>"
-PROGRAM_DESCRIPTION="\
-This script allows you to generate a 'wrapper toolchain', i.e. a set of
-simple scripts that act as toolchain binaries (e.g. my-cc, my-c++, my-ld,
-etc...) but call another installed toolchain instead, possibly with additional
-command-line options.
-
-For example, imagine we want a toolchain that generates 32-bit binaries while
-running on a 64-bit system, we could call this script as:
-
- $PROGNAME --cflags="-m32" --cxxflags="-m32" --ldflags="-m32" /tmp/my-toolchain
-
-Then, this will create programs like:
-
- /tmp/my-toolchain/my-cc
- /tmp/my-toolchain/my-gcc
- /tmp/my-toolchain/my-c++
- /tmp/my-toolchain/my-g++
- /tmp/my-toolchain/my-ld
- ...
-
-Where the compilers and linkers will add the -m32 flag to the command-line before
-calling the host version of 'cc', 'gcc', etc...
-
-Generally speaking:
-
- - The 'destination toolchain' is the one that will be called by the
- generated wrapper script. It is identified by a 'destination prefix'
- (e.g. 'x86_64-linux-gnu-', note the dash at the end).
-
- If is empty by default, but can be changed with --dst-prefix=<prefix>
-
- - The 'source prefix' is the prefix added to the generated toolchain scripts,
- it is 'my-' by default, but can be changed with --src-prefix=<prefix>
-
- - You can use --cflags, --cxxflags, --ldflags, etc... to add extra
- command-line flags for the generated compiler, linker, etc.. scripts
-
-"
-
-DEFAULT_SRC_PREFIX="my-"
-DEFAULT_DST_PREFIX=""
-
-SRC_PREFIX=$DEFAULT_SRC_PREFIX
-register_var_option "--src-prefix=<prefix>" SRC_PREFIX "Set source toolchain prefix"
-
-DST_PREFIX=$DEFAULT_DST_PREFIX
-register_var_option "--dst-prefix=<prefix>" DST_PREFIX "Set destination toolchain prefix"
-
-EXTRA_CFLAGS=
-register_var_option "--cflags=<options>" EXTRA_CFLAGS "Add extra C compiler flags"
-
-EXTRA_CXXFLAGS=
-register_var_option "--cxxflags=<options>" EXTRA_CXXFLAGS "Add extra C++ compiler flags"
-
-EXTRA_LDFLAGS=
-register_var_option "--ldflags=<options>" EXTRA_LDFLAGS "Add extra linker flags"
-
-EXTRA_ASFLAGS=
-register_var_option "--asflags=<options>" EXTRA_ASFLAGS "Add extra assembler flags"
-
-EXTRA_ARFLAGS=
-register_var_option "--arflags=<options>" EXTRA_ARFLAGS "Add extra archiver flags"
-
-EXTRA_WINDRES_FLAGS=
-register_var_option "--windres-flags=<options>" EXTRA_WINDRES_FLAGS "Add extra windres flags"
-
-PROGRAMS="cc gcc c++ g++ cpp as ld ar ranlib strip strings nm objdump dlltool windres"
-register_var_option "--programs=<list>" PROGRAMS "List of programs to generate wrapper for"
-
-extract_parameters "$@"
-
-PROGRAMS=$(commas_to_spaces "$PROGRAMS")
-if [ -z "$PROGRAMS" ]; then
- panic "Empty program list, nothing to do!"
-fi
-
-DST_DIR="$PARAMETERS"
-if [ -z "$DST_DIR" ]; then
- panic "Please provide a destination directory as a parameter! See --help for details."
-fi
-
-mkdir -p "$DST_DIR"
-fail_panic "Could not create destination directory: $DST_DIR"
-
-# Check if mingw compiler has dlfcn.h
-# $1: mignw compiler
-#
-mingw_has_dlfcn_h ()
-{
- local CC="$1"
-
- if [ ! -f "$CC" ]; then
- # compiler not found
- return 1
- fi
- "$CC" -xc /dev/null -dM -E | grep -q MINGW
- if [ $? != 0 ]; then
- # not a mingw compiler
- return 1
- fi
-
- "$CC" -xc -c /dev/null -include dlfcn.h -o /dev/null > /dev/null 2>&1
-}
-
-# Generate a small wrapper program
-#
-# $1: program name, without any prefix (e.g. gcc, g++, ar, etc..)
-# $2: source prefix (e.g. 'i586-mingw32msvc-')
-# $3: destination prefix (e.g. 'i586-px-mingw32msvc-')
-# $4: destination directory for the generate program
-#
-gen_wrapper_program ()
-{
- local PROG="$1"
- local SRC_PREFIX="$2"
- local DST_PREFIX="$3"
- local DST_FILE="$4/${SRC_PREFIX}$PROG"
- local FLAGS=""
- local LDFLAGS=""
-
- case $PROG in
- cc|gcc|cpp)
- FLAGS=$FLAGS" $EXTRA_CFLAGS"
- if mingw_has_dlfcn_h ${DST_PREFIX}$PROG; then
- LDFLAGS="-ldl"
- fi
- ;;
- c++|g++)
- FLAGS=$FLAGS" $EXTRA_CXXFLAGS"
- if mingw_has_dlfcn_h ${DST_PREFIX}$PROG; then
- LDFLAGS="-ldl"
- fi
- ;;
- ar) FLAGS=$FLAGS" $EXTRA_ARFLAGS";;
- as) FLAGS=$FLAGS" $EXTRA_ASFLAGS";;
- ld|ld.bfd|ld.gold) FLAGS=$FLAGS" $EXTRA_LDFLAGS";;
- windres) FLAGS=$FLAGS" $EXTRA_WINDRES_FLAGS";;
- esac
-
- cat > "$DST_FILE" << EOF
-#!/bin/sh
-# Auto-generated, do not edit
-${DST_PREFIX}$PROG $FLAGS "\$@" $LDFLAGS
-EOF
- chmod +x "$DST_FILE"
- log "Generating: ${SRC_PREFIX}$PROG"
-}
-
-log "Generating toolchain wrappers in: $DST_DIR"
-
-for PROG in $PROGRAMS; do
- gen_wrapper_program $PROG "$SRC_PREFIX" "$DST_PREFIX" "$DST_DIR"
-done
-
-log "Done!"
diff --git a/build/tools/ndk-common.sh b/build/tools/ndk-common.sh
deleted file mode 100644
index f3415f3..0000000
--- a/build/tools/ndk-common.sh
+++ /dev/null
@@ -1,803 +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.
-#
-
-# A collection of shell function definitions used by various build scripts
-# in the Android NDK (Native Development Kit)
-#
-
-# Get current script name into PROGNAME
-PROGNAME=`basename $0`
-
-if [ -z "$TMPDIR" ]; then
- export TMPDIR=/tmp/ndk-$USER
-fi
-
-OS=`uname -s`
-if [ "$OS" == "Darwin" -a -z "$MACOSX_DEPLOYMENT_TARGET" ]; then
- export MACOSX_DEPLOYMENT_TARGET="10.9"
-fi
-
-# Find the Android NDK root, assuming we are invoked from a script
-# within its directory structure.
-#
-# $1: Variable name that will receive the path
-# $2: Path of invoking script
-find_ndk_root ()
-{
- # Try to auto-detect the NDK root by walking up the directory
- # path to the current script.
- local PROGDIR="`dirname \"$2\"`"
- while [ -n "1" ] ; do
- if [ -d "$PROGDIR/build/core" ] ; then
- break
- fi
- if [ -z "$PROGDIR" -o "$PROGDIR" = '/' ] ; then
- return 1
- fi
- PROGDIR="`cd \"$PROGDIR/..\" && pwd`"
- done
- eval $1="$PROGDIR"
-}
-
-# Setup default ANDROID_NDK_ROOT and verify.
-if [ -z "$ANDROID_NDK_ROOT" ] ; then
- find_ndk_root ANDROID_NDK_ROOT "$0"
- if [ $? != 0 ]; then
- echo "Please define ANDROID_NDK_ROOT to point to the root of your"
- echo "Android NDK installation."
- exit 1
- fi
-fi
-
-echo "$ANDROID_NDK_ROOT" | grep -q -e " "
-if [ $? = 0 ] ; then
- echo "ERROR: The Android NDK installation path contains a space !"
- echo "Please install to a different location."
- exit 1
-fi
-
-if [ ! -d $ANDROID_NDK_ROOT ] ; then
- echo "ERROR: Your ANDROID_NDK_ROOT variable does not point to a directory."
- echo "ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT"
- exit 1
-fi
-
-if [ ! -f $ANDROID_NDK_ROOT/build/tools/ndk-common.sh ] ; then
- echo "ERROR: Your ANDROID_NDK_ROOT does not contain a valid NDK build system."
- echo "ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT"
- exit 1
-fi
-
-## Use DRYRUN to find out top-level commands.
-DRYRUN=${DRYRUN-no}
-
-## Logging support
-##
-VERBOSE=${VERBOSE-yes}
-
-dump ()
-{
- echo "$@"
-}
-
-dump_n ()
-{
- printf %s "$@"
-}
-
-log ()
-{
- if [ "$VERBOSE" = "yes" ] ; then
- echo "$@"
- fi
-}
-
-log_n ()
-{
- if [ "$VERBOSE" = "yes" ] ; then
- printf %s "$@"
- fi
-}
-
-run ()
-{
- if [ "$DRYRUN" = "yes" ] ; then
- echo "## SKIP COMMAND: $@"
- elif [ "$VERBOSE" = "yes" ] ; then
- echo "## COMMAND: $@"
- "$@" 2>&1
- else
- "$@" > /dev/null 2>&1
- fi
-}
-
-panic ()
-{
- dump "ERROR: $@"
- exit 1
-}
-
-fail_panic ()
-{
- if [ $? != 0 ] ; then
- dump "ERROR: $@"
- exit 1
- fi
-}
-
-fail_warning ()
-{
- if [ $? != 0 ] ; then
- dump "WARNING: $@"
- fi
-}
-
-
-## Utilities
-##
-
-# Return the value of a given named variable
-# $1: variable name
-#
-# example:
-# FOO=BAR
-# BAR=ZOO
-# echo `var_value $FOO`
-# will print 'ZOO'
-#
-var_value ()
-{
- # find a better way to do that ?
- eval echo "$`echo $1`"
-}
-
-# convert to uppercase
-# assumes tr is installed on the platform ?
-#
-to_uppercase ()
-{
- echo $1 | tr "[:lower:]" "[:upper:]"
-}
-
-## First, we need to detect the HOST CPU, because proper HOST_ARCH detection
-## requires platform-specific tricks.
-##
-HOST_EXE=""
-HOST_OS=`uname -s`
-HOST_ARCH=x86_64
-case "$HOST_OS" in
- Darwin)
- HOST_OS=darwin
- ;;
- Linux)
- # note that building 32-bit binaries on x86_64 is handled later
- HOST_OS=linux
- ;;
- FreeBsd) # note: this is not tested
- HOST_OS=freebsd
- ;;
- CYGWIN*|*_NT-*)
- HOST_OS=windows
- HOST_EXE=.exe
- HOST_ARCH=`uname -m`
- if [ "x$OSTYPE" = xcygwin ] ; then
- HOST_OS=cygwin
- fi
- ;;
-esac
-
-log "HOST_OS=$HOST_OS"
-log "HOST_EXE=$HOST_EXE"
-log "HOST_ARCH=$HOST_ARCH"
-
-# at this point, the supported values for HOST_ARCH are:
-# x86
-# x86_64
-#
-# other values may be possible but haven't been tested
-#
-# at this point, the value of HOST_OS should be one of the following:
-# linux
-# darwin
-# windows (MSys)
-# cygwin
-#
-# Note that cygwin is treated as a special case because it behaves very differently
-# for a few things. Other values may be possible but have not been tested
-#
-
-# define HOST_TAG as a unique tag used to identify both the host OS and CPU
-# supported values are:
-#
-# linux-x86_64
-# darwin-x86_64
-# windows
-# windows-x86_64
-#
-# other values are possible but were not tested.
-#
-compute_host_tag ()
-{
- HOST_TAG=${HOST_OS}-${HOST_ARCH}
- # Special case for windows-x86 => windows
- case $HOST_TAG in
- windows-x86|cygwin-x86)
- HOST_TAG="windows"
- ;;
- cygwin-x86_64)
- HOST_TAG="windows-x86_64"
- ;;
- esac
- log "HOST_TAG=$HOST_TAG"
-}
-
-compute_host_tag
-
-# Compute the number of host CPU cores an HOST_NUM_CPUS
-#
-case "$HOST_OS" in
- linux)
- HOST_NUM_CPUS=`cat /proc/cpuinfo | grep processor | wc -l`
- ;;
- darwin|freebsd)
- HOST_NUM_CPUS=`sysctl -n hw.ncpu`
- ;;
- windows|cygwin)
- HOST_NUM_CPUS=$NUMBER_OF_PROCESSORS
- ;;
- *) # let's play safe here
- HOST_NUM_CPUS=1
-esac
-
-log "HOST_NUM_CPUS=$HOST_NUM_CPUS"
-
-# If BUILD_NUM_CPUS is not already defined in your environment,
-# define it as the double of HOST_NUM_CPUS. This is used to
-# run Make commands in parralles, as in 'make -j$BUILD_NUM_CPUS'
-#
-if [ -z "$BUILD_NUM_CPUS" ] ; then
- BUILD_NUM_CPUS=`expr $HOST_NUM_CPUS \* 2`
-fi
-
-log "BUILD_NUM_CPUS=$BUILD_NUM_CPUS"
-
-
-## HOST TOOLCHAIN SUPPORT
-##
-
-# force the generation of 32-bit binaries on 64-bit systems
-#
-FORCE_32BIT=no
-force_32bit_binaries ()
-{
- if [ "$HOST_ARCH" = x86_64 ] ; then
- log "Forcing generation of 32-bit host binaries on $HOST_ARCH"
- FORCE_32BIT=yes
- HOST_ARCH=x86
- log "HOST_ARCH=$HOST_ARCH"
- compute_host_tag
- fi
-}
-
-# On Windows, cygwin binaries will be generated by default, but
-# you can force mingw ones that do not link to cygwin.dll if you
-# call this function.
-#
-disable_cygwin ()
-{
- if [ $HOST_OS = cygwin ] ; then
- log "Disabling cygwin binaries generation"
- CFLAGS="$CFLAGS -mno-cygwin"
- LDFLAGS="$LDFLAGS -mno-cygwin"
- HOST_OS=windows
- compute_host_tag
- fi
-}
-
-# Various probes are going to need to run a small C program
-mkdir -p $TMPDIR/tmp/tests
-
-TMPC=$TMPDIR/tmp/tests/test-$$.c
-TMPO=$TMPDIR/tmp/tests/test-$$.o
-TMPE=$TMPDIR/tmp/tests/test-$$$EXE
-TMPL=$TMPDIR/tmp/tests/test-$$.log
-
-# cleanup temporary files
-clean_temp ()
-{
- rm -f $TMPC $TMPO $TMPL $TMPE
-}
-
-# cleanup temp files then exit with an error
-clean_exit ()
-{
- clean_temp
- exit 1
-}
-
-# this function will setup the compiler and linker and check that they work as advertised
-# note that you should call 'force_32bit_binaries' before this one if you want it to
-# generate 32-bit binaries on 64-bit systems (that support it).
-#
-setup_toolchain ()
-{
- if [ -z "$CC" ] ; then
- CC=gcc
- fi
- if [ -z "$CXX" ] ; then
- CXX=g++
- fi
- if [ -z "$CXXFLAGS" ] ; then
- CXXFLAGS="$CFLAGS"
- fi
- if [ -z "$LD" ] ; then
- LD="$CC"
- fi
-
- log "Using '$CC' as the C compiler"
-
- # check that we can compile a trivial C program with this compiler
- mkdir -p $(dirname "$TMPC")
- cat > $TMPC <<EOF
-int main(void) {}
-EOF
-
- if [ "$FORCE_32BIT" = yes ] ; then
- CC="$CC -m32"
- CXX="$CXX -m32"
- LD="$LD -m32"
- compile
- if [ $? != 0 ] ; then
- # sometimes, we need to also tell the assembler to generate 32-bit binaries
- # this is highly dependent on your GCC installation (and no, we can't set
- # this flag all the time)
- CFLAGS="$CFLAGS -Wa,--32"
- compile
- fi
- fi
-
- compile
- if [ $? != 0 ] ; then
- echo "your C compiler doesn't seem to work:"
- cat $TMPL
- clean_exit
- fi
- log "CC : compiler check ok ($CC)"
-
- # check that we can link the trivial program into an executable
- link
- if [ $? != 0 ] ; then
- OLD_LD="$LD"
- LD="$CC"
- compile
- link
- if [ $? != 0 ] ; then
- LD="$OLD_LD"
- echo "your linker doesn't seem to work:"
- cat $TMPL
- clean_exit
- fi
- fi
- log "Using '$LD' as the linker"
- log "LD : linker check ok ($LD)"
-
- # check the C++ compiler
- log "Using '$CXX' as the C++ compiler"
-
- cat > $TMPC <<EOF
-#include <iostream>
-using namespace std;
-int main()
-{
- cout << "Hello World!" << endl;
- return 0;
-}
-EOF
-
- compile_cpp
- if [ $? != 0 ] ; then
- echo "your C++ compiler doesn't seem to work"
- cat $TMPL
- clean_exit
- fi
-
- log "CXX : C++ compiler check ok ($CXX)"
-
- # XXX: TODO perform AR checks
- AR=ar
- ARFLAGS=
-}
-
-# try to compile the current source file in $TMPC into an object
-# stores the error log into $TMPL
-#
-compile ()
-{
- log "Object : $CC -o $TMPO -c $CFLAGS $TMPC"
- $CC -o $TMPO -c $CFLAGS $TMPC 2> $TMPL
-}
-
-compile_cpp ()
-{
- log "Object : $CXX -o $TMPO -c $CXXFLAGS $TMPC"
- $CXX -o $TMPO -c $CXXFLAGS $TMPC 2> $TMPL
-}
-
-# try to link the recently built file into an executable. error log in $TMPL
-#
-link()
-{
- log "Link : $LD -o $TMPE $TMPO $LDFLAGS"
- $LD -o $TMPE $TMPO $LDFLAGS 2> $TMPL
-}
-
-# run a command
-#
-execute()
-{
- log "Running: $*"
- $*
-}
-
-# perform a simple compile / link / run of the source file in $TMPC
-compile_exec_run()
-{
- log "RunExec : $CC -o $TMPE $CFLAGS $TMPC"
- compile
- if [ $? != 0 ] ; then
- echo "Failure to compile test program"
- cat $TMPC
- cat $TMPL
- clean_exit
- fi
- link
- if [ $? != 0 ] ; then
- echo "Failure to link test program"
- cat $TMPC
- echo "------"
- cat $TMPL
- clean_exit
- fi
- $TMPE
-}
-
-pattern_match ()
-{
- echo "$2" | grep -q -E -e "$1"
-}
-
-# Let's check that we have a working md5sum here
-check_md5sum ()
-{
- A_MD5=`echo "A" | md5sum | cut -d' ' -f1`
- if [ "$A_MD5" != "bf072e9119077b4e76437a93986787ef" ] ; then
- echo "Please install md5sum on this machine"
- exit 2
- fi
-}
-
-# Find if a given shell program is available.
-# We need to take care of the fact that the 'which <foo>' command
-# may return either an empty string (Linux) or something like
-# "no <foo> in ..." (Darwin). Also, we need to redirect stderr
-# to /dev/null for Cygwin
-#
-# $1: variable name
-# $2: program name
-#
-# Result: set $1 to the full path of the corresponding command
-# or to the empty/undefined string if not available
-#
-find_program ()
-{
- local PROG RET
- PROG=`which $2 2>/dev/null`
- RET=$?
- if [ $RET != 0 ]; then
- PROG=
- fi
- eval $1=\"$PROG\"
- return $RET
-}
-
-prepare_download ()
-{
- find_program CMD_WGET wget
- find_program CMD_CURL curl
- find_program CMD_SCRP scp
-}
-
-find_pbzip2 ()
-{
- if [ -z "$_PBZIP2_initialized" ] ; then
- find_program PBZIP2 pbzip2
- _PBZIP2_initialized="yes"
- fi
-}
-
-# Download a file with either 'curl', 'wget' or 'scp'
-#
-# $1: source URL (e.g. http://foo.com, ssh://blah, /some/path)
-# $2: target file
-download_file ()
-{
- # Is this HTTP, HTTPS or FTP ?
- if pattern_match "^(http|https|ftp):.*" "$1"; then
- if [ -n "$CMD_WGET" ] ; then
- run $CMD_WGET -O $2 $1
- elif [ -n "$CMD_CURL" ] ; then
- run $CMD_CURL -o $2 $1
- else
- echo "Please install wget or curl on this machine"
- exit 1
- fi
- return
- fi
-
- # Is this SSH ?
- # Accept both ssh://<path> or <machine>:<path>
- #
- if pattern_match "^(ssh|[^:]+):.*" "$1"; then
- if [ -n "$CMD_SCP" ] ; then
- scp_src=`echo $1 | sed -e s%ssh://%%g`
- run $CMD_SCP $scp_src $2
- else
- echo "Please install scp on this machine"
- exit 1
- fi
- return
- fi
-
- # Is this a file copy ?
- # Accept both file://<path> or /<path>
- #
- if pattern_match "^(file://|/).*" "$1"; then
- cp_src=`echo $1 | sed -e s%^file://%%g`
- run cp -f $cp_src $2
- return
- fi
-}
-
-# Form the relative path between from one abs path to another
-#
-# $1 : start path
-# $2 : end path
-#
-# From:
-# http://stackoverflow.com/questions/2564634/bash-convert-absolute-path-into-relative-path-given-a-current-directory
-relpath ()
-{
- [ $# -ge 1 ] && [ $# -le 2 ] || return 1
- current="${2:+"$1"}"
- target="${2:-"$1"}"
- [ "$target" != . ] || target=/
- target="/${target##/}"
- [ "$current" != . ] || current=/
- current="${current:="/"}"
- current="/${current##/}"
- appendix="${target##/}"
- relative=''
- while appendix="${target#"$current"/}"
- [ "$current" != '/' ] && [ "$appendix" = "$target" ]; do
- if [ "$current" = "$appendix" ]; then
- relative="${relative:-.}"
- echo "${relative#/}"
- return 0
- fi
- current="${current%/*}"
- relative="$relative${relative:+/}.."
- done
- relative="$relative${relative:+${appendix:+/}}${appendix#/}"
- echo "$relative"
-}
-
-# Pack a given archive
-#
-# $1: archive file path (including extension)
-# $2: source directory for archive content
-# $3+: list of files (including patterns), all if empty
-pack_archive ()
-{
- local ARCHIVE="$1"
- local SRCDIR="$2"
- local SRCFILES
- local TARFLAGS ZIPFLAGS
- shift; shift;
- if [ -z "$1" ] ; then
- SRCFILES="*"
- else
- SRCFILES="$@"
- fi
- if [ "`basename $ARCHIVE`" = "$ARCHIVE" ] ; then
- ARCHIVE="`pwd`/$ARCHIVE"
- fi
- mkdir -p `dirname $ARCHIVE`
-
- TARFLAGS="--exclude='*.py[cod]' --exclude='*.swp' --exclude=.git --exclude=.gitignore -cf"
- ZIPFLAGS="-x *.git* -x *.pyc -x *.pyo -0qr"
- # Ensure symlinks are stored as is in zip files. for toolchains
- # this can save up to 7 MB in the size of the final archive
- #ZIPFLAGS="$ZIPFLAGS --symlinks"
- case "$ARCHIVE" in
- *.zip)
- rm -f $ARCHIVE
- (cd $SRCDIR && run zip $ZIPFLAGS "$ARCHIVE" $SRCFILES)
- ;;
- *.tar.bz2)
- find_pbzip2
- if [ -n "$PBZIP2" ] ; then
- (cd $SRCDIR && run tar --use-compress-prog=pbzip2 $TARFLAGS "$ARCHIVE" $SRCFILES)
- else
- (cd $SRCDIR && run tar -j $TARFLAGS "$ARCHIVE" $SRCFILES)
- fi
- ;;
- *)
- panic "Unsupported archive format: $ARCHIVE"
- ;;
- esac
-}
-
-# Copy a directory, create target location if needed
-#
-# $1: source directory
-# $2: target directory location
-#
-copy_directory ()
-{
- local SRCDIR="$1"
- local DSTDIR="$2"
- if [ ! -d "$SRCDIR" ] ; then
- panic "Can't copy from non-directory: $SRCDIR"
- fi
- log "Copying directory: "
- log " from $SRCDIR"
- log " to $DSTDIR"
- mkdir -p "$DSTDIR" && (cd "$SRCDIR" && 2>/dev/null tar cf - *) | (tar xf - -C "$DSTDIR")
- fail_panic "Cannot copy to directory: $DSTDIR"
-}
-
-# Move a directory, create target location if needed
-#
-# $1: source directory
-# $2: target directory location
-#
-move_directory ()
-{
- local SRCDIR="$1"
- local DSTDIR="$2"
- if [ ! -d "$SRCDIR" ] ; then
- panic "Can't move from non-directory: $SRCDIR"
- fi
- log "Move directory: "
- log " from $SRCDIR"
- log " to $DSTDIR"
- mkdir -p "$DSTDIR" && (mv "$SRCDIR"/* "$DSTDIR")
- fail_panic "Cannot move to directory: $DSTDIR"
-}
-
-# This is the same than copy_directory(), but symlinks will be replaced
-# by the file they actually point to instead.
-copy_directory_nolinks ()
-{
- local SRCDIR="$1"
- local DSTDIR="$2"
- if [ ! -d "$SRCDIR" ] ; then
- panic "Can't copy from non-directory: $SRCDIR"
- fi
- log "Copying directory (without symlinks): "
- log " from $SRCDIR"
- log " to $DSTDIR"
- mkdir -p "$DSTDIR" && (cd "$SRCDIR" && tar chf - *) | (tar xf - -C "$DSTDIR")
- fail_panic "Cannot copy to directory: $DSTDIR"
-}
-
-# Copy certain files from one directory to another one
-# $1: source directory
-# $2: target directory
-# $3+: file list (including patterns)
-copy_file_list ()
-{
- local SRCDIR="$1"
- local DSTDIR="$2"
- shift; shift;
- if [ ! -d "$SRCDIR" ] ; then
- panic "Cant' copy from non-directory: $SRCDIR"
- fi
- log "Copying file: $@"
- log " from $SRCDIR"
- log " to $DSTDIR"
- mkdir -p "$DSTDIR" && (cd "$SRCDIR" && (echo $@ | tr ' ' '\n' | tar hcf - -T -)) | (tar xf - -C "$DSTDIR")
- fail_panic "Cannot copy files to directory: $DSTDIR"
-}
-
-# Rotate a log file
-# If the given log file exist, add a -1 to the end of the file.
-# If older log files exist, rename them to -<n+1>
-# $1: log file
-# $2: maximum version to retain [optional]
-rotate_log ()
-{
- # Default Maximum versions to retain
- local MAXVER="5"
- local LOGFILE="$1"
- shift;
- if [ ! -z "$1" ] ; then
- local tmpmax="$1"
- shift;
- tmpmax=`expr $tmpmax + 0`
- if [ $tmpmax -lt 1 ] ; then
- panic "Invalid maximum log file versions '$tmpmax' invalid; defaulting to $MAXVER"
- else
- MAXVER=$tmpmax;
- fi
- fi
-
- # Do Nothing if the log file does not exist
- if [ ! -f "${LOGFILE}" ] ; then
- return
- fi
-
- # Rename existing older versions
- ver=$MAXVER
- while [ $ver -ge 1 ]
- do
- local prev=$(( $ver - 1 ))
- local old="-$prev"
-
- # Instead of old version 0; use the original filename
- if [ $ver -eq 1 ] ; then
- old=""
- fi
-
- if [ -f "${LOGFILE}${old}" ] ; then
- mv -f "${LOGFILE}${old}" "${LOGFILE}-${ver}"
- fi
-
- ver=$prev
- done
-}
-
-# Dereference symlink
-# $1+: directories
-dereference_symlink ()
-{
- local DIRECTORY SYMLINKS DIR FILE LINK
- for DIRECTORY in "$@"; do
- if [ -d "$DIRECTORY" ]; then
- while true; do
- # Find all symlinks in this directory.
- SYMLINKS=`find $DIRECTORY -type l`
- if [ -z "$SYMLINKS" ]; then
- break;
- fi
- # Iterate symlinks
- for SYMLINK in $SYMLINKS; do
- if [ -L "$SYMLINK" ]; then
- DIR=`dirname "$SYMLINK"`
- FILE=`basename "$SYMLINK"`
- # Note that if `readlink $FILE` is also a link, we want to deal
- # with it in the next iteration. There is potential infinite-loop
- # situation for cicular link doesn't exist in our case, though.
- (cd "$DIR" && \
- LINK=`readlink "$FILE"` && \
- test ! -L "$LINK" && \
- rm -f "$FILE" && \
- cp -a "$LINK" "$FILE")
- fi
- done
- done
- fi
- done
-}
diff --git a/build/tools/prebuilt-common.sh b/build/tools/prebuilt-common.sh
deleted file mode 100644
index d84ce09..0000000
--- a/build/tools/prebuilt-common.sh
+++ /dev/null
@@ -1,1437 +0,0 @@
-# Common functions for all prebuilt-related scripts
-# This is included/sourced by other scripts
-#
-
-# ensure stable sort order
-export LC_ALL=C
-
-# NDK_BUILDTOOLS_PATH should point to the directory containing
-# this script. If it is not defined, assume that this is one of
-# the scripts in the same directory that sourced this file.
-#
-if [ -z "$NDK_BUILDTOOLS_PATH" ]; then
- NDK_BUILDTOOLS_PATH=$(dirname $0)
- if [ ! -f "$NDK_BUILDTOOLS_PATH/prebuilt-common.sh" ]; then
- echo "INTERNAL ERROR: Please define NDK_BUILDTOOLS_PATH to point to \$NDK/build/tools"
- exit 1
- fi
-fi
-
-# Warn if /bin/sh isn't bash.
-if [ -z "$BASH_VERSION" ] ; then
- echo "WARNING: The shell running this script isn't bash. Although we try to avoid bashism in scripts, things can happen."
-fi
-
-NDK_BUILDTOOLS_ABSPATH=$(cd $NDK_BUILDTOOLS_PATH && pwd)
-
-. $NDK_BUILDTOOLS_PATH/ndk-common.sh
-. $NDK_BUILDTOOLS_PATH/dev-defaults.sh
-
-
-# Given an input string of the form <foo>-<bar>-<version>, where
-# <version> can be <major>.<minor>, extract <major>
-extract_version ()
-{
- echo $1 | tr '-' '\n' | tail -1
-}
-
-# $1: versioned name (e.g. arm-linux-androideabi-4.8)
-# Out: major version (e.g. 4)
-#
-# Examples: arm-linux-androideabi-4.4.3 -> 4
-# gmp-0.81 -> 0
-#
-extract_major_version ()
-{
- local RET=$(extract_version $1 | cut -d . -f 1)
- RET=${RET:-0}
- echo $RET
-}
-
-# Same as extract_major_version, but for the minor version number
-# $1: versioned named
-# Out: minor version
-#
-extract_minor_version ()
-{
- local RET=$(extract_version $1 | cut -d . -f 2)
- RET=${RET:-0}
- echo $RET
-}
-
-# Compare two version numbers and only succeeds if the first one is
-# greater than or equal to the second one.
-#
-# $1: first version (e.g. 4.9)
-# $2: second version (e.g. 4.8)
-#
-# Example: version_is_at_least 4.9 4.8 --> success
-#
-version_is_at_least ()
-{
- local A_MAJOR A_MINOR B_MAJOR B_MINOR
- A_MAJOR=$(extract_major_version $1)
- B_MAJOR=$(extract_major_version $2)
-
- if [ $A_MAJOR -lt $B_MAJOR ]; then
- return 1
- elif [ $A_MAJOR -gt $B_MAJOR ]; then
- return 0
- fi
-
- # We have A_MAJOR == B_MAJOR here
-
- A_MINOR=$(extract_minor_version $1)
- B_MINOR=$(extract_minor_version $2)
-
- if [ $A_MINOR -lt $B_MINOR ]; then
- return 1
- else
- return 0
- fi
-}
-
-#====================================================
-#
-# UTILITY FUNCTIONS
-#
-#====================================================
-
-# Return the maximum length of a series of strings
-#
-# Usage: len=`max_length <string1> <string2> ...`
-#
-max_length ()
-{
- echo "$@" | tr ' ' '\n' | awk 'BEGIN {max=0} {len=length($1); if (len > max) max=len} END {print max}'
-}
-
-# Translate dashes to underscores
-# Usage: str=`dashes_to_underscores <values>`
-dashes_to_underscores ()
-{
- echo "$@" | tr '-' '_'
-}
-
-# Translate underscores to dashes
-# Usage: str=`underscores_to_dashes <values>`
-underscores_to_dashes ()
-{
- echo "$@" | tr '_' '-'
-}
-
-# Translate commas to spaces
-# Usage: str=`commas_to_spaces <list>`
-commas_to_spaces ()
-{
- echo "$@" | tr ',' ' '
-}
-
-# Translate spaces to commas
-# Usage: list=`spaces_to_commas <string>`
-spaces_to_commas ()
-{
- echo "$@" | tr ' ' ','
-}
-
-# Remove trailing path of a path
-# $1: path
-remove_trailing_slash () {
- echo ${1%%/}
-}
-
-# Reverse a file path directory
-# foo -> .
-# foo/bar -> ..
-# foo/bar/zoo -> ../..
-reverse_path ()
-{
- local path cur item
- path=${1%%/} # remove trailing slash
- cur="."
- if [ "$path" != "." ] ; then
- for item in $(echo "$path" | tr '/' ' '); do
- cur="../$cur"
- done
- fi
- echo ${cur%%/.}
-}
-
-# test_reverse_path ()
-# {
-# rr=`reverse_path $1`
-# if [ "$rr" != "$2" ] ; then
-# echo "ERROR: reverse_path '$1' -> '$rr' (expected '$2')"
-# fi
-# }
-#
-# test_reverse_path . .
-# test_reverse_path ./ .
-# test_reverse_path foo ..
-# test_reverse_path foo/ ..
-# test_reverse_path foo/bar ../..
-# test_reverse_path foo/bar/ ../..
-# test_reverse_path foo/bar/zoo ../../..
-# test_reverse_path foo/bar/zoo/ ../../..
-
-# Sort a space-separated list and remove duplicates
-# $1+: slist
-# Output: new slist
-sort_uniq ()
-{
- local RET
- RET=$(echo "$@" | tr ' ' '\n' | sort -u)
- echo $RET
-}
-
-# Return the list of all regular files under a given directory
-# $1: Directory path
-# Output: list of files, relative to $1
-list_files_under ()
-{
- if [ -d "$1" ]; then
- (cd $1 && find . -type f | sed -e "s!./!!" | sort -u)
- else
- echo ""
- fi
-}
-
-# Returns all words in text that do not match any of the pattern
-# $1: pattern
-# $2: text
-filter_out ()
-{
- local PATTERN="$1"
- local TEXT="$2"
- for pat in $PATTERN; do
- pat=$"${pat//\//\\/}"
- TEXT=$(echo $TEXT | sed -e 's/'$pat' //g' -e 's/'$pat'$//g')
- done
- echo $TEXT
-}
-
-# Assign a value to a variable
-# $1: Variable name
-# $2: Value
-var_assign ()
-{
- eval $1=\"$2\"
-}
-
-#====================================================
-#
-# OPTION PROCESSING
-#
-#====================================================
-
-# We recognize the following option formats:
-#
-# -f
-# --flag
-#
-# -s<value>
-# --setting=<value>
-#
-
-# NOTE: We translate '-' into '_' when storing the options in global variables
-#
-
-OPTIONS=""
-OPTION_FLAGS=""
-OPTION_SETTINGS=""
-
-# Set a given option attribute
-# $1: option name
-# $2: option attribute
-# $3: attribute value
-#
-option_set_attr ()
-{
- eval OPTIONS_$1_$2=\"$3\"
-}
-
-# Get a given option attribute
-# $1: option name
-# $2: option attribute
-#
-option_get_attr ()
-{
- echo `var_value OPTIONS_$1_$2`
-}
-
-# Register a new option
-# $1: option
-# $2: small abstract for the option
-# $3: optional. default value
-#
-register_option_internal ()
-{
- optlabel=
- optname=
- optvalue=
- opttype=
- while [ -n "1" ] ; do
- # Check for something like --setting=<value>
- echo "$1" | grep -q -E -e '^--[^=]+=<.+>$'
- if [ $? = 0 ] ; then
- optlabel=`expr -- "$1" : '\(--[^=]*\)=.*'`
- optvalue=`expr -- "$1" : '--[^=]*=\(<.*>\)'`
- opttype="long_setting"
- break
- fi
-
- # Check for something like --flag
- echo "$1" | grep -q -E -e '^--[^=]+$'
- if [ $? = 0 ] ; then
- optlabel="$1"
- opttype="long_flag"
- break
- fi
-
- # Check for something like -f<value>
- echo "$1" | grep -q -E -e '^-[A-Za-z0-9]<.+>$'
- if [ $? = 0 ] ; then
- optlabel=`expr -- "$1" : '\(-.\).*'`
- optvalue=`expr -- "$1" : '-.\(<.+>\)'`
- opttype="short_setting"
- break
- fi
-
- # Check for something like -f
- echo "$1" | grep -q -E -e '^-.$'
- if [ $? = 0 ] ; then
- optlabel="$1"
- opttype="short_flag"
- break
- fi
-
- echo "ERROR: Invalid option format: $1"
- echo " Check register_option call"
- exit 1
- done
-
- log "new option: type='$opttype' name='$optlabel' value='$optvalue'"
-
- optname=`dashes_to_underscores $optlabel`
- OPTIONS="$OPTIONS $optname"
- OPTIONS_TEXT="$OPTIONS_TEXT $1"
- option_set_attr $optname label "$optlabel"
- option_set_attr $optname otype "$opttype"
- option_set_attr $optname value "$optvalue"
- option_set_attr $optname text "$1"
- option_set_attr $optname abstract "$2"
- option_set_attr $optname default "$3"
-}
-
-# Register a new option with a function callback.
-#
-# $1: option
-# $2: name of function that will be called when the option is parsed
-# $3: small abstract for the option
-# $4: optional. default value
-#
-register_option ()
-{
- local optname optvalue opttype optlabel
- register_option_internal "$1" "$3" "$4"
- option_set_attr $optname funcname "$2"
-}
-
-# Register a new option with a variable store
-#
-# $1: option
-# $2: name of variable that will be set by this option
-# $3: small abstract for the option
-#
-# NOTE: The current value of $2 is used as the default
-#
-register_var_option ()
-{
- local optname optvalue opttype optlabel
- register_option_internal "$1" "$3" "`var_value $2`"
- option_set_attr $optname varname "$2"
-}
-
-
-MINGW=no
-DARWIN=no
-do_mingw_option ()
-{
- if [ "$DARWIN" = "yes" ]; then
- echo "Can not have both --mingw and --darwin"
- exit 1
- fi
- MINGW=yes;
-}
-do_darwin_option ()
-{
- if [ "$MINGW" = "yes" ]; then
- echo "Can not have both --mingw and --darwin"
- exit 1
- fi
- DARWIN=yes;
-}
-
-register_canadian_option ()
-{
- if [ "$HOST_OS" = "linux" ] ; then
- register_option "--mingw" do_mingw_option "Generate windows binaries on Linux."
- register_option "--darwin" do_darwin_option "Generate darwin binaries on Linux."
- fi
-}
-
-TRY64=no
-do_try64_option () { TRY64=yes; }
-
-register_try64_option ()
-{
- register_option "--try-64" do_try64_option "Generate 64-bit only binaries."
-}
-
-
-register_jobs_option ()
-{
- NUM_JOBS=$BUILD_NUM_CPUS
- register_var_option "-j<number>" NUM_JOBS "Use <number> parallel build jobs"
-}
-
-# Print the help, including a list of registered options for this program
-# Note: Assumes PROGRAM_PARAMETERS and PROGRAM_DESCRIPTION exist and
-# correspond to the parameters list and the program description
-#
-print_help ()
-{
- local opt text abstract default
-
- echo "Usage: $PROGNAME [options] $PROGRAM_PARAMETERS"
- echo ""
- if [ -n "$PROGRAM_DESCRIPTION" ] ; then
- echo "$PROGRAM_DESCRIPTION"
- echo ""
- fi
- echo "Valid options (defaults are in brackets):"
- echo ""
-
- maxw=`max_length "$OPTIONS_TEXT"`
- AWK_SCRIPT=`echo "{ printf \"%-${maxw}s\", \\$1 }"`
- for opt in $OPTIONS; do
- text=`option_get_attr $opt text | awk "$AWK_SCRIPT"`
- abstract=`option_get_attr $opt abstract`
- default=`option_get_attr $opt default`
- if [ -n "$default" ] ; then
- echo " $text $abstract [$default]"
- else
- echo " $text $abstract"
- fi
- done
- echo ""
-}
-
-option_panic_no_args ()
-{
- echo "ERROR: Option '$1' does not take arguments. See --help for usage."
- exit 1
-}
-
-option_panic_missing_arg ()
-{
- echo "ERROR: Option '$1' requires an argument. See --help for usage."
- exit 1
-}
-
-extract_parameters ()
-{
- local opt optname otype value name fin funcname
- PARAMETERS=""
- while [ -n "$1" ] ; do
- # If the parameter does not begin with a dash
- # it is not an option.
- param=`expr -- "$1" : '^\([^\-].*\)$'`
- if [ -n "$param" ] ; then
- if [ -z "$PARAMETERS" ] ; then
- PARAMETERS="$1"
- else
- PARAMETERS="$PARAMETERS $1"
- fi
- shift
- continue
- fi
-
- while [ -n "1" ] ; do
- # Try to match a long setting, i.e. --option=value
- opt=`expr -- "$1" : '^\(--[^=]*\)=.*$'`
- if [ -n "$opt" ] ; then
- otype="long_setting"
- value=`expr -- "$1" : '^--[^=]*=\(.*\)$'`
- break
- fi
-
- # Try to match a long flag, i.e. --option
- opt=`expr -- "$1" : '^\(--.*\)$'`
- if [ -n "$opt" ] ; then
- otype="long_flag"
- value="yes"
- break
- fi
-
- # Try to match a short setting, i.e. -o<value>
- opt=`expr -- "$1" : '^\(-[A-Za-z0-9]\)..*$'`
- if [ -n "$opt" ] ; then
- otype="short_setting"
- value=`expr -- "$1" : '^-.\(.*\)$'`
- break
- fi
-
- # Try to match a short flag, i.e. -o
- opt=`expr -- "$1" : '^\(-.\)$'`
- if [ -n "$opt" ] ; then
- otype="short_flag"
- value="yes"
- break
- fi
-
- echo "ERROR: Unknown option '$1'. Use --help for list of valid values."
- exit 1
- done
-
- #echo "Found opt='$opt' otype='$otype' value='$value'"
-
- name=`dashes_to_underscores $opt`
- found=0
- for xopt in $OPTIONS; do
- if [ "$name" != "$xopt" ] ; then
- continue
- fi
- # Check that the type is correct here
- #
- # This also allows us to handle -o <value> as -o<value>
- #
- xotype=`option_get_attr $name otype`
- if [ "$otype" != "$xotype" ] ; then
- case "$xotype" in
- "short_flag")
- option_panic_no_args $opt
- ;;
- "short_setting")
- if [ -z "$2" ] ; then
- option_panic_missing_arg $opt
- fi
- value="$2"
- shift
- ;;
- "long_flag")
- option_panic_no_args $opt
- ;;
- "long_setting")
- option_panic_missing_arg $opt
- ;;
- esac
- fi
- found=1
- break
- break
- done
- if [ "$found" = "0" ] ; then
- echo "ERROR: Unknown option '$opt'. See --help for usage."
- exit 1
- fi
- # Set variable or launch option-specific function.
- varname=`option_get_attr $name varname`
- if [ -n "$varname" ] ; then
- eval ${varname}=\"$value\"
- else
- eval `option_get_attr $name funcname` \"$value\"
- fi
- shift
- done
-}
-
-do_option_help ()
-{
- print_help
- exit 0
-}
-
-VERBOSE=no
-do_option_verbose ()
-{
- VERBOSE=yes
-}
-
-DRYRUN=no
-do_option_dryrun ()
-{
- DRYRUN=yes
-}
-
-register_option "--help" do_option_help "Print this help."
-register_option "--verbose" do_option_verbose "Enable verbose mode."
-register_option "--dryrun" do_option_dryrun "Set to dryrun mode."
-
-#====================================================
-#
-# TOOLCHAIN AND ABI PROCESSING
-#
-#====================================================
-
-# Determine optional variable value
-# $1: final variable name
-# $2: option variable name
-# $3: small description for the option
-fix_option ()
-{
- if [ -n "$2" ] ; then
- eval $1="$2"
- log "Using specific $3: $2"
- else
- log "Using default $3: `var_value $1`"
- fi
-}
-
-
-# If SYSROOT is empty, check that $1/$2 contains a sysroot
-# and set the variable to it.
-#
-# $1: sysroot path
-# $2: platform/arch suffix
-check_sysroot ()
-{
- if [ -z "$SYSROOT" ] ; then
- log "Probing directory for sysroot: $1/$2"
- if [ -d $1/$2 ] ; then
- SYSROOT=$1/$2
- fi
- fi
-}
-
-# Determine sysroot
-# $1: Option value (or empty)
-#
-fix_sysroot ()
-{
- if [ -n "$1" ] ; then
- eval SYSROOT="$1"
- log "Using specified sysroot: $1"
- else
- SYSROOT_SUFFIX=$PLATFORM/arch-$ARCH
- SYSROOT=
- check_sysroot $ANDROID_BUILD_TOP/prebuilts/ndk/current/platforms $SYSROOT_SUFFIX
- check_sysroot $ANDROID_NDK_ROOT/platforms $SYSROOT_SUFFIX
- check_sysroot `dirname $ANDROID_NDK_ROOT`/development/ndk/platforms $SYSROOT_SUFFIX
-
- if [ -z "$SYSROOT" ] ; then
- echo "ERROR: Could not find NDK sysroot path for $SYSROOT_SUFFIX."
- echo " Use --sysroot=<path> to specify one."
- exit 1
- fi
- fi
-
- if [ ! -f $SYSROOT/usr/include/stdlib.h ] ; then
- echo "ERROR: Invalid sysroot path: $SYSROOT"
- echo " Use --sysroot=<path> to indicate a valid one."
- exit 1
- fi
-}
-
-# Check for the availability of a compatibility SDK in Darwin
-# this can be used to generate binaries compatible with either Tiger or
-# Leopard.
-#
-# $1: SDK root path
-# $2: Optional MacOS X minimum version (e.g. 10.5)
-DARWIN_MINVER=10.6
-check_darwin_sdk ()
-{
- local MACSDK="$1"
- local MINVER=$2
-
- if [ -z "$MINVER" ] ; then
- # expect SDK root path ended up with either MacOSX##.#.sdk or MacOSX##.#u.sdk
- MINVER=${MACSDK##*MacOSX}
- MINVER=${MINVER%%.sdk*}
- if [ "$MINVER" = "10.4u" ]; then
- MINVER=10.4
- fi
- fi
- if [ -d "$MACSDK" ] ; then
- HOST_CFLAGS=$HOST_CFLAGS" -isysroot $MACSDK -mmacosx-version-min=$MINVER -DMAXOSX_DEPLOYEMENT_TARGET=$MINVER"
- HOST_LDFLAGS=$HOST_LDFLAGS" -Wl,-syslibroot,$MACSDK -mmacosx-version-min=$MINVER"
- DARWIN_MINVER=$MINVER
- return 0 # success
- fi
- return 1
-}
-
-# Probe Darwin SDK in specified diectory $DARWIN_SYSROOT, or
-# /Developer/SDKs/MacOSX10.6.sdk
-#
-probe_darwin_sdk ()
-{
- if [ -n "$DARWIN_SYSROOT" ]; then
- if check_darwin_sdk "$DARWIN_SYSROOT"; then
- log "Use darwin sysroot $DARWIN_SYSROOT"
- else
- echo "darwin sysroot $DARWIN_SYSROOT is not valid"
- exit 1
- fi
- elif check_darwin_sdk /Developer/SDKs/MacOSX10.6.sdk 10.6; then
- log "Generating Snow Leopard-compatible binaries!"
- else
- local version=`sw_vers -productVersion`
- log "Generating $version-compatible binaries!"
- fi
-}
-
-handle_canadian_build ()
-{
- HOST_EXE=
- if [ "$MINGW" = "yes" -o "$DARWIN" = "yes" ] ; then
- case $HOST_TAG in
- linux-*)
- ;;
- *)
- echo "ERROR: Can only enable --mingw or --darwin on Linux platforms !"
- exit 1
- ;;
- esac
- if [ "$MINGW" = "yes" ] ; then
- if [ "$TRY64" = "yes" ]; then
- ABI_CONFIGURE_HOST=x86_64-w64-mingw32
- HOST_TAG=windows-x86_64
- else
- # NOTE: A wrapper is generated for i686-w64-mingw32.
- ABI_CONFIGURE_HOST=i686-w64-mingw32
- HOST_TAG=windows
- fi
- HOST_OS=windows
- HOST_EXE=.exe
- else
- if [ "$TRY64" = "yes" ]; then
- ABI_CONFIGURE_HOST=x86_64-apple-darwin
- HOST_TAG=darwin-x86_64
- else
- ABI_CONFIGURE_HOST=i686-apple-darwin
- HOST_TAG=darwin-x86
- fi
- HOST_OS=darwin
- fi
- fi
-}
-
-# Find mingw toolchain
-#
-# Set MINGW_GCC to the found mingw toolchain
-#
-find_mingw_toolchain ()
-{
- local LINUX_GCC_PREBUILTS=$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86
- local MINGW_ROOT=$LINUX_GCC_PREBUILTS/host/x86_64-w64-mingw32-4.8/
- BINPREFIX=x86_64-w64-mingw32-
- MINGW_GCC=$MINGW_ROOT/bin/${BINPREFIX}gcc
- if [ ! -e "$MINGW_GCC" ]; then
- panic "$MINGW_GCC does not exist"
- fi
-
- if [ "$HOST_ARCH" = "x86_64" -a "$TRY64" = "yes" ]; then
- DEBIAN_NAME=mingw-w64
- else
- # we are trying 32 bit anyway, so forcing it to avoid build issues
- force_32bit_binaries
- DEBIAN_NAME=mingw-w64
- fi
-}
-
-# Check there is a working cross-toolchain installed.
-#
-# $1: install directory for mingw/darwin wrapper toolchain
-#
-# NOTE: Build scripts need to call this function to create MinGW wrappers,
-# even if they aren't doing a "Canadian" cross-compile with different build,
-# host, and target systems.
-#
-prepare_canadian_toolchain ()
-{
- if [ "$MINGW" != "yes" -a "$DARWIN" != "yes" ]; then
- return
- fi
- CROSS_GCC=
- if [ "$MINGW" = "yes" ]; then
- find_mingw_toolchain
- CROSS_GCC=$MINGW_GCC
- else
- if [ -z "$DARWIN_TOOLCHAIN" ]; then
- echo "Please set DARWIN_TOOLCHAIN to darwin cross-toolchain"
- exit 1
- fi
- if [ ! -f "${DARWIN_TOOLCHAIN}-gcc" ]; then
- echo "darwin cross-toolchain $DARWIN_TOOLCHAIN-gcc doesn't exist"
- exit 1
- fi
- if [ "$HOST_ARCH" = "x86_64" -a "$TRY64" = "yes" ]; then
- BINPREFIX=x86_64-apple-darwin-
- DEBIAN_NAME=darwin64
- HOST_CFLAGS=$HOST_CFLAGS" -m64"
- else
- force_32bit_binaries
- BINPREFIX=i686-apple-darwin-
- DEBIAN_NAME=darwin32
- HOST_CFLAGS=$HOST_CFLAGS" -m32"
- fi
- CROSS_GCC=${DARWIN_TOOLCHAIN}-gcc
- probe_darwin_sdk
- fi
-
- # Create a wrapper toolchain, and prepend its dir to our PATH
- CROSS_WRAP_DIR="$1"/$DEBIAN_NAME-wrapper
- rm -rf "$CROSS_WRAP_DIR"
- mkdir -p "$CROSS_WRAP_DIR"
-
- if [ "$DARWIN" = "yes" ] ; then
- cat > "$CROSS_WRAP_DIR/sw_vers" <<EOF
-#!/bin/sh
-# Tiny utility for the real sw_vers some Makefiles need
-case \$1 in
- -productVersion)
- echo $DARWIN_MINVER
- ;;
- *)
- echo "ERROR: Unknown switch \$1"
- exit 1
-esac
-EOF
- chmod 0755 "$CROSS_WRAP_DIR/sw_vers"
- fi
-
- DST_PREFIX=${CROSS_GCC%gcc}
- $NDK_BUILDTOOLS_PATH/gen-toolchain-wrapper.sh --src-prefix=$BINPREFIX --dst-prefix="$DST_PREFIX" "$CROSS_WRAP_DIR" \
- --cflags="$HOST_CFLAGS" --cxxflags="$HOST_CFLAGS" --ldflags="$HOST_LDFLAGS"
- # generate wrappers for BUILD toolchain
- # this is required for mingw/darwin build to avoid tools canadian cross configuration issues
- # 32-bit BUILD toolchain
- LEGACY_TOOLCHAIN_DIR="$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8"
- $NDK_BUILDTOOLS_PATH/gen-toolchain-wrapper.sh --src-prefix=i386-linux-gnu- \
- --cflags="-m32" --cxxflags="-m32" --ldflags="-m elf_i386" --asflags="--32" \
- --dst-prefix="$LEGACY_TOOLCHAIN_DIR/bin/x86_64-linux-" "$CROSS_WRAP_DIR"
- $NDK_BUILDTOOLS_PATH/gen-toolchain-wrapper.sh --src-prefix=i386-pc-linux-gnu- \
- --cflags="-m32" --cxxflags="-m32" --ldflags="-m elf_i386" --asflags="--32" \
- --dst-prefix="$LEGACY_TOOLCHAIN_DIR/bin/x86_64-linux-" "$CROSS_WRAP_DIR"
- # 64-bit BUILD toolchain. libbfd is still built in 32-bit.
- $NDK_BUILDTOOLS_PATH/gen-toolchain-wrapper.sh --src-prefix=x86_64-linux-gnu- \
- --dst-prefix="$LEGACY_TOOLCHAIN_DIR/bin/x86_64-linux-" "$CROSS_WRAP_DIR"
- $NDK_BUILDTOOLS_PATH/gen-toolchain-wrapper.sh --src-prefix=x86_64-pc-linux-gnu- \
- --dst-prefix="$LEGACY_TOOLCHAIN_DIR/bin/x86_64-linux-" "$CROSS_WRAP_DIR"
- fail_panic "Could not create $DEBIAN_NAME wrapper toolchain in $CROSS_WRAP_DIR"
-
- # 32-bit Windows toolchain (i686-w64-mingw32 -> x86_64-w64-mingw32 -m32)
- local MINGW_TOOLCHAIN_DIR="$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8"
- $NDK_BUILDTOOLS_PATH/gen-toolchain-wrapper.sh --src-prefix=i686-w64-mingw32- \
- --cflags="-m32" --cxxflags="-m32" --ldflags="-m i386pe" --asflags="--32" \
- --windres-flags="-F pe-i386" \
- --dst-prefix="$MINGW_TOOLCHAIN_DIR/bin/x86_64-w64-mingw32-" "$CROSS_WRAP_DIR"
-
- export PATH=$CROSS_WRAP_DIR:$PATH
- dump "Using $DEBIAN_NAME wrapper: $CROSS_WRAP_DIR/${BINPREFIX}gcc"
-}
-
-handle_host ()
-{
- if [ "$TRY64" != "yes" ]; then
- force_32bit_binaries # to modify HOST_TAG and others
- HOST_BITS=32
- fi
- handle_canadian_build
-}
-
-prepare_common_build ()
-{
- if [ "$MINGW" = "yes" -o "$DARWIN" = "yes" ]; then
- if [ "$TRY64" = "yes" ]; then
- HOST_BITS=64
- else
- HOST_BITS=32
- fi
- if [ "$MINGW" = "yes" ]; then
- log "Generating $HOST_BITS-bit Windows binaries"
- else
- log "Generating $HOST_BITS-bit Darwin binaries"
- fi
- # Do *not* set CC and CXX when building the Windows/Darwin binaries in canadian build.
- # Otherwise, the GCC configure/build script will mess that Canadian cross
- # build in weird ways. Instead we rely on the toolchain detected or generated
- # previously in prepare_canadian_toolchain.
- unset CC CXX
- return
- fi
-
- # On Linux, detect our legacy-compatible toolchain when in the Android
- # source tree, and use it to force the generation of glibc-2.7 compatible
- # binaries.
- #
- # We only do this if the CC variable is not defined to a given value
- if [ -z "$CC" ]; then
- LEGACY_TOOLCHAIN_DIR=
- if [ "$HOST_OS" = "linux" ]; then
- LEGACY_TOOLCHAIN_DIR="$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/bin"
- LEGACY_TOOLCHAIN_PREFIX="$LEGACY_TOOLCHAIN_DIR/x86_64-linux-"
- elif [ "$HOST_OS" = "darwin" ]; then
- LEGACY_TOOLCHAIN_DIR="$ANDROID_BUILD_TOP/prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1/bin"
- LEGACY_TOOLCHAIN_PREFIX="$LEGACY_TOOLCHAIN_DIR/i686-apple-darwin10-"
- fi
- log "Forcing generation of $HOST_OS binaries with legacy toolchain"
- CC="${LEGACY_TOOLCHAIN_PREFIX}gcc"
- CXX="${LEGACY_TOOLCHAIN_PREFIX}g++"
- if [ ! -e "${CC}" ]; then
- panic "${CC} does not exist."
- fi
- fi
-
- CC=${CC:-gcc}
- CXX=${CXX:-g++}
- STRIP=${STRIP:-strip}
- case $HOST_TAG in
- darwin-*)
- probe_darwin_sdk
- ;;
- esac
-
- # Force generation of 32-bit binaries on 64-bit systems.
- # We used to test the value of $HOST_TAG for *-x86_64, but this is
- # not sufficient on certain systems.
- #
- # For example, Snow Leopard can be booted with a 32-bit kernel, running
- # a 64-bit userland, with a compiler that generates 64-bit binaries by
- # default *even* though "gcc -v" will report --target=i686-apple-darwin10!
- #
- # So know, simply probe for the size of void* by performing a small runtime
- # compilation test.
- #
- cat > $TMPC <<EOF
- /* this test should fail if the compiler generates 64-bit machine code */
- int test_array[1-2*(sizeof(void*) != 4)];
-EOF
- log_n "Checking whether the compiler generates 32-bit binaries..."
- log $CC $HOST_CFLAGS -c -o $TMPO $TMPC
- $CC $HOST_CFLAGS -c -o $TMPO $TMPC >$TMPL 2>&1
- if [ $? != 0 ] ; then
- log "no"
- if [ "$TRY64" != "yes" ]; then
- # NOTE: We need to modify the definitions of CC and CXX directly
- # here. Just changing the value of CFLAGS / HOST_CFLAGS
- # will not work well with the GCC toolchain scripts.
- CC="$CC -m32"
- CXX="$CXX -m32"
- fi
- else
- log "yes"
- if [ "$TRY64" = "yes" ]; then
- CC="$CC -m64"
- CXX="$CXX -m64"
- fi
- fi
-
- if [ "$TRY64" = "yes" ]; then
- HOST_BITS=64
- else
- force_32bit_binaries # to modify HOST_TAG and others
- HOST_BITS=32
- fi
-}
-
-prepare_host_build ()
-{
- prepare_common_build
-
- # Now deal with mingw or darwin
- if [ "$MINGW" = "yes" -o "$DARWIN" = "yes" ]; then
- handle_canadian_build
- CC=$ABI_CONFIGURE_HOST-gcc
- CXX=$ABI_CONFIGURE_HOST-g++
- CPP=$ABI_CONFIGURE_HOST-cpp
- LD=$ABI_CONFIGURE_HOST-ld
- AR=$ABI_CONFIGURE_HOST-ar
- AS=$ABI_CONFIGURE_HOST-as
- RANLIB=$ABI_CONFIGURE_HOST-ranlib
- STRIP=$ABI_CONFIGURE_HOST-strip
- export CC CXX CPP LD AR AS RANLIB STRIP
- fi
-}
-
-prepare_abi_configure_build ()
-{
- # detect build tag
- case $HOST_TAG in
- linux-x86)
- ABI_CONFIGURE_BUILD=i386-linux-gnu
- ;;
- linux-x86_64)
- ABI_CONFIGURE_BUILD=x86_64-linux-gnu
- ;;
- darwin-x86)
- ABI_CONFIGURE_BUILD=i686-apple-darwin
- ;;
- darwin-x86_64)
- ABI_CONFIGURE_BUILD=x86_64-apple-darwin
- ;;
- windows)
- ABI_CONFIGURE_BUILD=i686-pc-cygwin
- ;;
- *)
- echo "ERROR: Unsupported HOST_TAG: $HOST_TAG"
- echo "Please update 'prepare_host_flags' in build/tools/prebuilt-common.sh"
- ;;
- esac
-}
-
-prepare_target_build ()
-{
- prepare_abi_configure_build
-
- # By default, assume host == build
- ABI_CONFIGURE_HOST="$ABI_CONFIGURE_BUILD"
-
- prepare_common_build
- HOST_GMP_ABI=$HOST_BITS
-
- # Now handle the --mingw/--darwin flag
- if [ "$MINGW" = "yes" -o "$DARWIN" = "yes" ] ; then
- handle_canadian_build
- STRIP=$ABI_CONFIGURE_HOST-strip
- if [ "$MINGW" = "yes" ] ; then
- # It turns out that we need to undefine this to be able to
- # perform a canadian-cross build with mingw. Otherwise, the
- # GMP configure scripts will not be called with the right options
- HOST_GMP_ABI=
- fi
- fi
-}
-
-# $1: Toolchain name
-#
-parse_toolchain_name ()
-{
- TOOLCHAIN=$1
- if [ -z "$TOOLCHAIN" ] ; then
- echo "ERROR: Missing toolchain name!"
- exit 1
- fi
-
- ABI_CFLAGS_FOR_TARGET=
- ABI_CXXFLAGS_FOR_TARGET=
-
- # Determine ABI based on toolchain name
- #
- case "$TOOLCHAIN" in
- arm-linux-androideabi-*)
- ARCH="arm"
- ABI="armeabi"
- ABI_CONFIGURE_TARGET="arm-linux-androideabi"
- ABI_CONFIGURE_EXTRA_FLAGS="--with-arch=armv5te"
- ;;
- arm-eabi-*)
- ARCH="arm"
- ABI="armeabi"
- ABI_CONFIGURE_TARGET="arm-eabi"
- ABI_CONFIGURE_EXTRA_FLAGS="--with-arch=armv5te --disable-gold --disable-libgomp"
- ;;
- aarch64-linux-android-*)
- ARCH="arm64"
- ABI="arm64-v8a"
- ABI_CONFIGURE_TARGET="aarch64-linux-android"
- # Reserve the platform register, x18. This should happen automatically
- # with clang but we need to pass it manually when compiling with gcc.
- ABI_CFLAGS_FOR_TARGET="-ffixed-x18"
- ABI_CXXFLAGS_FOR_TARGET="-ffixed-x18"
- ;;
- x86-*)
- ARCH="x86"
- ABI=$ARCH
- ABI_INSTALL_NAME="x86"
- ABI_CONFIGURE_TARGET="i686-linux-android"
- # Enable C++ exceptions, RTTI and GNU libstdc++ at the same time
- # You can't really build these separately at the moment.
- ABI_CFLAGS_FOR_TARGET="-fPIC"
- ;;
- x86_64-*)
- ARCH="x86_64"
- ABI=$ARCH
- ABI_INSTALL_NAME="x86_64"
- ABI_CONFIGURE_TARGET="x86_64-linux-android"
- # Enable C++ exceptions, RTTI and GNU libstdc++ at the same time
- # You can't really build these separately at the moment.
- ABI_CFLAGS_FOR_TARGET="-fPIC"
- ;;
- mipsel*)
- ARCH="mips"
- ABI=$ARCH
- ABI_INSTALL_NAME="mips"
- ABI_CONFIGURE_TARGET="mipsel-linux-android"
- # Set default to mips32
- ABI_CONFIGURE_EXTRA_FLAGS="--with-arch=mips32"
- # Enable C++ exceptions, RTTI and GNU libstdc++ at the same time
- # You can't really build these separately at the moment.
- # Add -fpic, because MIPS NDK will need to link .a into .so.
- ABI_CFLAGS_FOR_TARGET="-fexceptions -fpic"
- ABI_CXXFLAGS_FOR_TARGET="-frtti -fpic"
- # Add --disable-fixed-point to disable fixed-point support
- ABI_CONFIGURE_EXTRA_FLAGS="$ABI_CONFIGURE_EXTRA_FLAGS --disable-fixed-point"
- ;;
- mips64el*)
- ARCH="mips64"
- ABI=$ARCH
- ABI_INSTALL_NAME="mips64"
- ABI_CONFIGURE_TARGET="mips64el-linux-android"
- # Set default to mips64r6
- ABI_CONFIGURE_EXTRA_FLAGS="--with-arch=mips64r6"
- # Enable C++ exceptions, RTTI and GNU libstdc++ at the same time
- # You can't really build these separately at the moment.
- # Add -fpic, because MIPS NDK will need to link .a into .so.
- ABI_CFLAGS_FOR_TARGET="-fexceptions -fpic"
- ABI_CXXFLAGS_FOR_TARGET="-frtti -fpic"
- # Add --disable-fixed-point to disable fixed-point support
- ABI_CONFIGURE_EXTRA_FLAGS="$ABI_CONFIGURE_EXTRA_FLAGS --disable-fixed-point"
- ;;
- * )
- echo "Invalid toolchain specified. Expected (arm-linux-androideabi-*|arm-eabi-*|x86-*|mipsel*|mips64el*)"
- echo ""
- print_help
- exit 1
- ;;
- esac
-
- log "Targetting CPU: $ARCH"
-
- GCC_VERSION=`expr -- "$TOOLCHAIN" : '.*-\([0-9x\.]*\)'`
- log "Using GCC version: $GCC_VERSION"
-}
-
-# Return the host "tag" used to identify prebuilt host binaries.
-# NOTE: Handles the case where '$MINGW = true' or '$DARWIN = true'
-# For now, valid values are: linux-x86, darwin-x86 and windows
-get_prebuilt_host_tag ()
-{
- local RET=$HOST_TAG
- if [ "$MINGW" = "yes" ]; then
- if [ "$TRY64" = "no" ]; then
- RET=windows
- else
- RET=windows-x86_64
- fi
- fi
- if [ "$DARWIN" = "yes" ]; then
- RET=darwin-x86_64 # let the following handles 32-bit case
- fi
- case $RET in
- linux-*)
- RET=linux-x86_64
- ;;
- darwin-*)
- RET=darwin-x86_64
- ;;
- esac
- echo $RET
-}
-
-# Return the executable suffix corresponding to host executables
-get_prebuilt_host_exe_ext ()
-{
- if [ "$MINGW" = "yes" ]; then
- echo ".exe"
- else
- echo ""
- fi
-}
-
-# Get library suffix for given ABI
-# $1: ABI
-# Return: .so or .bc
-get_lib_suffix_for_abi ()
-{
- local ABI=$1
- echo ".so"
-}
-
-# Convert an ABI name into an Architecture name
-# $1: ABI name
-# Result: Arch name
-convert_abi_to_arch ()
-{
- local RET
- local ABI=$1
- case $ABI in
- armeabi|armeabi-v7a)
- RET=arm
- ;;
- x86|mips|x86_64|mips64)
- RET=$ABI
- ;;
- mips32r6)
- RET=mips
- ;;
- arm64-v8a)
- RET=arm64
- ;;
- *)
- >&2 echo "ERROR: Unsupported ABI name: $ABI, use one of: armeabi, armeabi-v7a, x86, mips, arm64-v8a, x86_64 or mips64"
- exit 1
- ;;
- esac
- echo "$RET"
-}
-
-# Take architecture name as input, and output the list of corresponding ABIs
-# Inverse for convert_abi_to_arch
-# $1: ARCH name
-# Out: ABI names list (comma-separated)
-convert_arch_to_abi ()
-{
- local RET
- local ARCH=$1
- case $ARCH in
- arm)
- RET=armeabi,armeabi-v7a
- ;;
- x86|x86_64|mips|mips64)
- RET=$ARCH
- ;;
- arm64)
- RET=arm64-v8a
- ;;
- *)
- >&2 echo "ERROR: Unsupported ARCH name: $ARCH, use one of: arm, x86, mips"
- exit 1
- ;;
- esac
- echo "$RET"
-}
-
-# Take a list of architecture names as input, and output the list of corresponding ABIs
-# $1: ARCH names list (separated by spaces or commas)
-# Out: ABI names list (comma-separated)
-convert_archs_to_abis ()
-{
- local RET
- for ARCH in $(commas_to_spaces $@); do
- ABI=$(convert_arch_to_abi $ARCH)
- if [ -n "$ABI" ]; then
- if [ -n "$RET" ]; then
- RET=$RET",$ABI"
- else
- RET=$ABI
- fi
- else # Error message is printed by convert_arch_to_abi
- exit 1
- fi
- done
- echo "$RET"
-}
-
-# Return the default toolchain binary path prefix for given architecture and gcc version
-# For example: arm 4.8 -> toolchains/<system>/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-
-# $1: Architecture name
-# $2: GCC version
-# $3: optional, system name, defaults to $HOST_TAG
-get_toolchain_binprefix_for_arch ()
-{
- local NAME PREFIX DIR BINPREFIX
- local SYSTEM=${3:-$(get_prebuilt_host_tag)}
- NAME=$(get_toolchain_name_for_arch $1 $2)
- PREFIX=$(get_default_toolchain_prefix_for_arch $1)
- DIR=$(get_toolchain_install . $NAME $SYSTEM)
- BINPREFIX=${DIR#./}/bin/$PREFIX-
- echo "$BINPREFIX"
-}
-
-# Return default API level for a given arch
-# This is the level used to build the toolchains.
-#
-# $1: Architecture name
-get_default_api_level_for_arch ()
-{
- # For now, always build the toolchain against API level 14 for 32-bit arch
- # and API level $FIRST_API64_LEVEL for 64-bit arch
- case $1 in
- *64) echo $FIRST_API64_LEVEL ;;
- *) echo 14 ;;
- esac
-}
-
-# Return the default platform sysroot corresponding to a given architecture
-# This is the sysroot used to build the toolchain and other binaries like
-# the STLport libraries.
-# $1: Architecture name
-get_default_platform_sysroot_for_arch ()
-{
- local ARCH=$1
- local LEVEL=$(get_default_api_level_for_arch $ARCH)
-
- if [ "$ARCH" != "${ARCH%%64*}" ] ; then
- LEVEL=$FIRST_API64_LEVEL
- fi
- echo "platforms/android-$LEVEL/arch-$ARCH"
-}
-
-# Return the default platform sysroot corresponding to a given abi
-# $1: ABI
-get_default_platform_sysroot_for_abi ()
-{
- local ARCH=$(convert_abi_to_arch $1)
- $(get_default_platform_sysroot_for_arch $ARCH)
-}
-
-# Return the default libs dir corresponding to a given architecture
-# $1: Architecture name
-get_default_libdir_for_arch ()
-{
- case $1 in
- x86_64|mips64) echo "lib64" ;;
- arm64) echo "lib" ;; # return "lib" until aarch64 is built to look for sysroot/usr/lib64
- *) echo "lib" ;;
- esac
-}
-
-# Return the default libs dir corresponding to a given abi
-# $1: ABI
-get_default_libdir_for_abi ()
-{
- local ARCH
-
- case $1 in
- mips32r6) echo "libr6" ;;
- *)
- local ARCH=$(convert_abi_to_arch $1)
- echo "$(get_default_libdir_for_arch $ARCH)"
- ;;
- esac
-}
-
-# Return the host/build specific path for prebuilt toolchain binaries
-# relative to $1.
-#
-# $1: target root NDK directory
-# $2: toolchain name
-# $3: optional, host system name
-#
-get_toolchain_install ()
-{
- local NDK="$1"
- shift
- echo "$NDK/$(get_toolchain_install_subdir "$@")"
-}
-
-# $1: toolchain name
-# $2: optional, host system name
-get_toolchain_install_subdir ()
-{
- local SYSTEM=${2:-$(get_prebuilt_host_tag)}
- echo "toolchains/$SYSTEM/$1"
-}
-
-# Return the relative install prefix for prebuilt host
-# executables (relative to the NDK top directory).
-#
-# Out: relative path to prebuilt install prefix
-get_prebuilt_install_prefix ()
-{
- echo "host-tools"
-}
-
-# Return the relative path of an installed prebuilt host
-# executable.
-#
-# $1: executable name
-# Out: path to prebuilt host executable, relative
-get_prebuilt_host_exec ()
-{
- local PREFIX EXE
- PREFIX=$(get_prebuilt_install_prefix)
- EXE=$(get_prebuilt_host_exe_ext)
- echo "$PREFIX/bin/$1$EXE"
-}
-
-# Return the name of a given host executable
-# $1: executable base name
-# Out: executable name, with optional suffix (e.g. .exe for windows)
-get_host_exec_name ()
-{
- local EXE=$(get_prebuilt_host_exe_ext)
- echo "$1$EXE"
-}
-
-# Return the directory where host-specific binaries are installed.
-# $1: target root NDK directory
-get_host_install ()
-{
- echo "$1/$(get_prebuilt_install_prefix)"
-}
-
-# Set the toolchain target NDK location.
-# this sets TOOLCHAIN_PATH and TOOLCHAIN_PREFIX
-# $1: target NDK path
-# $2: toolchain name
-set_toolchain_ndk ()
-{
- TOOLCHAIN_PATH=`get_toolchain_install "$1" $2`
- log "Using toolchain path: $TOOLCHAIN_PATH"
-
- TOOLCHAIN_PREFIX=$TOOLCHAIN_PATH/bin/$ABI_CONFIGURE_TARGET
- log "Using toolchain prefix: $TOOLCHAIN_PREFIX"
-}
-
-# Check that a toolchain is properly installed at a target NDK location
-#
-# $1: target root NDK directory
-# $2: toolchain name
-#
-check_toolchain_install ()
-{
- TOOLCHAIN_PATH=`get_toolchain_install "$1" $2`
- if [ ! -d "$TOOLCHAIN_PATH" ] ; then
- echo "ERROR: Cannot find directory '$TOOLCHAIN_PATH'!"
- echo " Toolchain '$2' not installed in '$NDK_DIR'!"
- echo " Ensure that the toolchain has been installed there before."
- exit 1
- fi
-
- set_toolchain_ndk $1 $2
-}
-
-# $1: toolchain source directory
-check_toolchain_src_dir ()
-{
- local SRC_DIR="$1"
- if [ -z "$SRC_DIR" ]; then
- echo "ERROR: Please provide the path to the toolchain source tree. See --help"
- exit 1
- fi
-
- if [ ! -d "$SRC_DIR" ]; then
- echo "ERROR: Not a directory: '$SRC_DIR'"
- exit 1
- fi
-}
-
-make_repo_prop () {
- local OUT_PATH="$1/repo.prop"
-
- # The build server generates a repo.prop file that contains the current SHAs
- # of each project.
- if [ -f $DIST_DIR/repo.prop ]; then
- cp $DIST_DIR/repo.prop $OUT_PATH
- else
- # Generate our own if we're building locally.
- pushd $ANDROID_NDK_ROOT
- repo forall \
- -c 'echo $REPO_PROJECT $(git rev-parse HEAD)' > $OUT_PATH
- popd
- fi
-}
-
-#
-# Define HOST_TAG32, as the 32-bit version of HOST_TAG
-# We do this by replacing an -x86_64 suffix by -x86
-HOST_TAG32=$HOST_TAG
-case $HOST_TAG32 in
- *-x86_64)
- HOST_TAG32=${HOST_TAG%%_64}
- ;;
-esac
diff --git a/build/tools/pylintrc b/build/tools/pylintrc
deleted file mode 120000
index e242284..0000000
--- a/build/tools/pylintrc
+++ /dev/null
@@ -1 +0,0 @@
-../../pylintrc
\ No newline at end of file
diff --git a/build/tools/toolchain-licenses/COPYING b/build/tools/toolchain-licenses/COPYING
deleted file mode 100644
index 623b625..0000000
--- a/build/tools/toolchain-licenses/COPYING
+++ /dev/null
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/build/tools/toolchain-licenses/COPYING.LIB b/build/tools/toolchain-licenses/COPYING.LIB
deleted file mode 100644
index 2d2d780..0000000
--- a/build/tools/toolchain-licenses/COPYING.LIB
+++ /dev/null
@@ -1,510 +0,0 @@
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations
-below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it
-becomes a de-facto standard. To achieve this, non-free programs must
-be allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control
-compilation and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at least
- three years, to give the same user the materials specified in
- Subsection 6a, above, for a charge no more than the cost of
- performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply, and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License
-may add an explicit geographical distribution limitation excluding those
-countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms
-of the ordinary General Public License).
-
- To apply these terms, attach the following notices to the library.
-It is safest to attach them to the start of each source file to most
-effectively convey the exclusion of warranty; and each file should
-have at least the "copyright" line and a pointer to where the full
-notice is found.
-
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or
-your school, if any, to sign a "copyright disclaimer" for the library,
-if necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James
- Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/build/tools/toolchain-licenses/COPYING.RUNTIME b/build/tools/toolchain-licenses/COPYING.RUNTIME
deleted file mode 100644
index e1b3c69..0000000
--- a/build/tools/toolchain-licenses/COPYING.RUNTIME
+++ /dev/null
@@ -1,73 +0,0 @@
-GCC RUNTIME LIBRARY EXCEPTION
-
-Version 3.1, 31 March 2009
-
-Copyright (C) 2009 Free Software Foundation, Inc. <http://fsf.org/>
-
-Everyone is permitted to copy and distribute verbatim copies of this
-license document, but changing it is not allowed.
-
-This GCC Runtime Library Exception ("Exception") is an additional
-permission under section 7 of the GNU General Public License, version
-3 ("GPLv3"). It applies to a given file (the "Runtime Library") that
-bears a notice placed by the copyright holder of the file stating that
-the file is governed by GPLv3 along with this Exception.
-
-When you use GCC to compile a program, GCC may combine portions of
-certain GCC header files and runtime libraries with the compiled
-program. The purpose of this Exception is to allow compilation of
-non-GPL (including proprietary) programs to use, in this way, the
-header files and runtime libraries covered by this Exception.
-
-0. Definitions.
-
-A file is an "Independent Module" if it either requires the Runtime
-Library for execution after a Compilation Process, or makes use of an
-interface provided by the Runtime Library, but is not otherwise based
-on the Runtime Library.
-
-"GCC" means a version of the GNU Compiler Collection, with or without
-modifications, governed by version 3 (or a specified later version) of
-the GNU General Public License (GPL) with the option of using any
-subsequent versions published by the FSF.
-
-"GPL-compatible Software" is software whose conditions of propagation,
-modification and use would permit combination with GCC in accord with
-the license of GCC.
-
-"Target Code" refers to output from any compiler for a real or virtual
-target processor architecture, in executable form or suitable for
-input to an assembler, loader, linker and/or execution
-phase. Notwithstanding that, Target Code does not include data in any
-format that is used as a compiler intermediate representation, or used
-for producing a compiler intermediate representation.
-
-The "Compilation Process" transforms code entirely represented in
-non-intermediate languages designed for human-written code, and/or in
-Java Virtual Machine byte code, into Target Code. Thus, for example,
-use of source code generators and preprocessors need not be considered
-part of the Compilation Process, since the Compilation Process can be
-understood as starting with the output of the generators or
-preprocessors.
-
-A Compilation Process is "Eligible" if it is done using GCC, alone or
-with other GPL-compatible software, or if it is done without using any
-work based on GCC. For example, using non-GPL-compatible Software to
-optimize any GCC intermediate representations would not qualify as an
-Eligible Compilation Process.
-
-1. Grant of Additional Permission.
-
-You have permission to propagate a work of Target Code formed by
-combining the Runtime Library with Independent Modules, even if such
-propagation would otherwise violate the terms of GPLv3, provided that
-all Target Code was generated by Eligible Compilation Processes. You
-may then convey such a combination under terms of your choice,
-consistent with the licensing of the Independent Modules.
-
-2. No Weakening of GCC Copyleft.
-
-The availability of this Exception does not imply any general
-presumption that third-party software is unaffected by the copyleft
-requirements of the license of GCC.
-
diff --git a/build/tools/toolchain-licenses/COPYING3 b/build/tools/toolchain-licenses/COPYING3
deleted file mode 100644
index 94a9ed0..0000000
--- a/build/tools/toolchain-licenses/COPYING3
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- <program> Copyright (C) <year> <name of author>
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/build/tools/toolchain-licenses/COPYING3.LIB b/build/tools/toolchain-licenses/COPYING3.LIB
deleted file mode 100644
index fc8a5de..0000000
--- a/build/tools/toolchain-licenses/COPYING3.LIB
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/docs/BuildSystemMaintainers.md b/docs/BuildSystemMaintainers.md
index 4513236..29481d9 100644
--- a/docs/BuildSystemMaintainers.md
+++ b/docs/BuildSystemMaintainers.md
@@ -316,12 +316,11 @@
should only be used as a last resort.
Note: Linking libc++ and its dependencies explicitly may be necessary to defend
-against exception unwinding bugs caused by improperly built dependencies on
-ARM32 (see [Issue 379]). If not dependent on stack unwinding (the usual reason
-being that the application does not make use of C++ exceptions) or if no
-dependencies were improperly built, this is not necessary. If needed, link the
-libraries as listed in the linker script and be sure to follow the instructions
-in [Unwinding].
+against exception unwinding bugs caused by improperly built dependencies (see
+[Issue 379]). If not dependent on stack unwinding (the usual reason being that
+the application does not make use of C++ exceptions) or if no dependencies were
+improperly built, this is not necessary. If needed, link the libraries as listed
+in the linker script and be sure to follow the instructions in [Unwinding].
[Important Considerations]: https://developer.android.com/ndk/guides/cpp-support#important_considerations
[Issue 379]: https://github.com/android-ndk/ndk/issues/379
@@ -423,13 +422,6 @@
preserved. By default, only symbols in used sections will be included in the
linked binary.
-If this behavior is not desired for your build system, ensure that these flags
-are at least used for `libgcc.a` (`libgcc_real.a` on Arm32, where `libgcc.a` is
-a linker script, as `--exclude-libs` does not have any effect on the contents of
-linker scripts) and `libunwind.a` (libunwind is only used for ARM32). This is
-necessary to avoid unwinding bugs on Arm32. See [Unwinding] for more
-information.
-
[visibility]: https://gcc.gnu.org/wiki/Visibility
### Controlling Binary Size
@@ -510,47 +502,40 @@
### Unwinding
[Unwinding]: #unwinding
-For 32-bit ARM the NDK makes use of two unwinders: libgcc and LLVM's libunwind.
-libunwind is needed to provide C++ exception handling support. libgcc is needed
-to provide compiler runtime support and as such its unwinder is also seen by the
-linker.
+The NDK uses LLVM's libunwind. libunwind is needed to provide C++ exception
+handling support and C's `__attribute__((cleanup))`. The unwinder is linked
+automatically by Clang, and is built with hidden visibility to avoid shared
+libraries re-exporting the unwind interface.
-These two unwinders are not ABI compatible but do use the same names, so caution
-is required to avoid ODR bugs. For 32-bit ARM, the libgcc.a in the NDK is a
-linker script that ensures that libunwind is linked before libgcc, causing the
-linker to prefer symbols from libunwind to those from libgcc.
+Until NDK r23, libgcc was the unwinder for all architectures other than 32-bit
+ARM, and even 32-bit ARM used libgcc to provide compiler runtime support.
+Libraries built with NDKs older than r23 by build systems that did not follow
+the advice in this document may re-export that incompatible unwinder. In this
+case those libraries can prevent the correct unwinder from being used by your
+build, resulting in crashes or incorrect behavior at runtime.
-As these are static libraries, the symbols will be included in the linked
-binary. By default they will be linked with public visibility. If used in a
-build system that does not strictly adhere to only linking shared libraries
-after all objects and static libraries, the binary being linked may instead load
-these symbols from a shared library. If this library was built with the wrong
-unwinder, it is possible for one unwinder to call into the other. As they are
-not compatible, this will likely result in either a crash or a failed unwind. To
-avoid this problem, libraries should always be built with
-`-Wl,--exclude-libs,libgcc.a`, `-Wl,--exclude-libs,libgcc_real.a` and
-`-Wl,--exclude-libs,libunwind.a` (the latter is only necessary for 32-bit Arm)
-to ensure that unwind symbols are not re-exported from shared libraries. Note
-that `libgcc_real.a` is needed because on some architectures (currently only
-32-bit Arm) `libgcc.a` is a linker script and `--exclude-libs` does not extend
-to the contents of linker scripts.
+The best way to avoid this problem is to ensure all libraries in the application
+were built with NDK r23 or newer.
-Even with the above precautions, it is still possible for an improperly built
-external dependency to provide an incorrect unwind implementation as described
-in the above paragraph. The only way to guarantee protection against this for
-libraries built in your build system is to ensure that objects are linked in the
-following order:
+For cases where that is not an option, build systems can ensure that shared
+libraries are always linked **after** static libraries, and explicitly link the
+unwinder between each group. The linker will prefer definitions that appear
+sooner in the link order, so libunwind appearing **before** the shared libraries
+will prevent the linker from considering the incompatible unwinder provided by
+the broken library. libunwind must be linked after other static libraries to
+provide the unwind interface to those static libraries.
+
+The following link order will protect against incorrectly built dependencies:
1. crtbegin
2. object files
3. static libraries
- 4. libgcc
+ 4. libunwind
5. shared libraries
6. crtend
Unless using `-nostdlib` when linking, crtend and crtbegin will be linked
-automatically by Clang. Linking libraries in the order above will require
-`-nostdlib++` when using libc++.
+automatically by Clang. libunwind can be manually linked with `-lunwind`.
## Windows Specific Issues
diff --git a/docs/Building.md b/docs/Building.md
index 7f1977f..ddd076f 100644
--- a/docs/Building.md
+++ b/docs/Building.md
@@ -17,10 +17,10 @@
repo init -u https://android.googlesource.com/platform/manifest \
-b master-ndk
- # Googlers, use
+ # Googlers, follow http://go/repo-init/aosp-master-ndk. At time of
+ # writing, the correct invocation is:
repo init -u \
- persistent-https://android.git.corp.google.com/platform/manifest \
- -b master-ndk
+ sso://android.git.corp.google.com/platform/manifest -b master-ndk
```
If you wish to rebuild a given release of the NDK, the release branches can also
diff --git a/docs/changelogs/Changelog-r23.md b/docs/changelogs/Changelog-r23.md
index cdb1acb..42e73b3 100644
--- a/docs/changelogs/Changelog-r23.md
+++ b/docs/changelogs/Changelog-r23.md
@@ -20,6 +20,14 @@
## Changes
* Includes preview Android S DP 1 APIs.
+* Updated LLVM to clang-r416183, based on LLVM 12 development.
+ * [Issue 1047]: Fixes crash when using ASan with the CFI unwinder.
+ * [Issue 1096]: Includes support for [Polly]. Enable by adding `-mllvm -polly`
+ to your cflags.
+ * [Issue 1230]: LLVM's libunwind is now used instead of libgcc for all
+ architectures rather than just 32-bit Arm.
+ * [Issue 1231]: LLVM's libclang_rt.builtins is now used instead of libgcc.
+ * [Issue 1406]: Fixes crash with Neon intrinsic.
* Vulkan validation layer source and binaries are no longer shipped in the NDK.
The latest are now posted directly to [GitHub](https://github.com/KhronosGroup/Vulkan-ValidationLayers/releases).
* Vulkan tools source is also removed, specifically vulkan_wrapper.
@@ -39,8 +47,14 @@
should be needed.
[Issue 929]: https://github.com/android/ndk/issues/929
+[Issue 1047]: https://github.com/android/ndk/issues/1047
+[Issue 1096]: https://github.com/android/ndk/issues/1096
+[Issue 1230]: https://github.com/android/ndk/issues/1230
+[Issue 1231]: https://github.com/android/ndk/issues/1231
[Issue 1390]: https://github.com/android/ndk/issues/1390
+[Issue 1406]: https://github.com/android/ndk/issues/1406
[Issue 1452]: https://github.com/android/ndk/issues/1452
+[Polly]: https://polly.llvm.org/
## Known Issues
diff --git a/docs/user/common_problems.md b/docs/user/common_problems.md
index 4778a60..33eee7e 100644
--- a/docs/user/common_problems.md
+++ b/docs/user/common_problems.md
@@ -1,179 +1 @@
-# Common Problems and Solutions
-
-This document lists common issues that users encounter when using the NDK. It is
-by no means complete, but represents some of the most common non-bugs we see
-filed.
-
-
-## Using `_FILE_OFFSET_BITS=64` With Early API Levels
-
-Prior to [Unified Headers], the NDK did not support `_FILE_OFFSET_BITS=64`. If
-you defined it when building, it was silently ignored. With [Unified Headers]
-the `_FILE_OFFSET_BITS=64` option is now supported, but on old versions of
-Android very few of the `off_t` APIs were available as an `off64_t` variant, so
-using this feature with old API levels will result in fewer functions being
-available.
-
-This problem is explained in detail in the [r16 blog post] and in the [bionic
-documentation].
-
-[Unified Headers]: ../UnifiedHeaders.md
-[r16 blog post]: https://android-developers.googleblog.com/2017/09/introducing-android-native-development.html
-[bionic documentation]: https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md
-
-**Problem**: Your build is asking for APIs that do not exist in your
-`minSdkVersion`.
-
-**Solution**: Disable `_FILE_OFFSET_BITS=64` or raise your `minSdkVersion`.
-
-### Undeclared or implicit definition of `mmap`
-
-In C++:
-
-> error: use of undeclared identifier 'mmap'
-
-In C:
-
-> warning: implicit declaration of function 'mmap' is invalid in C99
-
-Using `_FILE_OFFSET_BITS=64` instructs the C library to use `mmap64` instead of
-`mmap`. `mmap64` was not available until android-21. If your `minSdkVersion`
-value is lower than 21, the C library does not contain an `mmap` that is
-compatible with `_FILE_OFFSET_BITS=64`, so the function is unavailable.
-
-**Note**: `mmap` is only the most common manifestation of this problem. The same
-is true of any function in the C library that has an `off_t` parameter.
-
-**Note**: As of r16 beta 2, the C library exposes `mmap64` as an inline function
-to mitigate this instance of this issue.
-
-TODO: Update this section once we know what the next most common problem is.
-
-
-## Target API Set Higher Than Device API
-
-The target API level in the NDK has a very different meaning than
-`targetSdkVersion` does in Java. The NDK target API level is your app's
-**minimum** supported API level. In ndk-build, this is your `APP_PLATFORM`
-setting.
-
-Since references to functions are (typically) resolved when a library is
-loaded rather than when they are first called, you cannot reference APIs that
-are not always present and guard their use with API level checks. If they are
-referred to at all, they must be present.
-
-**Problem**: Your target API level is higher than the API supported by your
-device.
-
-**Solution**: Set your target API level (`APP_PLATFORM`) to the minimum version
-of Android your app supports.
-
-Build System | Setting
----------------------|-------------------
-ndk-build | `APP_PLATFORM`
-CMake | `ANDROID_PLATFORM`
-Standalone Toolchain | `--api`
-Gradle | TODO: No idea
-
-### Cannot Locate `__aeabi` Symbols
-
-> UnsatisfiedLinkError: dlopen failed: cannot locate symbol "`__aeabi_memcpy`"
-
-Note that these are *runtime* errors. These errors will appear in the log when
-you attempt to load your native libraries. The symbol might be any of
-`__aeabi_*` (`__aeabi_memcpy` and `__aeabi_memclr` seem to be the most common).
-
-This problem is documented at https://github.com/android-ndk/ndk/issues/126.
-
-### Cannot Locate Symbol `rand`
-
-> UnsatisfiedLinkError: dlopen failed: cannot locate symbol "`rand`"
-
-This problem was explained very well on Stack Overflow:
-http://stackoverflow.com/a/27338365/632035
-
-There are a handful of other symbols that are also affected by this.
-TODO: Figure out what the other ones were.
-
-
-## Undefined Reference to `__atomic_*`
-
-**Problem**: Some ABIs (particularly armeabi) need libatomic to provide some
-implementations for atomic operations.
-
-**Solution**: Add `-latomic` when linking.
-
-> error: undefined reference to '`__atomic_exchange_4`'
-
-The actual symbol here might be anything prefixed with `__atomic_`.
-
-Note that ndk-build, cmake, and libc++ standalone toolchains handle this for
-you. For non libc++ standalone toolchains or a different build system, you may
-need to do this manually.
-
-
-## RTTI/Exceptions Not Working Across Library Boundaries
-
-**Problem**: Exceptions are not being caught when thrown across shared library
-boundaries, or `dynamic_cast` is failing.
-
-**Solution**: Add a [key function] to your types. A key function is the first
-non-pure, out-of-line virtual function for a type. For an example, see the
-discussion on [Issue 533].
-
-The [C++ ABI] states that two objects have the same type if and only if their
-`type_info` pointers are identical. Exceptions may only be caught if the
-`type_info` for the catch matches the thrown exception. The same rule applies
-for `dynamic_cast`.
-
-When a type does not have a key function, its typeinfo is emitted as a weak
-symbol and matching type infos are merged when libraries are loaded. When
-loading libraries dynamically after the executable has been loaded (i.e. via
-`dlopen` or `System.loadLibrary`), it may not be possible for the loader to
-merge type infos for the loaded libraries. When this happens, the two types are
-not considered equal.
-
-Note that for non-polymorphic types, the type cannot have a key function. For
-non-polymorphic types, RTTI is unnecessary, as `std::is_same` can be used to
-determine type equality at compile time.
-
-[C++ ABI]: https://itanium-cxx-abi.github.io/cxx-abi/abi.html#rtti
-[Issue 533]: https://github.com/android-ndk/ndk/issues/533#issuecomment-335977747
-[key function]: https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague-vtable
-
-
-## Using Mismatched Prebuilt Libraries
-
-Using prebuilt libraries (third-party libraries, typically) in your application
-requires a bit of extra care. In general, the following rules need to be
-followed:
-
-* The resulting app's minimum API level is the maximum of all API levels
- targeted by all libraries.
-
- If your target API level is android-9, but you're using a prebuilt library
- that was built against android-16, the resulting app's minimum API level is
- android-16. Failure to adhere to this will be visible at build time if the
- prebuilt library is static, but may not appear until run time for prebuilt
- shared libraries.
-
-* All libraries should be generated with the same NDK version.
-
- This rule is a bit more flexible than most, but in general NDK code is only
- guaranteed to be compatible with code generated with the same version of the
- NDK (minor revision mismatches generally okay).
-
-* All libraries must use the same STL.
-
- A library using libc++ will not interoperate with one using stlport. All
- libraries in an application must use the same STL.
-
- Strictly speaking this can be made to work, but it's a very fragile
- configuration. Avoid it.
-
-* Apps with multiple shared libraries must use a shared STL.
-
- https://developer.android.com/ndk/guides/cpp-support.html#sr
-
- As with mismatched STLs, the problems caused by this can be avoided if great
- care is taken, but it's better to just avoid the problem.
+Moved to https://developer.android.com/ndk/guides/common-problems
diff --git a/docs/user/middleware_vendors.md b/docs/user/middleware_vendors.md
index 215403c..f3a01b5 100644
--- a/docs/user/middleware_vendors.md
+++ b/docs/user/middleware_vendors.md
@@ -1,92 +1 @@
-# Advice for Middleware Vendors
-
-Distributing middleware built with the NDK imposes some additional problems that
-app developers do not need to worry about. Prebuilt libraries impose some of
-their implementation choices on their users.
-
-## Choosing API levels and NDK versions
-
-Your users cannot use a `minSdkVersion` lower than yours. If your users' apps
-need to run on Android 16, you cannot build for Android 21.
-
-NDK versions are largely compatible with each other, but occasionally there are
-changes that break compatibility. If you know that all of your users are using
-the same version of the NDK, it's best to use the same version that they do.
-Otherwise, use the newest version.
-
-## Using the STL
-
-If you're writing C++ and using the STL, your choice between libc++_shared and
-libc++_static affects your users if you distribute a shared library. If you
-distribute a shared library, you must either use libc++_shared or ensure that
-libc++'s symbols are not exposed by your library. The best way to do this is to
-explicitly declare your ABI surface with a version script (this also helps keep
-your implementation details private). For example, a simple arithmetic library
-might have the following version script:
-
-Note: If you distribute a static library, it does not matter whether you choose
-a static or shared STL because nothing is linked in a static library. The user
-can link whichever they choose in their application. They must link *something*,
-even for C-only consumers, so be sure to document that it is required and which
-version of the NDK was used to build in case of incompatibility in STL versions.
-
-```txt
-LIBMYMATH {
-global:
- add;
- sub;
- mul;
- div;
- # C++ symbols in an extern block will be mangled automatically. See
- # https://stackoverflow.com/a/21845178/632035 for more examples.
- extern "C++" {
- "pow(int, int)";
- }
-local:
- *;
-};
-```
-
-A version script should be the preferred option because it is the most robust
-way to control symbol visibility. Another, less robust option is to use
-`-Wl,--exclude-libs,libc++_static.a -Wl,--exclude-libs,libc++abi.a` when
-linking. This is less robust because it will only hide the symbols in the
-libraries that are explicitly named, and no diagnostics are reported for
-libraries that are not used (a typo in the library name is not an error, and the
-burden is on the user to keep the library list up to date).
-
-## For Java Middleware with JNI Libraries
-
-Java libraries that include JNI libraries (i.e. use `jniLibs`) need to be
-careful that the JNI libraries they include will not collide with other
-libraries in the user's app. For example, if the AAR includes
-`libc++_shared.so`, but a different version of `libc++_shared.so` than the app
-uses, only one will be installed to the APK and that may lead to unreliable
-behavior.
-
-Warning: [Bug 141758241]: The Android Gradle Plugin does not currently diagnose
-this error condition. One of the identically named libraries will be arbitrarily
-chosen for packaging in the APK.
-
-[Bug 141758241]: https://issuetracker.google.com/141758241
-
-The most reliable solution is for Java libraries to include no more than **one**
-JNI library. All dependencies including the STL should be statically linked into
-the implementation library, and a version script should be used to enforce the
-ABI surface. For example, a Java library com.example.foo that includes the JNI
-library libfooimpl.so should use the following version script:
-
-```txt
-LIBFOOIMPL {
-global:
- JNI_OnLoad;
-local:
- *;
-};
-```
-
-Note that this example uses `registerNatives` via `JNI_OnLoad` as described in
-[JNI Tips] to ensure that the minimal ABI surface is exposed and library load
-time is minimized.
-
-[JNI Tips]: https://developer.android.com/training/articles/perf-jni#native-libraries
+Moved to https://developer.android.com/ndk/guides/middleware-vendors
diff --git a/ndk/checkbuild.py b/ndk/checkbuild.py
index df44cc6..9cd6bef 100755
--- a/ndk/checkbuild.py
+++ b/ndk/checkbuild.py
@@ -414,18 +414,15 @@
(bin_dir / 'clang.real').rename(clang)
(bin_dir / 'clang++').symlink_to('clang')
- # The prebuilts have duplicates as clang-MAJ. Remove these to save
- # space.
- for path in bin_dir.glob('clang-*'):
- if re.search(r'^clang-\d+$', path.name) is not None:
- path.unlink()
-
- # Remove LLD duplicates. We only need ld.lld.
- # http://b/74250510
bin_ext = '.exe' if self.host.is_windows else ''
- (bin_dir / f'ld64.lld{bin_ext}').unlink()
- (bin_dir / f'lld{bin_ext}').unlink()
- (bin_dir / f'lld-link{bin_ext}').unlink()
+ if self.host.is_windows:
+ # Remove LLD duplicates. We only need ld.lld. For non-Windows these
+ # are all symlinks so we can keep them (and *need* to keep lld
+ # since that's the real binary).
+ # http://b/74250510
+ (bin_dir / f'ld64.lld{bin_ext}').unlink()
+ (bin_dir / f'lld{bin_ext}').unlink()
+ (bin_dir / f'lld-link{bin_ext}').unlink()
install_clanglib = install_path / 'lib64/clang'
linux_prebuilt_path = ClangToolchain.path_for_host(Host.Linux)
@@ -467,6 +464,23 @@
shutil.rmtree(dst_lib_dir)
shutil.copytree(ndk_runtimes, dst_lib_dir)
+ # Create empty libatomic.a stub libraries to keep -latomic working.
+ # This is needed for backwards compatibility and might be useful if
+ # upstream LLVM splits out the __atomic_* APIs from the builtins.
+ for arch in ndk.abis.ALL_ARCHITECTURES:
+ # Only the arch-specific subdir is on the linker search path.
+ subdir = {
+ ndk.abis.Abi('arm'): 'arm',
+ ndk.abis.Abi('arm64'): 'aarch64',
+ ndk.abis.Abi('x86'): 'i386',
+ ndk.abis.Abi('x86_64'): 'x86_64',
+ }[arch]
+ (dst_lib_dir / subdir / 'libatomic.a').write_text(
+ textwrap.dedent("""\
+ /* The __atomic_* APIs are now in libclang_rt.builtins-*.a. They might
+ eventually be broken out into a separate library -- see llvm.org/D47606. */
+ """))
+
# Also remove the other libraries that we installed, but they were only
# installed on Linux.
if self.host == Host.Linux:
@@ -479,20 +493,6 @@
shutil.rmtree(install_path / 'lib64/cmake')
-def get_gcc_prebuilt_path(arch: ndk.abis.Arch) -> Path:
- """Returns the path to the GCC prebuilt for the given arch.
-
- Since this is only used for getting *target* binaries like libgcc, we
- always use the Linux prebuilts.
- """
- prebuilt_path = (ANDROID_DIR /
- 'prebuilts/ndk/current/toolchains/linux-x86_64' /
- f'{ndk.abis.arch_to_toolchain(arch)}-4.9')
- if not prebuilt_path.is_dir():
- raise RuntimeError(f'Could not find prebuilt GCC at {prebuilt_path}')
- return prebuilt_path
-
-
def get_binutils_prebuilt_path(host: Host, arch: ndk.abis.Arch) -> Path:
if host == Host.Windows64:
host_dir_name = 'win64'
@@ -522,98 +522,6 @@
raise ValueError(f'Unsupported host: {host}')
-def install_gcc_lib(install_path: Path,
- arch: ndk.abis.Arch,
- subarch: str,
- lib_subdir: Path,
- libname: str,
- src_subdir: Optional[Path] = None) -> None:
- if src_subdir is None:
- src_subdir = lib_subdir
-
- lib_install_dir = install_path / lib_subdir / subarch
- if not lib_install_dir.exists():
- lib_install_dir.mkdir(parents=True)
-
- shutil.copy2(
- get_gcc_prebuilt_path(arch) / src_subdir / subarch / libname,
- lib_install_dir / libname)
-
-
-def install_gcc_crtbegin(install_path: Path, arch: ndk.abis.Arch,
- subarch: str) -> None:
- triple = ndk.abis.arch_to_triple(arch)
- subdir = Path('lib/gcc') / triple / '4.9.x'
- install_gcc_lib(install_path, arch, subarch, subdir, 'crtbegin.o')
-
-
-def install_libgcc(install_path: Path,
- arch: ndk.abis.Arch,
- subarch: str,
- new_layout: bool = False) -> None:
- triple = ndk.abis.arch_to_triple(arch)
- subdir = Path('lib/gcc') / triple / '4.9.x'
- install_gcc_lib(install_path, arch, subarch, subdir, 'libgcc.a')
-
- if new_layout:
- # For all architectures, we want to ensure that libcompiler_rt-extras
- # is linked when libgcc is linked. Some day this will be entirely
- # replaced by compiler-rt, but for now we are still dependent on libgcc
- # but still need some things from compiler_rt-extras.
- #
- # For ARM32 we need to use LLVM's libunwind rather than libgcc.
- # Unfortunately we still use libgcc for the compiler builtins, so we we
- # have to link both. To make sure that the LLVM unwinder gets used, add
- # a linker script for libgcc to make sure that libunwind is placed
- # first whenever libgcc is used. This also necessitates linking libdl
- # since libunwind makes use of dl_iterate_phdr.
- #
- # Historically we dealt with this in the libc++ linker script, but
- # since the new toolchain setup has the toolchain link the STL for us
- # the correct way to use the static libc++ is to use
- # `-static-libstdc++' which will expand to `-Bstatic -lc++ -Bshared`,
- # which results in the static libdl being used. The stub implementation
- # of libdl.a causes the unwind to fail, so we can't link libdl there.
- # If we don't link it at all, linking fails when building a static
- # executable since the driver does not link libdl when building a
- # static executable.
- #
- # We only do this for the new toolchain layout since build systems
- # using the legacy toolchain already needed to handle this, and
- # -lunwind may not be valid in those configurations (it could have been
- # linked by a full path instead).
- libgcc_base_path = install_path / subdir / subarch
- libgcc_path = libgcc_base_path / 'libgcc.a'
- libgcc_real_path = libgcc_base_path / 'libgcc_real.a'
- libgcc_path.rename(libgcc_real_path)
- if arch == 'arm':
- libs = '-lunwind -lcompiler_rt-extras -lgcc_real -ldl'
- else:
- libs = '-lcompiler_rt-extras -lgcc_real'
- libgcc_path.write_text('INPUT({})'.format(libs))
-
-
-def install_libatomic(install_path: Path, arch: ndk.abis.Arch,
- subarch: str) -> None:
- triple = ndk.abis.arch_to_triple(arch)
- libdir_name = 'lib64' if arch.endswith('64') else 'lib'
- install_gcc_lib(install_path, arch, subarch,
- Path('lib/gcc') / triple / '4.9.x', 'libatomic.a',
- Path(triple) / libdir_name)
-
-
-def get_subarches(arch: ndk.abis.Arch) -> List[str]:
- if arch != ndk.abis.Arch('arm'):
- return ['']
-
- return [
- '',
- 'thumb',
- 'armv7-a',
- 'armv7-a/thumb'
- ]
-
-
class ShaderTools(ndk.builds.CMakeModule):
name = 'shader-tools'
src = ANDROID_DIR / 'external' / 'shaderc' / 'shaderc'
@@ -928,9 +836,6 @@
shutil.copy2(os.path.join(static_lib_dir, 'libc++abi.a'), lib_dir)
shutil.copy2(os.path.join(static_lib_dir, 'libc++_static.a'), lib_dir)
- if abi == 'armeabi-v7a':
- shutil.copy2(os.path.join(static_lib_dir, 'libunwind.a'), lib_dir)
-
if abi in ndk.abis.LP32_ABIS:
shutil.copy2(
os.path.join(static_lib_dir, 'libandroid_support.a'), lib_dir)
@@ -1569,9 +1474,6 @@
yield from Sysroot().notices
yield from SystemStl().notices
yield ANDROID_DIR / 'toolchain/binutils/binutils-2.27/gas/COPYING'
- for arch in ndk.abis.ALL_ARCHITECTURES:
- # For libgcc/libatomic.
- yield get_gcc_prebuilt_path(arch) / 'NOTICE'
def build(self) -> None:
pass
@@ -1606,16 +1508,6 @@
gas = binutils_dir / f'bin/{triple}-as{exe}'
shutil.copy2(gas, bin_dir)
- # We still need libgcc/libatomic. Copy them from the old GCC
- # prebuilts.
- for subarch in get_subarches(arch):
- install_libgcc(Path(install_dir), arch, subarch)
- install_libatomic(Path(install_dir), arch, subarch)
-
- # We don't actually want this, but Clang won't recognize a
- # -gcc-toolchain without it.
- install_gcc_crtbegin(Path(install_dir), arch, subarch)
-
platforms = self.get_dep('platforms')
assert isinstance(platforms, Platforms)
for api in platforms.get_apis():
@@ -1737,17 +1629,6 @@
copy_tree(libcxxabi_inc_src, libcxx_inc_dst)
for arch in ndk.abis.ALL_ARCHITECTURES:
- # We need to replace libgcc with linker scripts that also use
- # libunwind on arm32.
- #
- # This needs to be done here rather than in BaseToolchain because
- # libunwind isn't available until libc++ has been built.
- for subarch in get_subarches(arch):
- install_libgcc(Path(install_dir),
- arch,
- subarch,
- new_layout=True)
-
triple = ndk.abis.arch_to_triple(arch)
abi, = ndk.abis.arch_to_abis(arch)
libcxx_lib_dir = os.path.join(libcxx_dir, 'libs', abi)
@@ -1758,8 +1639,6 @@
'libc++_static.a',
'libc++abi.a',
]
- if arch == 'arm':
- libs.append('libunwind.a')
if abi in ndk.abis.LP32_ABIS:
libs.append('libandroid_support.a')
diff --git a/ndk/config.py b/ndk/config.py
index 3d95bae..3555414 100644
--- a/ndk/config.py
+++ b/ndk/config.py
@@ -4,9 +4,9 @@
major = 23
hotfix = 0
hotfix_str = chr(ord('a') + hotfix) if hotfix else ''
-beta = 2
+beta = 0
beta_str = '-beta{}'.format(beta) if beta > 0 else ''
-canary = False
+canary = True
canary_str = '-canary' if canary else ''
release = 'r{}{}{}{}'.format(major, hotfix_str, beta_str, canary_str)
if __name__ == '__main__':
diff --git a/ndk/toolchains.py b/ndk/toolchains.py
index d73f64f..b8f33a9 100644
--- a/ndk/toolchains.py
+++ b/ndk/toolchains.py
@@ -22,7 +22,7 @@
import ndk.paths
-CLANG_VERSION = 'clang-r399163b'
+CLANG_VERSION = 'clang-r416183'
HOST_TRIPLE_MAP = {
diff --git a/tests/build/link_order/test.py b/tests/build/link_order/test.py
index 0a2d448..2a6f6ee 100644
--- a/tests/build/link_order/test.py
+++ b/tests/build/link_order/test.py
@@ -67,6 +67,16 @@
return args
+def builtins_basename(abi: Abi):
+ runtimes_arch = {
+ 'armeabi-v7a': 'arm',
+ 'arm64-v8a': 'aarch64',
+ 'x86': 'i686',
+ 'x86_64': 'x86_64',
+ }[abi]
+ return 'libclang_rt.builtins-' + runtimes_arch + '-android.a'
+
+
def check_link_order(link_line: str, abi: Abi,
api: int) -> Tuple[bool, Optional[Iterator[str]]]:
"""Determines if a given link command has the correct ordering.
@@ -80,26 +90,27 @@
suitable for use with `' '.join()`. The diff represents the changes
between the expected link order and the actual link order.
"""
- libunwind_arg = ['libunwind.a'] if abi == 'armeabi-v7a' else []
android_support_arg = ['libandroid_support.a'] if api < 21 else []
expected = [
'crtbegin_so.o',
'foo.o',
- ] + android_support_arg + libunwind_arg + [
- # The most important part of this test is checking that libgcc comes
- # *before* the shared libraries so we can be sure we're actually
- # getting libgcc symbols rather than getting them from some shared
+ ] + android_support_arg + [
+ # The most important part of this test is checking that libunwind.a
+ # comes *before* the shared libraries so we can be sure we're actually
+ # getting libunwind.a symbols rather than getting them from some shared
# library dependency that's re-exporting them.
- '-lgcc',
+ 'libunwind.a',
'-latomic',
'libc++_shared.so',
'-lc',
'-lm',
'-lm',
- '-lgcc',
+ builtins_basename(abi),
+ '-l:libunwind.a',
'-ldl',
'-lc',
- '-lgcc',
+ builtins_basename(abi),
+ '-l:libunwind.a',
'-ldl',
'crtend_so.o',
]
diff --git a/tests/libc++/test/std/iterators/iterator.primitives/iterator.traits/test_config.py b/tests/libc++/test/std/iterators/iterator.primitives/iterator.traits/test_config.py
new file mode 100644
index 0000000..03bc9cf
--- /dev/null
+++ b/tests/libc++/test/std/iterators/iterator.primitives/iterator.traits/test_config.py
@@ -0,0 +1,6 @@
+def build_broken(test):
+ if test.case_name == 'empty.fail':
+ # Format of the diagnostic changed in clang and we don't have the
+ # libc++ update to match (https://reviews.llvm.org/D92239).
+ return 'all', 'https://github.com/android/ndk/issues/1454'
+ return None, None