summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2021-11-28 10:49:18 +0200
committeravih <avih@users.noreply.github.com>2021-12-01 11:00:05 +0200
commit3de25ed5c50ba0f86495bc22919c86e059a0ea48 (patch)
treec188f97f5b46a2f4378fd6b424079f1475390348
parent1eb1bd29d183ceb4863cc84a2fbc4bc2c3d0195d (diff)
downloadmpv-build-3de25ed5c50ba0f86495bc22919c86e059a0ea48.tar.bz2
mpv-build-3de25ed5c50ba0f86495bc22919c86e059a0ea48.tar.xz
configure options: allow CLI arguments with spaces
While configure CLI options are not used with ./build and ./rebuild, scripts/*-config can be invoked directly with arguments, and these script do take that into account. Previously, spaces in such arguments e.g. --extra-libs="-L/foo -lbar" caused the argument to be incorrectly split (on IFS), and now they're preserved correctly. The issue was that the arguments were stored using USER_OPTS="$@", and the var value was later used unquoted - which splits on IFS. Another issue is that VAR="$@" is unspecified by posix, because quoted "$@" is only specified where field-splitting otherwise happens, but it doesn't happen in variable assignment. The solution is to never store "$@", and instead just use it directly. Also, previously scripts/fribidi-config ignored CLI arguments, now it doesn't. Config options at NAME_options files will be fixed at the next commit.
-rwxr-xr-xscripts/ffmpeg-config11
-rwxr-xr-xscripts/fribidi-config5
-rwxr-xr-xscripts/libass-config7
-rwxr-xr-xscripts/mpv-config8
4 files changed, 12 insertions, 19 deletions
diff --git a/scripts/ffmpeg-config b/scripts/ffmpeg-config
index 298f4a1..49d68f1 100755
--- a/scripts/ffmpeg-config
+++ b/scripts/ffmpeg-config
@@ -3,18 +3,15 @@ set -e
BUILD="$(pwd)"
-USER_OPTS="$@"
if test -f "$BUILD"/ffmpeg_options ; then
- USER_OPTS="$(cat "$BUILD"/ffmpeg_options) $USER_OPTS"
+ set -- $(cat "$BUILD"/ffmpeg_options) "$@"
fi
-OPTIONS="--enable-gpl --disable-debug --disable-doc"
+OPTIONS="--enable-gpl --disable-debug --disable-doc"
if "$BUILD"/scripts/test-libmpv ; then
OPTIONS="$OPTIONS --enable-pic"
fi
-OPTIONS="$OPTIONS $USER_OPTS"
-
# Do FFmpeg's job.
if ! ( echo "$OPTIONS" | grep -q -e --enable-openssl ) &&
! ( echo "$OPTIONS" | grep -q -e --enable-gnutls ) &&
@@ -38,8 +35,8 @@ case "$PKG_CONFIG_PATH" in
;;
esac
-echo Using ffmpeg options: $OPTIONS
+echo Using ffmpeg options: $OPTIONS "$@"
mkdir -p "$BUILD"/ffmpeg_build
cd "$BUILD"/ffmpeg_build
-"$BUILD"/ffmpeg/configure --prefix="$BUILD"/build_libs --enable-static --disable-shared $OPTIONS
+"$BUILD"/ffmpeg/configure --prefix="$BUILD"/build_libs --enable-static --disable-shared $OPTIONS "$@"
diff --git a/scripts/fribidi-config b/scripts/fribidi-config
index 20fa684..f9e7be6 100755
--- a/scripts/fribidi-config
+++ b/scripts/fribidi-config
@@ -2,12 +2,11 @@
set -e
BUILD="$(pwd)"
-OPTIONS=""
-
+OPTIONS=
if "$BUILD"/scripts/test-libmpv ; then
OPTIONS="$OPTIONS --with-pic"
fi
cd "$BUILD"/fribidi
./bootstrap
-./configure --prefix="$BUILD/build_libs" --libdir="$BUILD/build_libs/lib" --enable-static --disable-shared --without-glib $OPTIONS
+./configure --prefix="$BUILD/build_libs" --libdir="$BUILD/build_libs/lib" --enable-static --disable-shared --without-glib $OPTIONS "$@"
diff --git a/scripts/libass-config b/scripts/libass-config
index f391ae7..1a6e56e 100755
--- a/scripts/libass-config
+++ b/scripts/libass-config
@@ -2,8 +2,7 @@
set -e
BUILD="$(pwd)"
-OPTIONS="$@"
-
+OPTIONS=
if "$BUILD"/scripts/test-libmpv ; then
OPTIONS="$OPTIONS --with-pic"
fi
@@ -19,6 +18,6 @@ esac
cd "$BUILD"/libass
# Later libass doesn't automatically run configure with autogen.sh anymore
-./autogen.sh --prefix="$BUILD/build_libs" --libdir="$BUILD/build_libs/lib" --enable-static --disable-shared $OPTIONS
-./configure --prefix="$BUILD/build_libs" --libdir="$BUILD/build_libs/lib" --enable-static --disable-shared $OPTIONS
+./autogen.sh --prefix="$BUILD/build_libs" --libdir="$BUILD/build_libs/lib" --enable-static --disable-shared $OPTIONS "$@"
+./configure --prefix="$BUILD/build_libs" --libdir="$BUILD/build_libs/lib" --enable-static --disable-shared $OPTIONS "$@"
diff --git a/scripts/mpv-config b/scripts/mpv-config
index 7acd085..126fdcf 100755
--- a/scripts/mpv-config
+++ b/scripts/mpv-config
@@ -3,11 +3,9 @@ set -e
BUILD="$(pwd)"
-USER_OPTS="$@"
if test -f "$BUILD"/mpv_options ; then
- USER_OPTS="$(cat "$BUILD"/mpv_options) $USER_OPTS"
+ set -- $(cat "$BUILD"/mpv_options) "$@"
fi
-OPTIONS="$USER_OPTS"
case "$PKG_CONFIG_PATH" in
'')
@@ -22,7 +20,7 @@ esac
# this is necessary due to the hybrid static / dynamic nature of the build
export LDFLAGS="$LDFLAGS $(pkg-config --libs fontconfig harfbuzz fribidi)"
-echo Using mpv options: $OPTIONS
+echo Using mpv options: "$@"
cd "$BUILD"/mpv
-python3 ./waf configure $OPTIONS
+python3 ./waf configure "$@"