[Android] buildsystem: use more portable shell logic test
Steve Lhomme
git at videolan.org
Mon Jun 16 13:47:41 UTC 2025
vlc-android | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jun 12 08:27:44 2025 +0200| [7008b9cb28fcc2ccc62c746ad2613f6262cadd8a] | committer: Duncan McNamara
buildsystem: use more portable shell logic test
> https://code.videolan.org/videolan/vlc-android/commit/7008b9cb28fcc2ccc62c746ad2613f6262cadd8a
---
buildsystem/compile.sh | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/buildsystem/compile.sh b/buildsystem/compile.sh
index 84ff66c576..1c537564cc 100755
--- a/buildsystem/compile.sh
+++ b/buildsystem/compile.sh
@@ -111,7 +111,7 @@ while [ $# -gt 0 ]; do
shift
done
-if [ -z "$ANDROID_NDK" -o -z "$ANDROID_SDK" ]; then
+if [ -z "$ANDROID_NDK" ] || [ -z "$ANDROID_SDK" ]; then
diagnostic "You must define ANDROID_NDK, ANDROID_SDK before starting."
diagnostic "They must point to your NDK and SDK directories."
exit 1
@@ -124,12 +124,12 @@ if [ -z "$ANDROID_ABI" ]; then
TRIPLET="aarch64-linux-android"
fi
-if [ "$ANDROID_ABI" = "armeabi-v7a" -o "$ANDROID_ABI" = "arm" ]; then
+if [ "$ANDROID_ABI" = "armeabi-v7a" ] || [ "$ANDROID_ABI" = "arm" ]; then
ANDROID_ABI="armeabi-v7a"
GRADLE_ABI="ARMv7"
ARCH="arm"
TRIPLET="arm-linux-androideabi"
-elif [ "$ANDROID_ABI" = "arm64-v8a" -o "$ANDROID_ABI" = "arm64" ]; then
+elif [ "$ANDROID_ABI" = "arm64-v8a" ] || [ "$ANDROID_ABI" = "arm64" ]; then
ANDROID_ABI="arm64-v8a"
GRADLE_ABI="ARMv8"
ARCH="arm64"
@@ -215,13 +215,13 @@ init_local_props() {
total_ndk_count=`grep -c "${ndk_line_start}" "$1"`
good_ndk_count=`grep -c "${ndk_line_start}${android_ndk_regex}\$" "$1"`
# if one of each is found and both match the environment vars, no action needed
- if [ "$total_sdk_count" -eq "1" -a "$good_sdk_count" -eq "1" \
- -a "$total_ndk_count" -eq "1" -a "$good_ndk_count" -eq "1" ]
+ if [ "$total_sdk_count" -eq "1" ] && [ "$good_sdk_count" -eq "1" ] \
+ && [ "$total_ndk_count" -eq "1" ] && [ "$good_ndk_count" -eq "1" ]
then
return 0
fi
# if neither property is set they can simply be appended to the file
- if [ "$total_sdk_count" -eq "0" -a "$total_ndk_count" -eq "0" ]; then
+ if [ "$total_sdk_count" -eq "0" ] && [ "$total_ndk_count" -eq "0" ]; then
echo_props >> "$1"
return 0
fi
@@ -232,7 +232,7 @@ init_local_props() {
while IFS= read -r LINE || [ -n "$LINE" ]; do
line_sdk_dir="${LINE#sdk.dir=}"
line_ndk_dir="${LINE#android.ndkPath=}"
- if [ "x$line_sdk_dir" = "x$LINE" -a "x$line_ndk_dir" = "x$LINE" ]; then
+ if [ "x$line_sdk_dir" = "x$LINE" ] && [ "x$line_ndk_dir" = "x$LINE" ]; then
echo "$LINE"
fi
done <"$1" >"$temp_props"
@@ -337,7 +337,7 @@ diagnostic "Configuring"
OUT_DBG_DIR=.dbg/${ANDROID_ABI}
mkdir -p $OUT_DBG_DIR
-if [ "$BUILD_MEDIALIB" != 1 -o ! -d "${VLC_LIBJNI_PATH}/libvlc/jni/libs/" ]; then
+if [ "$BUILD_MEDIALIB" != 1 ] || [ ! -d "${VLC_LIBJNI_PATH}/libvlc/jni/libs/" ]; then
if [ "$PREBUILT_CONTRIBS" = 1 ];then
VLC_CONTRIB_SHA="$(cd ${VLC_LIBJNI_PATH}/vlc && extras/ci/get-contrib-sha.sh android-${ARCH})"
if [ "$FORCE_VLC_4" = 1 ]; then
@@ -386,14 +386,14 @@ elif [ "$BUILD_MEDIALIB" = 1 ]; then
GRADLE_ABI=$GRADLE_ABI ./gradlew ${gradle_prop} -Dmaven.repo.local=$M2_REPO -p medialibrary assemble${BUILDTYPE}
RUN=0
else
- if [ "$TEST" = 1 -o "$RUN" = 1 ]; then
+ if [ "$TEST" = 1 ] || [ "$RUN" = 1 ]; then
ACTION="install"
else
ACTION="assemble"
fi
TARGET="${ACTION}${BUILDTYPE}"
GRADLE_VLC_SRC_DIRS="$GRADLE_VLC_SRC_DIRS" CLI="" GRADLE_ABI=$GRADLE_ABI ./gradlew ${gradle_prop} -Dmaven.repo.local=$M2_REPO $TARGET
- if [ "$BUILDTYPE" = "Release" -a "$ACTION" = "assemble" ]; then
+ if [ "$BUILDTYPE" = "Release" ] && [ "$ACTION" = "assemble" ]; then
TARGET="bundle${BUILDTYPE}"
GRADLE_VLC_SRC_DIRS="$GRADLE_VLC_SRC_DIRS" CLI="" GRADLE_ABI=$GRADLE_ABI ./gradlew ${gradle_prop} -Dmaven.repo.local=$M2_REPO $TARGET
fi
More information about the Android
mailing list