Fix build/host-setup.sh in various ways
- run as bash script (since Debian's new 'dash' shell doesn't support it)
- remove obsolete host GCC requirement
- improve Windows support by using better heuristics for the executable suffix
- better NDK root directory auto-detection (avoids the need to define ANDROID_NDK_ROOT on some installs)
diff --git a/ndk/build/core/ndk-common.sh b/ndk/build/core/ndk-common.sh
index c89ffd9..d456191 100644
--- a/ndk/build/core/ndk-common.sh
+++ b/ndk/build/core/ndk-common.sh
@@ -24,12 +24,21 @@
# perform a tiny amount of sanity check
#
if [ -z "$ANDROID_NDK_ROOT" ] ; then
- if [ ! -f build/core/ndk-common.sh ] ; then
- echo "Please define ANDROID_NDK_ROOT to point to the root of your"
- echo "Android NDK installation."
- exit 1
- fi
- ANDROID_NDK_ROOT=.
+ # Try to auto-detect the NDK root by walking up the directory
+ # path to the current script.
+ PROGDIR=`dirname $0`
+ while [ -n "1" ] ; do
+ if [ -d $PROGDIR/build/core ] ; then
+ break
+ fi
+ if [ -z $PROGDIR -o $PROGDIR = '.' ] ; then
+ echo "Please define ANDROID_NDK_ROOT to point to the root of your"
+ echo "Android NDK installation."
+ exit 1
+ fi
+ PROGDIR=`dirname $PROGDIR`
+ done
+ ANDROID_NDK_ROOT=`cd $PROGDIR && pwd`
fi
if [ ! -d $ANDROID_NDK_ROOT ] ; then
diff --git a/ndk/build/host-setup.sh b/ndk/build/host-setup.sh
index e94944e..ed44408 100755
--- a/ndk/build/host-setup.sh
+++ b/ndk/build/host-setup.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Copyright (C) 2009 The Android Open Source Project
#
@@ -51,37 +51,23 @@
echo "$1" >> $config_mk
}
-echo "Detecting host toolchain."
-echo ""
+echo "Detecting host platform."
force_32bit_binaries
-setup_toolchain
-
create_config_mk
add_config "HOST_OS := $HOST_OS"
add_config "HOST_ARCH := $HOST_ARCH"
add_config "HOST_TAG := $HOST_TAG"
-add_config "HOST_CC := $CC"
-add_config "HOST_CFLAGS := $CFLAGS"
-add_config "HOST_CXX := $CXX"
-add_config "HOST_CXXFLAGS := $CXXFLAGS"
-add_config "HOST_LD := $LD"
-add_config "HOST_LDFLAGS := $LDFLAGS"
-add_config "HOST_AR := $AR"
-add_config "HOST_ARFLAGS := $ARFLAGS"
## Check that the toolchains we need are installed
## Otherwise, instruct the user to download them from the web site
TOOLCHAINS=arm-eabi-4.2.1
-EXT=""
-[ "Windows_NT" == "$OS" ] && EXT=".exe"
-
for tc in $TOOLCHAINS; do
echo "Toolchain : Checking for $tc prebuilt binaries"
- COMPILER_PATTERN=$ANDROID_NDK_ROOT/build/prebuilt/$HOST_TAG/$tc/bin/*-gcc${EXT}
+ COMPILER_PATTERN=$ANDROID_NDK_ROOT/build/prebuilt/$HOST_TAG/$tc/bin/*-gcc$HOST_EXE
COMPILERS=`ls $COMPILER_PATTERN 2> /dev/null`
if [ -z $COMPILERS ] ; then
echo ""
diff --git a/ndk/docs/CHANGES.TXT b/ndk/docs/CHANGES.TXT
index c65c821..8dbf61d 100644
--- a/ndk/docs/CHANGES.TXT
+++ b/ndk/docs/CHANGES.TXT
@@ -1,4 +1,13 @@
Android NDK ChangeLog:
-------------------------------------------------------------------------------
+current version
+
+- Fix build/host-setup.sh to:
+ * execute as a bash script
+ * remove unused host gcc dependency
+ * improve Windows host auto-detection
+
+
+-------------------------------------------------------------------------------
android-1.5_r1 released.