OpenVoiceOS/buildroot-patches/0109-Return-rpi-fix-linking...

105 lines
4.2 KiB
Diff

From 34fcaf17ecc1044aa8e2243dde4f84d9123c1d28 Mon Sep 17 00:00:00 2001
From: j1nx <p.steenbergen@j1nx.nl>
Date: Fri, 27 Mar 2020 11:26:38 +0100
Subject: [PATCH 1/1] Return rpi fix linking patch
---
package/mpv/0003-rpi-fix-linking-errors.patch | 85 +++++++++++++++++++
1 file changed, 85 insertions(+)
create mode 100644 package/mpv/0003-rpi-fix-linking-errors.patch
diff --git a/package/mpv/0003-rpi-fix-linking-errors.patch b/package/mpv/0003-rpi-fix-linking-errors.patch
new file mode 100644
index 0000000000..7344da5724
--- /dev/null
+++ b/package/mpv/0003-rpi-fix-linking-errors.patch
@@ -0,0 +1,85 @@
+From 8a038f982a4621f4c62947ef3929c3beae7e7744 Mon Sep 17 00:00:00 2001
+From: j1nx <p.steenbergen@j1nx.nl>
+Date: Fri, 27 Mar 2020 10:47:27 +0100
+Subject: [PATCH 1/1] rpi: fix linking errors
+
+---
+ waftools/checks/custom.py | 26 +++++++++++++++++++++++++-
+ wscript | 18 +-----------------
+ 2 files changed, 26 insertions(+), 18 deletions(-)
+
+diff --git a/waftools/checks/custom.py b/waftools/checks/custom.py
+index 821bf9c46f..c2a600abe4 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_cocoa", "check_wl_protocols", "check_swift"]
++ "check_cocoa", "check_wl_protocols", "check_swift", "check_rpi"]
+
+ pthreads_program = load_fragment('pthreads.c')
+
+@@ -120,3 +120,27 @@ def check_swift(ctx, dependency_identifier):
+ if major >= 3:
+ 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 = [
++ # 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_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']),
++ ]
++
++ ret = all((fn(ctx, dependency_identifier) for fn in checks))
++ os.environ['PKG_CONFIG_PATH'] = prev_pkg_path
++ return ret
+diff --git a/wscript b/wscript
+index e9e0ab3672..49ed85a294 100644
+--- a/wscript
++++ b/wscript
+@@ -753,25 +753,9 @@ video_output_features = [
+ 'deps': 'win32-desktop && shaderc && crossc',
+ 'func': check_cc(header_name=['d3d11_1.h', 'dxgi1_2.h']),
+ }, {
+- # We need MMAL/bcm_host/dispmanx APIs. Also, most RPI distros require
+- # every project to hardcode the paths to the include directories. Also,
+- # these headers are so broken that they spam tons of warnings by merely
+- # including them (compensate with -isystem and -fgnu89-inline).
+ 'name': '--rpi',
+ 'desc': 'Raspberry Pi support',
+- 'func': compose_checks(
+- check_cc(cflags=["-isystem/opt/vc/include",
+- "-isystem/opt/vc/include/interface/vcos/pthreads",
+- "-isystem/opt/vc/include/interface/vmcs_host/linux",
+- "-fgnu89-inline"],
+- linkflags="-L/opt/vc/lib",
+- header_name="bcm_host.h",
+- lib=['mmal_core', 'mmal_util', 'mmal_vc_client', 'bcm_host']),
+- # We still need all OpenGL symbols, because the vo_gpu code is
+- # generic and supports anything from GLES2/OpenGL 2.1 to OpenGL 4 core.
+- check_cc(lib="EGL", linkflags="-lGLESv2"),
+- check_cc(lib="GLESv2"),
+- ),
++ 'func': check_rpi,
+ } , {
+ 'name': '--ios-gl',
+ 'desc': 'iOS OpenGL ES hardware decoding interop support',
+--
+2.17.1
+
--
2.17.1