summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-11-28 08:36:41 +0100
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-11-28 09:06:43 +0100
commite8677aa36333206f59fae610e9b94ad5d2c3c7e2 (patch)
treec2200fdb3ed2517a14e5491f433afe1021f41c46
parent156dcbbeb1c64fdba668f4d44ab717511f8bd985 (diff)
downloadmpv-e8677aa36333206f59fae610e9b94ad5d2c3c7e2.tar.bz2
mpv-e8677aa36333206f59fae610e9b94ad5d2c3c7e2.tar.xz
build: make --disable-gl disable all the gl backends
Fixes #369
-rw-r--r--DOCS/waf-buildsystem.rst5
-rw-r--r--waftools/dependencies.py17
-rw-r--r--wscript4
3 files changed, 22 insertions, 4 deletions
diff --git a/DOCS/waf-buildsystem.rst b/DOCS/waf-buildsystem.rst
index ca52531501..d8e4270c11 100644
--- a/DOCS/waf-buildsystem.rst
+++ b/DOCS/waf-buildsystem.rst
@@ -135,6 +135,11 @@ For example::
will override the value of ``func`` with ``check_pthreads_w32_static`` only
if the target OS of the build is Windows.
+``groups``: groups a dependency with another one. This can be used to disabled
+all the grouped dependencies with one ``--disable-``. At the moment this is
+only used for OpenGL backends, where you want to disable them when
+``--disable-gl`` is passed to the configure.
+
mpv's custom build step on top of waf
=====================================
diff --git a/waftools/dependencies.py b/waftools/dependencies.py
index 16fd2d5f57..f83f29fc38 100644
--- a/waftools/dependencies.py
+++ b/waftools/dependencies.py
@@ -34,6 +34,7 @@ class Dependency(object):
self.ctx.start_msg('Checking for {0}'.format(self.desc))
try:
+ self.check_group_disabled()
self.check_disabled()
self.check_any_dependencies()
self.check_dependencies()
@@ -49,6 +50,14 @@ class Dependency(object):
self.check_autodetect_func()
+ def check_group_disabled(self):
+ if 'groups' in self.attributes:
+ groups = self.attributes['groups']
+ disabled = (self.enabled_option(g) == False for g in groups)
+ if any(disabled):
+ self.skip()
+ raise DependencyError
+
def check_disabled(self):
if self.enabled_option() == False:
self.skip()
@@ -89,15 +98,15 @@ the autodetection check failed.".format(self.identifier)
self.fail()
self.fatal_if_needed()
- def enabled_option(self):
+ def enabled_option(self, identifier=None):
try:
- return getattr(self.ctx.options, self.enabled_option_repr())
+ return getattr(self.ctx.options, self.enabled_option_repr(identifier))
except AttributeError:
pass
return None
- def enabled_option_repr(self):
- return "enable_{0}".format(self.identifier)
+ def enabled_option_repr(self, identifier):
+ return "enable_{0}".format(identifier or self.identifier)
def success(self, depname):
self.ctx.mark_satisfied(depname)
diff --git a/wscript b/wscript
index 19a1d438d7..17dec8d1f9 100644
--- a/wscript
+++ b/wscript
@@ -497,11 +497,13 @@ video_output_features = [
'name': '--gl-cocoa',
'desc': 'OpenGL Cocoa Backend',
'deps': [ 'cocoa' ],
+ 'groups': [ 'gl' ],
'func': check_true
} , {
'name': '--gl-x11',
'desc': 'OpenGL X11 Backend',
'deps': [ 'x11' ],
+ 'groups': [ 'gl' ],
'func': check_libs(['GL', 'GL Xdamage'],
check_cc(fragment=load_fragment('gl_x11.c'),
use=['x11', 'libdl', 'pthreads']))
@@ -509,12 +511,14 @@ video_output_features = [
'name': '--gl-wayland',
'desc': 'OpenGL Wayland Backend',
'deps': [ 'wayland' ],
+ 'groups': [ 'gl' ],
'func': check_pkg_config('wayland-egl', '>= 9.0.0',
'egl', '>= 9.0.0')
} , {
'name': '--gl-win32',
'desc': 'OpenGL Win32 Backend',
'deps': [ 'gdi' ],
+ 'groups': [ 'gl' ],
'func': check_statement('windows.h', 'wglCreateContext(0)',
lib='opengl32')
} , {