mirror of
https://github.com/mpv-player/mpv
synced 2024-12-22 06:42:03 +00:00
parent
156dcbbeb1
commit
e8677aa363
@ -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
|
||||
=====================================
|
||||
|
||||
|
@ -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)
|
||||
|
4
wscript
4
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')
|
||||
} , {
|
||||
|
Loading…
Reference in New Issue
Block a user