summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2022-05-14 10:29:14 -0500
committerDudemanguy <random342@airmail.cc>2022-05-16 14:16:23 +0000
commit8155e07d700fac69f555c712866e3cc588d7ff0d (patch)
treeebd737acc45f5a7a67592cc3037e635a42f8f171
parent040d8ada0bb66fd68203ba531c7830ffa781aba1 (diff)
downloadmpv-build-8155e07d700fac69f555c712866e3cc588d7ff0d.tar.bz2
mpv-build-8155e07d700fac69f555c712866e3cc588d7ff0d.tar.xz
configure/build: add meson support
This adds an optional environment variable, BUILDSYSTEM, that can be passed to the build scripts to use mpv's meson build instead of waf, the default. BUILDSYSTEM=meson needs to be set and any configure options passed must use meson's syntax instead of waf. The catch with meson support is that it requires the new prefer_static option for statically linking libass and ffmpeg. This option is not currrently in a release and will land in meson 0.63.
-rw-r--r--README.rst15
-rwxr-xr-xscripts/mpv-build6
-rwxr-xr-xscripts/mpv-clean3
-rwxr-xr-xscripts/mpv-config14
-rwxr-xr-xscripts/mpv-install6
-rwxr-xr-xscripts/mpv-uninstall6
-rwxr-xr-xscripts/test-libmpv4
7 files changed, 42 insertions, 12 deletions
diff --git a/README.rst b/README.rst
index 04686c1..86e6df4 100644
--- a/README.rst
+++ b/README.rst
@@ -39,6 +39,21 @@ statically linked with mpv when using the provided scripts, and no ffmpeg or
libass libraries are/need to be installed. There are no required config or
data files either.
+Meson Support
+=============
+
+These scripts do have support for building with mpv's meson build. They are not
+used by default. To invoke them, you must pass an additional environment variable,
+BUILDSYSTEM=meson to your commands. For example::
+
+ BUILDSYSTEM=meson ./rebuild -j4
+
+The arguments that you pass should conform to meson conventions and not the waf
+ones.
+
+**Note**: The meson scripts specifically invoke the new ``prefer_static`` built-in
+option. This requires a meson version of 0.63 or greater.
+
Dependencies
============
diff --git a/scripts/mpv-build b/scripts/mpv-build
index 0a73ba8..7515003 100755
--- a/scripts/mpv-build
+++ b/scripts/mpv-build
@@ -2,4 +2,8 @@
set -e
cd mpv
-python3 ./waf build "$@"
+if [ "$BUILDSYSTEM" = "meson" ]; then
+ meson compile -C build "$@"
+else
+ python3 ./waf build "$@"
+fi
diff --git a/scripts/mpv-clean b/scripts/mpv-clean
index 6f483e3..5758e5a 100755
--- a/scripts/mpv-clean
+++ b/scripts/mpv-clean
@@ -2,7 +2,8 @@
test -e mpv || exit 0
cd mpv
-python3 ./waf distclean
+python3 ./waf distclean # waf clean
+rm -rf build # meson clean
# waf might pick up some old-configure/makefile produced files
# also, waf clean won't remove the old binary
rm -f DOCS/man/*/mpv.1 version.h input/input_conf.h video/out/vdpau_template.c demux/ebml_types.h demux/ebml_defs.c video/out/gl_video_shaders.h video/out/x11_icon.inc sub/osd_font.h player/lua/defaults.inc player/lua/assdraw.inc player/lua/osc.inc mpv
diff --git a/scripts/mpv-config b/scripts/mpv-config
index c83f22d..d09153f 100755
--- a/scripts/mpv-config
+++ b/scripts/mpv-config
@@ -20,11 +20,15 @@ case "$PKG_CONFIG_PATH" in
;;
esac
-# add missing private dependencies from libass.pc
-# 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: "$@"
cd "$BUILD"/mpv
-python3 ./waf configure "$@"
+
+if [ "$BUILDSYSTEM" = "meson" ]; then
+ meson build -Dprefer_static=true -Dbuildtype=release "$@"
+else
+ # add missing private dependencies from libass.pc
+ # this is necessary due to the hybrid static / dynamic nature of the build
+ export LDFLAGS="$LDFLAGS $(pkg-config --libs fontconfig harfbuzz fribidi)"
+ python3 ./waf configure "$@"
+fi
diff --git a/scripts/mpv-install b/scripts/mpv-install
index d79ca0b..0a3a30f 100755
--- a/scripts/mpv-install
+++ b/scripts/mpv-install
@@ -2,4 +2,8 @@
set -e
cd mpv
-python3 ./waf install
+if [ "$BUILDSYSTEM" = "meson" ]; then
+ meson install -C build
+else
+ python3 ./waf install
+fi
diff --git a/scripts/mpv-uninstall b/scripts/mpv-uninstall
index 645c45f..777db4b 100755
--- a/scripts/mpv-uninstall
+++ b/scripts/mpv-uninstall
@@ -2,4 +2,8 @@
set -e
cd mpv
-python3 ./waf uninstall
+if [ "$BUILDSYSTEM" = "meson" ]; then
+ ninja uninstall -C build
+else
+ python3 ./waf uninstall
+fi
diff --git a/scripts/test-libmpv b/scripts/test-libmpv
index 5ee4d22..276e74a 100755
--- a/scripts/test-libmpv
+++ b/scripts/test-libmpv
@@ -8,8 +8,6 @@ BUILD="$(pwd)"
USER_OPTS="$@"
if test -f "$BUILD"/mpv_options ; then
- if cat "$BUILD"/mpv_options | grep -e '--enable-libmpv' > /dev/null ; then
- exit 0
- fi
+ grep -Eqe '--enable-libmpv|-Dlibmpv=true' "$BUILD"/mpv_options && exit 0
fi
exit 1