aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2010-04-07 15:30:45 -0700
committerDavid 'Digit' Turner <digit@google.com>2010-04-08 13:00:59 -0700
commit35f944d26f33fff3e59ab449c991b18260a5fa0b (patch)
tree0d655c4fa83d6498baefdc056395d22e2e92da71
parent67c22255b157f1945d478b5cc44f603352b0d8b5 (diff)
downloadndk-35f944d26f33fff3e59ab449c991b18260a5fa0b.tar.gz
Perform auto-detection of host platform in build scripts.
This removes build/host-setup.sh and the generated file out/host/config.mk Also: fix a bug that copied gdbserver into release projects, not debug ones. Change-Id: Ie3641dadb6148b1a671534d9bbb5e587cd742845
-rw-r--r--GNUmakefile24
-rw-r--r--apps/hello-neon/project/jni/Android.mk4
-rw-r--r--build/check-awk.awk2
-rw-r--r--build/core/definitions.mk120
-rw-r--r--build/core/main.mk85
-rw-r--r--build/core/setup-toolchain.mk45
-rwxr-xr-xbuild/host-setup.sh265
-rw-r--r--docs/CHANGES.TXT7
-rw-r--r--docs/INSTALL.TXT10
-rw-r--r--docs/OVERVIEW.TXT27
10 files changed, 207 insertions, 382 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 3cd1635ea..bf74b8ed1 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 The Android Open Source Project
+# Copyright (C) 2010 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.
@@ -14,5 +14,25 @@
#
# DO NOT MODIFY THIS FILE
-include build/core/main.mk
+
+# Check that we have at least GNU Make 3.81
+# We do this by detecting whether 'lastword' is supported
+#
+MAKE_TEST := $(lastword a b c d e f)
+ifneq ($(MAKE_TEST),f)
+ $(error,The Android NDK requires GNU Make 3.81 or higher to run !)
+endif
+
+# Find the NDK root installation path, should be this file's location.
+NDK_ROOT := $(dir $(lastword $(MAKEFILE_LIST)))
+NDK_ROOT := $(NDK_ROOT:%/=%)
+
+# Complain if the path contains spaces
+ifneq ($(words $(NDK_ROOT)),1)
+ $(info,The Android NDK installation path contains spaces: '$(NDK_ROOT)')
+ $(error,Please fix the problem by reinstalling to a different location.)
+endif
+
+include $(NDK_ROOT)/build/core/main.mk
+
# END OF FILE
diff --git a/apps/hello-neon/project/jni/Android.mk b/apps/hello-neon/project/jni/Android.mk
index 5c7cb2511..a3ca55edd 100644
--- a/apps/hello-neon/project/jni/Android.mk
+++ b/apps/hello-neon/project/jni/Android.mk
@@ -11,7 +11,7 @@ ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_SRC_FILES += helloneon-intrinsics.c.neon
endif
-LOCAL_C_INCLUDES := sources/cpufeatures
+LOCAL_C_INCLUDES := $(NDK_ROOT)/sources/cpufeatures
LOCAL_STATIC_LIBRARIES := cpufeatures
@@ -19,4 +19,4 @@ LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
-include sources/cpufeatures/Android.mk
+include $(NDK_ROOT)/sources/cpufeatures/Android.mk
diff --git a/build/check-awk.awk b/build/check-awk.awk
index 1e0931715..425867ef8 100644
--- a/build/check-awk.awk
+++ b/build/check-awk.awk
@@ -4,7 +4,7 @@
# These were introduced in nawk/gawk, but the original awk
# does not have them.
#
-END {
+BEGIN {
RSTART=0
RLENGTH=0
s1="A real world example"
diff --git a/build/core/definitions.mk b/build/core/definitions.mk
index 93b5e3170..a04c90a3c 100644
--- a/build/core/definitions.mk
+++ b/build/core/definitions.mk
@@ -16,28 +16,7 @@
#
# We use the GNU Make Standard Library
-include $(BUILD_SYSTEM)/../gmsl/gmsl
-
-# This is the Android NDK version number as a list of three items:
-# major, minor, revision
-#
-ndk_version := 1 0 0
-
-# Used to output warnings and error from the library, it's possible to
-# disable any warnings or errors by overriding these definitions
-# manually or by setting GMSL_NO_WARNINGS or GMSL_NO_ERRORS
-
-__ndk_name := Android NDK
-__ndk_info = $(info $(__ndk_name): $1 $2 $3 $4 $5)
-__ndk_warning = $(warning $(__ndk_name): $1 $2 $3 $4 $5)
-__ndk_error = $(error $(__ndk_name): $1 $2 $3 $4 $5)
-
-ifdef NDK_NO_WARNINGS
-__ndk_warning :=
-endif
-ifdef NDK_NO_ERRORS
-__ndk_error :=
-endif
+include $(NDK_ROOT)/build/gmsl/gmsl
# If NDK_TRACE is enabled then calls to the library functions are
# traced to stdout using warning messages with their arguments
@@ -53,19 +32,6 @@ __ndk_tr3 :=
endif
# -----------------------------------------------------------------------------
-# Function : ndk_log
-# Arguments: 1: text to print when NDK_LOG is defined
-# Returns : None
-# Usage : $(call ndk_log,<some text>)
-# -----------------------------------------------------------------------------
-ifdef NDK_LOG
-ndk_log = $(info $(__ndk_name): $1)
-else
-ndk_log :=
-endif
-
-
-# -----------------------------------------------------------------------------
# Macro : empty
# Returns : an empty macro
# Usage : $(empty)
@@ -620,3 +586,87 @@ define cmd-install-file
@mkdir -p $(dir $2)
$(hide) cp -fp $1 $2
endef
+
+
+#
+# Determine host system and architecture from the environment
+#
+HOST_OS := $(strip $(HOST_OS))
+ifndef HOST_OS
+ # On all modern variants of Windows (including Cygwin and Wine)
+ # the OS environment variable is defined to 'Windows_NT'
+ #
+ # The value of PROCESSOR_ARCHITECTURE will be x86 or AMD64
+ #
+ ifeq ($(OS),Windows_NT)
+ HOST_OS := windows
+ else
+ # For other systems, use the `uname` output
+ UNAME := $(shell uname -s)
+ ifneq (,$(findstring Linux,$(UNAME)))
+ HOST_OS := linux
+ endif
+ ifneq (,$(findstring Darwin,$(UNAME)))
+ HOST_OS := darwin
+ endif
+ # We should not be there, but just in case !
+ ifneq (,$(findstring CYGWIN,$(UNAME)))
+ HOST_OS := windows
+ endif
+ ifeq ($(HOST_OS),)
+ $(call __ndk_info,Unable to determine HOST_OS from uname -s: $(UNAME))
+ $(call __ndk_info,Please define HOST_OS in your environment.)
+ $(call __ndk_error,Aborting.)
+ endif
+ endif
+ $(call ndk_log,Host OS was auto-detected: $(HOST_OS))
+else
+ $(call ndk_log,Host OS from environment: $(HOST_OS))
+endif
+
+HOST_ARCH := $(strip $(HOST_ARCH))
+ifndef HOST_ARCH
+ ifeq ($(HOST_OS),windows)
+ HOST_ARCH := $(PROCESSOR_ARCHITECTURE)
+ ifeq ($(HOST_ARCH),AMD64)
+ HOST_ARCH := x86
+ endif
+ else # HOST_OS != windows
+ UNAME := $(shell uname -m)
+ ifneq (,$(findstring 86,$(UNAME)))
+ HOST_ARCH := x86
+ endif
+ # We should probably should not care at all
+ ifneq (,$(findstring Power,$(UNAME)))
+ HOST_ARCH := ppc
+ endif
+ ifeq ($(HOST_ARCH),)
+ $(call __ndk_info,Unsupported host architecture: $(UNAME))
+ $(call __ndk_error,Aborting)
+ endif
+ endif # HOST_OS != windows
+ $(call ndk_log,Host CPU was auto-detected: $(HOST_ARCH))
+else
+ $(call ndk_log,Host CPU from environment: $(HOST_ARCH))
+endif
+
+HOST_TAG := $(HOST_OS)-$(HOST_ARCH)
+$(call ndk_log,HOST_TAG set to $(HOST_TAG))
+
+#
+#
+#
+HOST_AWK := $(strip $(HOST_AWK))
+ifndef HOST_AWK
+ HOST_AWK := awk
+ $(call ndk_log,Host awk tool was auto-detected: $(HOST_AWK))
+else
+ $(call ndk_log,Host awk tool from environment: $(HOST_AWK))
+endif
+
+AWK_TEST := $(shell $(HOST_AWK) -f $(NDK_ROOT)/build/check-awk.awk)
+$(call ndk_log,Host awk test returned: $(AWK_TEST))
+ifneq ($(AWK_TEST),Pass)
+ $(call __ndk_info,Host awk tool is outdated. Please define HOST_AWK to point to Gawk or Nawk !)
+ $(call __ndk_error,Aborting.)
+endif
diff --git a/build/core/main.mk b/build/core/main.mk
index 97f0bcbe3..92c2ea2be 100644
--- a/build/core/main.mk
+++ b/build/core/main.mk
@@ -15,39 +15,74 @@
# ====================================================================
#
+# Define a few useful variables and functions.
+# More stuff will follow in definitions.mk.
+#
+# ====================================================================
+
+# Used to output warnings and error from the library, it's possible to
+# disable any warnings or errors by overriding these definitions
+# manually or by setting NDK_NO_WARNINGS or NDK_NO_ERRORS
+
+__ndk_name := Android NDK
+__ndk_info = $(info $(__ndk_name): $1 $2 $3 $4 $5)
+__ndk_warning = $(warning $(__ndk_name): $1 $2 $3 $4 $5)
+__ndk_error = $(error $(__ndk_name): $1 $2 $3 $4 $5)
+
+ifdef NDK_NO_WARNINGS
+__ndk_warning :=
+endif
+ifdef NDK_NO_ERRORS
+__ndk_error :=
+endif
+
+# -----------------------------------------------------------------------------
+# Function : ndk_log
+# Arguments: 1: text to print when NDK_LOG is defined
+# Returns : None
+# Usage : $(call ndk_log,<some text>)
+# -----------------------------------------------------------------------------
+ifdef NDK_LOG
+ndk_log = $(info $(__ndk_name): $1)
+else
+ndk_log :=
+endif
+
+# ====================================================================
+#
# Define the main configuration variables, and read the host-specific
# configuration file that is normally generated by build/host-setup.sh
#
# ====================================================================
+# Detect the NDK installation path by processing this Makefile's location.
+# This assumes we are located under $NDK_ROOT/build/core/main.mk
+#
+NDK_ROOT := $(lastword $(MAKEFILE_LIST))
+NDK_ROOT := $(strip $(NDK_ROOT:%build/core/main.mk=%))
+ifeq ($(NDK_ROOT),)
+ # for the case when we're invoked from the NDK install path
+ NDK_ROOT := .
+else
+ # get rid of trailing slash
+ NDK_ROOT := $(NDK_ROOT:%/=%)
+endif
+$(call ndk_log,NDK installation path auto-detected: '$(NDK_ROOT)')
+
# The location of the build system files
-BUILD_SYSTEM := $(strip $(dir $(lastword $(MAKEFILE_LIST))))
-BUILD_SYSTEM := $(BUILD_SYSTEM:%/=%)
+BUILD_SYSTEM := $(NDK_ROOT)/build/core
# Include common definitions
-include build/core/definitions.mk
+include $(BUILD_SYSTEM)/definitions.mk
# Where all generated files will be stored during a build
-NDK_OUT := out
+NDK_OUT := $(NDK_ROOT)/out
-# Read the host-specific configuration file in $(NDK_OUT)
-#
-HOST_CONFIG_MAKE := $(NDK_OUT)/host/config.mk
-
-ifeq ($(strip $(wildcard $(HOST_CONFIG_MAKE))),)
- $(call __ndk_info,\
- The configuration file '$(HOST_CONFIG_MAKE)' doesnt' exist.)
- $(call __ndk_info,\
- Please run 'build/host-setup.sh' to generate it.)
- $(call __ndk_error, Aborting)
-endif
-
-include $(HOST_CONFIG_MAKE)
HOST_PREBUILT_TAG := $(HOST_TAG)
# Location where all prebuilt binaries for a given host architectures
# will be stored.
-HOST_PREBUILT := build/prebuilt/$(HOST_TAG)
+HOST_PREBUILT := $(NDK_ROOT)/build/prebuilt/$(HOST_TAG)
# Where all app-specific generated files will be stored
NDK_APP_OUT := $(NDK_OUT)/apps
@@ -78,7 +113,7 @@ ADD_TOOLCHAIN := $(BUILD_SYSTEM)/add-toolchain.mk
NDK_ALL_TOOLCHAINS :=
NDK_ALL_ABIS :=
-TOOLCHAIN_CONFIGS := $(wildcard build/toolchains/*/config.mk)
+TOOLCHAIN_CONFIGS := $(wildcard $(NDK_ROOT)/build/toolchains/*/config.mk)
$(foreach _config_mk,$(TOOLCHAIN_CONFIGS),\
$(eval include $(BUILD_SYSTEM)/add-toolchain.mk)\
)
@@ -120,7 +155,7 @@ $(foreach tc,$(NDK_ALL_TOOLCHAINS),\
#
# ====================================================================
-NDK_PLATFORMS_ROOT := $(BUILD_SYSTEM)/../platforms
+NDK_PLATFORMS_ROOT := $(NDK_ROOT)/build/platforms
NDK_ALL_PLATFORMS := $(strip $(notdir $(wildcard $(NDK_PLATFORMS_ROOT)/android-*)))
$(call ndk_log,Found supported platforms: $(NDK_ALL_PLATFORMS))
@@ -153,10 +188,11 @@ $(call ndk_log,Found max platform level: $(NDK_MAX_PLATFORM_LEVEL))
# ====================================================================
NDK_ALL_APPS :=
+NDK_APPS_ROOT := $(NDK_ROOT)/apps
# Get the list of apps listed under apps/*
-NDK_APPLICATIONS := $(wildcard apps/*)
-NDK_ALL_APPS := $(NDK_APPLICATIONS:apps/%=%)
+NDK_APPLICATIONS := $(wildcard $(NDK_APPS_ROOT)/*)
+NDK_ALL_APPS := $(NDK_APPLICATIONS:$(NDK_APPS_ROOT)/%=%)
# Check that APP is not empty
APP := $(strip $(APP))
@@ -185,7 +221,7 @@ endif
# Check that all apps listed in APP have an Application.mk
$(foreach _app,$(APP),\
- $(eval _application_mk := $(strip $(wildcard apps/$(_app)/Application.mk))) \
+ $(eval _application_mk := $(strip $(wildcard $(NDK_ROOT)/apps/$(_app)/Application.mk))) \
$(call ndk_log,Parsing $(_application_mk))\
$(if $(_application_mk),\
$(eval include $(BUILD_SYSTEM)/add-application.mk)\
@@ -207,9 +243,6 @@ ifeq ($(strip $(NDK_ALL_APPS)),)
$(call __ndk_error, Aborting)
endif
-ifeq ($(strip $(APP)),)
-endif
-
# now check that APP doesn't contain an unknown app name
# if it does, we ignore them if there is at least one known
# app name in the list. Otherwise, abort with an error message
diff --git a/build/core/setup-toolchain.mk b/build/core/setup-toolchain.mk
index c8717b7a5..3114a48e3 100644
--- a/build/core/setup-toolchain.mk
+++ b/build/core/setup-toolchain.mk
@@ -24,27 +24,27 @@ $(call assert-defined,NDK_APPS)
# NOTE: If NDK_TOOLCHAIN is defined, we're going to use it.
#
ifndef NDK_TOOLCHAIN
- TARGET_TOOLCHAIN_LIST := $(strip $(sort $(NDK_ABI.$(TARGET_ARCH_ABI).toolchains)))
- ifndef TARGET_TOOLCHAIN_LIST
- $(call __ndk_info,There is no toolchain that supports the $(TARGET_ARCH_ABI) ABI.)
- $(call __ndk_info,Please modify the APP_ABI definition in $(NDK_APP_APPLICATION_MK) to use)
- $(call __ndk_info,a set of the following values: $(NDK_ALL_ABIS))
- $(call __ndk_error,Aborting)
- endif
- # Select the last toolchain from the sorted list.
- # For now, this is enough to select armeabi-4.4.0 by default for ARM
- TARGET_TOOLCHAIN := $(lastword $(TARGET_TOOLCHAIN_LIST))
- $(call ndk_log,Using target toolchain '$(TARGET_TOOLCHAIN)' for '$(TARGET_ARCH_ABI)' ABI)
+ TARGET_TOOLCHAIN_LIST := $(strip $(sort $(NDK_ABI.$(TARGET_ARCH_ABI).toolchains)))
+ ifndef TARGET_TOOLCHAIN_LIST
+ $(call __ndk_info,There is no toolchain that supports the $(TARGET_ARCH_ABI) ABI.)
+ $(call __ndk_info,Please modify the APP_ABI definition in $(NDK_APP_APPLICATION_MK) to use)
+ $(call __ndk_info,a set of the following values: $(NDK_ALL_ABIS))
+ $(call __ndk_error,Aborting)
+ endif
+ # Select the last toolchain from the sorted list.
+ # For now, this is enough to select armeabi-4.4.0 by default for ARM
+ TARGET_TOOLCHAIN := $(lastword $(TARGET_TOOLCHAIN_LIST))
+ $(call ndk_log,Using target toolchain '$(TARGET_TOOLCHAIN)' for '$(TARGET_ARCH_ABI)' ABI)
else # NDK_TOOLCHAIN is not empty
- TARGET_TOOLCHAIN_LIST := $(strip $(filter $(NDK_TOOLCHAIN),$(NDK_ABI.$(TARGET_ARCH_ABI).toolchains)))
- ifndef TARGET_TOOLCHAIN_LIST
- $(call __ndk_info,The selected toolchain ($(NDK_TOOLCHAIN)) does not support the $(TARGET_ARCH_ABI) ABI.)
- $(call __ndk_info,Please modify the APP_ABI definition in $(NDK_APP_APPLICATION_MK) to use)
- $(call __ndk_info,a set of the following values: $(NDK_TOOLCHAIN.$(NDK_TOOLCHAIN).abis))
- $(call __ndk_info,Or change your NDK_TOOLCHAIN definition.)
- $(call __ndk_error,Aborting)
- endif
- TARGET_TOOLCHAIN := $(NDK_TOOLCHAIN)
+ TARGET_TOOLCHAIN_LIST := $(strip $(filter $(NDK_TOOLCHAIN),$(NDK_ABI.$(TARGET_ARCH_ABI).toolchains)))
+ ifndef TARGET_TOOLCHAIN_LIST
+ $(call __ndk_info,The selected toolchain ($(NDK_TOOLCHAIN)) does not support the $(TARGET_ARCH_ABI) ABI.)
+ $(call __ndk_info,Please modify the APP_ABI definition in $(NDK_APP_APPLICATION_MK) to use)
+ $(call __ndk_info,a set of the following values: $(NDK_TOOLCHAIN.$(NDK_TOOLCHAIN).abis))
+ $(call __ndk_info,Or change your NDK_TOOLCHAIN definition.)
+ $(call __ndk_error,Aborting)
+ endif
+ TARGET_TOOLCHAIN := $(NDK_TOOLCHAIN)
endif # NDK_TOOLCHAIN is not empty
TARGET_ABI := $(TARGET_PLATFORM)-$(TARGET_ARCH_ABI)
@@ -54,7 +54,7 @@ TARGET_ABI := $(TARGET_PLATFORM)-$(TARGET_ARCH_ABI)
# some libraries and object files used for linking the generated
# target files properly.
#
-SYSROOT := build/platforms/$(TARGET_PLATFORM)/arch-$(TARGET_ARCH)
+SYSROOT := $(NDK_ROOT)/build/platforms/$(TARGET_PLATFORM)/arch-$(TARGET_ARCH)
TARGET_CRTBEGIN_STATIC_O := $(SYSROOT)/usr/lib/crtbegin_static.o
TARGET_CRTBEGIN_DYNAMIC_O := $(SYSROOT)/usr/lib/crtbegin_dynamic.o
@@ -75,7 +75,7 @@ NDK_APP_DEST := $(NDK_APP_PROJECT_PATH)/libs/$(TARGET_ARCH_ABI)
# Ensure that for debuggable applications, gdbserver will be copied to
# the proper location
-ifneq ($(NDK_APP_OPTIM),debug)
+ifeq ($(NDK_APP_OPTIM),debug)
NDK_APP_GDBSERVER := $(NDK_APP_DEST)/gdbserver
@@ -90,7 +90,6 @@ $(NDK_APP_GDBSERVER): clean-installed-binaries
@ echo "Gdbserver : [$(PRIVATE_NAME)] $(PRIVATE_DST)"
$(hide) mkdir -p $(PRIVATE_DEST)
$(hide) install -p $(PRIVATE_SRC) $(PRIVATE_DST)
- $(hide) $(call cmd-strip, $(PRIVATE_DST))
endif
diff --git a/build/host-setup.sh b/build/host-setup.sh
deleted file mode 100755
index ee4a9e3d6..000000000
--- a/build/host-setup.sh
+++ /dev/null
@@ -1,265 +0,0 @@
-#!/bin/sh
-#
-# 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 shell script used to configure the host-specific parts of the NDK
-# build system. This will create out/host/config-host.make based on
-# your host system and additionnal command-line options.
-#
-
-# check that this script is run from the top-level NDK directory
-if [ ! -f build/core/ndk-common.sh ] ; then
- echo "Please run this script from the top-level NDK directory as in:"
- echo " cd \$NDKROOT"
- echo " build/host-setup.sh"
- exit 1
-fi
-
-# include common function and variable definitions
-. `dirname $0`/core/ndk-common.sh
-
-OUT_DIR=out
-HOST_CONFIG=$OUT_DIR/host/config.mk
-
-## Build configuration file support
-## you must define $config_mk before calling this function
-##
-create_config_mk ()
-{
- # create the directory if needed
- local config_dir
- config_mk=${config_mk:-$HOST_CONFIG}
- config_dir=`dirname $config_mk`
- mkdir -p $config_dir 2> $TMPL
- if [ $? != 0 ] ; then
- echo "Can't create directory for host config file: $config_dir"
- exit 1
- fi
-
- # re-create the start of the configuration file
- log "Generate : $config_mk"
-
- echo "# This file was autogenerated by $PROGNAME. Do not edit !" > $config_mk
-}
-
-add_config ()
-{
- echo "$1" >> $config_mk
-}
-
-# assume $1 points to a GNU Make executable, and extract version number
-# to verify its a least what we need
-check_gnu_make_version ()
-{
- if [ -n "$GNU_MAKE" ] ; then
- return
- fi
-
- log2 " looking for GNU Make as '$1'"
- local executable=`which $1`
- if [ -z "$executable" ] ; then
- log2 " Not available."
- return
- fi
-
- # I'd love to do the version extraction with awk, but I'm unsure it is
- # part of the default Cygwin install, so don't bring the dependency
- # and rely on dumb tools instead.
- #
- local version major minor
- version=`$executable --version | grep "GNU Make"`
- if [ -z "$version" ] ; then
- log2 " Not a GNU Make executable."
- return
- fi
- version=`echo $version | sed -e 's/^GNU Make \([0-9\.]*\).*$/\1/g'`
- log2 " Found version $version"
- major=`echo $version | sed -e 's/\([0-9]*\)\..*/\1/g'`
- minor=`echo $version | sed -e 's/[0-9]*\.\(.*\)/\1/g'`
- if [ "$major" -lt "3" ] ; then
- log2 " Major version too small ($major.$minor < 3.81)."
- return
- fi
- if [ "$major" -eq "3" -a $minor -lt 80 ] ; then
- log2 " Minor version too small ($major.$minor < 3.81)."
- return
- fi
- GNU_MAKE=$1
- GNU_MAKE_VERSION=$version
-}
-
-# check that $1 points to an awk executable that has a working
-# match() function. This really means Nawk or GNU Awk, which should
-# be installed on all modern distributions, but hey, you never know...
-check_awk ()
-{
- if [ -n "$AWK" ] ; then
- return
- fi
- log2 " looking for nawk/gawk as '$1'"
- local executable=`which $1`
- if [ -z "$executable" ] ; then
- log2 " Not available."
- return
- fi
- local result
- result=`echo "" | $executable -f build/check-awk.awk`
- if [ "$result" = "Pass" ] ; then
- AWK="$1"
- fi
- log2 " Check $result"
-}
-
-bad_toolchain()
-{
- tc=$1 # Toolchain
- ht=$2 # Host Tag
- echo ""
- echo "ERROR: Toolchain compiler not found"
- if [ $tc = NONE_FOUND ] ; then
- echo "It seems you don't have any toolchain binaries."
- else
- echo "It seems you do not have the correct $tc toolchain binaries."
- echo "This may be the result of incorrect unzipping of the NDK archive."
- echo "Please go to the official Android NDK web site and download the"
- echo "appropriate NDK package for your platform ($ht)."
- echo ""
- echo "See http://developer.android.com/sdk/ndk/index.html"
- fi
- echo ""
- echo "ABORTING."
- echo ""
-}
-
-
-OPTION_HELP=no
-OPTION_NO_MAKE_CHECK=no
-OPTION_NO_AWK_CHECK=no
-
-for opt do
- optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
- case "$opt" in
- --help|-h|-\?) OPTION_HELP=yes
- ;;
- --no-make-check) OPTION_NO_MAKE_CHECK=yes
- ;;
- --no-awk-check) OPTION_NO_AWK_CHECK=yes
- ;;
- --verbose)
- if [ "$VERBOSE" = "yes" ] ; then
- VERBOSE2=yes
- else
- VERBOSE=yes
- fi
- ;;
- *)
- echo "unknown option '$opt', use --help"
- exit 1
- esac
-done
-
-if [ $OPTION_HELP = yes ] ; then
- echo "Usage: build/host-setup.sh [options]"
- echo ""
- echo "This script is used to check your host development environment"
- echo "to ensure that the Android NDK will work correctly with it."
- echo ""
- echo "Options: [defaults in brackets after descriptions]"
- echo ""
- echo " --help Print this help message"
- echo " --verbose Enable verbose mode"
- echo " --no-make-check Ignore GNU Make version check"
- echo " --no-awk-check Ignore Nawk/Gawk check"
- echo ""
- exit 1
-fi
-
-
-echo "Checking host development environment."
-echo "NDK Root : $ANDROID_NDK_ROOT"
-
-## Check for GNU Make with a proper version number
-##
-if [ "$OPTION_NO_MAKE_CHECK" = "no" ] ; then
- GNU_MAKE=
- check_gnu_make_version make
- check_gnu_make_version gmake
- if [ -z "$GNU_MAKE" ] ; then
- echo "ERROR: Could not find a valid GNU Make executable."
- echo " Please ensure GNU Make 3.81 or later is installed."
- echo " Use the --no-make-check option to ignore this message."
- exit 1
- fi
- echo "GNU Make : $GNU_MAKE (version $GNU_MAKE_VERSION)"
-else
- echo "GNU Make : Check ignored through user option."
-fi
-
-## Check for nawk or gawk, straight awk doesn't have the 'match'
-## function we need in the build system.
-##
-if [ "$OPTION_NO_AWK_CHECK" = "no" ] ; then
- AWK=
- check_awk awk
- check_awk gawk
- check_awk nawk
- if [ -z "$AWK" ] ; then
- echo "ERROR: Could not find a valid Nawk or Gawk executable."
- echo " Please ensure that either one of them is installed."
- echo " Use the --no-awk-check option to ignore this message."
- exit 1
- fi
- echo "Awk : $AWK"
-else
- echo "Awk : Check ignored through user option."
-fi
-
-## Check the host platform tag that will be used to locate prebuilt
-## toolchain binaries. And create configuration file.
-##
-force_32bit_binaries
-echo "Platform : $HOST_TAG"
-
-create_config_mk
-add_config "HOST_OS := $HOST_OS"
-add_config "HOST_ARCH := $HOST_ARCH"
-add_config "HOST_TAG := $HOST_TAG"
-add_config "HOST_AWK := $AWK"
-
-## Determine which toolchains are installed and verify their integrity.
-## Otherwise, instruct the user to download them from the web site
-
-TOOLCHAINS=`ls build/prebuilt/$HOST_TAG`
-
-if [ -z "$TOOLCHAINS" ]; then
- bad_toolchain NONE_FOUND $HOST_TAG
- exit 1
-fi
-
-for tc in $TOOLCHAINS; do
- echo "Toolchain : Checking for $tc prebuilt binaries"
- PREBUILT_BIN=build/prebuilt/$HOST_TAG/$tc/bin
- log2 "Toolchain : Cross-compiler in <NDK>/$PREBUILT_BIN ?"
- COMPILER_PATTERN=$ANDROID_NDK_ROOT/$PREBUILT_BIN/*-gcc$HOST_EXE
- COMPILERS=`ls $COMPILER_PATTERN 2> /dev/null`
- if [ -z $COMPILERS ] ; then
- bad_toolchain $tc $HOST_TAG
- exit 1
- fi
-done
-
-echo ""
-echo "Host setup complete. Please read docs/OVERVIEW.TXT if you don't know what to do."
-echo ""
diff --git a/docs/CHANGES.TXT b/docs/CHANGES.TXT
index 3b37c09ec..004baba9d 100644
--- a/docs/CHANGES.TXT
+++ b/docs/CHANGES.TXT
@@ -5,14 +5,15 @@ android-ndk-r4
IMPORTANT BUG FIXES:
-- build/host-setup.sh will complain if the NDK installation path contains
- a space and refuse to run.
-
- The <fenv.h> header was not placed in the correct location and could not
be found by normal builds.
IMPORTANT CHANGES:
+- build/host-setup.sh has been removed. There is no need for a 'setup' step
+ when using the NDK for the first time. All host-specific autodetection and
+ basic tool sanity checking have been moved to the build scripts themselves.
+
- Support for hardware FPU. This is through the new 'armeabi-v7a' ABI
corresponding to ARMv7-a class devices.
diff --git a/docs/INSTALL.TXT b/docs/INSTALL.TXT
index 570c248c9..f01c810ea 100644
--- a/docs/INSTALL.TXT
+++ b/docs/INSTALL.TXT
@@ -51,9 +51,9 @@ See http://www.cygwin.com for instructions.
II. Preparing your installation prebuilt cross-toolchain binaries:
------------------------------------------------------------------
-After installing and unarchiving the NDK, you will need to run the following
-command from the root folder:
+Previous releases required you to run the 'build/host-setup.sh' script to
+configure the NDK. However, this step has been removed in release 4 (a.k.a. r4).
- build/host-setup.sh
-
-This will test your setup and make sure the NDK can work properly.
+The auto-detection and sanity checks that were performed by the script have
+been moved into the NDK makefiles (and are now performed each time you invoke
+GNU Make).
diff --git a/docs/OVERVIEW.TXT b/docs/OVERVIEW.TXT
index f02653c2f..9c094c891 100644
--- a/docs/OVERVIEW.TXT
+++ b/docs/OVERVIEW.TXT
@@ -127,17 +127,15 @@ III. NDK development in practice:
Here's a very rough overview of how you can develop native code with the
Android NDK:
- 1/ Run build/host-setup.sh to configure the NDK
+ 1/ Place your native sources under $PROJECT/jni/...
- 2/ Place your native sources under $PROJECT/jni/...
-
- 3/ Write $PROJECT/jni/Android.mk to describe your sources
+ 2/ Write $PROJECT/jni/Android.mk to describe your sources
to the NDK build system
- 4/ Write apps/<myapp>/Application.mk to describe your application
+ 3/ Write apps/<myapp>/Application.mk to describe your application
and the native sources it needs to the NDK build system
- 5/ Build your native code by running "make APP=<myapp>"
+ 4/ Build your native code by running "make APP=<myapp>"
in the top-level NDK directory.
The last step will copy, in case of success, the stripped shared libraries
@@ -150,20 +148,9 @@ Now, for a few more details:
III.1/ Configuring the NDK:
- - - - - - - - - - - - - -
-After installing the NDK as described in docs/INSTALL.TXT, you should call
-the 'build/host-setup.sh' script to configure your NDK.
-
-This script is used to probe your host system and verify a few pre-requisites.
-It will then generate a configuration file (e.g. out/host/config-host.mk) that
-is later used during NDK builds.
-
-In some cases, this might instruct you to download an archive containing
-prebuilt toolchain binaries for your development platform, the unzip it
-to the NDK root directory. The message should contain enough information
-to let you do that.
-
-If you forget this step, trying to build with the NDK will generate an
-error message telling you what to do.
+Previous releases required that you run the 'build/host-setup.sh'
+script to configure your NDK. This step has been removed completely
+in release 4 (a.k.a. r4).
III.2/ Placing C and C++ sources: