1DESCRIPTION = "This repository contains the source code for the ARM side \
2libraries used on Raspberry Pi. These typically are installed in /opt/vc/lib \
3and includes source for the ARM side code to interface to: EGL, mmal, GLESv2,\
4vcos, openmaxil, vchiq_arm, bcm_host, WFC, OpenVG."
5LICENSE = "BSD-3-Clause"
6LIC_FILES_CHKSUM = "file://LICENCE;md5=0448d6488ef8cc380632b1569ee6d196"
7
8PROVIDES += "${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "", "virtual/libgles2 virtual/egl", d)}"
9PROVIDES += "virtual/libomxil"
10
11RPROVIDES_${PN} += "${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "", "libgles2 egl libegl libegl1 libglesv2-2", d)}"
12COMPATIBLE_MACHINE = "^rpi$"
13
14SRCBRANCH = "master"
15SRCFORK = "raspberrypi"
16SRCREV = "6fb59736b1ae80fc62cddfe3309c800f72e1c07e"
17
18# Use the date of the above commit as the package version. Update this when
19# SRCREV is changed.
20PV = "20200316"
21
22SRC_URI = "\
23    git://github.com/${SRCFORK}/userland.git;protocol=git;branch=${SRCBRANCH} \
24    file://0001-Allow-applications-to-set-next-resource-handle.patch \
25    file://0002-wayland-Add-support-for-the-Wayland-winsys.patch \
26    file://0003-wayland-Add-Wayland-example.patch \
27    file://0004-wayland-egl-Add-bcm_host-to-dependencies.patch \
28    file://0005-interface-remove-faulty-assert-to-make-weston-happy-.patch \
29    file://0006-zero-out-wl-buffers-in-egl_surface_free.patch \
30    file://0007-initialize-front-back-wayland-buffers.patch \
31    file://0008-Remove-RPC_FLUSH.patch \
32    file://0009-fix-cmake-dependency-race.patch \
33    file://0010-Fix-for-framerate-with-nested-composition.patch \
34    file://0011-build-shared-library-for-vchostif.patch \
35    file://0012-implement-buffer-wrapping-interface-for-dispmanx.patch \
36    file://0013-Implement-triple-buffering-for-wayland.patch \
37    file://0014-GLES2-gl2ext.h-Define-GL_R8_EXT-and-GL_RG8_EXT.patch \
38    file://0015-EGL-glplatform.h-define-EGL_CAST.patch \
39    file://0016-Allow-multiple-wayland-compositor-state-data-per-pro.patch \
40    file://0017-khronos-backport-typedef-for-EGL_EXT_image_dma_buf_i.patch \
41    file://0018-Add-EGL_IMG_context_priority-related-defines.patch \
42    file://0019-libfdt-Undefine-__wordsize-if-already-defined.patch \
43    file://0020-openmaxil-add-pkg-config-file.patch \
44    file://0021-cmake-Disable-format-overflow-warning-as-error.patch \
45"
46S = "${WORKDIR}/git"
47
48inherit cmake pkgconfig
49
50ASNEEDED = ""
51
52EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DCMAKE_EXE_LINKER_FLAGS='-Wl,--no-as-needed' \
53                 -DVMCS_INSTALL_PREFIX=${exec_prefix} \
54"
55
56EXTRA_OECMAKE_append_aarch64 = " -DARM64=ON "
57
58
59PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', '', d)}"
60
61PACKAGECONFIG[wayland] = "-DBUILD_WAYLAND=TRUE -DWAYLAND_SCANNER_EXECUTABLE:FILEPATH=${STAGING_BINDIR_NATIVE}/wayland-scanner,,wayland-native wayland"
62
63CFLAGS_append = " -fPIC"
64
65do_install_append () {
66	for f in `find ${D}${includedir}/interface/vcos/ -name "*.h"`; do
67		sed -i 's/include "vcos_platform.h"/include "pthreads\/vcos_platform.h"/g' ${f}
68		sed -i 's/include "vcos_futex_mutex.h"/include "pthreads\/vcos_futex_mutex.h"/g' ${f}
69		sed -i 's/include "vcos_platform_types.h"/include "pthreads\/vcos_platform_types.h"/g' ${f}
70	done
71        rm -rf ${D}${prefix}${sysconfdir}
72	if [ "${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "1", "0", d)}" = "1" ]; then
73		rm -rf ${D}${libdir}/libEGL*
74		rm -rf ${D}${libdir}/libGLES*
75		rm -rf ${D}${libdir}/libwayland-*
76		rm -rf ${D}${libdir}/pkgconfig/egl.pc ${D}${libdir}/pkgconfig/glesv2.pc \
77			${D}${libdir}/pkgconfig/wayland-egl.pc
78		rm -rf ${D}${includedir}/EGL ${D}${includedir}/GLES* ${D}${includedir}/KHR
79        else
80                ln -sf brcmglesv2.pc ${D}${libdir}/pkgconfig/glesv2.pc
81                ln -sf brcmegl.pc ${D}${libdir}/pkgconfig/egl.pc
82                ln -sf brcmvg.pc ${D}${libdir}/pkgconfig/vg.pc
83	fi
84}
85
86# Shared libs from userland package  build aren't versioned, so we need
87# to force the .so files into the runtime package (and keep them
88# out of -dev package).
89FILES_SOLIBSDEV = ""
90INSANE_SKIP_${PN} += "dev-so"
91
92FILES_${PN} += " \
93    ${libdir}/*.so \
94    ${libdir}/plugins"
95FILES_${PN}-dev += "${includedir} \
96                   ${prefix}/src"
97FILES_${PN}-doc += "${datadir}/install"
98FILES_${PN}-dbg += "${libdir}/plugins/.debug"
99
100RDEPENDS_${PN} += "bash"
101RDEPENDS_${PN} += "${@bb.utils.contains("MACHINE_FEATURES", "vc4graphics", "libegl-mesa", "", d)}"
102