0003-rpi-fix-linking-errors.patch 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. From fe482a600d507dc7ce77f6d154a9e8b395f74fdd Mon Sep 17 00:00:00 2001
  2. From: Mahyar Koshkouei <mahyar.koshkouei@gmail.com>
  3. Date: Tue, 24 Oct 2017 09:47:38 +0100
  4. Subject: [PATCH] rpi: fix linking errors
  5. Fixes linking issues when compiling with Raspberry Pi support.
  6. Signed-off-by: Mahyar Koshkouei <mahyar.koshkouei@gmail.com>
  7. ---
  8. Status: pull request https://github.com/mpv-player/mpv/pull/4883
  9. ---
  10. waftools/checks/custom.py | 26 +++++++++++++++++++++++++-
  11. wscript | 18 +-----------------
  12. 2 files changed, 26 insertions(+), 18 deletions(-)
  13. diff --git a/waftools/checks/custom.py b/waftools/checks/custom.py
  14. index d8065a3..9086795 100644
  15. --- a/waftools/checks/custom.py
  16. +++ b/waftools/checks/custom.py
  17. @@ -4,7 +4,7 @@ from waflib import Utils
  18. import os
  19. __all__ = ["check_pthreads", "check_iconv", "check_lua",
  20. - "check_cocoa", "check_openal"]
  21. + "check_cocoa", "check_openal", "check_rpi"]
  22. pthreads_program = load_fragment('pthreads.c')
  23. @@ -103,3 +103,27 @@ def check_openal(ctx, dependency_identifier):
  24. if fn(ctx, dependency_identifier):
  25. return True
  26. return False
  27. +
  28. +def check_rpi(ctx, dependency_identifier):
  29. + # We need MMAL/bcm_host/dispmanx APIs.
  30. + # Upstream keeps pkgconfig files in '/opt/vc/lib/pkgconfig'.
  31. + # See https://github.com/raspberrypi/userland/issues/245
  32. + # PKG_CONFIG_SYSROOT_DIR helps with cross compilation.
  33. + prev_pkg_path = os.getenv('PKG_CONFIG_PATH', '')
  34. + os.environ['PKG_CONFIG_PATH'] = os.pathsep.join(
  35. + filter(None, [os.path.join(os.getenv('PKG_CONFIG_SYSROOT_DIR', '/'),
  36. + 'opt/vc/lib/pkgconfig'),
  37. + prev_pkg_path]))
  38. +
  39. + checks = [
  40. + # We still need all OpenGL symbols, because the vo_opengl code is
  41. + # generic and supports anything from GLES2/OpenGL 2.1 to OpenGL 4 core.
  42. + check_pkg_config('bcm_host', uselib_store='bcm_host'),
  43. + check_pkg_config('egl'),
  44. + check_pkg_config('glesv2'),
  45. + check_cc(lib=['mmal_core', 'mmal_util', 'mmal_vc_client'], use=['bcm_host']),
  46. + ]
  47. +
  48. + ret = all((fn(ctx, dependency_identifier) for fn in checks))
  49. + os.environ['PKG_CONFIG_PATH'] = prev_pkg_path
  50. + return ret
  51. diff --git a/wscript b/wscript
  52. index 9d88588..84e5f2e 100644
  53. --- a/wscript
  54. +++ b/wscript
  55. @@ -732,25 +732,9 @@ video_output_features = [
  56. 'desc': 'Android support',
  57. 'func': check_statement('android/api-level.h', '(void)__ANDROID__'), # arbitrary android-specific header
  58. }, {
  59. - # We need MMAL/bcm_host/dispmanx APIs. Also, most RPI distros require
  60. - # every project to hardcode the paths to the include directories. Also,
  61. - # these headers are so broken that they spam tons of warnings by merely
  62. - # including them (compensate with -isystem and -fgnu89-inline).
  63. 'name': '--rpi',
  64. 'desc': 'Raspberry Pi support',
  65. - 'func': compose_checks(
  66. - check_cc(cflags="-isystem/opt/vc/include/ "+
  67. - "-isystem/opt/vc/include/interface/vcos/pthreads " +
  68. - "-isystem/opt/vc/include/interface/vmcs_host/linux " +
  69. - "-fgnu89-inline",
  70. - linkflags="-L/opt/vc/lib",
  71. - header_name="bcm_host.h",
  72. - lib=['mmal_core', 'mmal_util', 'mmal_vc_client', 'bcm_host']),
  73. - # We still need all OpenGL symbols, because the vo_opengl code is
  74. - # generic and supports anything from GLES2/OpenGL 2.1 to OpenGL 4 core.
  75. - check_cc(lib="EGL"),
  76. - check_cc(lib="GLESv2"),
  77. - ),
  78. + 'func': check_rpi,
  79. } , {
  80. 'name': '--ios-gl',
  81. 'desc': 'iOS OpenGL ES hardware decoding interop support',
  82. --
  83. 2.14.2