Add --prebuilt-ndk=FILE and --no-git options to build/tools/make-release.sh script.

This is used to help people easily package experimental versions of the NDK to
test and distribute fixes and improvements. The main idea is to allow external
contributors to play with it in interesting way and share the result easily.
This commit is contained in:
David 'Digit' Turner
2009-10-14 15:22:11 -07:00
parent bc7c36728c
commit 854f820c24
2 changed files with 121 additions and 34 deletions

View File

@@ -22,8 +22,11 @@
NDK_ROOT_DIR=`dirname $0`/../.. NDK_ROOT_DIR=`dirname $0`/../..
NDK_ROOT_DIR=`cd $NDK_ROOT_DIR && pwd` NDK_ROOT_DIR=`cd $NDK_ROOT_DIR && pwd`
# the release name . $NDK_ROOT_DIR/build/core/ndk-common.sh
RELEASE=1.6_r1 force_32bit_binaries
# the default release name (use today's date)
RELEASE=`date +%Y%m%d`
# the package prefix # the package prefix
PREFIX=android-ndk PREFIX=android-ndk
@@ -37,6 +40,13 @@ PREBUILT_PREFIX=android-ndk-prebuilt-20090323
# the list of supported host development systems # the list of supported host development systems
PREBUILT_SYSTEMS="linux-x86 darwin-x86 windows" PREBUILT_SYSTEMS="linux-x86 darwin-x86 windows"
# a prebuilt NDK archive (.zip file). empty means don't use any
PREBUILT_NDK=
# set to 'yes' if we should use 'git ls-files' to list the files to
# be copied into the archive.
USE_GIT_FILES=yes
OPTION_HELP=no OPTION_HELP=no
for opt do for opt do
@@ -55,12 +65,16 @@ for opt do
;; ;;
--prefix=*) PREFIX=$optarg --prefix=*) PREFIX=$optarg
;; ;;
--prebuilt-ndk=*) PREBUILT_NDK=$optarg
;;
--prebuilt-prefix=*) PREBUILT_PREFIX=$optarg --prebuilt-prefix=*) PREBUILT_PREFIX=$optarg
;; ;;
--prebuilt-path=*) PREBUILT_DIR=$optarg --prebuilt-path=*) PREBUILT_DIR=$optarg
;; ;;
--systems=*) PREBUILT_SYSTEMS=$optarg --systems=*) PREBUILT_SYSTEMS=$optarg
;; ;;
--no-git) USE_GIT_FILES=no
;;
*) *)
echo "unknown option '$opt', use --help" echo "unknown option '$opt', use --help"
exit 1 exit 1
@@ -74,52 +88,87 @@ if [ $OPTION_HELP = yes ] ; then
echo "You will need to specify the path of a directory containing" echo "You will need to specify the path of a directory containing"
echo "prebuilt toolchain tarballs with the --prebuilt-path option." echo "prebuilt toolchain tarballs with the --prebuilt-path option."
echo "" echo ""
echo "Alternatively, you can specify an existing NDK release package"
echo "with the --prebuilt-ndk option."
echo ""
echo "Options: [defaults in brackets after descriptions]" echo "Options: [defaults in brackets after descriptions]"
echo "" echo ""
echo " --help Print this help message" echo " --help Print this help message"
echo " --prefix=PREFIX Package prefix name [$PREFIX]" echo " --prefix=PREFIX Package prefix name [$PREFIX]"
echo " --release=NAME Specify release name [$RELEASE]" echo " --release=NAME Specify release name [$RELEASE]"
echo " --systems=SYSTEMS List of host system packages [$PREBUILT_SYSTEMS]" echo " --systems=SYSTEMS List of host system packages [$PREBUILT_SYSTEMS]"
echo " --prebuilt-ndk=FILE Specify a previous NDK package [$PREBUILT_NDK]"
echo " --prebuilt-path=PATH Location of prebuilt binary tarballs [$PREBUILT_DIR]" echo " --prebuilt-path=PATH Location of prebuilt binary tarballs [$PREBUILT_DIR]"
echo " --prebuilt-prefix=PREFIX Prefix of prebuilt binary tarballs [$PREBUILT_PREFIX]" echo " --prebuilt-prefix=PREFIX Prefix of prebuilt binary tarballs [$PREBUILT_PREFIX]"
echo " --no-git Don't use git to list input files, take all of them."
echo "" echo ""
exit 1 exit 1
fi fi
# Check the prebuilt path # Check the prebuilt path
# #
if [ -z "$PREBUILT_DIR" ] ; then if [ -n "$PREBUILD_NDK" -a -n "$PREBUILT_DIR" ] ; then
echo "ERROR: You must use --prebuilt-path=PATH to specify the path of prebuilt binary tarballs." echo "ERROR: You cannot use both --prebuilt-ndk and --prebuilt-path at the same time."
exit 1 exit 1
fi fi
if [ ! -d "$PREBUILT_DIR" ] ; then if [ -z "$PREBUILT_DIR" -a -z "$PREBUILT_NDK" ] ; then
echo "ERROR: You must use --prebuilt-path=PATH to specify the path of prebuilt binary tarballs."
echo " Or --prebuilt-ndk=FILE to specify an existing NDK release archive."
exit 1
fi
if [ -n "$PREBUILT_DIR" ] ; then
if [ ! -d "$PREBUILT_DIR" ] ; then
echo "ERROR: the --prebuilt-path argument is not a directory path: $PREBUILT_DIR" echo "ERROR: the --prebuilt-path argument is not a directory path: $PREBUILT_DIR"
exit 1 exit 1
fi fi
if [ -z "$PREBUILT_PREFIX" ] ; then
# Check the systems
#
if [ -z "$PREBUILT_SYSTEMS" ] ; then
echo "ERROR: Your systems list is empty, use --system=LIST to specify a different one."
exit 1
fi
if [ -z "$PREBUILT_PREFIX" ] ; then
echo "ERROR: Your prebuilt prefix is empty; use --prebuilt-prefix=PREFIX." echo "ERROR: Your prebuilt prefix is empty; use --prebuilt-prefix=PREFIX."
exit 1 exit 1
fi fi
if [ -z "$PREBUILT_SYSTEMS" ] ; then
for SYS in $PREBUILT_SYSTEMS; do echo "ERROR: Your systems list is empty, use --system=LIST to specify a different one."
exit 1
fi
# Check the systems
#
for SYS in $PREBUILT_SYSTEMS; do
if [ ! -f $PREBUILT_DIR/$PREBUILT_PREFIX-$SYS.tar.bz2 ] ; then if [ ! -f $PREBUILT_DIR/$PREBUILT_PREFIX-$SYS.tar.bz2 ] ; then
echo "ERROR: It seems there is no prebuilt binary tarball for the '$SYS' system" echo "ERROR: It seems there is no prebuilt binary tarball for the '$SYS' system"
echo "Please check the content of $PREBUILT_DIR for a file named $PREBUILT_PREFIX-$SYS.tar.bz2." echo "Please check the content of $PREBUILT_DIR for a file named $PREBUILT_PREFIX-$SYS.tar.bz2."
exit 1 exit 1
fi fi
done done
else
if [ ! -f "$PREBUILT_NDK" ] ; then
echo "ERROR: the --prebuilt-ndk argument is not a file: $PREBUILT_NDK"
exit 1
fi
# Check that the name ends with the proper host tag
HOST_NDK_SUFFIX="$HOST_TAG.zip"
echo "$PREBUILT_NDK" | grep -q "$HOST_NDK_SUFFIX"
if [ $? != 0 ] ; then
echo "ERROR: the name of the prebuilt NDK must end in $HOST_NDK_SUFFIX"
exit 1
fi
PREBUILT_SYSTEMS=$HOST_TAG
fi
# The list of git files to copy into the archives # The list of git files to copy into the archives
GIT_FILES=`cd $NDK_ROOT_DIR && git ls-files` if [ "$USE_GIT_FILES" = "yes" ] ; then
echo "Collecting sources from git (use --no-git to copy all files instead)."
GIT_FILES=`cd $NDK_ROOT_DIR && git ls-files`
else
echo "Collecting all sources files under tree."
# Cleanup everything that is likely to not be part of the final NDK
# i.e. generated files...
rm -rf $NDK_ROOT_DIR/out
rm -rf $NDK_ROOT_DIR/apps/*/project/libs/armeabi
# Get all files under the NDK root
GIT_FILES=`cd $NDK_ROOT_DIR && find .`
GIT_FILES=`echo $GIT_FILES | sed -e "s!\./!!g"`
fi
# temporary directory used for packaging # temporary directory used for packaging
TMPDIR=/tmp/ndk-release TMPDIR=/tmp/ndk-release
@@ -129,17 +178,17 @@ RELEASE_PREFIX=$PREFIX-$RELEASE
rm -rf $TMPDIR && mkdir -p $TMPDIR rm -rf $TMPDIR && mkdir -p $TMPDIR
# first create the reference ndk directory from the git reference # first create the reference ndk directory from the git reference
echo "Creating reference from git files" echo "Creating reference from source files"
REFERENCE=$TMPDIR/reference && REFERENCE=$TMPDIR/reference &&
mkdir -p $REFERENCE && mkdir -p $REFERENCE &&
(cd $NDK_ROOT_DIR && tar cf - $GIT_FILES) | (cd $REFERENCE && tar xf -) && (cd $NDK_ROOT_DIR && tar cf - $GIT_FILES) | (cd $REFERENCE && tar xf -) &&
rm -f $REFERENCE/Android.mk rm -f $REFERENCE/Android.mk
if [ $? != 0 ] ; then if [ $? != 0 ] ; then
echo "Could not create git reference. Aborting." echo "Could not create reference. Aborting."
exit 2 exit 2
fi fi
# now, for each system, create a preview package # now, for each system, create a package
# #
for SYSTEM in $PREBUILT_SYSTEMS; do for SYSTEM in $PREBUILT_SYSTEMS; do
echo "Preparing package for system $SYSTEM." echo "Preparing package for system $SYSTEM."
@@ -153,12 +202,28 @@ for SYSTEM in $PREBUILT_SYSTEMS; do
exit 2 exit 2
fi fi
if [ -n "$PREBUILT_NDK" ] ; then
echo "Unpacking prebuilt toolchain from $PREBUILT_NDK"
UNZIP_DIR=$TMPDIR/prev-ndk
rm -rf $UNZIP_DIR && mkdir -p $UNZIP_DIR
if [ $? != 0 ] ; then
echo "Could not create temporary directory: $UNZIP_DIR"
exit 1
fi
cd $UNZIP_DIR && unzip -q $PREBUILT_NDK 1>/dev/null 2>&1
if [ $? != 0 ] ; then
echo "ERROR: Could not unzip NDK package $PREBUILT_NDK"
exit 1
fi
cd android-ndk-* && cp -rP build/prebuilt $DSTDIR/build
else
echo "Unpacking $PREBUILT.tar.bz2" echo "Unpacking $PREBUILT.tar.bz2"
(cd $DSTDIR && tar xjf $PREBUILT.tar.bz2) 2>/dev/null 1>&2 (cd $DSTDIR && tar xjf $PREBUILT.tar.bz2) 2>/dev/null 1>&2
if [ $? != 0 ] ; then if [ $? != 0 ] ; then
echo "Could not unpack prebuilt for system $SYSTEM. Aborting." echo "Could not unpack prebuilt for system $SYSTEM. Aborting."
exit 1 exit 1
fi fi
fi
ARCHIVE=$BIN_RELEASE.zip ARCHIVE=$BIN_RELEASE.zip
echo "Creating $ARCHIVE" echo "Creating $ARCHIVE"
@@ -173,6 +238,7 @@ done
echo "Cleaning up." echo "Cleaning up."
rm -rf $TMPDIR/reference rm -rf $TMPDIR/reference
rm -rf $TMPDIR/prev-ndk
echo "Done, please see packages in $TMPDIR:" echo "Done, please see packages in $TMPDIR:"
ls -l $TMPDIR ls -l $TMPDIR

View File

@@ -12,6 +12,27 @@ IMPORTANT BUG FIXES:
- Actually use the awk version detected by host-setup.sh during the build. - Actually use the awk version detected by host-setup.sh during the build.
OTHER FIXES & CHANGES:
- Added --prebuilt-ndk=FILE option to build/tools/make-release.sh script to
package a new experimental NDK package archive from the current source tree
plus the toolchain binaries of an existing NDK release package. E.g.:
build/tools/make-release.sh \
--prebuilt-ndk=/path/to/android-ndk-1.6_r1-linux-x86.zip
will generate a new NDK package in /tmp/ndk-release that contains the most
up-to-date build scripts, plus the toolchain binaries from 1.6_r1 (which
are not in the git repository).
Also added the --no-git option to collect all sources from the current
NDK root directory, instead of the list given by 'git ls-files'. This can
be useful if you don't want to checkout the whole 'platform/development'
project from repo and still work on the NDK.
This change is to help people easily package experimental NDK releases to
test and distribute fixes and improvements.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
android-ndk-1.6_r1 android-ndk-1.6_r1