blob: f916e553c932438374ed834eaef25b6d82e156ca [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "A free implementation of the OpenGL API"
2DESCRIPTION = "Mesa is an open-source implementation of the OpenGL specification - \
3a system for rendering interactive 3D graphics. \
4A variety of device drivers allows Mesa to be used in many different environments \
5ranging from software emulation to complete hardware acceleration for modern GPUs. \
6Mesa is used as part of the overall Direct Rendering Infrastructure and X.org \
7environment."
8
9HOMEPAGE = "http://mesa3d.org"
10BUGTRACKER = "https://bugs.freedesktop.org"
11SECTION = "x11"
12LICENSE = "MIT"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050013LIC_FILES_CHKSUM = "file://docs/license.html;md5=725f991a1cc322aa7a0cd3a2016621c4"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050014
15PE = "2"
16
Brad Bishop393846f2019-05-20 12:24:11 -040017DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native python3-mako-native gettext-native"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050018EXTRANATIVEPATH += "chrpath-native"
Brad Bishop316dfdd2018-06-25 12:45:53 -040019PROVIDES = " \
20 ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'virtual/libgl', '', d)} \
21 ${@bb.utils.contains('PACKAGECONFIG', 'gles', 'virtual/libgles1 virtual/libgles2', '', d)} \
22 ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'virtual/egl', '', d)} \
23 ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'virtual/libgbm', '', d)} \
24 virtual/mesa \
25 "
Patrick Williamsc124f4f2015-09-15 14:41:29 -050026
Brad Bishop393846f2019-05-20 12:24:11 -040027inherit meson pkgconfig python3native gettext distro_features_check
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028
Brad Bishop19323692019-04-05 15:28:33 -040029BBCLASSEXTEND = "native nativesdk"
30
31ANY_OF_DISTRO_FEATURES_class-target = "opengl vulkan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050032
Brad Bishopd7bf8c12018-02-25 22:55:05 -050033PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)} \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080034 ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'drm', '', d)} \
35 surfaceless"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050036
Brad Bishopd7bf8c12018-02-25 22:55:05 -050037export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080038export YOCTO_ALTERNATE_MULTILIB_NAME = "${base_libdir}"
Brad Bishop08902b02019-08-20 09:16:51 -040039export LLVM_CONFIG = "${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}"
40export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}"
41
42MESA_LLVM_RELEASE ?= "${LLVMVERSION}"
Brad Bishop393846f2019-05-20 12:24:11 -040043
44EXTRA_OEMESON = " \
45 -Dshared-glapi=true \
46 -Dgallium-opencl=disabled \
47 -Dglx-read-only-text=true \
48 -Dplatforms='${@",".join("${PLATFORMS}".split())}' \
Brad Bishop19323692019-04-05 15:28:33 -040049"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050050
Brad Bishop19323692019-04-05 15:28:33 -040051PACKAGECONFIG_class-target ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland vulkan', d)} \
52 ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl egl gles gbm dri gallium', '', d)} \
Brad Bishop316dfdd2018-06-25 12:45:53 -040053 ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11 dri3', '', d)} \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050054 ${@bb.utils.contains('DISTRO_FEATURES', 'x11 vulkan', 'dri3', '', d)} \
Brad Bishop393846f2019-05-20 12:24:11 -040055 glx-tls \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050056 "
Brad Bishop08902b02019-08-20 09:16:51 -040057PACKAGECONFIG_class-native ?= "gbm dri egl opengl glx-tls"
58PACKAGECONFIG_class-nativesdk ?= "gbm dri egl opengl glx-tls"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050059
Brad Bishop393846f2019-05-20 12:24:11 -040060PACKAGECONFIG_remove_libc-musl = "glx-tls"
61
Brad Bishopd7bf8c12018-02-25 22:55:05 -050062# "gbm" requires "dri", "opengl"
Brad Bishop393846f2019-05-20 12:24:11 -040063PACKAGECONFIG[gbm] = "-Dgbm=true,-Dgbm=false"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060064
Brad Bishop19323692019-04-05 15:28:33 -040065X11_DEPS = "xorgproto virtual/libx11 libxext libxxf86vm libxdamage libxfixes xrandr"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050066# "x11" requires "opengl"
Brad Bishop393846f2019-05-20 12:24:11 -040067PACKAGECONFIG[x11] = ",-Dglx=disabled,${X11_DEPS}"
68PACKAGECONFIG[glx-tls] = "-Dglx-tls=true, -Dglx-tls=false"
69PACKAGECONFIG[xvmc] = "-Dgallium-xvmc=true,-Dgallium-xvmc=false,libxvmc"
Brad Bishop316dfdd2018-06-25 12:45:53 -040070PACKAGECONFIG[wayland] = ",,wayland-native wayland libdrm wayland-protocols"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050071
Brad Bishop19323692019-04-05 15:28:33 -040072DRIDRIVERS_class-native = "swrast"
73DRIDRIVERS_class-nativesdk = "swrast"
Brad Bishop393846f2019-05-20 12:24:11 -040074DRIDRIVERS_append_x86_class-target = ",r100,r200,nouveau,i965,i915"
75DRIDRIVERS_append_x86-64_class-target = ",r100,r200,nouveau,i965,i915"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050076# "dri" requires "opengl"
Brad Bishop15ae2502019-06-18 21:44:24 -040077PACKAGECONFIG[dri] = "-Ddri=true -Ddri-drivers=${DRIDRIVERS}, -Ddri=false -Ddri-drivers='', xorgproto libdrm"
Brad Bishop393846f2019-05-20 12:24:11 -040078PACKAGECONFIG[dri3] = "-Ddri3=true, -Ddri3=false, xorgproto libxshmfence"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050079
Brad Bishop6e60e8b2018-02-01 10:27:11 -050080# Vulkan drivers need dri3 enabled
81# radeon could be enabled as well but requires gallium-llvm with llvm >= 3.9
Brad Bishopd7bf8c12018-02-25 22:55:05 -050082VULKAN_DRIVERS = ""
Brad Bishop19323692019-04-05 15:28:33 -040083VULKAN_DRIVERS_append_x86_class-target = ",intel"
84VULKAN_DRIVERS_append_x86-64_class-target = ",intel"
Brad Bishop393846f2019-05-20 12:24:11 -040085PACKAGECONFIG[vulkan] = "-Dvulkan-drivers=${VULKAN_DRIVERS}, -Dvulkan-drivers='',"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050086
Brad Bishop393846f2019-05-20 12:24:11 -040087PACKAGECONFIG[opengl] = "-Dopengl=true, -Dopengl=false"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050088
89# "gles" requires "opengl"
Brad Bishop393846f2019-05-20 12:24:11 -040090PACKAGECONFIG[gles] = "-Dgles1=true -Dgles2=true, -Dgles1=false -Dgles2=false"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050091
Brad Bishopd7bf8c12018-02-25 22:55:05 -050092# "egl" requires "dri", "opengl"
Brad Bishop393846f2019-05-20 12:24:11 -040093PACKAGECONFIG[egl] = "-Degl=true, -Degl=false"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050094
Brad Bishop6e60e8b2018-02-01 10:27:11 -050095PACKAGECONFIG[etnaviv] = ""
Brad Bishop393846f2019-05-20 12:24:11 -040096PACKAGECONFIG[kmsro] = ""
Brad Bishopc68388fc2019-08-26 01:33:31 -040097PACKAGECONFIG[vc4] = ""
98PACKAGECONFIG[v3d] = ""
Brad Bishop6e60e8b2018-02-01 10:27:11 -050099
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500100GALLIUMDRIVERS = "swrast"
Brad Bishop79641f22019-09-10 07:20:22 -0400101# gallium swrast was found to crash Xorg on startup in x32 qemu
102GALLIUMDRIVERS_x86-x32 = ""
103
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500104GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'etnaviv', ',etnaviv', '', d)}"
Brad Bishop393846f2019-05-20 12:24:11 -0400105GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'kmsro', ',kmsro', '', d)}"
Brad Bishopc68388fc2019-08-26 01:33:31 -0400106GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'vc4', ',vc4', '', d)}"
107GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'v3d', ',v3d', '', d)}"
Brad Bishop19323692019-04-05 15:28:33 -0400108
109# radeonsi requires LLVM
110GALLIUMDRIVERS_LLVM33 = "${@bb.utils.contains('PACKAGECONFIG', 'r600', ',radeonsi', '', d)}"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400111GALLIUMDRIVERS_LLVM33_ENABLED = "${@oe.utils.version_less_or_equal('MESA_LLVM_RELEASE', '3.2', False, len('${GALLIUMDRIVERS_LLVM33}') > 0, d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500112GALLIUMDRIVERS_LLVM = "r300,svga,nouveau${@',${GALLIUMDRIVERS_LLVM33}' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
Brad Bishop19323692019-04-05 15:28:33 -0400113
114PACKAGECONFIG[r600] = ""
115
116GALLIUMDRIVERS_append = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}"
117GALLIUMDRIVERS_append = "${@bb.utils.contains('PACKAGECONFIG', 'r600', ',r600', '', d)}"
118GALLIUMDRIVERS_append = ",virgl"
119
Brad Bishop393846f2019-05-20 12:24:11 -0400120PACKAGECONFIG[gallium] = "-Dgallium-drivers=${GALLIUMDRIVERS}, -Dgallium-drivers=''"
Brad Bishop393846f2019-05-20 12:24:11 -0400121PACKAGECONFIG[gallium-llvm] = "-Dllvm=true -Dshared-llvm=true, -Dllvm=false, llvm${MESA_LLVM_RELEASE} llvm-native \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500122 ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
Brad Bishop393846f2019-05-20 12:24:11 -0400123PACKAGECONFIG[xa] = "-Dgallium-xa=true, -Dgallium-xa=false"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500124
Brad Bishop96ff1982019-08-19 13:50:42 -0400125PACKAGECONFIG[lima] = ""
126GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'lima', ',lima', '', d)}"
127
Brad Bishop79641f22019-09-10 07:20:22 -0400128PACKAGECONFIG[panfrost] = ""
129GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'panfrost', ',panfrost', '', d)}"
130
Brad Bishop393846f2019-05-20 12:24:11 -0400131OSMESA = "${@bb.utils.contains('PACKAGECONFIG', 'gallium', 'gallium', 'classic', d)}"
132PACKAGECONFIG[osmesa] = "-Dosmesa=${OSMESA},-Dosmesa=none"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500133
Brad Bishop393846f2019-05-20 12:24:11 -0400134PACKAGECONFIG[unwind] = "-Dlibunwind=true,-Dlibunwind=false,libunwind"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500135
Brad Bishop393846f2019-05-20 12:24:11 -0400136# mesa tries to run cross-built gen_matypes on build machine to get struct size information
137EXTRA_OEMESON_append = " -Dasm=false"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800138
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500139# llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2)
140FULL_OPTIMIZATION_append = " -fno-omit-frame-pointer"
141
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500142CFLAGS_append_armv5 = " -DMISSING_64BIT_ATOMICS"
143
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500144# Remove the mesa dependency on mesa-dev, as mesa is empty
145RDEPENDS_${PN}-dev = ""
146
Brad Bishop37a0e4d2017-12-04 01:01:44 -0500147# Add dependency so that GLES3 header don't need to be added manually
148RDEPENDS_libgles2-mesa-dev += "libgles3-mesa-dev"
149
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500150PACKAGES =+ "libegl-mesa libegl-mesa-dev \
151 libosmesa libosmesa-dev \
152 libgl-mesa libgl-mesa-dev \
153 libglapi libglapi-dev \
154 libgbm libgbm-dev \
155 libgles1-mesa libgles1-mesa-dev \
156 libgles2-mesa libgles2-mesa-dev \
157 libgles3-mesa libgles3-mesa-dev \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500158 libxatracker libxatracker-dev \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500159 mesa-megadriver mesa-vulkan-drivers \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500160 "
161
162do_install_append () {
163 # Drivers never need libtool .la files
164 rm -f ${D}${libdir}/dri/*.la
165 rm -f ${D}${libdir}/egl/*.la
166 rm -f ${D}${libdir}/gallium-pipe/*.la
167 rm -f ${D}${libdir}/gbm/*.la
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500168
Brad Bishop19323692019-04-05 15:28:33 -0400169 # it was packaged in libdricore9.1.3-1 and preventing upgrades when debian.bbclass was used
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500170 chrpath --delete ${D}${libdir}/dri/*_dri.so || true
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800171
172 # libwayland-egl has been moved to wayland 1.15+
173 rm -f ${D}${libdir}/libwayland-egl*
174 rm -f ${D}${libdir}/pkgconfig/wayland-egl.pc
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500175}
176
177# For the packages that make up the OpenGL interfaces, inject variables so that
178# they don't get Debian-renamed (which would remove the -mesa suffix), and
179# RPROVIDEs/RCONFLICTs on the generic libgl name.
180python __anonymous() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500181 pkgconfig = (d.getVar('PACKAGECONFIG') or "").split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500182 for p in (("egl", "libegl", "libegl1"),
183 ("dri", "libgl", "libgl1"),
184 ("gles", "libgles1", "libglesv1-cm1"),
185 ("gles", "libgles2", "libglesv2-2"),
186 ("gles", "libgles3",)):
187 if not p[0] in pkgconfig:
188 continue
189 fullp = p[1] + "-mesa"
190 pkgs = " ".join(p[1:])
191 d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1")
192 d.appendVar("RREPLACES_" + fullp, pkgs)
193 d.appendVar("RPROVIDES_" + fullp, pkgs)
194 d.appendVar("RCONFLICTS_" + fullp, pkgs)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500195
196 d.appendVar("RRECOMMENDS_" + fullp, " mesa-megadriver")
197
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500198 # For -dev, the first element is both the Debian and original name
199 fullp += "-dev"
200 pkgs = p[1] + "-dev"
201 d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1")
202 d.appendVar("RREPLACES_" + fullp, pkgs)
203 d.appendVar("RPROVIDES_" + fullp, pkgs)
204 d.appendVar("RCONFLICTS_" + fullp, pkgs)
205}
206
207python mesa_populate_packages() {
208 pkgs = ['mesa', 'mesa-dev', 'mesa-dbg']
209 for pkg in pkgs:
210 d.setVar("RPROVIDES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
211 d.setVar("RCONFLICTS_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
212 d.setVar("RREPLACES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
213
214 import re
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500215 dri_drivers_root = oe.path.join(d.getVar('PKGD'), d.getVar('libdir'), "dri")
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600216 if os.path.isdir(dri_drivers_root):
217 dri_pkgs = os.listdir(dri_drivers_root)
218 lib_name = d.expand("${MLPREFIX}mesa-megadriver")
219 for p in dri_pkgs:
Brad Bishop19323692019-04-05 15:28:33 -0400220 m = re.match(r'^(.*)_dri\.so$', p)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600221 if m:
222 pkg_name = " ${MLPREFIX}mesa-driver-%s" % legitimize_package_name(m.group(1))
223 d.appendVar("RPROVIDES_%s" % lib_name, pkg_name)
224 d.appendVar("RCONFLICTS_%s" % lib_name, pkg_name)
225 d.appendVar("RREPLACES_%s" % lib_name, pkg_name)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500226
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500227 pipe_drivers_root = os.path.join(d.getVar('libdir'), "gallium-pipe")
Brad Bishop19323692019-04-05 15:28:33 -0400228 do_split_packages(d, pipe_drivers_root, r'^pipe_(.*)\.so$', 'mesa-driver-pipe-%s', 'Mesa %s pipe driver', extra_depends='')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500229}
230
231PACKAGESPLITFUNCS_prepend = "mesa_populate_packages "
232
233PACKAGES_DYNAMIC += "^mesa-driver-.*"
234
Brad Bishop19323692019-04-05 15:28:33 -0400235FILES_mesa-megadriver = "${libdir}/dri/* ${datadir}/drirc.d/00-mesa-defaults.conf"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500236FILES_mesa-vulkan-drivers = "${libdir}/libvulkan_*.so ${datadir}/vulkan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500237FILES_libegl-mesa = "${libdir}/libEGL.so.*"
238FILES_libgbm = "${libdir}/libgbm.so.*"
239FILES_libgles1-mesa = "${libdir}/libGLESv1*.so.*"
240FILES_libgles2-mesa = "${libdir}/libGLESv2.so.*"
241FILES_libgl-mesa = "${libdir}/libGL.so.*"
242FILES_libglapi = "${libdir}/libglapi.so.*"
243FILES_libosmesa = "${libdir}/libOSMesa.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500244FILES_libxatracker = "${libdir}/libxatracker.so.*"
245
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500246FILES_${PN}-dev = "${libdir}/pkgconfig/dri.pc ${includedir}/vulkan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500247FILES_libegl-mesa-dev = "${libdir}/libEGL.* ${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc"
248FILES_libgbm-dev = "${libdir}/libgbm.* ${libdir}/pkgconfig/gbm.pc ${includedir}/gbm.h"
249FILES_libgl-mesa-dev = "${libdir}/libGL.* ${includedir}/GL ${libdir}/pkgconfig/gl.pc"
250FILES_libglapi-dev = "${libdir}/libglapi.*"
251FILES_libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc"
252FILES_libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc"
253FILES_libgles3-mesa-dev = "${includedir}/GLES3"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500254FILES_libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500255FILES_libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \
256 ${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \
257 ${libdir}/pkgconfig/xatracker.pc"
Brad Bishop19323692019-04-05 15:28:33 -0400258
259# Fix upgrade path from mesa to mesa-megadriver
260RREPLACES_mesa-megadriver = "mesa"
261RCONFLICTS_mesa-megadriver = "mesa"
262RPROVIDES_mesa-megadriver = "mesa"