dev-cpp/pangomm: stable 2.42.1 for hppa, bug #717144
[gentoo.git] / media-libs / raspberrypi-userland / raspberrypi-userland-0_pre20160424.ebuild
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit cmake-utils
7
8 DESCRIPTION="Raspberry Pi userspace tools and libraries"
9 HOMEPAGE="https://github.com/raspberrypi/userland"
10
11 if [[ ${PV} == 9999* ]]; then
12         inherit git-2
13         EGIT_REPO_URI="https://github.com/${PN/-//}.git"
14         SRC_URI=""
15 else
16         GIT_COMMIT="dff5760"
17         SRC_URI="https://github.com/raspberrypi/userland/tarball/${GIT_COMMIT} -> ${P}.tar.gz"
18         KEYWORDS="arm"
19         S="${WORKDIR}/raspberrypi-userland-${GIT_COMMIT}"
20 fi
21
22 RDEPEND="
23         !media-libs/raspberrypi-userland-bin
24         wayland? ( dev-libs/wayland )"
25
26 DEPEND="
27         ${RDEPEND}
28         wayland? ( virtual/pkgconfig )"
29
30 IUSE="examples wayland"
31 LICENSE="BSD"
32 SLOT="0"
33
34 # TODO:
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
38 # * live ebuild
39
40 src_unpack() {
41         if [[ ${PV} == 9999* ]]; then
42                 git-2_src_unpack
43         else
44                 default
45         fi
46 }
47
48 src_prepare() {
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
51
52         # wayland egl support
53         epatch "${FILESDIR}"/next-resource-handle.patch
54 }
55
56 src_install() {
57         cmake-utils_src_install
58
59         # provide OpenGL ES v1 according to https://github.com/raspberrypi/firmware/issues/78
60         dosym libGLESv2.so /opt/vc/lib/libGLESv1_CM.so
61
62         doenvd "${FILESDIR}"/04${PN}
63
64         insinto /lib/udev/rules.d
65         doins "${FILESDIR}"/92-local-vchiq-permissions.rules
66
67         # enable dynamic switching of the GL implementation
68         dodir /usr/lib/opengl
69         dosym ../../../opt/vc /usr/lib/opengl/${PN}
70
71         # tell eselect opengl that we do not have libGL
72         touch "${ED}"/opt/vc/.gles-only || die
73
74         insinto /opt/vc/lib/pkgconfig
75         doins "${FILESDIR}"/bcm_host.pc
76         doins "${FILESDIR}"/egl.pc
77         doins "${FILESDIR}"/glesv2.pc
78         if use wayland; then
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?
82         fi
83
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
89         done
90
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
95         done
96
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
101         done
102
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
106         fi
107
108         rm -rfv "${D}"/opt/vc/src || die
109 }