summaryrefslogtreecommitdiff
blob: c6f42a68ee800218084e8590d5b87b2a7ea07f4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=5

inherit cmake-utils eutils

DESCRIPTION="Raspberry Pi userspace tools and libraries"
HOMEPAGE="https://github.com/raspberrypi/userland"

if [[ ${PV} == 9999* ]]; then
	inherit git-2
	EGIT_REPO_URI="git://github.com/${PN/-//}.git"
	SRC_URI=""
	KEYWORDS=""
else
	SRC_URI="http://dev.gentoo.org/~leio/distfiles/${P}.tar.xz"
	KEYWORDS="~arm"
fi

LICENSE="BSD"
SLOT="0"
IUSE="wayland"

RDEPEND="wayland? ( dev-libs/wayland )"
DEPEND="${RDEPEND}
	wayland? ( virtual/pkgconfig )"

# TODO:
# * port vcfiled init script
# * stuff is still installed to hardcoded /opt/vc location, investigate whether
#   anything else depends on it being there
# * live ebuild

src_unpack() {
	if [[ ${PV} == 9999* ]]; then
		git-2_src_unpack
	else
		default
		mv userland-*/ ${P}/ || die
	fi
}

src_prepare() {
	# init script for Debian, not useful on Gentoo
	sed -i "/DESTINATION \/etc\/init.d/,+2d" interface/vmcs_host/linux/vcfiled/CMakeLists.txt || die
	# wayland egl support
	epatch "${FILESDIR}"/next-resource-handle.patch
	epatch "${FILESDIR}"/wayland-wsys.patch
}

src_configure() {
	# FIXME: Fails to link apps using libmmal.so, due to libmmal_util getting filtered out and apps not linking to it
	append-ldflags $(no-as-needed)
	local mycmakeargs=(
		$(cmake-utils_use_build wayland WAYLAND)
	)
	cmake-utils_src_configure
}

src_install() {
	cmake-utils_src_install
	doenvd "${FILESDIR}"/04${PN}

	# enable dynamic switching of the GL implementation
	dodir /usr/lib/opengl
	dosym ../../../opt/vc /usr/lib/opengl/${PN}

	# tell eselect opengl that we do not have libGL
	touch "${ED}"/opt/vc/.gles-only

	insinto /usr/lib/pkgconfig
	doins "${FILESDIR}"/bcm_host.pc
	doins "${FILESDIR}"/egl.pc
	doins "${FILESDIR}"/glesv2.pc
	use wayland && doins "${ED}"/opt/vc/lib/pkgconfig/wayland-egl.pc # Maybe move?
}