summaryrefslogtreecommitdiffstats
path: root/waftools/checks/custom.py
diff options
context:
space:
mode:
authorJan Palus <atler@pld-linux.org>2020-04-18 20:38:52 +0200
committerwm4 <1387750+wm4@users.noreply.github.com>2020-05-14 15:08:33 +0200
commit727b1bff57389774b067f0af662455e64d6109bb (patch)
tree13a54eba3f8c9f33dbd70e69b764bf0398a77002 /waftools/checks/custom.py
parent65fd6c8ae9b131445bf9bfd99c8600661d93d73c (diff)
downloadmpv-727b1bff57389774b067f0af662455e64d6109bb.tar.bz2
mpv-727b1bff57389774b067f0af662455e64d6109bb.tar.xz
build: link against single EGL provider
when building with rpi EGL is provided by librcmegl library and libEGL should not be linked then
Diffstat (limited to 'waftools/checks/custom.py')
-rw-r--r--waftools/checks/custom.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/waftools/checks/custom.py b/waftools/checks/custom.py
index 7ca8f8655c..36c1d85d06 100644
--- a/waftools/checks/custom.py
+++ b/waftools/checks/custom.py
@@ -5,7 +5,8 @@ from distutils.version import StrictVersion
import os
__all__ = ["check_pthreads", "check_iconv", "check_lua",
- "check_cocoa", "check_wl_protocols", "check_swift"]
+ "check_cocoa", "check_wl_protocols", "check_swift",
+ "check_egl_provider"]
pthreads_program = load_fragment('pthreads.c')
@@ -124,3 +125,29 @@ def check_swift(ctx, dependency_identifier):
"'swift >= " + str(minVer) + "' not found, found " +
str(ctx.env.SWIFT_VERSION or None))
return False
+
+def check_egl_provider(minVersion=None, name='egl', check=None):
+ def fn(ctx, dependency_identifier, **kw):
+ if not hasattr(ctx, 'egl_provider'):
+ egl_provider_check = check or check_pkg_config(name)
+ if egl_provider_check(ctx, dependency_identifier):
+ ctx.egl_provider = name
+ for ver in ['1.5', '1.4', '1.3', '1.2', '1.1', '1.0']:
+ stmt = 'int x[EGL_VERSION_{0}]'.format(ver.replace('.','_'))
+ check_stmt = check_statement(['EGL/egl.h'], stmt)
+ if check_stmt(ctx, dependency_identifier):
+ ctx.egl_provider_version = StrictVersion(ver)
+ break
+ return True
+ else:
+ return False
+ else:
+ minVersionSV = minVersion and StrictVersion(minVersion)
+ if not minVersionSV or ctx.egl_provider_version and \
+ ctx.egl_provider_version >= minVersionSV:
+ defkey = inflector.define_key(dependency_identifier)
+ ctx.define(defkey, 1)
+ return True
+ else:
+ return False
+ return fn