summaryrefslogtreecommitdiffstats
path: root/waftools/checks/custom.py
diff options
context:
space:
mode:
Diffstat (limited to 'waftools/checks/custom.py')
-rw-r--r--waftools/checks/custom.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/waftools/checks/custom.py b/waftools/checks/custom.py
index 50a16ce26a..8ed06e5b24 100644
--- a/waftools/checks/custom.py
+++ b/waftools/checks/custom.py
@@ -4,7 +4,7 @@ from waflib import Utils
import os
__all__ = ["check_pthreads", "check_iconv", "check_lua", "check_oss_4front",
- "check_cocoa", "check_openal"]
+ "check_cocoa", "check_openal", "check_rpi"]
pthreads_program = load_fragment('pthreads.c')
@@ -50,6 +50,8 @@ def check_iconv(ctx, dependency_identifier):
if ctx.env.DEST_OS == 'openbsd' or ctx.env.DEST_OS == 'freebsd':
args['cflags'] = '-I/usr/local/include'
args['linkflags'] = '-L/usr/local/lib'
+ elif ctx.env.DEST_OS == 'win32':
+ args['linkflags'] = " ".join(['-L' + x for x in ctx.env.LIBRARY_PATH])
checkfn = check_cc(**args)
return check_libs(libs, checkfn)(ctx, dependency_identifier)
@@ -127,3 +129,29 @@ def check_openal(ctx, dependency_identifier):
if fn(ctx, dependency_identifier):
return True
return False
+
+def check_rpi(ctx, dependency_identifier):
+ # We need MMAL/bcm_host/dispmanx APIs.
+ # Upstream keeps pkgconfig files in '/opt/vc/lib/pkgconfig'.
+ # See https://github.com/raspberrypi/userland/issues/245
+ # PKG_CONFIG_SYSROOT_DIR helps with cross compilation.
+ prev_pkg_path = os.getenv('PKG_CONFIG_PATH', '')
+ os.environ['PKG_CONFIG_PATH'] = os.pathsep.join(
+ filter(None, [os.path.join(os.getenv('PKG_CONFIG_SYSROOT_DIR', '/'),
+ 'opt/vc/lib/pkgconfig'),
+ prev_pkg_path]))
+
+ checks = [
+ check_pkg_config('bcm_host', uselib_store='bcm_host'),
+ check_pkg_config('egl'),
+ check_pkg_config('glesv2'),
+ check_cc(lib=['mmal_core', 'mmal_util', 'mmal_vc_client'], use=['bcm_host']),
+ # We still need all OpenGL symbols, because the vo_opengl code is
+ # generic and supports anything from GLES2/OpenGL 2.1 to OpenGL 4 core.
+ check_statement('GL/gl.h', '(void)GL_RGB32F'), # arbitrary OpenGL 3.0 symbol
+ check_statement('GL/gl.h', '(void)GL_LUMINANCE16') # arbitrary OpenGL legacy-only symbol
+ ]
+
+ ret = all((fn(ctx, dependency_identifier) for fn in checks))
+ os.environ['PKG_CONFIG_PATH'] = prev_pkg_path
+ return ret