aboutsummaryrefslogtreecommitdiff
path: root/ndk-build
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2013-03-12 22:34:18 -0700
committerAndrew Hsieh <andrewhsieh@google.com>2013-03-12 22:39:12 -0700
commit2641f6f5414e56d792fac26572a5d984977ef462 (patch)
tree836dc42cd98aaaa2009d883e0e64c5f43d9585c5 /ndk-build
parent6fd98c4901d3fc4f6d80998b9bd1a5002b0e63ab (diff)
downloadndk-2641f6f5414e56d792fac26572a5d984977ef462.tar.gz
Download/build/use perl prebuilt
Change-Id: If4391fba184dde3d44aac85ecc3766e8f3ba7e2f
Diffstat (limited to 'ndk-build')
-rwxr-xr-xndk-build31
1 files changed, 30 insertions, 1 deletions
diff --git a/ndk-build b/ndk-build
index a8b811084..a1d8e9ecc 100755
--- a/ndk-build
+++ b/ndk-build
@@ -246,6 +246,35 @@ fi
if [ "$NDK_ANALYZE" = 1 ]; then
. $PROGDIR/build/tools/dev-defaults.sh # for DEFAULT_LLVM_VERSION
+ # Find perl. If HOST_PERL is defined, check that it points to a valid file
+ HOST_PERL_LIB=
+ if [ -n "$HOST_PERL" ] ; then
+ ABS_PERL=`which $HOST_PERL 2> /dev/null`
+ if [ $? != 0 ] ; then
+ echo "ERROR: Your HOST_PERL variable is defined to an invalid name: $HOST_PERL"
+ echo "Please fix it to point to a valid perl executable (e.g. /usr/bin/perl)"
+ exit 1
+ fi
+ HOST_PERL="$ABS_PERL"
+ log "HOST_PERL=$HOST_PERL (from environment variable)"
+ else
+ # Otherwise use the prebuilt version for our host tag
+ HOST_PERL="$PROGDIR/prebuilt/$HOST_TAG/bin/perl"
+ if [ ! -f "$HOST_PERL" ]; then
+ # Otherwise, use 'perl' and check that it is available
+ HOST_PERL=`which perl 2> /dev/null`
+ if [ $? != 0 ] ; then
+ echo "ERROR: Cannot find 'perl' program. Please install perl package"
+ echo "or define the HOST_PERL variable to point to it."
+ exit 1
+ fi
+ log "HOST_PERL=$HOST_PERL (system path)"
+ else
+ HOST_PERL_LIB="$PROGDIR/prebuilt/$HOST_TAG/lib/perl5"
+ log "HOST_PERL=$HOST_PERL (NDK prebuilt)"
+ fi
+ fi
+
# Return flags send in env. or command line which are enough to retrive APP_ABI and TOOLCHAIN_PREFIX later
gen_flags ()
{
@@ -284,7 +313,7 @@ if [ "$NDK_ANALYZE" = 1 ]; then
APP_ABIS=`get_build_var APP_ABI`
for ABI in $APP_ABIS; do
TOOLCHAIN_PREFIX=`get_build_var_for_abi TOOLCHAIN_PREFIX $ABI`
- $PROGDIR/prebuilt/common/scan-build/scan-build \
+ PERL5LIB="$HOST_PERL_LIB" "$HOST_PERL" $PROGDIR/prebuilt/common/scan-build/scan-build \
--use-analyzer $PROGDIR/toolchains/llvm-${DEFAULT_LLVM_VERSION}/prebuilt/$HOST_TAG/bin/${ABI}/analyzer \
--use-cc ${TOOLCHAIN_PREFIX}gcc \
--use-c++ ${TOOLCHAIN_PREFIX}g++ \