Add checks for unbound variables

This commit is contained in:
Jeffrey Walton 2016-11-10 02:41:23 -05:00
parent aa8260df2c
commit 5f17b4e6d3
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
4 changed files with 17 additions and 8 deletions

BIN
bds10.zip

Binary file not shown.

View File

@ -11,6 +11,8 @@
# See http://www.cryptopp.com/wiki/Android_(Command_Line) for more details
# ====================================================================
set -eu
unset IS_CROSS_COMPILE
unset IS_IOS
@ -32,7 +34,7 @@ unset ANDROID_STL_INC ANDROID_STL_LIB
unset CPP CC CXX LD AS AR RANLIB STRIP
# Similar to a "make clean"
if [ "$1" = "unset" ]; then
if [ x"${1-}" = "xunset" ]; then
echo "Unsetting script variables. PATH may remain tainted"
[ "$0" = "$BASH_SOURCE" ] && exit 0 || return 0
fi
@ -41,7 +43,7 @@ fi
# Note: 4.9 is required for the latest architectures, like ARM64/AARCH64.
# AOSP_TOOLCHAIN_SUFFIX=4.8
# AOSP_TOOLCHAIN_SUFFIX=4.9
if [ -z "$AOSP_TOOLCHAIN_SUFFIX" ]; then
if [ -z "${AOSP_TOOLCHAIN_SUFFIX-}" ]; then
AOSP_TOOLCHAIN_SUFFIX=4.9
fi
@ -57,7 +59,7 @@ fi
# AOSP_API="android-19" # Android 4.4 and above
# AOSP_API="android-21" # Android 5.0 and above
# AOSP_API="android-23" # Android 6.0 and above
if [ -z "$AOSP_API" ]; then
if [ -z "${AOSP_API-}" ]; then
AOSP_API="android-21"
fi
@ -68,7 +70,7 @@ fi
# If the user did not specify the NDK location, try and pick it up. We expect something
# like ANDROID_NDK_ROOT=/opt/android-ndk-r10e or ANDROID_NDK_ROOT=/usr/local/android-ndk-r10e.
if [ -z "$ANDROID_NDK_ROOT" ]; then
if [ -z "${ANDROID_NDK_ROOT-}" ]; then
ANDROID_NDK_ROOT=$(find /opt -maxdepth 1 -type d -name android-ndk-r10* 2>/dev/null | tail -1)
if [ -z "$ANDROID_NDK_ROOT" ]; then

View File

@ -13,6 +13,8 @@
# See http://www.cryptopp.com/wiki/ARM_Embedded_(Command_Line) for details.
# ====================================================================
set -eu
# Unset old options
unset IS_CROSS_COMPILE
@ -21,7 +23,7 @@ unset IS_IOS
unset IS_ANDROID
unset IS_ARM_EMBEDDED
if [ -z "$ARM_EMBEDDED_TOOLCHAIN" ]; then
if [ -z "${ARM_EMBEDDED_TOOLCHAIN-}" ]; then
ARM_EMBEDDED_TOOLCHAIN="/usr/bin"
fi

View File

@ -11,6 +11,8 @@
# See http://www.cryptopp.com/wiki/iOS_(Command_Line) for more details
# ====================================================================
set -eu
#########################################
##### Clear old options #####
#########################################
@ -38,6 +40,9 @@ SETENV_VERBOSE=1
##### Command line #####
########################################
APPLE_SDK=
IOS_ARCH=
for ARG in "$@"
do
CL=$(echo $ARG | tr '[A-Z]' '[a-z]')
@ -132,7 +137,7 @@ fi
# move /Applications/Xcode somewhere else for a side-by-side installation.
# These sorts of tricks are a required procedure on Apple's gear:
# http://stackoverflow.com/questions/11651773/install-simulator-sdk-4-3-to-xcode-4-4-on-mountain-lion
if [ -z "$XCODE_DEVELOPER" ]; then
if [ -z "${XCODE_DEVELOPER-}" ]; then
XCODE_DEVELOPER=$(xcode-select -print-path 2>/dev/null)
fi
@ -233,8 +238,8 @@ if [ "$SETENV_VERBOSE" == "1" ]; then
echo "XCODE_DEVELOPER_TOP: $XCODE_DEVELOPER_TOP"
echo "IOS_ARCH: $IOS_ARCH"
echo "IOS_TOOLCHAIN: $IOS_TOOLCHAIN"
echo "IOS_FLAGS: $IOS_FLAGS"
echo "IOS_SYSROOT: $IOS_SYSROOT"
echo "IOS_FLAGS: ${IOS_FLAGS-}"
echo "IOS_SYSROOT: ${IOS_SYSROOT-}"
fi
########################################