Diff raspberrypi-userland-0_pre20160424 with a raspberrypi-userland-0_pre20201022

/usr/portage/media-libs/raspberrypi-userland/raspberrypi-userland-0_pre20201022.ebuild 2023-10-09 14:52:31.712368406 +0300
1
# Copyright 1999-2022 Gentoo Authors
1
# Copyright 1999-2023 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4 4
EAPI=7
5

  
6
inherit cmake udev
7

  
8
DESCRIPTION="Raspberry Pi userspace tools and libraries"
9
HOMEPAGE="https://github.com/raspberrypi/userland"
5
inherit cmake flag-o-matic udev
10 6

  
11 7
if [[ ${PV} == 9999* ]]; then
12
	inherit git-2
8
	inherit git-r3
13 9
	EGIT_REPO_URI="https://github.com/${PN/-//}.git"
10
	SRC_URI=""
14 11
else
15
	GIT_COMMIT="dff5760"
16
	SRC_URI="https://github.com/raspberrypi/userland/tarball/${GIT_COMMIT} -> ${P}.tar.gz"
17
	KEYWORDS="arm"
18
	S="${WORKDIR}/raspberrypi-userland-${GIT_COMMIT}"
12
	# We base our versioning on  Raspbian
13
	# Go to https://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-userland/
14
	# Example:
15
	# * libraspberrypi-bin-dbgsym_2+git20201022~151804+e432bc3-1_arm64.deb
16
	# * "e432bc3" is the first 7 hex digits of the commit hash.
17
	# * Go to https://github.com/raspberrypi/userland/commits/master and find the full hash
18
	GIT_COMMIT="e432bc3400401064e2d8affa5d1454aac2cf4a00"
19
	SRC_URI="https://github.com/raspberrypi/userland/archive/${GIT_COMMIT}.tar.gz -> ${P}.tar.gz"
20
	KEYWORDS="arm arm64"
21
	S="${WORKDIR}/userland-${GIT_COMMIT}"
19 22
fi
20 23

  
21
RDEPEND="
22
	!media-libs/raspberrypi-userland-bin
23
	wayland? ( dev-libs/wayland )"
24

  
25
DEPEND="
26
	${RDEPEND}
27
	wayland? ( virtual/pkgconfig )"
24
DESCRIPTION="Raspberry Pi userspace tools and libraries"
25
HOMEPAGE="https://github.com/raspberrypi/userland"
28 26

  
29
IUSE="examples wayland"
30 27
LICENSE="BSD"
31 28
SLOT="0"
32 29

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

  
39
src_unpack() {
40
	if [[ ${PV} == 9999* ]]; then
41
		git-2_src_unpack
42
	else
43
		default
44
	fi
45
}
30
DEPEND=""
31
RDEPEND="acct-group/video
32
	!media-libs/raspberrypi-userland-bin"
33

  
34
PATCHES=(
35
	# Install in $(get_libdir)
36
	# See https://github.com/raspberrypi/userland/pull/650
37
	"${FILESDIR}/${PN}-libdir.patch"
38
	# Don't install includes that collide.
39
	"${FILESDIR}/${PN}-include.patch"
40
	# See https://github.com/raspberrypi/userland/pull/655
41
	"${FILESDIR}/${PN}-libfdt-static.patch"
42
	# See https://github.com/raspberrypi/userland/pull/659
43
	"${FILESDIR}/${PN}-pkgconf-arm64.patch"
44
)
46 45

  
47 46
src_prepare() {
48
	default
47
	cmake_src_prepare
48
	sed -i \
49
		-e 's:DESTINATION ${VMCS_INSTALL_PREFIX}/src:DESTINATION ${VMCS_INSTALL_PREFIX}/'"share/doc/${PF}:" \
50
		"${S}/makefiles/cmake/vmcs.cmake" || die "Failed sedding makefiles/cmake/vmcs.cmake"
51
	sed -i \
52
		-e 's:^install(TARGETS EGL GLESv2 OpenVG WFC:install(TARGETS:' \
53
		-e '/^install(TARGETS EGL_static GLESv2_static/d' \
54
		"${S}/interface/khronos/CMakeLists.txt" || die "Failed sedding interface/khronos/CMakeLists.txt"
55
}
49 56

  
50
	# init script for Debian, not useful on Gentoo
51
	sed -i "/DESTINATION \/etc\/init.d/,+2d" interface/vmcs_host/linux/vcfiled/CMakeLists.txt || die
57
src_configure() {
58
	append-ldflags $(no-as-needed)
52 59

  
53
	# wayland egl support
54
	eapply "${FILESDIR}"/next-resource-handle.patch
60
	local mycmakeargs=(
61
		-DVMCS_INSTALL_PREFIX="${EPREFIX}/usr"
62
		-DARM64=$(usex arm64)
63
	)
55 64

  
56
	cmake_src_prepare
65
	cmake_src_configure
57 66
}
58 67

  
59 68
src_install() {
60 69
	cmake_src_install
61

  
62
	# provide OpenGL ES v1 according to https://github.com/raspberrypi/firmware/issues/78
63
	dosym libGLESv2.so /opt/vc/lib/libGLESv1_CM.so
64

  
65
	doenvd "${FILESDIR}"/04${PN}
66

  
67 70
	udev_dorules "${FILESDIR}/92-local-vchiq-permissions.rules"
68

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

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

  
76
	insinto /opt/vc/lib/pkgconfig
77
	doins "${FILESDIR}"/bcm_host.pc
78
	doins "${FILESDIR}"/egl.pc
79
	doins "${FILESDIR}"/glesv2.pc
80
	if use wayland; then
81
	# Missing wayland-egl version from the patch; claim 9.0 (a mesa version) for now, so gst-plugins-bad wayland-egl check is happy
82
		sed -i -e 's/Version:  /Version: 9.0/' "${ED}/opt/vc/lib/pkgconfig/wayland-egl.pc" || die
83
		doins "${ED}"/opt/vc/lib/pkgconfig/wayland-egl.pc # Maybe move?
84
	fi
85

  
86
	# some #include instructions are wrong so we need to fix them
87
	einfo "Fixing #include \"vcos_platform_types.h\""
88
	for file in $(grep -l "#include \"vcos_platform_types.h\"" "${D}"/opt/vc/include/* -r); do
89
		einfo "  Fixing file ${file}"
90
		sed -i "s%#include \"vcos_platform_types.h\"%#include \"interface/vcos/pthreads/vcos_platform_types.h\"%g" ${file} || die
91
	done
92

  
93
	einfo "Fixing #include \"vcos_platform.h\""
94
	for file in $(grep -l "#include \"vcos_platform.h\"" "${D}"/opt/vc/include/* -r); do
95
		einfo "  Fixing file ${file}"
96
		sed -i "s%#include \"vcos_platform.h\"%#include \"interface/vcos/pthreads/vcos_platform.h\"%g" ${file} || die
97
	done
98

  
99
	einfo "Fixing #include \"vchost_config.h\""
100
	for file in $(grep -l "#include \"vchost_config.h\"" "${D}"/opt/vc/include/* -r); do
101
		einfo "  Fixing file ${file}"
102
		sed -i "s%#include \"vchost_config.h\"%#include \"interface/vmcs_host/linux/vchost_config.h\"%g" ${file} || die
103
	done
104

  
105
	if use examples; then
106
		dodir /usr/share/doc/${PF}/examples
107
		mv "${D}"/opt/vc/src/hello_pi "${D}"/usr/share/doc/${PF}/examples/ || die
108
	fi
109

  
110
	rm -rfv "${D}"/opt/vc/src || die
111 71
}
112 72

  
113 73
pkg_postinst() {
Thank you!