am e715cadd: Merge change 5634 into donut
Merge commit 'e715cadd4115c2e6a97745aa6d808d9a24271a3f' * commit 'e715cadd4115c2e6a97745aa6d808d9a24271a3f': Fix build/host-setup.sh to run as a Bourne shell script and add better host detection:
This commit is contained in:
committed by
The Android Open Source Project
commit
3101934dd6
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Copyright (C) 2009 The Android Open Source Project
|
# Copyright (C) 2009 The Android Open Source Project
|
||||||
#
|
#
|
||||||
@@ -19,8 +19,16 @@
|
|||||||
# your host system and additionnal command-line options.
|
# 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
|
# include common function and variable definitions
|
||||||
source `dirname $0`/core/ndk-common.sh
|
. `dirname $0`/core/ndk-common.sh
|
||||||
|
|
||||||
OUT_DIR=out
|
OUT_DIR=out
|
||||||
HOST_CONFIG=$OUT_DIR/host/config.mk
|
HOST_CONFIG=$OUT_DIR/host/config.mk
|
||||||
@@ -51,11 +59,112 @@ add_config ()
|
|||||||
echo "$1" >> $config_mk
|
echo "$1" >> $config_mk
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Detecting host platform."
|
# 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
|
||||||
|
}
|
||||||
|
|
||||||
|
OPTION_HELP=no
|
||||||
|
OPTION_NO_MAKE_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
|
||||||
|
;;
|
||||||
|
--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 ""
|
||||||
|
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 the host platform tag that will be used to locate prebuilt
|
||||||
|
## toolchain binaries. And create configuration file.
|
||||||
|
##
|
||||||
force_32bit_binaries
|
force_32bit_binaries
|
||||||
create_config_mk
|
echo "Platform : $HOST_TAG"
|
||||||
|
|
||||||
|
create_config_mk
|
||||||
add_config "HOST_OS := $HOST_OS"
|
add_config "HOST_OS := $HOST_OS"
|
||||||
add_config "HOST_ARCH := $HOST_ARCH"
|
add_config "HOST_ARCH := $HOST_ARCH"
|
||||||
add_config "HOST_TAG := $HOST_TAG"
|
add_config "HOST_TAG := $HOST_TAG"
|
||||||
@@ -67,12 +176,15 @@ TOOLCHAINS=arm-eabi-4.2.1
|
|||||||
|
|
||||||
for tc in $TOOLCHAINS; do
|
for tc in $TOOLCHAINS; do
|
||||||
echo "Toolchain : Checking for $tc prebuilt binaries"
|
echo "Toolchain : Checking for $tc prebuilt binaries"
|
||||||
COMPILER_PATTERN=$ANDROID_NDK_ROOT/build/prebuilt/$HOST_TAG/$tc/bin/*-gcc$HOST_EXE
|
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`
|
COMPILERS=`ls $COMPILER_PATTERN 2> /dev/null`
|
||||||
if [ -z $COMPILERS ] ; then
|
if [ -z $COMPILERS ] ; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "ERROR:"
|
echo "ERROR: Toolchain compiler not found"
|
||||||
echo "It seems you do not have the correct $tc toolchain binaries."
|
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 "Please go to the official Android NDK web site and download the"
|
||||||
echo "appropriate NDK package for your platform ($HOST_TAG)."
|
echo "appropriate NDK package for your platform ($HOST_TAG)."
|
||||||
echo "See http://developer.android.com/sdk/index.html"
|
echo "See http://developer.android.com/sdk/index.html"
|
||||||
|
|||||||
@@ -4,10 +4,12 @@ Android NDK ChangeLog:
|
|||||||
current version
|
current version
|
||||||
|
|
||||||
- Fix build/host-setup.sh to:
|
- Fix build/host-setup.sh to:
|
||||||
* execute as a bash script
|
* execute as a Bourne shell script
|
||||||
* remove unused host gcc dependency
|
* remove unused host gcc dependency
|
||||||
* improve Windows host auto-detection
|
* improve Windows host auto-detection
|
||||||
|
* add GNU Make version check
|
||||||
|
* ensure that the script is run from $NDKROOT as build/host-setup.sh
|
||||||
|
* add --help, --verbose and --no-make-check options
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
android-1.5_r1 released.
|
android-1.5_r1 released.
|
||||||
|
|||||||
Reference in New Issue
Block a user