blob: 3ecfb8506c0d952cf86c243dcfab06839eb56b6e [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 Bishop393846f2019-05-20 12:24:11 -040039
40EXTRA_OEMESON = " \
41 -Dshared-glapi=true \
42 -Dgallium-opencl=disabled \
43 -Dglx-read-only-text=true \
44 -Dplatforms='${@",".join("${PLATFORMS}".split())}' \
Brad Bishop19323692019-04-05 15:28:33 -040045"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050046
Brad Bishop19323692019-04-05 15:28:33 -040047PACKAGECONFIG_class-target ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland vulkan', d)} \
48 ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl egl gles gbm dri gallium', '', d)} \
Brad Bishop316dfdd2018-06-25 12:45:53 -040049 ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11 dri3', '', d)} \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050050 ${@bb.utils.contains('DISTRO_FEATURES', 'x11 vulkan', 'dri3', '', d)} \
Brad Bishop393846f2019-05-20 12:24:11 -040051 glx-tls \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050052 "
Brad Bishop19323692019-04-05 15:28:33 -040053PACKAGECONFIG_class-native ?= "gbm dri egl opengl"
54PACKAGECONFIG_class-nativesdk ?= "gbm dri egl opengl"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050055
Brad Bishop393846f2019-05-20 12:24:11 -040056PACKAGECONFIG_remove_libc-musl = "glx-tls"
57
Brad Bishopd7bf8c12018-02-25 22:55:05 -050058# "gbm" requires "dri", "opengl"
Brad Bishop393846f2019-05-20 12:24:11 -040059PACKAGECONFIG[gbm] = "-Dgbm=true,-Dgbm=false"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060060
Brad Bishop19323692019-04-05 15:28:33 -040061X11_DEPS = "xorgproto virtual/libx11 libxext libxxf86vm libxdamage libxfixes xrandr"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050062# "x11" requires "opengl"
Brad Bishop393846f2019-05-20 12:24:11 -040063PACKAGECONFIG[x11] = ",-Dglx=disabled,${X11_DEPS}"
64PACKAGECONFIG[glx-tls] = "-Dglx-tls=true, -Dglx-tls=false"
65PACKAGECONFIG[xvmc] = "-Dgallium-xvmc=true,-Dgallium-xvmc=false,libxvmc"
Brad Bishop316dfdd2018-06-25 12:45:53 -040066PACKAGECONFIG[wayland] = ",,wayland-native wayland libdrm wayland-protocols"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050067
Brad Bishop19323692019-04-05 15:28:33 -040068DRIDRIVERS_class-native = "swrast"
69DRIDRIVERS_class-nativesdk = "swrast"
Brad Bishop393846f2019-05-20 12:24:11 -040070DRIDRIVERS_append_x86_class-target = ",r100,r200,nouveau,i965,i915"
71DRIDRIVERS_append_x86-64_class-target = ",r100,r200,nouveau,i965,i915"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050072# "dri" requires "opengl"
Brad Bishop15ae2502019-06-18 21:44:24 -040073PACKAGECONFIG[dri] = "-Ddri=true -Ddri-drivers=${DRIDRIVERS}, -Ddri=false -Ddri-drivers='', xorgproto libdrm"
Brad Bishop393846f2019-05-20 12:24:11 -040074PACKAGECONFIG[dri3] = "-Ddri3=true, -Ddri3=false, xorgproto libxshmfence"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075
Brad Bishop6e60e8b2018-02-01 10:27:11 -050076# Vulkan drivers need dri3 enabled
77# radeon could be enabled as well but requires gallium-llvm with llvm >= 3.9
Brad Bishopd7bf8c12018-02-25 22:55:05 -050078VULKAN_DRIVERS = ""
Brad Bishop19323692019-04-05 15:28:33 -040079VULKAN_DRIVERS_append_x86_class-target = ",intel"
80VULKAN_DRIVERS_append_x86-64_class-target = ",intel"
Brad Bishop393846f2019-05-20 12:24:11 -040081PACKAGECONFIG[vulkan] = "-Dvulkan-drivers=${VULKAN_DRIVERS}, -Dvulkan-drivers='',"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050082
Brad Bishop393846f2019-05-20 12:24:11 -040083PACKAGECONFIG[opengl] = "-Dopengl=true, -Dopengl=false"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050084
85# "gles" requires "opengl"
Brad Bishop393846f2019-05-20 12:24:11 -040086PACKAGECONFIG[gles] = "-Dgles1=true -Dgles2=true, -Dgles1=false -Dgles2=false"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050087
Brad Bishopd7bf8c12018-02-25 22:55:05 -050088# "egl" requires "dri", "opengl"
Brad Bishop393846f2019-05-20 12:24:11 -040089PACKAGECONFIG[egl] = "-Degl=true, -Degl=false"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050090
Brad Bishop6e60e8b2018-02-01 10:27:11 -050091PACKAGECONFIG[etnaviv] = ""
Brad Bishop393846f2019-05-20 12:24:11 -040092PACKAGECONFIG[kmsro] = ""
Brad Bishop6e60e8b2018-02-01 10:27:11 -050093
Patrick Williamsc124f4f2015-09-15 14:41:29 -050094GALLIUMDRIVERS = "swrast"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050095GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'etnaviv', ',etnaviv', '', d)}"
Brad Bishop393846f2019-05-20 12:24:11 -040096GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'kmsro', ',kmsro', '', d)}"
Brad Bishop19323692019-04-05 15:28:33 -040097
98# radeonsi requires LLVM
99GALLIUMDRIVERS_LLVM33 = "${@bb.utils.contains('PACKAGECONFIG', 'r600', ',radeonsi', '', d)}"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400100GALLIUMDRIVERS_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 -0500101GALLIUMDRIVERS_LLVM = "r300,svga,nouveau${@',${GALLIUMDRIVERS_LLVM33}' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
Brad Bishop19323692019-04-05 15:28:33 -0400102
103PACKAGECONFIG[r600] = ""
104
105GALLIUMDRIVERS_append = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}"
106GALLIUMDRIVERS_append = "${@bb.utils.contains('PACKAGECONFIG', 'r600', ',r600', '', d)}"
107GALLIUMDRIVERS_append = ",virgl"
108
Brad Bishop393846f2019-05-20 12:24:11 -0400109PACKAGECONFIG[gallium] = "-Dgallium-drivers=${GALLIUMDRIVERS}, -Dgallium-drivers=''"
Brad Bishop19323692019-04-05 15:28:33 -0400110MESA_LLVM_RELEASE ?= "8.0.0"
Brad Bishop393846f2019-05-20 12:24:11 -0400111PACKAGECONFIG[gallium-llvm] = "-Dllvm=true -Dshared-llvm=true, -Dllvm=false, llvm${MESA_LLVM_RELEASE} llvm-native \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500112 ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
113export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}"
Brad Bishop393846f2019-05-20 12:24:11 -0400114PACKAGECONFIG[xa] = "-Dgallium-xa=true, -Dgallium-xa=false"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500115
Brad Bishop393846f2019-05-20 12:24:11 -0400116OSMESA = "${@bb.utils.contains('PACKAGECONFIG', 'gallium', 'gallium', 'classic', d)}"
117PACKAGECONFIG[osmesa] = "-Dosmesa=${OSMESA},-Dosmesa=none"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500118
Brad Bishop393846f2019-05-20 12:24:11 -0400119PACKAGECONFIG[unwind] = "-Dlibunwind=true,-Dlibunwind=false,libunwind"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500120
Brad Bishop393846f2019-05-20 12:24:11 -0400121# mesa tries to run cross-built gen_matypes on build machine to get struct size information
122EXTRA_OEMESON_append = " -Dasm=false"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800123
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500124# llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2)
125FULL_OPTIMIZATION_append = " -fno-omit-frame-pointer"
126
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500127CFLAGS_append_armv5 = " -DMISSING_64BIT_ATOMICS"
128
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500129# Remove the mesa dependency on mesa-dev, as mesa is empty
130RDEPENDS_${PN}-dev = ""
131
Brad Bishop37a0e4d2017-12-04 01:01:44 -0500132# Add dependency so that GLES3 header don't need to be added manually
133RDEPENDS_libgles2-mesa-dev += "libgles3-mesa-dev"
134
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500135PACKAGES =+ "libegl-mesa libegl-mesa-dev \
136 libosmesa libosmesa-dev \
137 libgl-mesa libgl-mesa-dev \
138 libglapi libglapi-dev \
139 libgbm libgbm-dev \
140 libgles1-mesa libgles1-mesa-dev \
141 libgles2-mesa libgles2-mesa-dev \
142 libgles3-mesa libgles3-mesa-dev \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500143 libxatracker libxatracker-dev \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500144 mesa-megadriver mesa-vulkan-drivers \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500145 "
146
147do_install_append () {
148 # Drivers never need libtool .la files
149 rm -f ${D}${libdir}/dri/*.la
150 rm -f ${D}${libdir}/egl/*.la
151 rm -f ${D}${libdir}/gallium-pipe/*.la
152 rm -f ${D}${libdir}/gbm/*.la
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500153
Brad Bishop19323692019-04-05 15:28:33 -0400154 # it was packaged in libdricore9.1.3-1 and preventing upgrades when debian.bbclass was used
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500155 chrpath --delete ${D}${libdir}/dri/*_dri.so || true
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800156
157 # libwayland-egl has been moved to wayland 1.15+
158 rm -f ${D}${libdir}/libwayland-egl*
159 rm -f ${D}${libdir}/pkgconfig/wayland-egl.pc
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500160}
161
162# For the packages that make up the OpenGL interfaces, inject variables so that
163# they don't get Debian-renamed (which would remove the -mesa suffix), and
164# RPROVIDEs/RCONFLICTs on the generic libgl name.
165python __anonymous() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500166 pkgconfig = (d.getVar('PACKAGECONFIG') or "").split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500167 for p in (("egl", "libegl", "libegl1"),
168 ("dri", "libgl", "libgl1"),
169 ("gles", "libgles1", "libglesv1-cm1"),
170 ("gles", "libgles2", "libglesv2-2"),
171 ("gles", "libgles3",)):
172 if not p[0] in pkgconfig:
173 continue
174 fullp = p[1] + "-mesa"
175 pkgs = " ".join(p[1:])
176 d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1")
177 d.appendVar("RREPLACES_" + fullp, pkgs)
178 d.appendVar("RPROVIDES_" + fullp, pkgs)
179 d.appendVar("RCONFLICTS_" + fullp, pkgs)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500180
181 d.appendVar("RRECOMMENDS_" + fullp, " mesa-megadriver")
182
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500183 # For -dev, the first element is both the Debian and original name
184 fullp += "-dev"
185 pkgs = p[1] + "-dev"
186 d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1")
187 d.appendVar("RREPLACES_" + fullp, pkgs)
188 d.appendVar("RPROVIDES_" + fullp, pkgs)
189 d.appendVar("RCONFLICTS_" + fullp, pkgs)
190}
191
192python mesa_populate_packages() {
193 pkgs = ['mesa', 'mesa-dev', 'mesa-dbg']
194 for pkg in pkgs:
195 d.setVar("RPROVIDES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
196 d.setVar("RCONFLICTS_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
197 d.setVar("RREPLACES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
198
199 import re
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500200 dri_drivers_root = oe.path.join(d.getVar('PKGD'), d.getVar('libdir'), "dri")
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600201 if os.path.isdir(dri_drivers_root):
202 dri_pkgs = os.listdir(dri_drivers_root)
203 lib_name = d.expand("${MLPREFIX}mesa-megadriver")
204 for p in dri_pkgs:
Brad Bishop19323692019-04-05 15:28:33 -0400205 m = re.match(r'^(.*)_dri\.so$', p)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600206 if m:
207 pkg_name = " ${MLPREFIX}mesa-driver-%s" % legitimize_package_name(m.group(1))
208 d.appendVar("RPROVIDES_%s" % lib_name, pkg_name)
209 d.appendVar("RCONFLICTS_%s" % lib_name, pkg_name)
210 d.appendVar("RREPLACES_%s" % lib_name, pkg_name)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500211
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500212 pipe_drivers_root = os.path.join(d.getVar('libdir'), "gallium-pipe")
Brad Bishop19323692019-04-05 15:28:33 -0400213 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 -0500214}
215
216PACKAGESPLITFUNCS_prepend = "mesa_populate_packages "
217
218PACKAGES_DYNAMIC += "^mesa-driver-.*"
219
Brad Bishop19323692019-04-05 15:28:33 -0400220FILES_mesa-megadriver = "${libdir}/dri/* ${datadir}/drirc.d/00-mesa-defaults.conf"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500221FILES_mesa-vulkan-drivers = "${libdir}/libvulkan_*.so ${datadir}/vulkan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500222FILES_libegl-mesa = "${libdir}/libEGL.so.*"
223FILES_libgbm = "${libdir}/libgbm.so.*"
224FILES_libgles1-mesa = "${libdir}/libGLESv1*.so.*"
225FILES_libgles2-mesa = "${libdir}/libGLESv2.so.*"
226FILES_libgl-mesa = "${libdir}/libGL.so.*"
227FILES_libglapi = "${libdir}/libglapi.so.*"
228FILES_libosmesa = "${libdir}/libOSMesa.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500229FILES_libxatracker = "${libdir}/libxatracker.so.*"
230
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500231FILES_${PN}-dev = "${libdir}/pkgconfig/dri.pc ${includedir}/vulkan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500232FILES_libegl-mesa-dev = "${libdir}/libEGL.* ${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc"
233FILES_libgbm-dev = "${libdir}/libgbm.* ${libdir}/pkgconfig/gbm.pc ${includedir}/gbm.h"
234FILES_libgl-mesa-dev = "${libdir}/libGL.* ${includedir}/GL ${libdir}/pkgconfig/gl.pc"
235FILES_libglapi-dev = "${libdir}/libglapi.*"
236FILES_libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc"
237FILES_libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc"
238FILES_libgles3-mesa-dev = "${includedir}/GLES3"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500239FILES_libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500240FILES_libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \
241 ${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \
242 ${libdir}/pkgconfig/xatracker.pc"
Brad Bishop19323692019-04-05 15:28:33 -0400243
244# Fix upgrade path from mesa to mesa-megadriver
245RREPLACES_mesa-megadriver = "mesa"
246RCONFLICTS_mesa-megadriver = "mesa"
247RPROVIDES_mesa-megadriver = "mesa"