From 31780a6db5d31c6ed5c92a64a5f3bd349950f547 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Sun, 7 Nov 2021 13:29:11 -0600 Subject: ci: add meson builds Update the github workflows to also do meson builds for every OS. Additionally, make every workflow execute the built mpv executable (except for windows and FreeBSD's waf executable) to make sure that it runs. As an aside, FreeBSD unfortunately is a bit less elegant since it is in a VM. --- .github/workflows/build.yml | 62 +++++++++++++++++++++++++++++++++++++-------- ci/build-freebsd.sh | 18 +++++++++++++ ci/build-macos.sh | 39 ++++++++++++++++++++-------- ci/build-mingw64.sh | 40 +++++++++++++++++++++++++---- ci/build-tumbleweed.sh | 37 +++++++++++++++++++-------- 5 files changed, 160 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d6c18693f5..92759c9648 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,15 +28,28 @@ jobs: run: | sudo apt-get update sudo apt-get install -y autoconf automake pkg-config g++-mingw-w64 gcc-multilib nasm yasm + # Meson from apt is too old + pip3 install --no-input meson ninja ./bootstrap.py - - name: Build + - name: Build with meson run: | - ./ci/build-mingw64.sh + ./ci/build-mingw64.sh meson env: TARGET: ${{ matrix.target }} - - name: Print configure log + - name: Print meson log + if: ${{ failure() }} + run: | + cat ./build/meson-logs/meson-log.txt + + - name: Build with waf + run: | + ./ci/build-mingw64.sh waf + env: + TARGET: ${{ matrix.target }} + + - name: Print waf log if: ${{ failure() }} run: | cat ./build/config.log @@ -66,16 +79,28 @@ jobs: - name: Install dependencies run: | brew update - brew install autoconf automake pkg-config libtool python freetype fribidi little-cms2 luajit libass ffmpeg + brew install autoconf automake pkg-config libtool python freetype fribidi little-cms2 luajit libass ffmpeg meson + + - name: Build with meson + run: | + ./ci/build-macos.sh meson + env: + CC: "${{ matrix.cc }}" + TRAVIS_OS_NAME: "${{ matrix.os }}" + + - name: Print meson log + if: ${{ failure() }} + run: | + cat ./build/meson-logs/meson-log.txt - - name: Build + - name: Build with waf run: | - ./ci/build-macos.sh + ./ci/build-macos.sh waf env: CC: "${{ matrix.cc }}" TRAVIS_OS_NAME: "${{ matrix.os }}" - - name: Print configure log + - name: Print waf log if: ${{ failure() }} run: | cat ./build/config.log @@ -101,12 +126,25 @@ jobs: - name: Install dependencies run: | ./bootstrap.py + # TODO: switch back to zypper when OpenSuse updates Meson + # zypper -n install meson + zypper -n install python3-pip + pip install --no-input meson ninja + + - name: Build with meson + run: | + ./ci/build-tumbleweed.sh meson + + - name: Print meson log + if: ${{ failure() }} + run: | + cat ./build/meson-logs/meson-log.txt - - name: Build + - name: Build with waf run: | - ./ci/build-tumbleweed.sh + ./ci/build-tumbleweed.sh waf - - name: Print configure log + - name: Print waf log if: ${{ failure() }} run: | cat ./build/config.log @@ -122,6 +160,7 @@ jobs: prepare: | # Requested in ci/build-freebsd.sh pkg install -y \ + cmake \ evdev-proto \ ffmpeg \ libplacebo \ @@ -151,5 +190,8 @@ jobs: uchardet \ v4l_compat \ # + # Meson from pkg is too old + python3 -m ensurepip + pip3 install --no-input meson ninja run: | ./ci/build-freebsd.sh diff --git a/ci/build-freebsd.sh b/ci/build-freebsd.sh index a64c03be7e..b0219326ee 100755 --- a/ci/build-freebsd.sh +++ b/ci/build-freebsd.sh @@ -5,6 +5,24 @@ export CFLAGS="$CFLAGS -isystem/usr/local/include" export CXXFLAGS="$CXXFLAGS -isystem/usr/local/include" export LDFLAGS="$LDFLAGS -L/usr/local/lib" +meson build \ + -Dlibmpv=true \ + -Dlua=enabled \ + -Degl-drm=enabled \ + -Dopenal=enabled \ + -Dsdl2=enabled \ + -Dvaapi-wayland=enabled \ + -Dvdpau=enabled \ + -Dvulkan=enabled \ + -Doss-audio=enabled \ + $(pkg info -q v4l_compat && echo -Ddvbin=enabled) \ + $(pkg info -q libdvdnav && echo -Ddvdnav=enabled) \ + $(pkg info -q libcdio-paranoia && echo -Dcdda=enabled) \ + $NULL + +meson compile -C build +./build/mpv + if [ ! -e "./waf" ] ; then python3 ./bootstrap.py fi diff --git a/ci/build-macos.sh b/ci/build-macos.sh index cf3fbb3509..6e6456c154 100755 --- a/ci/build-macos.sh +++ b/ci/build-macos.sh @@ -10,18 +10,35 @@ if [[ -d "./build/${MPV_VARIANT}" ]] ; then rm -rf "./build/${MPV_VARIANT}" fi -if [[ ! -e "./waf" ]] ; then - python3 ./bootstrap.py +if [[ $1 = "meson" ]]; then + PKG_CONFIG_PATH="${FFMPEG_SYSROOT}/lib/pkgconfig/" CC="${CC}" CXX="${CXX}" \ + meson build \ + -Dprefix="${MPV_INSTALL_PREFIX}" \ + -Dlibmpv=true \ + -D{gl,iconv,lcms2,lua,jpeg,plain-gl,zlib}=enabled \ + -D{cocoa,coreaudio,gl-cocoa,macos-cocoa-cb,macos-touchbar,videotoolbox-gl}=enabled + + meson compile -C build -j4 + + meson install -C build + ./build/mpv fi -PKG_CONFIG_PATH="${FFMPEG_SYSROOT}/lib/pkgconfig/" CC="${CC}" CXX="${CXX}" python3 \ - ./waf configure \ - --variant="${MPV_VARIANT}" \ - --prefix="${MPV_INSTALL_PREFIX}" \ - --enable-{gl,iconv,lcms2,libmpv-shared,lua,jpeg,plain-gl,zlib} \ - --enable-{cocoa,coreaudio,gl-cocoa,macos-cocoa-cb,macos-touchbar,videotoolbox-gl} \ - --swift-flags="${CI_SWIFT_FLAGS}" +if [[ $1 = "waf" ]]; then + if [[ ! -e "./waf" ]] ; then + python3 ./bootstrap.py + fi -python3 ./waf build --variant="${MPV_VARIANT}" -j4 + PKG_CONFIG_PATH="${FFMPEG_SYSROOT}/lib/pkgconfig/" CC="${CC}" CXX="${CXX}" python3 \ + ./waf configure \ + --variant="${MPV_VARIANT}" \ + --prefix="${MPV_INSTALL_PREFIX}" \ + --enable-{gl,iconv,lcms2,libmpv-shared,lua,jpeg,plain-gl,zlib} \ + --enable-{cocoa,coreaudio,gl-cocoa,macos-cocoa-cb,macos-touchbar,videotoolbox-gl} \ + --swift-flags="${CI_SWIFT_FLAGS}" -python3 ./waf install --variant="${MPV_VARIANT}" + python3 ./waf build --variant="${MPV_VARIANT}" -j4 + + python3 ./waf install --variant="${MPV_VARIANT}" + ./build/mpv +fi diff --git a/ci/build-mingw64.sh b/ci/build-mingw64.sh index f663345879..5e4e93f119 100755 --- a/ci/build-mingw64.sh +++ b/ci/build-mingw64.sh @@ -154,9 +154,39 @@ if [ ! -e "$prefix_dir/lib/libluajit-5.1.a" ]; then fi ## mpv -PKG_CONFIG=pkg-config CFLAGS="-I'$prefix_dir/include'" LDFLAGS="-L'$prefix_dir/lib'" \ -python3 ./waf configure \ - --enable-libmpv-shared --lua=luajit \ - --enable-{shaderc,spirv-cross,d3d11} -python3 ./waf build --verbose +if [ $1 = "meson" ]; then + CPU="x86_64" + mkdir -p "${TARGET}_mingw_build" && pushd "${TARGET}_mingw_build" + +cat > mingw64_crossfile << EOF +[binaries] +c = '${CC}' +cpp = '${CXX}' +ar = '${AR}' +strip = '${TARGET}-strip' +pkgconfig = 'pkg-config' +exe_wrapper = 'wine64' # A command used to run generated executables. +windres = '${TARGET}-windres' +[host_machine] +system = 'windows' +cpu_family = '${CPU}' +cpu = '${CPU}' +endian = 'little' +EOF + + CFLAGS="-I'$prefix_dir/include'" LDFLAGS="-L'$prefix_dir/lib'" \ + meson .. --cross-file mingw64_crossfile --libdir lib \ + -Dlibmpv=true -Dlua=luajit -D{shaderc,spirv-cross,d3d11}=enabled + + meson compile +fi + +if [ $1 = "waf" ]; then + PKG_CONFIG=pkg-config CFLAGS="-I'$prefix_dir/include'" LDFLAGS="-L'$prefix_dir/lib'" \ + python3 ./waf configure \ + --enable-libmpv-shared --lua=luajit \ + --enable-{shaderc,spirv-cross,d3d11} + + python3 ./waf build --verbose +fi diff --git a/ci/build-tumbleweed.sh b/ci/build-tumbleweed.sh index 9c0c2851a6..1785360f22 100755 --- a/ci/build-tumbleweed.sh +++ b/ci/build-tumbleweed.sh @@ -1,13 +1,30 @@ #!/bin/sh set -e -python3 ./waf configure \ - --enable-cdda \ - --enable-dvbin \ - --enable-dvdnav \ - --enable-libarchive \ - --enable-libmpv-shared \ - --enable-manpage-build \ - --enable-shaderc \ - --enable-vulkan -python3 ./waf build --verbose +if [ "$1" = "meson" ]; then + meson build \ + -Dcdda=enabled \ + -Ddvbin=enabled \ + -Ddvdnav=enabled \ + -Dlibarchive=enabled \ + -Dlibmpv=true \ + -Dmanpage-build=enabled \ + -Dshaderc=enabled \ + -Dvulkan=enabled + meson compile -C build --verbose + ./build/mpv +fi + +if [ "$1" = "waf" ]; then + python3 ./waf configure \ + --enable-cdda \ + --enable-dvbin \ + --enable-dvdnav \ + --enable-libarchive \ + --enable-libmpv-shared \ + --enable-manpage-build \ + --enable-shaderc \ + --enable-vulkan + python3 ./waf build --verbose + ./build/mpv +fi -- cgit v1.2.3