xref: /OK3568_Linux_fs/yocto/meta-rockchip/recipes-graphics/rockchip-libmali/rockchip-libmali.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1# Copyright (C) 2019, Fuzhou Rockchip Electronics Co., Ltd
2# Released under the MIT license (see COPYING.MIT for the terms)
3
4DESCRIPTION = "Userspace Mali GPU drivers for Rockchip SoCs"
5SECTION = "libs"
6
7LICENSE = "CLOSED"
8LIC_FILES_CHKSUM = "file://END_USER_LICENCE_AGREEMENT.txt;md5=3918cc9836ad038c5a090a0280233eea"
9
10inherit local-git
11
12SRC_URI = " \
13	git://github.com/JeffyCN/mirrors.git;protocol=https;branch=libmali; \
14"
15SRCREV = "309268f7a34ca0bba0ab94a0b09feb0191c77fb8"
16S = "${WORKDIR}/git"
17
18DEPENDS = "coreutils-native libdrm"
19
20PROVIDES:append = " virtual/egl virtual/libgles1 virtual/libgles2 virtual/libgles3 virtual/libgbm"
21
22MALI_GPU ??= "midgard-t86x"
23MALI_VERSION ??= "r18p0"
24MALI_SUBVERSION ??= "none"
25MALI_PLATFORM ??= "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland', bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', 'gbm', d), d)}"
26
27# The utgard DDK would not provide OpenCL.
28# The ICD OpenCL implementation should work with opencl-icd-loader.
29RDEPENDS:${PN} = " \
30	${@ 'wayland' if 'wayland' == d.getVar('MALI_PLATFORM') else ''} \
31	${@ 'libx11 libxcb' if 'x11' == d.getVar('MALI_PLATFORM') else ''} \
32	${@ 'opencl-icd-loader' if not d.getVar('MALI_GPU').startswith('utgard') else ''} \
33"
34
35DEPENDS:append = " \
36	${@ 'wayland' if 'wayland' == d.getVar('MALI_PLATFORM') else ''} \
37	${@ 'libx11 libxcb' if 'x11' == d.getVar('MALI_PLATFORM') else ''} \
38"
39
40PACKAGE_ARCH = "${MACHINE_ARCH}"
41
42ASNEEDED = ""
43
44# Inject RPROVIDEs/RCONFLICTs on the generic lib name.
45python __anonymous() {
46    pn = d.getVar('PN')
47    pn_dev = pn + "-dev"
48    d.setVar("DEBIAN_NOAUTONAME:" + pn, "1")
49    d.setVar("DEBIAN_NOAUTONAME:" + pn_dev, "1")
50
51    for p in (("libegl", "libegl1"),
52              ("libgles1", "libglesv1-cm1"),
53              ("libgles2", "libglesv2-2"),
54              ("libgles3",)):
55        pkgs = " " + " ".join(p)
56        d.appendVar("RREPLACES:" + pn, pkgs)
57        d.appendVar("RPROVIDES:" + pn, pkgs)
58        d.appendVar("RCONFLICTS:" + pn, pkgs)
59
60        # For -dev, the first element is both the Debian and original name
61        pkgs = " " + p[0] + "-dev"
62        d.appendVar("RREPLACES:" + pn_dev, pkgs)
63        d.appendVar("RPROVIDES:" + pn_dev, pkgs)
64        d.appendVar("RCONFLICTS:" + pn_dev, pkgs)
65}
66
67inherit meson pkgconfig
68
69EXTRA_OEMESON = " \
70	-Dgpu=${MALI_GPU} \
71	-Dversion=${MALI_VERSION} \
72	-Dsubversion=${MALI_SUBVERSION} \
73	-Dplatform=${MALI_PLATFORM} \
74"
75
76do_install:append () {
77	if grep -q "\-DMESA_EGL_NO_X11_HEADERS" \
78		${D}${libdir}/pkgconfig/egl.pc; then
79		sed -i 's/defined(MESA_EGL_NO_X11_HEADERS)/1/' \
80			${D}${includedir}/EGL/eglplatform.h
81	fi
82}
83
84INSANE_SKIP:${PN} = "already-stripped ldflags dev-so textrel"
85INSANE_SKIP:${PN}-dev = "staticdev"
86
87INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
88INHIBIT_PACKAGE_STRIP = "1"
89
90RPROVIDES:${PN}:append = " libmali"
91
92FILES:${PN}-staticdev = ""
93FILES:${PN}-dev = " \
94	${includedir} \
95	${libdir}/lib*.a \
96	${libdir}/pkgconfig \
97"
98
99# Any remaining files, including .so links for utgard DDK's internal dlopen
100FILES:${PN} = "*"
101