aboutsummaryrefslogtreecommitdiff
path: root/build/tools
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2009-12-04 17:57:36 -0800
committerDavid 'Digit' Turner <digit@google.com>2009-12-04 17:57:36 -0800
commit9abdf03f12e02c97abbecebd45196c6a90924f58 (patch)
tree9437de98b47537ea13f0b680e15dfc2cfe7d8ff4 /build/tools
parenta38d0532041b706478544319966d5f23b7a0efea (diff)
downloadndk-9abdf03f12e02c97abbecebd45196c6a90924f58.tar.gz
Fix toolchain scripts for Darwin and Cygwin.
Only touches download-toolchain-sources.sh and build-toolchain.sh This does not impact the NDK build scripts themselves and is only needed to properly package NDK release packages.
Diffstat (limited to 'build/tools')
-rwxr-xr-xbuild/tools/build-toolchain.sh31
-rwxr-xr-xbuild/tools/download-toolchain-sources.sh3
2 files changed, 30 insertions, 4 deletions
diff --git a/build/tools/build-toolchain.sh b/build/tools/build-toolchain.sh
index 7bed99a6c..80bb4e9a2 100755
--- a/build/tools/build-toolchain.sh
+++ b/build/tools/build-toolchain.sh
@@ -212,10 +212,35 @@ if [ "$A_MD5" != "bf072e9119077b4e76437a93986787ef" ] ; then
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
+ PROG=`which $2 2>/dev/null`
+ if [ -n "$PROG" ] ; then
+ echo "$PROG" | grep -q -e '^no '
+ if [ $? = 0 ] ; then
+ PROG=
+ fi
+ fi
+ eval $1="$PROG"
+}
+
# And wget too
-WGET=`which wget`
-CURL=`which curl`
-SCP=`which scp`
+find_program WGET wget
+find_program CURL curl
+find_program SCP scp
# download a file with either 'curl', 'wget' or 'scp'
# $1: source
diff --git a/build/tools/download-toolchain-sources.sh b/build/tools/download-toolchain-sources.sh
index 38baf08bc..5d8332d0d 100755
--- a/build/tools/download-toolchain-sources.sh
+++ b/build/tools/download-toolchain-sources.sh
@@ -185,8 +185,9 @@ toolchain_clone mpfr
# We only keep one version of gcc and binutils
# we clearly don't need this
-log "getting rid of obsolete gcc 4.3.1 sources"
+log "getting rid of obsolete sources: gcc-4.3.1 gdb-6.8"
rm -rf $TMPDIR/gcc/gcc-4.3.1
+rm -rf $TMPDIR/gcc/gdb-6.8
# create the package
PACKAGE=/tmp/$PKGNAME.tar.bz2