1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
8 DESCRIPTION="Raspberry Pi userspace tools and libraries"
9 HOMEPAGE="https://github.com/raspberrypi/userland"
11 if [[ ${PV} == 9999* ]]; then
13 EGIT_REPO_URI="https://github.com/${PN/-//}.git"
17 SRC_URI="https://github.com/raspberrypi/userland/tarball/${GIT_COMMIT} -> ${P}.tar.gz"
19 S="${WORKDIR}/raspberrypi-userland-${GIT_COMMIT}"
23 !media-libs/raspberrypi-userland-bin
24 wayland? ( dev-libs/wayland )"
28 wayland? ( virtual/pkgconfig )"
30 IUSE="examples wayland"
35 # * port vcfiled init script
36 # * stuff is still installed to hardcoded /opt/vc location, investigate whether
37 # anything else depends on it being there
41 if [[ ${PV} == 9999* ]]; then
49 # init script for Debian, not useful on Gentoo
50 sed -i "/DESTINATION \/etc\/init.d/,+2d" interface/vmcs_host/linux/vcfiled/CMakeLists.txt || die
53 epatch "${FILESDIR}"/next-resource-handle.patch
57 cmake-utils_src_install
59 # provide OpenGL ES v1 according to https://github.com/raspberrypi/firmware/issues/78
60 dosym libGLESv2.so /opt/vc/lib/libGLESv1_CM.so
62 doenvd "${FILESDIR}"/04${PN}
64 insinto /lib/udev/rules.d
65 doins "${FILESDIR}"/92-local-vchiq-permissions.rules
67 # enable dynamic switching of the GL implementation
69 dosym ../../../opt/vc /usr/lib/opengl/${PN}
71 # tell eselect opengl that we do not have libGL
72 touch "${ED}"/opt/vc/.gles-only || die
74 insinto /opt/vc/lib/pkgconfig
75 doins "${FILESDIR}"/bcm_host.pc
76 doins "${FILESDIR}"/egl.pc
77 doins "${FILESDIR}"/glesv2.pc
79 # Missing wayland-egl version from the patch; claim 9.0 (a mesa version) for now, so gst-plugins-bad wayland-egl check is happy
80 sed -i -e 's/Version: /Version: 9.0/' "${ED}/opt/vc/lib/pkgconfig/wayland-egl.pc" || die
81 doins "${ED}"/opt/vc/lib/pkgconfig/wayland-egl.pc # Maybe move?
84 # some #include instructions are wrong so we need to fix them
85 einfo "Fixing #include \"vcos_platform_types.h\""
86 for file in $(grep -l "#include \"vcos_platform_types.h\"" "${D}"/opt/vc/include/* -r); do
87 einfo " Fixing file ${file}"
88 sed -i "s%#include \"vcos_platform_types.h\"%#include \"interface/vcos/pthreads/vcos_platform_types.h\"%g" ${file} || die
91 einfo "Fixing #include \"vcos_platform.h\""
92 for file in $(grep -l "#include \"vcos_platform.h\"" "${D}"/opt/vc/include/* -r); do
93 einfo " Fixing file ${file}"
94 sed -i "s%#include \"vcos_platform.h\"%#include \"interface/vcos/pthreads/vcos_platform.h\"%g" ${file} || die
97 einfo "Fixing #include \"vchost_config.h\""
98 for file in $(grep -l "#include \"vchost_config.h\"" "${D}"/opt/vc/include/* -r); do
99 einfo " Fixing file ${file}"
100 sed -i "s%#include \"vchost_config.h\"%#include \"interface/vmcs_host/linux/vchost_config.h\"%g" ${file} || die
103 if use examples; then
104 dodir /usr/share/doc/${PF}/examples
105 mv "${D}"/opt/vc/src/hello_pi "${D}"/usr/share/doc/${PF}/examples/ || die
108 rm -rfv "${D}"/opt/vc/src || die