1From ddc2ea76058466b45a1acf37bed0d794cd3112a3 Mon Sep 17 00:00:00 2001
2From: Vincent Davis Jr <vince@underview.tech>
3Date: Fri, 9 Dec 2022 19:04:42 -0600
4Subject: [PATCH] configure.ac: setup for OE usage
5
6Upstream-Status: Inappropriate
7
8RPI-Distro repo forks original vlc and applies patches to enable
9raspiberry pi support.
10
11Need to use userland graphics libraries package files as it's best
12to not assume /opt/vc is where all libs and headers are installed per
13distro. Also, needed to include $BCMHOST_MMAL_LIBS variable as
14AC_CHECK_LIB(bcm_host) fails to find `vc_tv_unregister_callback_full`.
15Adding $BCMHOST_MMAL_LIBS uses all libs inside
16bcm_host.pc, mmal.pc, vcsm.pc, openmaxil.pc files when checking
17for `vc_tv_unregister_callback_full` function.
18
19Supposed to change linked version to opengl to GLESv2
20
21Ensure correct package config file is used for:
22* opencv
23* freerdp
24
25Adds Workaround for modules/codec/omxil/omxil_core.h
26   multiple definition of `pf_enable_graphic_buffers'
27   multiple definition of `pf_get_graphic_buffer_usage'
28   multiple definition of `pf_get_hal_format'
29
30Signed-off-by: Vincent Davis Jr <vince@underview.tech>
31---
32 configure.ac | 34 ++++++++++++++++++++++------------
33 1 file changed, 22 insertions(+), 12 deletions(-)
34
35diff --git a/configure.ac b/configure.ac
36index a72dca0b6..5b8585a26 100644
37--- a/configure.ac
38+++ b/configure.ac
39@@ -95,6 +95,13 @@ AS_IF([test -n "${with_binary_version}"],[
40          [Binary specific version])
41 ])
42
43+# Workaround for modules/codec/omxil/omxil_core.h
44+#   multiple definition of `pf_enable_graphic_buffers'
45+#   multiple definition of `pf_get_graphic_buffer_usage'
46+#   multiple definition of `pf_get_hal_format'
47+AC_SUBST([AM_CXXFLAGS], [-fcommon])
48+AC_SUBST([AM_CFLAGS], [-fcommon])
49+
50 dnl Prevent clang from accepting unknown flags with a mere warning
51 AX_APPEND_COMPILE_FLAGS([-Werror=unknown-warning-option -Werror=invalid-command-line-argument], [CFLAGS])
52 AX_APPEND_COMPILE_FLAGS([-Werror=unknown-warning-option -Werror=invalid-command-line-argument], [CXXFLAGS])
53@@ -1900,7 +1907,7 @@ PKG_ENABLE_MODULES_VLC([BLURAY], [libbluray], [libbluray >= 0.6.2], (libbluray f
54 dnl
55 dnl  OpenCV wrapper and example filters
56 dnl
57-PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper], [opencv > 2.0], (OpenCV (computer vision) filter), [auto])
58+PKG_ENABLE_MODULES_VLC([OPENCV], [opencv_example opencv_wrapper], [opencv4 >= 2.0], (OpenCV (computer vision) filter), [auto])
59
60
61 dnl
62@@ -2077,7 +2084,7 @@ PKG_ENABLE_MODULES_VLC([VNC], [vnc], [libvncclient >= 0.9.9], (VNC/rfb client su
63
64 dnl  RDP/Remote Desktop access module
65 dnl
66-PKG_ENABLE_MODULES_VLC([FREERDP], [rdp], [freerdp >= 1.0.1], (RDP/Remote Desktop client support) )
67+PKG_ENABLE_MODULES_VLC([FREERDP], [rdp], [freerdp2 >= 1.0.1], (RDP/Remote Desktop client support) )
68
69 dnl
70 dnl  Real RTSP plugin
71@@ -3089,14 +3096,14 @@ PKG_CHECK_MODULES([GL], [gl], [
72 #ifdef _WIN32
73 # include <GL/glew.h>
74 #endif
75-#include <GL/gl.h>
76+#include <GLES2/gl2.h>
77 ]], [
78     [int t0 = GL_TEXTURE0;]])
79   ], [
80     GL_CFLAGS=""
81     have_gl="yes"
82     AS_IF([test "${SYS}" != "mingw32"], [
83-      GL_LIBS="-lGL"
84+      GL_LIBS="-lGLESv2"
85     ], [
86       GL_LIBS="-lopengl32"
87     ])
88@@ -3483,15 +3490,14 @@ AC_ARG_ENABLE(mmal_avcodec,
89     [Use MMAL enabled avcodec libs (default disable)]))
90 if test "${enable_mmal}" != "no"; then
91   VLC_SAVE_FLAGS
92-  LDFLAGS="${LDFLAGS} -L/opt/vc/lib -lvchostif"
93-  CPPFLAGS="${CPPFLAGS} -isystem /opt/vc/include -isystem /opt/vc/include/interface/vcos/pthreads -isystem /opt/vc/include/interface/vmcs_host/linux"
94-  AC_CHECK_HEADERS(interface/mmal/mmal.h,
95-    [ AC_CHECK_LIB(bcm_host, vc_tv_unregister_callback_full, [
96+  PKG_CHECK_MODULES(BCMHOST_MMAL, [bcm_host mmal vcsm openmaxil egl], [
97+    HAVE_MMAL=yes
98+    AC_CHECK_HEADERS(interface/mmal/mmal.h,
99+      [ AC_CHECK_LIB(bcm_host $BCMHOST_MMAL_LIBS, vc_tv_unregister_callback_full, [
100         have_mmal="yes"
101-        VLC_ADD_PLUGIN([mmal])
102-        VLC_ADD_LDFLAGS([mmal],[ -L/opt/vc/lib ])
103-        VLC_ADD_CFLAGS([mmal],[ -isystem /opt/vc/include -isystem /opt/vc/include/interface/vcos/pthreads -isystem /opt/vc/include/interface/vmcs_host/linux ])
104-        VLC_ADD_LIBS([mmal],[ -lbcm_host -lmmal -lmmal_core -lmmal_components -lmmal_util -lvchostif -lvchiq_arm -lvcsm ]) ], [
105+        VLC_ADD_PLUGIN([bcm_host mmal vcsm openmaxil egl])
106+        VLC_ADD_CFLAGS([bcm_host mmal vcsm openmaxil egl],[$BCMHOST_MMAL_CFLAGS])
107+        VLC_ADD_LIBS([bcm_host mmal vcsm openmaxil egl],[$BCMHOST_MMAL_LIBS -lmmal_components]) ], [
108           AS_IF([test "${enable_mmal}" = "yes"],
109             [ AC_MSG_ERROR([Cannot find bcm library...]) ],
110             [ AC_MSG_WARN([Cannot find bcm library...]) ])
111@@ -3500,6 +3506,10 @@ if test "${enable_mmal}" != "no"; then
112     ] , [ AS_IF([test "${enable_mmal}" = "yes"],
113       [ AC_MSG_ERROR([Cannot find development headers for mmal...]) ],
114       [ AC_MSG_WARN([Cannot find development headers for mmal...]) ]) ])
115+  ],:[
116+    AC_MSG_WARN([${BCMHOST_PKG_ERRORS}: userland graphics not available.])
117+    HAVE_MMAL=NO
118+  ])
119   VLC_RESTORE_FLAGS
120 fi
121 AM_CONDITIONAL([HAVE_MMAL], [test "${have_mmal}" = "yes"])
122--
1232.38.1
124
125