From 1c0ffee0ebdf0965a11ec9eead478d75529395d9 Mon Sep 17 00:00:00 2001 From: Riven Skaye Date: Mon, 2 Jan 2023 14:52:59 +0100 Subject: [PATCH 1/7] Testing this locally rn --- build/media-suite_compile.sh | 115 ++++++++++++++++++++++++++++++----- 1 file changed, 101 insertions(+), 14 deletions(-) diff --git a/build/media-suite_compile.sh b/build/media-suite_compile.sh index e589ea94c5..36ec0df283 100644 --- a/build/media-suite_compile.sh +++ b/build/media-suite_compile.sh @@ -2386,7 +2386,10 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t log bootstrap /usr/bin/python bootstrap.py if [[ -d build ]]; then + # Temporarily keep this until Waf is reasonably phased out. + # Not all users will run this weekly, so keep the cleanup for now. /usr/bin/python waf distclean >/dev/null 2>&1 + rm -rf build # Meson's recommended way to clean up previous runs! do_uninstall bin-video/mpv{.exe,-2.dll}.debug "${_check[@]}" fi @@ -2415,9 +2418,13 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t [[ -f mpv_extra.sh ]] && source mpv_extra.sh - mpv_enabled mruby && - { git merge --no-edit --no-gpg-sign origin/mruby || - git merge --abort && do_removeOption MPV_OPTS "--enable-mruby"; } + # The mruby branch cannot (currently) be built with Meson, and hasn't seen + # any activity in over 5 years; for now it's statically disabled. + # https://github.com/mpv-player/mpv/issues/11078 + if mpv_enabled mruby; then + do_removeOption MPV_OPTS "--enable-mruby"; + do_simple_print "${orange}mruby in mpv is no longer supported"'!'"${reset}" + fi if files_exist libavutil.a; then MPV_OPTS+=(--enable-static-build) @@ -2432,6 +2439,88 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t done fi + # Translate the Waf flags to Meson options instead. + # It should be fairly easy to overwrite the mpv_options file, + # though differentiating would require ugly hacks like a header marker. + # This allows reusing old configs and doesn't rely on correctly formatted input, + # since users editing a config may easily slip up with `-D` prepended to every line. + # The alternative is having users only specify everything after it in the config, e.g. + # `lua=luajit` and `cdda=enabled` (optionally omitting `=enabled` for on/off features) + local meson_opts=() + local option + for option in "${MPV_OPTS[@]}"; do + # Process Waf flags into Meson options. + # starting with boolean flags + if [[ option =~ ^--enable-(gpl|cplayer|libmpv(-shared)?|build-date|tests|ta-leak-report) ]]; then + meson_opts+=("${${option/--enable-/-D}/libmpv-shared/libmpv}"+"=true") + elif [[ option =~ ^--disable-(gpl|cplayer|libmpv(-shared)?|build-date|tests|ta-leak-report) ]]; then + meson_opts+=("${${option/--disable-/-D}/libmpv-shared/libmpv}"+"=false") + # features in the misc section + elif [[ option =~ ^--enable-(cdda|cplugins|dvbin|dvdnav|iconv|javascript|lcms2|libarchive|libavdevice|libbluray|pthread-debug|rubberband|sdl2|sdl2-gamepad|stdatomic|uchardet|uwp|vapoursynth|vector|win32-internal-pthreads|zimg|zlib) ]]; then + meson_opts+=("${option/--enable-/-D}"+"=enabled") + elif [[ option =~ ^--disable-(cdda|cplugins|dvbin|dvdnav|iconv|javascript|lcms2|libarchive|libavdevice|libbluray|pthread-debug|rubberband|sdl2|sdl2-gamepad|stdatomic|uchardet|uwp|vapoursynth|vector|win32-internal-pthreads|zimg|zlib) ]]; then + meson_opts+=("${option/--disable-/-D}"+"=disabled") + # Audio option time! This goes in twos; we're unconditionally disabling non-Windows options and warning the user. + elif [[ option =~ ^--enable-(alsa|audiounit|coreaudio|oss-audio|pipewire|pulse|sndio) ]]; then + meson_opts+=("${option/--enable-/-D}"+"=disabled") + do_simple_print "${orange}Disabling option '${option}' as it's not usable on Windows"'!'"${reset}" + elif [[ option =~ ^--enable-(jack|openal|opensles|sdl2-audio|wasapi) ]]; then + meson_opts+=("${option/--enable-/-D}"+"=enabled") + elif [[ option =~ ^--disable-(jack|openal|opensles|sdl2-audio|wasapi) ]]; then + meson_opts+=("${option/--disable-/-D}"+"=disabled") + # Video corner, same as with audio + elif [[ option =~ ^--enable-(cocoa|drm|egl-android|*-drm|*-wayland|*-x11|*-cocoa|gbm|rpi|vdpau|vdpau-*|vaapi|vaapi-*|wayland|x11|xv) ]]; then + meson_opts+=("${option/--enable-/-D}"+"=disabled") + do_simple_print "${orange}Disabling option '${option}' as it's not usable on Windows"'!'"${reset}" + elif [[ option =~ ^--enable-(caca|d3d11|direct3d|egl|egl-*|plain-gl|gl|gl-*|jpeg|libplacebo|sdl2-video|shaderc|sixel|spirv-cross|vulkan) ]]; then + meson_opts+=("${option/--enable-/-D}"+"=enabled") + elif [[ option =~ ^--disable-(caca|d3d11|direct3d|egl|egl-*|plain-gl|gl|gl-*|jpeg|libplacebo|sdl2-video|shaderc|sixel|spirv-cross|vulkan) ]]; then + meson_opts+=("${option/--disable-/-D}"+"=disabled") + # hwaccel features + elif [[ option =~ ^--enable-(android-media-ndk|ios-gl|rpi-mmal|videotoolbox-gl) ]]; then + meson_opts+=("${option/--enable-/-D}"+"=disabled") + do_simple_print "${orange}Disabling option '${option}' as it's not usable on Windows"'!'"${reset}" + elif [[ option =~ ^--enable-(cuda-hwaccel|cuda-interop|d3d-hwaccel|d3d9-hwaccel|gl-dxinterop-d3d9) ]]; then + meson_opts+=("${option/--enable-/-D}"+"=enabled") + elif [[ option =~ ^--disable-(cuda-hwaccel|cuda-interop|d3d-hwaccel|d3d9-hwaccel|gl-dxinterop-d3d9) ]]; then + meson_opts+=("${option/--disable-/-D}"+"=disabled") + # Mac-only options, we might as well catch and squash them + elif [[ option =~ ^--enable-(macos-*|swift-*) ]]; then + meson_opts+=("${option/--enable-/-D}"+"=disabled") + do_simple_print "${orange}Disabling option '${option}' as it's not usable on Windows"'!'"${reset}" + # Manpages corner + elif [[ option =~ ^--enable-(html-build|manpage-build) ]]; then + meson_opts+=("${option/--enable-/-D}"+"=enabled") + elif [[ option =~ ^--disable-(html-build|manpage-build) ]]; then + meson_opts+=("${option/--disable-/-D}"+"=disabled") + elif [[ option =~ ^--enable-pdf-build ]]; then + meson_opts+=("${option/--disable-/-D}"+"=disabled") + do_simple_print "${orange}Disabling PDF manual, currently broken"'!'"${reset}" + elif [[ option =~ ^--lua=lua* ]]; then + # `meson setup build` does not take kindly to a format not matching lua(jit|\d\.\d) + local luaver="${option/--lua=}" + if [[ luaver =~ ^(5|-5) ]]; then + luaver='5.${luaver:-1}' + elif [[ luaver =~ ^-jit ]]; then + luaver='jit' + fi + meson_opts+=("-Dlua=lua${luaver}") + # Remove the `-Dlua=enabled` flag if present, since the order of flags matters. + # - `-Dlua=lua5.2 -Dlua=enabled` makes Meson behave like only `-Dlua=enabled` was specified; + # - `-Dlua=enabled -Dlua=lua5.2` makes Meson take lua5.2 if available, erroring otherwise; + meson_opts=("${meson_opts[@]/-Dlua=enabled}") + elif [[ option =~ ^--enable-lua ]] && ! [[ "${meson_opts[@]}" =~ -Dlua= ]]; then + meson_opts+=("-Dlua=enabled") + # Add all options formatted as Meson args + elif [[ option =~ ^-D* ]]; then + meson_opts+=("${option}") + # Try to add all options given without -- or -D prefixes + elif ! [[ option =~ ^-(-|D) ]]; then + meson_opts+=("-D${option}") + fi + unset option + done + extra_script pre configure CFLAGS+=" ${mpv_cflags[*]} -Wno-int-conversion" LDFLAGS+=" ${mpv_ldflags[*]}" \ RST2MAN="${MINGW_PREFIX}/bin/rst2man" \ @@ -2439,20 +2528,18 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t RST2PDF="${MINGW_PREFIX}/bin/rst2pdf2" \ PKG_CONFIG="$LOCALDESTDIR/bin/ab-pkg-config" \ log configure /usr/bin/python waf configure \ - "--prefix=$LOCALDESTDIR" "--bindir=$LOCALDESTDIR/bin-video" \ - "${MPV_OPTS[@]}" + "--prefix=$LOCALDESTDIR" "--bindir=$LOCALDESTDIR/bin-video" + mkdir build + PKG_CONFIG="pkgconf --keep-system-libs --keep-system-cflags" CC=${CC/ccache /}.bat CXX=${CXX/ccache /}.bat + log "meson" meson setup build --default-library=static --buildtype=release --prefix="$LOCALDESTDIR" --backend=ninja --bindir=bin-video "${meson_opts[@]}" extra_script post configure - replace="LIBPATH_lib\1 = ['${LOCALDESTDIR}/lib','${MINGW_PREFIX}/lib']" - sed -r -i "s:LIBPATH_lib(ass|av(|device|filter)) = .*:$replace:g" ./build/c4che/_cache.py - - extra_script pre build - log build /usr/bin/python waf -j "${cpuCount:-1}" - extra_script post build + extra_script pre ninja + log "build" ninja + extra_script post ninja extra_script pre install - log install /usr/bin/python waf -j1 install || - log install /usr/bin/python waf -j1 install + cpuCount=1 log "install" ninja install extra_script post install if ! files_exist libavutil.a; then @@ -2464,7 +2551,7 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t done fi - unset mpv_ldflags replace PKGCONF_STATIC + unset mpv_ldflags replace PKGCONF_STATIC meson_opts hide_conflicting_libs -R files_exist share/man/man1/mpv.1 && dos2unix -q "$LOCALDESTDIR"/share/man/man1/mpv.1 ! mpv_disabled debug-build && From 1c0ffeea88d1a88a321ce816b31af26dc40bc9e4 Mon Sep 17 00:00:00 2001 From: Riven Skaye Date: Tue, 3 Jan 2023 00:01:37 +0100 Subject: [PATCH 2/7] This should work:tm: --- build/media-suite_compile.sh | 94 +++++++++++++++++------------------- 1 file changed, 45 insertions(+), 49 deletions(-) diff --git a/build/media-suite_compile.sh b/build/media-suite_compile.sh index 36ec0df283..0d5f28759a 100644 --- a/build/media-suite_compile.sh +++ b/build/media-suite_compile.sh @@ -2449,59 +2449,60 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t local meson_opts=() local option for option in "${MPV_OPTS[@]}"; do + do_simple_print "Processing $option" # Process Waf flags into Meson options. # starting with boolean flags - if [[ option =~ ^--enable-(gpl|cplayer|libmpv(-shared)?|build-date|tests|ta-leak-report) ]]; then - meson_opts+=("${${option/--enable-/-D}/libmpv-shared/libmpv}"+"=true") - elif [[ option =~ ^--disable-(gpl|cplayer|libmpv(-shared)?|build-date|tests|ta-leak-report) ]]; then - meson_opts+=("${${option/--disable-/-D}/libmpv-shared/libmpv}"+"=false") + if [[ $option =~ ^--enable-(gpl|cplayer|libmpv-shared|build-date|tests|ta-leak-report) ]]; then + meson_opts+=("${option/--enable-/-D}=true") + elif [[ $option =~ ^--disable-(gpl|cplayer|libmpv(-shared)?|build-date|tests|ta-leak-report) ]]; then + meson_opts+=("${${option/--disable-/-D}/libmpv-shared/libmpv}=false") # features in the misc section - elif [[ option =~ ^--enable-(cdda|cplugins|dvbin|dvdnav|iconv|javascript|lcms2|libarchive|libavdevice|libbluray|pthread-debug|rubberband|sdl2|sdl2-gamepad|stdatomic|uchardet|uwp|vapoursynth|vector|win32-internal-pthreads|zimg|zlib) ]]; then - meson_opts+=("${option/--enable-/-D}"+"=enabled") - elif [[ option =~ ^--disable-(cdda|cplugins|dvbin|dvdnav|iconv|javascript|lcms2|libarchive|libavdevice|libbluray|pthread-debug|rubberband|sdl2|sdl2-gamepad|stdatomic|uchardet|uwp|vapoursynth|vector|win32-internal-pthreads|zimg|zlib) ]]; then - meson_opts+=("${option/--disable-/-D}"+"=disabled") + elif [[ $option =~ ^--enable-(cdda|cplugins|dvbin|dvdnav|iconv|javascript|lcms2|libarchive|libavdevice|libbluray|pthread-debug|rubberband|sdl2|sdl2-gamepad|stdatomic|uchardet|uwp|vapoursynth|vector|win32-internal-pthreads|zimg|zlib) ]]; then + meson_opts+=("${option/--enable-/-D}=enabled") + elif [[ $option =~ ^--disable-(cdda|cplugins|dvbin|dvdnav|iconv|javascript|lcms2|libarchive|libavdevice|libbluray|pthread-debug|rubberband|sdl2|sdl2-gamepad|stdatomic|uchardet|uwp|vapoursynth|vector|win32-internal-pthreads|zimg|zlib) ]]; then + meson_opts+=("${option/--disable-/-D}=disabled") # Audio option time! This goes in twos; we're unconditionally disabling non-Windows options and warning the user. - elif [[ option =~ ^--enable-(alsa|audiounit|coreaudio|oss-audio|pipewire|pulse|sndio) ]]; then - meson_opts+=("${option/--enable-/-D}"+"=disabled") + elif [[ $option =~ ^--enable-(alsa|audiounit|coreaudio|oss-audio|pipewire|pulse|sndio) ]]; then + meson_opts+=("${option/--enable-/-D}=disabled") do_simple_print "${orange}Disabling option '${option}' as it's not usable on Windows"'!'"${reset}" - elif [[ option =~ ^--enable-(jack|openal|opensles|sdl2-audio|wasapi) ]]; then - meson_opts+=("${option/--enable-/-D}"+"=enabled") - elif [[ option =~ ^--disable-(jack|openal|opensles|sdl2-audio|wasapi) ]]; then - meson_opts+=("${option/--disable-/-D}"+"=disabled") + elif [[ $option =~ ^--enable-(jack|openal|opensles|sdl2-audio|wasapi) ]]; then + meson_opts+=("${option/--enable-/-D}=enabled") + elif [[ $option =~ ^--disable-(jack|openal|opensles|sdl2-audio|wasapi) ]]; then + meson_opts+=("${option/--disable-/-D}=disabled") # Video corner, same as with audio - elif [[ option =~ ^--enable-(cocoa|drm|egl-android|*-drm|*-wayland|*-x11|*-cocoa|gbm|rpi|vdpau|vdpau-*|vaapi|vaapi-*|wayland|x11|xv) ]]; then - meson_opts+=("${option/--enable-/-D}"+"=disabled") + elif [[ $option =~ ^--enable-(cocoa|drm|egl-android|*-drm|*-wayland|*-x11|*-cocoa|gbm|rpi|vdpau|vdpau-*|vaapi|vaapi-*|wayland|x11|xv) ]]; then + meson_opts+=("${option/--enable-/-D}=disabled") do_simple_print "${orange}Disabling option '${option}' as it's not usable on Windows"'!'"${reset}" - elif [[ option =~ ^--enable-(caca|d3d11|direct3d|egl|egl-*|plain-gl|gl|gl-*|jpeg|libplacebo|sdl2-video|shaderc|sixel|spirv-cross|vulkan) ]]; then - meson_opts+=("${option/--enable-/-D}"+"=enabled") - elif [[ option =~ ^--disable-(caca|d3d11|direct3d|egl|egl-*|plain-gl|gl|gl-*|jpeg|libplacebo|sdl2-video|shaderc|sixel|spirv-cross|vulkan) ]]; then - meson_opts+=("${option/--disable-/-D}"+"=disabled") + elif [[ $option =~ ^--enable-(caca|d3d11|direct3d|egl|egl-*|plain-gl|gl|gl-*|jpeg|libplacebo|sdl2-video|shaderc|sixel|spirv-cross|vulkan) ]]; then + meson_opts+=("${option/--enable-/-D}=enabled") + elif [[ $option =~ ^--disable-(caca|d3d11|direct3d|egl|egl-*|plain-gl|gl|gl-*|jpeg|libplacebo|sdl2-video|shaderc|sixel|spirv-cross|vulkan) ]]; then + meson_opts+=("${option/--disable-/-D}=disabled") # hwaccel features - elif [[ option =~ ^--enable-(android-media-ndk|ios-gl|rpi-mmal|videotoolbox-gl) ]]; then - meson_opts+=("${option/--enable-/-D}"+"=disabled") + elif [[ $option =~ ^--enable-(android-media-ndk|ios-gl|rpi-mmal|videotoolbox-gl) ]]; then + meson_opts+=("${option/--enable-/-D}=disabled") do_simple_print "${orange}Disabling option '${option}' as it's not usable on Windows"'!'"${reset}" - elif [[ option =~ ^--enable-(cuda-hwaccel|cuda-interop|d3d-hwaccel|d3d9-hwaccel|gl-dxinterop-d3d9) ]]; then - meson_opts+=("${option/--enable-/-D}"+"=enabled") - elif [[ option =~ ^--disable-(cuda-hwaccel|cuda-interop|d3d-hwaccel|d3d9-hwaccel|gl-dxinterop-d3d9) ]]; then - meson_opts+=("${option/--disable-/-D}"+"=disabled") + elif [[ $option =~ ^--enable-(cuda-hwaccel|cuda-interop|d3d-hwaccel|d3d9-hwaccel|gl-dxinterop-d3d9) ]]; then + meson_opts+=("${option/--enable-/-D}=enabled") + elif [[ $option =~ ^--disable-(cuda-hwaccel|cuda-interop|d3d-hwaccel|d3d9-hwaccel|gl-dxinterop-d3d9) ]]; then + meson_opts+=("${option/--disable-/-D}=disabled") # Mac-only options, we might as well catch and squash them - elif [[ option =~ ^--enable-(macos-*|swift-*) ]]; then - meson_opts+=("${option/--enable-/-D}"+"=disabled") + elif [[ $option =~ ^--enable-(macos-*|swift-*) ]]; then + meson_opts+=("${option/--enable-/-D}=disabled") do_simple_print "${orange}Disabling option '${option}' as it's not usable on Windows"'!'"${reset}" # Manpages corner - elif [[ option =~ ^--enable-(html-build|manpage-build) ]]; then - meson_opts+=("${option/--enable-/-D}"+"=enabled") - elif [[ option =~ ^--disable-(html-build|manpage-build) ]]; then - meson_opts+=("${option/--disable-/-D}"+"=disabled") - elif [[ option =~ ^--enable-pdf-build ]]; then - meson_opts+=("${option/--disable-/-D}"+"=disabled") + elif [[ $option =~ ^--enable-(html-build|manpage-build) ]]; then + meson_opts+=("${option/--enable-/-D}=enabled") + elif [[ $option =~ ^--disable-(html-build|manpage-build) ]]; then + meson_opts+=("${option/--disable-/-D}=disabled") + elif [[ $option =~ ^--enable-pdf-build ]]; then + meson_opts+=("${option/--disable-/-D}=disabled") do_simple_print "${orange}Disabling PDF manual, currently broken"'!'"${reset}" - elif [[ option =~ ^--lua=lua* ]]; then + elif [[ $option =~ ^--lua=lua* ]]; then # `meson setup build` does not take kindly to a format not matching lua(jit|\d\.\d) - local luaver="${option/--lua=}" + local luaver="${option/--lua=lua}" if [[ luaver =~ ^(5|-5) ]]; then luaver='5.${luaver:-1}' - elif [[ luaver =~ ^-jit ]]; then + elif [[ luaver =~ ^jit ]]; then luaver='jit' fi meson_opts+=("-Dlua=lua${luaver}") @@ -2509,17 +2510,12 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t # - `-Dlua=lua5.2 -Dlua=enabled` makes Meson behave like only `-Dlua=enabled` was specified; # - `-Dlua=enabled -Dlua=lua5.2` makes Meson take lua5.2 if available, erroring otherwise; meson_opts=("${meson_opts[@]/-Dlua=enabled}") - elif [[ option =~ ^--enable-lua ]] && ! [[ "${meson_opts[@]}" =~ -Dlua= ]]; then + elif [[ $option =~ ^--enable-lua ]] && ! [[ "${meson_opts[@]}" =~ -Dlua= ]]; then meson_opts+=("-Dlua=enabled") - # Add all options formatted as Meson args - elif [[ option =~ ^-D* ]]; then - meson_opts+=("${option}") - # Try to add all options given without -- or -D prefixes - elif ! [[ option =~ ^-(-|D) ]]; then - meson_opts+=("-D${option}") fi unset option done + do_simple_print "${meson_opts[@]}" extra_script pre configure CFLAGS+=" ${mpv_cflags[*]} -Wno-int-conversion" LDFLAGS+=" ${mpv_ldflags[*]}" \ @@ -2527,11 +2523,11 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t RST2HTML="${MINGW_PREFIX}/bin/rst2html" \ RST2PDF="${MINGW_PREFIX}/bin/rst2pdf2" \ PKG_CONFIG="$LOCALDESTDIR/bin/ab-pkg-config" \ - log configure /usr/bin/python waf configure \ - "--prefix=$LOCALDESTDIR" "--bindir=$LOCALDESTDIR/bin-video" - mkdir build - PKG_CONFIG="pkgconf --keep-system-libs --keep-system-cflags" CC=${CC/ccache /}.bat CXX=${CXX/ccache /}.bat - log "meson" meson setup build --default-library=static --buildtype=release --prefix="$LOCALDESTDIR" --backend=ninja --bindir=bin-video "${meson_opts[@]}" + mkdir build\ + PKG_CONFIG="pkgconf --keep-system-libs --keep-system-cflags" CC=${CC/ccache /}.bat CXX=${CXX/ccache /}.bat\ + log "meson" meson setup build\ + cd build\ + log "meson" meson configure --default-library=static --buildtype=release --prefix="$LOCALDESTDIR" --backend=ninja --bindir=bin-video "${meson_opts[@]}" extra_script post configure extra_script pre ninja From 1c0ffee2f033a1515c8f4b0f9dd0cb1682f64896 Mon Sep 17 00:00:00 2001 From: Riven Skaye Date: Tue, 3 Jan 2023 00:13:23 +0100 Subject: [PATCH 3/7] This is cleaner imo --- build/media-suite_compile.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/media-suite_compile.sh b/build/media-suite_compile.sh index 0d5f28759a..d3e3840777 100644 --- a/build/media-suite_compile.sh +++ b/build/media-suite_compile.sh @@ -2523,8 +2523,8 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t RST2HTML="${MINGW_PREFIX}/bin/rst2html" \ RST2PDF="${MINGW_PREFIX}/bin/rst2pdf2" \ PKG_CONFIG="$LOCALDESTDIR/bin/ab-pkg-config" \ - mkdir build\ PKG_CONFIG="pkgconf --keep-system-libs --keep-system-cflags" CC=${CC/ccache /}.bat CXX=${CXX/ccache /}.bat\ + mkdir build\ log "meson" meson setup build\ cd build\ log "meson" meson configure --default-library=static --buildtype=release --prefix="$LOCALDESTDIR" --backend=ninja --bindir=bin-video "${meson_opts[@]}" From 1c0ffee31615d622012510de028df060f78175e7 Mon Sep 17 00:00:00 2001 From: Riven Skaye Date: Tue, 3 Jan 2023 00:37:24 +0100 Subject: [PATCH 4/7] Chop chop? --- build/media-suite_compile.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/build/media-suite_compile.sh b/build/media-suite_compile.sh index d3e3840777..770a21a20f 100644 --- a/build/media-suite_compile.sh +++ b/build/media-suite_compile.sh @@ -2522,12 +2522,10 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t RST2MAN="${MINGW_PREFIX}/bin/rst2man" \ RST2HTML="${MINGW_PREFIX}/bin/rst2html" \ RST2PDF="${MINGW_PREFIX}/bin/rst2pdf2" \ - PKG_CONFIG="$LOCALDESTDIR/bin/ab-pkg-config" \ - PKG_CONFIG="pkgconf --keep-system-libs --keep-system-cflags" CC=${CC/ccache /}.bat CXX=${CXX/ccache /}.bat\ - mkdir build\ - log "meson" meson setup build\ - cd build\ - log "meson" meson configure --default-library=static --buildtype=release --prefix="$LOCALDESTDIR" --backend=ninja --bindir=bin-video "${meson_opts[@]}" + PKG_CONFIG="pkgconf --keep-system-libs --keep-system-cflags $LOCALDESTDIR/bin/ab-pkg-config" CC=${CC/ccache /}.bat CXX=${CXX/ccache /}.bat + mkdir build + log "meson" meson setup build + log "meson" meson configure --default-library=static --buildtype=release --prefix="$LOCALDESTDIR" --backend=ninja --bindir=bin-video "${meson_opts[@]}" extra_script post configure extra_script pre ninja From 1c0ffeebb39b3677d90ccc9b43cf5fc0c81aeb4e Mon Sep 17 00:00:00 2001 From: Riven Skaye Date: Wed, 4 Jan 2023 13:52:09 +0100 Subject: [PATCH 5/7] This might work, but ffmpeg broke so no dice --- build/media-suite_compile.sh | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/build/media-suite_compile.sh b/build/media-suite_compile.sh index 770a21a20f..465e64105f 100644 --- a/build/media-suite_compile.sh +++ b/build/media-suite_compile.sh @@ -2384,7 +2384,6 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t hide_conflicting_libs create_ab_pkgconfig - log bootstrap /usr/bin/python bootstrap.py if [[ -d build ]]; then # Temporarily keep this until Waf is reasonably phased out. # Not all users will run this weekly, so keep the cleanup for now. @@ -2447,15 +2446,20 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t # The alternative is having users only specify everything after it in the config, e.g. # `lua=luajit` and `cdda=enabled` (optionally omitting `=enabled` for on/off features) local meson_opts=() + local default_lib="both" local option for option in "${MPV_OPTS[@]}"; do - do_simple_print "Processing $option" # Process Waf flags into Meson options. # starting with boolean flags - if [[ $option =~ ^--enable-(gpl|cplayer|libmpv-shared|build-date|tests|ta-leak-report) ]]; then + if [[ $option =~ ^--enable-(gpl|cplayer|build-date|tests|ta-leak-report) ]]; then meson_opts+=("${option/--enable-/-D}=true") - elif [[ $option =~ ^--disable-(gpl|cplayer|libmpv(-shared)?|build-date|tests|ta-leak-report) ]]; then - meson_opts+=("${${option/--disable-/-D}/libmpv-shared/libmpv}=false") + elif [[ $option =~ ^--disable-(gpl|cplayer|build-date|tests|ta-leak-report) ]]; then + meson_opts+=("${option/--disable-/-D}=false") + elif [[ $option =~ ^--enable-libmpv(-shared)? ]]; then + meson_opts+=("-Dlibmpv=true") + elif [[ $option =~ ^--disable-libmpv(-shared)? ]]; then + meson_opts+=("-Dlibmpv=false") + default_lib="static" # features in the misc section elif [[ $option =~ ^--enable-(cdda|cplugins|dvbin|dvdnav|iconv|javascript|lcms2|libarchive|libavdevice|libbluray|pthread-debug|rubberband|sdl2|sdl2-gamepad|stdatomic|uchardet|uwp|vapoursynth|vector|win32-internal-pthreads|zimg|zlib) ]]; then meson_opts+=("${option/--enable-/-D}=enabled") @@ -2509,7 +2513,7 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t # Remove the `-Dlua=enabled` flag if present, since the order of flags matters. # - `-Dlua=lua5.2 -Dlua=enabled` makes Meson behave like only `-Dlua=enabled` was specified; # - `-Dlua=enabled -Dlua=lua5.2` makes Meson take lua5.2 if available, erroring otherwise; - meson_opts=("${meson_opts[@]/-Dlua=enabled}") + meson_opts=("${meson_opts[@]/ -Dlua=enabled}") elif [[ $option =~ ^--enable-lua ]] && ! [[ "${meson_opts[@]}" =~ -Dlua= ]]; then meson_opts+=("-Dlua=enabled") fi @@ -2521,19 +2525,18 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t CFLAGS+=" ${mpv_cflags[*]} -Wno-int-conversion" LDFLAGS+=" ${mpv_ldflags[*]}" \ RST2MAN="${MINGW_PREFIX}/bin/rst2man" \ RST2HTML="${MINGW_PREFIX}/bin/rst2html" \ - RST2PDF="${MINGW_PREFIX}/bin/rst2pdf2" \ - PKG_CONFIG="pkgconf --keep-system-libs --keep-system-cflags $LOCALDESTDIR/bin/ab-pkg-config" CC=${CC/ccache /}.bat CXX=${CXX/ccache /}.bat + RST2PDF="${MINGW_PREFIX}/bin/rst2pdf2" mkdir build - log "meson" meson setup build - log "meson" meson configure --default-library=static --buildtype=release --prefix="$LOCALDESTDIR" --backend=ninja --bindir=bin-video "${meson_opts[@]}" + PKG_CONFIG="pkgconf --keep-system-libs --keep-system-cflags" CC=${CC/ccache /}.bat CXX=${CXX/ccache /}.bat \ + log "meson.setup" meson setup build "${meson_opts[@]}" --prefix="${LOCALDESTDIR}" --bindir="${LOCALDESTDIR}/bin-video" --default-library="${default_lib}" --buildtype=release extra_script post configure - extra_script pre ninja - log "build" ninja - extra_script post ninja + extra_script pre build + log "meson.compile" meson compile -C build + extra_script post build extra_script pre install - cpuCount=1 log "install" ninja install + cpuCount=1 log "meson.install" meson install -C build extra_script post install if ! files_exist libavutil.a; then @@ -2545,7 +2548,7 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t done fi - unset mpv_ldflags replace PKGCONF_STATIC meson_opts + unset mpv_ldflags replace PKGCONF_STATIC meson_opts default_lib hide_conflicting_libs -R files_exist share/man/man1/mpv.1 && dos2unix -q "$LOCALDESTDIR"/share/man/man1/mpv.1 ! mpv_disabled debug-build && From 1c0ffeefd3a9cafcc245d74ce155f862dd92a444 Mon Sep 17 00:00:00 2001 From: Riven Skaye Date: Thu, 5 Jan 2023 13:20:16 +0100 Subject: [PATCH 6/7] mpv builds and installs successfully! --- build/media-suite_compile.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build/media-suite_compile.sh b/build/media-suite_compile.sh index 465e64105f..87b3feb8d5 100644 --- a/build/media-suite_compile.sh +++ b/build/media-suite_compile.sh @@ -2522,7 +2522,8 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t do_simple_print "${meson_opts[@]}" extra_script pre configure - CFLAGS+=" ${mpv_cflags[*]} -Wno-int-conversion" LDFLAGS+=" ${mpv_ldflags[*]}" \ + local old_ldf="$LDFLAGS" + CFLAGS+=" ${mpv_cflags[*]} -Wno-int-conversion" LDFLAGS+=" ${mpv_ldflags[*]} -larchive -lb2 -lzstd" \ RST2MAN="${MINGW_PREFIX}/bin/rst2man" \ RST2HTML="${MINGW_PREFIX}/bin/rst2html" \ RST2PDF="${MINGW_PREFIX}/bin/rst2pdf2" @@ -2536,7 +2537,8 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t extra_script post build extra_script pre install - cpuCount=1 log "meson.install" meson install -C build + cpuCount=1 log "meson.install" meson install -C build && + mv "${LOCALDESTDIR}/bin-video/libmpv-2.dll" "$LOCALDESTDIR/bin-video/mpv-2.dll" extra_script post install if ! files_exist libavutil.a; then @@ -2548,7 +2550,8 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t done fi - unset mpv_ldflags replace PKGCONF_STATIC meson_opts default_lib + LDFLAGS="$old_ldf" + unset mpv_ldflags replace PKGCONF_STATIC meson_opts default_lib old_ldf hide_conflicting_libs -R files_exist share/man/man1/mpv.1 && dos2unix -q "$LOCALDESTDIR"/share/man/man1/mpv.1 ! mpv_disabled debug-build && From 1c0ffeefa3cac036ff69f5d153a902f71df1fe5d Mon Sep 17 00:00:00 2001 From: Riven Skaye Date: Thu, 5 Jan 2023 14:12:00 +0100 Subject: [PATCH 7/7] Cleanup CFLAGS for builds coming after --- build/media-suite_compile.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/media-suite_compile.sh b/build/media-suite_compile.sh index 87b3feb8d5..3179e5fb0c 100644 --- a/build/media-suite_compile.sh +++ b/build/media-suite_compile.sh @@ -2551,6 +2551,8 @@ if [[ $mpv != n ]] && pc_exists libavcodec libavformat libswscale libavfilter; t fi LDFLAGS="$old_ldf" + replace=" ${mpv_cflags[*]} -Wno-int-conversion" + CFLAGS="${CFLAGS/$replace}" unset mpv_ldflags replace PKGCONF_STATIC meson_opts default_lib old_ldf hide_conflicting_libs -R files_exist share/man/man1/mpv.1 && dos2unix -q "$LOCALDESTDIR"/share/man/man1/mpv.1