1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-18 13:14:36 +00:00

build: make --disable-gl disable all the gl backends

Fixes #369
This commit is contained in:
Stefano Pigozzi 2013-11-28 08:36:41 +01:00
parent 156dcbbeb1
commit e8677aa363
3 changed files with 22 additions and 4 deletions

View File

@ -135,6 +135,11 @@ For example::
will override the value of ``func`` with ``check_pthreads_w32_static`` only will override the value of ``func`` with ``check_pthreads_w32_static`` only
if the target OS of the build is Windows. 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 mpv's custom build step on top of waf
===================================== =====================================

View File

@ -34,6 +34,7 @@ class Dependency(object):
self.ctx.start_msg('Checking for {0}'.format(self.desc)) self.ctx.start_msg('Checking for {0}'.format(self.desc))
try: try:
self.check_group_disabled()
self.check_disabled() self.check_disabled()
self.check_any_dependencies() self.check_any_dependencies()
self.check_dependencies() self.check_dependencies()
@ -49,6 +50,14 @@ class Dependency(object):
self.check_autodetect_func() 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): def check_disabled(self):
if self.enabled_option() == False: if self.enabled_option() == False:
self.skip() self.skip()
@ -89,15 +98,15 @@ the autodetection check failed.".format(self.identifier)
self.fail() self.fail()
self.fatal_if_needed() self.fatal_if_needed()
def enabled_option(self): def enabled_option(self, identifier=None):
try: try:
return getattr(self.ctx.options, self.enabled_option_repr()) return getattr(self.ctx.options, self.enabled_option_repr(identifier))
except AttributeError: except AttributeError:
pass pass
return None return None
def enabled_option_repr(self): def enabled_option_repr(self, identifier):
return "enable_{0}".format(self.identifier) return "enable_{0}".format(identifier or self.identifier)
def success(self, depname): def success(self, depname):
self.ctx.mark_satisfied(depname) self.ctx.mark_satisfied(depname)

View File

@ -497,11 +497,13 @@ video_output_features = [
'name': '--gl-cocoa', 'name': '--gl-cocoa',
'desc': 'OpenGL Cocoa Backend', 'desc': 'OpenGL Cocoa Backend',
'deps': [ 'cocoa' ], 'deps': [ 'cocoa' ],
'groups': [ 'gl' ],
'func': check_true 'func': check_true
} , { } , {
'name': '--gl-x11', 'name': '--gl-x11',
'desc': 'OpenGL X11 Backend', 'desc': 'OpenGL X11 Backend',
'deps': [ 'x11' ], 'deps': [ 'x11' ],
'groups': [ 'gl' ],
'func': check_libs(['GL', 'GL Xdamage'], 'func': check_libs(['GL', 'GL Xdamage'],
check_cc(fragment=load_fragment('gl_x11.c'), check_cc(fragment=load_fragment('gl_x11.c'),
use=['x11', 'libdl', 'pthreads'])) use=['x11', 'libdl', 'pthreads']))
@ -509,12 +511,14 @@ video_output_features = [
'name': '--gl-wayland', 'name': '--gl-wayland',
'desc': 'OpenGL Wayland Backend', 'desc': 'OpenGL Wayland Backend',
'deps': [ 'wayland' ], 'deps': [ 'wayland' ],
'groups': [ 'gl' ],
'func': check_pkg_config('wayland-egl', '>= 9.0.0', 'func': check_pkg_config('wayland-egl', '>= 9.0.0',
'egl', '>= 9.0.0') 'egl', '>= 9.0.0')
} , { } , {
'name': '--gl-win32', 'name': '--gl-win32',
'desc': 'OpenGL Win32 Backend', 'desc': 'OpenGL Win32 Backend',
'deps': [ 'gdi' ], 'deps': [ 'gdi' ],
'groups': [ 'gl' ],
'func': check_statement('windows.h', 'wglCreateContext(0)', 'func': check_statement('windows.h', 'wglCreateContext(0)',
lib='opengl32') lib='opengl32')
} , { } , {