ci: refactor ci so common args are picked from one location

Mostly. It is annoying if we want to add some flag/option to all the cis
and then have to do it manually. Things easily get missed that way.
Skipped powershell because of course I'm not going to deal with that.
This commit is contained in:
Dudemanguy 2024-10-16 17:27:13 -05:00
parent 3e499ff3bc
commit 09bbca8770
9 changed files with 68 additions and 70 deletions

View File

@ -387,7 +387,7 @@ jobs:
- name: Build with meson - name: Build with meson
id: build id: build
run: | run: |
./ci/build-linux-old.sh ./ci/build-linux-old.sh
- name: Print meson log - name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }} if: ${{ failure() && steps.build.outcome == 'failure' }}

6
ci/build-common.sh Executable file
View File

@ -0,0 +1,6 @@
common_args="--werror \
-Dlibmpv=true \
-Dtests=true \
"
export CFLAGS="$CFLAGS -Wno-error=deprecated -Wno-error=deprecated-declarations"

View File

@ -1,29 +1,27 @@
#!/bin/sh #!/bin/sh
set -e set -e
export CFLAGS="$CFLAGS -isystem/usr/local/include" . ./ci/build-common.sh
export CFLAGS="$CFLAGS -isystem/usr/local/include -march=native"
export CXXFLAGS="$CXXFLAGS -isystem/usr/local/include" export CXXFLAGS="$CXXFLAGS -isystem/usr/local/include"
export LDFLAGS="$LDFLAGS -L/usr/local/lib" export LDFLAGS="$LDFLAGS -L/usr/local/lib"
# TODO: readd -Ddvbin=enabled # TODO: readd -Ddvbin=enabled
meson setup build \ meson setup build $common_args \
--werror \ -Db_sanitize=address,undefined \
-Dc_args="-Wno-error=deprecated -Wno-error=deprecated-declarations -march=native" \ -Diconv=disabled \
-Diconv=disabled \ -Dlua=enabled \
-Dlibmpv=true \ -Degl-drm=enabled \
-Dlua=enabled \ -Dopenal=enabled \
-Degl-drm=enabled \ -Dsndio=enabled \
-Dopenal=enabled \ -Dvdpau=enabled \
-Dsndio=enabled \ -Dvulkan=enabled \
-Dtests=true \ -Doss-audio=enabled \
-Dvdpau=enabled \ $(pkg info -q libdvdnav && echo -Ddvdnav=enabled) \
-Dvulkan=enabled \ $(pkg info -q libcdio-paranoia && echo -Dcdda=enabled) \
-Doss-audio=enabled \ $(pkg info -q pipewire && echo -Dpipewire=enabled)
$(pkg info -q libdvdnav && echo -Ddvdnav=enabled) \
$(pkg info -q libcdio-paranoia && echo -Dcdda=enabled) \
$(pkg info -q pipewire && echo -Dpipewire=enabled) \
$NULL
meson compile -C build meson compile -C build
./build/mpv -v --no-config ./build/mpv -v --no-config

View File

@ -1,6 +1,8 @@
#!/bin/sh #!/bin/sh
set -e set -e
. ./ci/build-common.sh
# clone exactly the oldest libplacebo we want to support # clone exactly the oldest libplacebo we want to support
rm -rf subprojects rm -rf subprojects
mkdir -p subprojects mkdir -p subprojects
@ -8,12 +10,8 @@ git clone https://code.videolan.org/videolan/libplacebo.git \
--recurse-submodules --shallow-submodules \ --recurse-submodules --shallow-submodules \
--depth=1 --branch v6.338 subprojects/libplacebo \ --depth=1 --branch v6.338 subprojects/libplacebo \
meson setup build \ meson setup build $common_args \
--werror \ -Dlibplacebo:vulkan=disabled \
-Dlibplacebo:vulkan=disabled \ -Dlua=enabled
-Dlibmpv=true \
-Dlua=enabled \
-Dtests=true
meson compile -C build meson compile -C build
./build/mpv -v --no-config ./build/mpv -v --no-config

View File

@ -2,6 +2,8 @@
set -e set -e
. ./ci/build-common.sh
FFMPEG_SYSROOT="${HOME}/deps/sysroot" FFMPEG_SYSROOT="${HOME}/deps/sysroot"
MPV_INSTALL_PREFIX="${HOME}/out/mpv" MPV_INSTALL_PREFIX="${HOME}/out/mpv"
MPV_VARIANT="${TRAVIS_OS_NAME}" MPV_VARIANT="${TRAVIS_OS_NAME}"
@ -11,14 +13,12 @@ if [[ -d "./build/${MPV_VARIANT}" ]] ; then
fi fi
PKG_CONFIG_PATH="${FFMPEG_SYSROOT}/lib/pkgconfig/" CC="${CC}" CXX="${CXX}" \ PKG_CONFIG_PATH="${FFMPEG_SYSROOT}/lib/pkgconfig/" CC="${CC}" CXX="${CXX}" \
meson setup build \ meson setup build $common_args \
--werror \ -Dprefix="${MPV_INSTALL_PREFIX}" \
-Dprefix="${MPV_INSTALL_PREFIX}" \ -Dobjc_args="-Wno-error=deprecated -Wno-error=deprecated-declarations" \
-D{c_args,objc_args}="-Wno-error=deprecated -Wno-error=deprecated-declarations" \ -D{gl,iconv,lcms2,lua,jpeg,plain-gl,zlib}=enabled \
-D{libmpv,tests}=true \ -D{cocoa,coreaudio,gl-cocoa,videotoolbox-gl,videotoolbox-pl}=enabled \
-D{gl,iconv,lcms2,lua,jpeg,plain-gl,zlib}=enabled \ -D{swift-build,macos-cocoa-cb,macos-media-player,macos-touchbar,vulkan}=enabled
-D{cocoa,coreaudio,gl-cocoa,videotoolbox-gl,videotoolbox-pl}=enabled \
-D{swift-build,macos-cocoa-cb,macos-media-player,macos-touchbar,vulkan}=enabled
meson compile -C build -j4 meson compile -C build -j4
meson install -C build meson install -C build

View File

@ -23,6 +23,8 @@ export LDFLAGS="-fstack-protector-strong"
export PKG_CONFIG_SYSROOT_DIR="$prefix_dir" export PKG_CONFIG_SYSROOT_DIR="$prefix_dir"
export PKG_CONFIG_LIBDIR="$PKG_CONFIG_SYSROOT_DIR/lib/pkgconfig" export PKG_CONFIG_LIBDIR="$PKG_CONFIG_SYSROOT_DIR/lib/pkgconfig"
. ./ci/build-common.sh
if [[ "$TARGET" == "i686-"* ]]; then if [[ "$TARGET" == "i686-"* ]]; then
export WINEPATH="`$CC -print-file-name=`;/usr/$TARGET/lib" export WINEPATH="`$CC -print-file-name=`;/usr/$TARGET/lib"
fi fi
@ -294,16 +296,13 @@ export CFLAGS LDFLAGS
build=mingw_build build=mingw_build
rm -rf $build rm -rf $build
meson setup $build --cross-file "$prefix_dir/crossfile" \ meson setup $build --cross-file "$prefix_dir/crossfile" $common_args \
--werror \ --buildtype debugoptimized \
-Dc_args="-Wno-error=deprecated -Wno-error=deprecated-declarations" \ --force-fallback-for=mujs \
--buildtype debugoptimized \ -Dmujs:werror=false \
--force-fallback-for=mujs \ -Dmujs:default_library=static \
-Dmujs:werror=false \ -Dlua=luajit \
-Dmujs:default_library=static \ -D{shaderc,spirv-cross,d3d11,javascript}=enabled
-D{libmpv,tests}=true -Dlua=luajit \
-D{shaderc,spirv-cross,d3d11,javascript}=enabled
meson compile -C $build meson compile -C $build
if [ "$2" = pack ]; then if [ "$2" = pack ]; then

View File

@ -1,17 +1,16 @@
#!/bin/sh -e #!/bin/bash -e
. ./ci/build-common.sh
args=( args=(
--werror
-Dc_args='-Wno-error=deprecated -Wno-error=deprecated-declarations'
-D{cdda,d3d-hwaccel,d3d11,dvdnav,jpeg,lcms2,libarchive}=enabled -D{cdda,d3d-hwaccel,d3d11,dvdnav,jpeg,lcms2,libarchive}=enabled
-D{libbluray,lua,shaderc,spirv-cross,uchardet,vapoursynth}=enabled -D{libbluray,lua,shaderc,spirv-cross,uchardet,vapoursynth}=enabled
-D{libmpv,tests}=true
) )
[[ "$SYS" != "mingw32" ]] && args+=( [[ "$SYS" != "mingw32" ]] && args+=(
-D{egl-angle-lib,egl-angle-win32,pdf-build,rubberband,win32-smtc}=enabled -D{egl-angle-lib,egl-angle-win32,pdf-build,rubberband,win32-smtc}=enabled
) )
meson setup build "${args[@]}" meson setup build $common_args "${args[@]}"
meson compile -C build meson compile -C build
./build/mpv.com -v --no-config ./build/mpv.com -v --no-config

View File

@ -1,6 +1,8 @@
#!/bin/sh #!/bin/sh
set -e set -e
. ./ci/build-common.sh
# FFmpeg on openBSD (4.4.4) is too old; use a subproject # FFmpeg on openBSD (4.4.4) is too old; use a subproject
rm -rf subprojects rm -rf subprojects
mkdir -p subprojects mkdir -p subprojects
@ -19,16 +21,14 @@ libswresample = libswresample_dep
libswscale = libswscale_dep libswscale = libswscale_dep
EOF EOF
meson setup build \ meson setup build $common_args \
-Dffmpeg:vulkan=auto \ -Dffmpeg:vulkan=auto \
-Dlibmpv=true \ -Dffmpeg:werror=false \
-Dlua=enabled \ -Dlua=enabled \
-Dopenal=enabled \ -Dopenal=enabled \
-Dpulse=enabled \ -Dpulse=enabled \
-Dtests=true \ -Dvulkan=enabled \
-Dvulkan=enabled \ -Ddvdnav=enabled \
-Ddvdnav=enabled \ -Dcdda=enabled
-Dcdda=enabled
meson compile -C build meson compile -C build
./build/mpv -v --no-config ./build/mpv -v --no-config

View File

@ -1,18 +1,16 @@
#!/bin/sh #!/bin/sh
set -e set -e
meson setup build \ . ./ci/build-common.sh
--werror \
-Dc_args="-Wno-error=deprecated -Wno-error=deprecated-declarations" \ meson setup build $common_args \
-Db_sanitize=address,undefined \ -Db_sanitize=address,undefined \
-Dcdda=enabled \ -Dcdda=enabled \
-Ddvbin=enabled \ -Ddvbin=enabled \
-Ddvdnav=enabled \ -Ddvdnav=enabled \
-Dlibarchive=enabled \ -Dlibarchive=enabled \
-Dlibmpv=true \
-Dmanpage-build=enabled \ -Dmanpage-build=enabled \
-Dpipewire=enabled \ -Dpipewire=enabled \
-Dtests=true \
-Dvulkan=enabled -Dvulkan=enabled
meson compile -C build meson compile -C build
./build/mpv -v --no-config ./build/mpv -v --no-config