aboutsummaryrefslogtreecommitdiff
path: root/build/tools
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2010-02-24 14:43:10 -0800
committerDavid 'Digit' Turner <digit@google.com>2010-02-24 14:43:10 -0800
commitab23698c3ede84f3dda5a65b6e8169d4b2e31347 (patch)
treef7c7329f7fa48a560200287b31cd0909174e7c62 /build/tools
parent898f9230e9bf4e005967a063fdbbb5e0db71d094 (diff)
downloadndk-ab23698c3ede84f3dda5a65b6e8169d4b2e31347.tar.gz
Allow the build-toolchain.sh script to apply source packages.
All you need to do is place name them like the following: build/tools/toolchain-patches/<subpath>/<foo>.patch And they will be applied with 'patch -p1' into: <build-src>/<subpath> This is useful to experiment with toolchain changes without having to regenerate a whole new source package tarball each time.
Diffstat (limited to 'build/tools')
-rwxr-xr-xbuild/tools/build-toolchain.sh47
1 files changed, 43 insertions, 4 deletions
diff --git a/build/tools/build-toolchain.sh b/build/tools/build-toolchain.sh
index 80bb4e9a2..51f3fa7ea 100755
--- a/build/tools/build-toolchain.sh
+++ b/build/tools/build-toolchain.sh
@@ -389,14 +389,13 @@ download_package ()
}
# Unpack a given package in a target location
-# $1: package name
-# $2: target directory
+# $1: package name (e.g. toolchain)
+# $2: target directory (e.g. /tmp/foo)
#
unpack_package ()
{
- WORKSPACE=$ANDROID_NDK_ARCHIVE/$1
- SRCDIR=$2
SRCPKG=`var_value PKG_$1`
+ SRCDIR=$2
if ! timestamp_check $1 unpack; then
echo "Unpack : $1 sources"
echo " from $SRCPKG"
@@ -413,6 +412,45 @@ unpack_package ()
exit 1
fi
timestamp_set $1 unpack
+ timestamp_force $1 patch
+ fi
+}
+
+# Patch a given package at a target location
+# $1: package name (e.g. toolchain)
+# $2: target directory (e.g. /tmp/foo)
+# $3: patch directory (e.g. build/tools/toolchain-patches)
+#
+# The rationale here is that anything named like $3/<subpath>/<foo>.patch
+# will be applied with "patch -p1" under $2/<subpath>
+#
+# Patches are listed and applied in alphanumerical order of their names
+# as returned by 'find'. Consider using numbered prefixes like the patch
+# files generated by "git format-patch" are named.
+#
+patch_package ()
+{
+ SRCPKG=`var_value PKG_$1`
+ SRCDIR=$2
+ if ! timestamp_check $1 patch; then
+ PATCH_FILES=`(cd $3 && find . -name "*.patch") 2> /dev/null`
+ if [ -z "$PATCH_FILES" ] ; then
+ echo "Patch : none provided"
+ return
+ fi
+ for PATCH in $PATCH_FILES; do
+ echo "Patch : $1 sources"
+ echo " from $PATCH"
+ echo " into $SRCDIR"
+ PATCHDIR=`dirname $PATCH`
+ PATCHNAME=`basename $PATCH`
+ cd $SRCDIR/$PATCHDIR && patch -p1 < $3/$PATCH
+ if [ $? != 0 ] ; then
+ echo "Patch failure !! Please check toolchain package !"
+ exit 1
+ fi
+ done
+ timestamp_set $1 patch
timestamp_force $1 configure
fi
}
@@ -443,6 +481,7 @@ else
fi
unpack_package toolchain $ANDROID_TOOLCHAIN_SRC
+patch_package toolchain $ANDROID_TOOLCHAIN_SRC $ANDROID_NDK_ROOT/build/tools/toolchain-patches
# remove all info files from the unpacked toolchain sources
# they create countless little problems during the build