diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2021-11-28 10:49:18 +0200 |
---|---|---|
committer | avih <avih@users.noreply.github.com> | 2021-12-01 11:00:05 +0200 |
commit | 3de25ed5c50ba0f86495bc22919c86e059a0ea48 (patch) | |
tree | c188f97f5b46a2f4378fd6b424079f1475390348 | |
parent | 1eb1bd29d183ceb4863cc84a2fbc4bc2c3d0195d (diff) | |
download | mpv-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-x | scripts/ffmpeg-config | 11 | ||||
-rwxr-xr-x | scripts/fribidi-config | 5 | ||||
-rwxr-xr-x | scripts/libass-config | 7 | ||||
-rwxr-xr-x | scripts/mpv-config | 8 |
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 "$@" |