blob: 60d07f536c8222200621ab4eb589f40f46090708 [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 Bishop6e60e8b2018-02-01 10:27:11 -050097
Patrick Williamsc124f4f2015-09-15 14:41:29 -050098GALLIUMDRIVERS = "swrast"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050099GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'etnaviv', ',etnaviv', '', d)}"
Brad Bishop393846f2019-05-20 12:24:11 -0400100GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'kmsro', ',kmsro', '', d)}"
Brad Bishop19323692019-04-05 15:28:33 -0400101
102# radeonsi requires LLVM
103GALLIUMDRIVERS_LLVM33 = "${@bb.utils.contains('PACKAGECONFIG', 'r600', ',radeonsi', '', d)}"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400104GALLIUMDRIVERS_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 -0500105GALLIUMDRIVERS_LLVM = "r300,svga,nouveau${@',${GALLIUMDRIVERS_LLVM33}' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
Brad Bishop19323692019-04-05 15:28:33 -0400106
107PACKAGECONFIG[r600] = ""
108
109GALLIUMDRIVERS_append = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}"
110GALLIUMDRIVERS_append = "${@bb.utils.contains('PACKAGECONFIG', 'r600', ',r600', '', d)}"
111GALLIUMDRIVERS_append = ",virgl"
112
Brad Bishop393846f2019-05-20 12:24:11 -0400113PACKAGECONFIG[gallium] = "-Dgallium-drivers=${GALLIUMDRIVERS}, -Dgallium-drivers=''"
Brad Bishop393846f2019-05-20 12:24:11 -0400114PACKAGECONFIG[gallium-llvm] = "-Dllvm=true -Dshared-llvm=true, -Dllvm=false, llvm${MESA_LLVM_RELEASE} llvm-native \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500115 ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
Brad Bishop393846f2019-05-20 12:24:11 -0400116PACKAGECONFIG[xa] = "-Dgallium-xa=true, -Dgallium-xa=false"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500117
Brad Bishop96ff1982019-08-19 13:50:42 -0400118PACKAGECONFIG[lima] = ""
119GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'lima', ',lima', '', d)}"
120
Brad Bishop393846f2019-05-20 12:24:11 -0400121OSMESA = "${@bb.utils.contains('PACKAGECONFIG', 'gallium', 'gallium', 'classic', d)}"
122PACKAGECONFIG[osmesa] = "-Dosmesa=${OSMESA},-Dosmesa=none"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500123
Brad Bishop393846f2019-05-20 12:24:11 -0400124PACKAGECONFIG[unwind] = "-Dlibunwind=true,-Dlibunwind=false,libunwind"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500125
Brad Bishop393846f2019-05-20 12:24:11 -0400126# mesa tries to run cross-built gen_matypes on build machine to get struct size information
127EXTRA_OEMESON_append = " -Dasm=false"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800128
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500129# llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2)
130FULL_OPTIMIZATION_append = " -fno-omit-frame-pointer"
131
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500132CFLAGS_append_armv5 = " -DMISSING_64BIT_ATOMICS"
133
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500134# Remove the mesa dependency on mesa-dev, as mesa is empty
135RDEPENDS_${PN}-dev = ""
136
Brad Bishop37a0e4d2017-12-04 01:01:44 -0500137# Add dependency so that GLES3 header don't need to be added manually
138RDEPENDS_libgles2-mesa-dev += "libgles3-mesa-dev"
139
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500140PACKAGES =+ "libegl-mesa libegl-mesa-dev \
141 libosmesa libosmesa-dev \
142 libgl-mesa libgl-mesa-dev \
143 libglapi libglapi-dev \
144 libgbm libgbm-dev \
145 libgles1-mesa libgles1-mesa-dev \
146 libgles2-mesa libgles2-mesa-dev \
147 libgles3-mesa libgles3-mesa-dev \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500148 libxatracker libxatracker-dev \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500149 mesa-megadriver mesa-vulkan-drivers \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500150 "
151
152do_install_append () {
153 # Drivers never need libtool .la files
154 rm -f ${D}${libdir}/dri/*.la
155 rm -f ${D}${libdir}/egl/*.la
156 rm -f ${D}${libdir}/gallium-pipe/*.la
157 rm -f ${D}${libdir}/gbm/*.la
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500158
Brad Bishop19323692019-04-05 15:28:33 -0400159 # it was packaged in libdricore9.1.3-1 and preventing upgrades when debian.bbclass was used
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500160 chrpath --delete ${D}${libdir}/dri/*_dri.so || true
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800161
162 # libwayland-egl has been moved to wayland 1.15+
163 rm -f ${D}${libdir}/libwayland-egl*
164 rm -f ${D}${libdir}/pkgconfig/wayland-egl.pc
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500165}
166
167# For the packages that make up the OpenGL interfaces, inject variables so that
168# they don't get Debian-renamed (which would remove the -mesa suffix), and
169# RPROVIDEs/RCONFLICTs on the generic libgl name.
170python __anonymous() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500171 pkgconfig = (d.getVar('PACKAGECONFIG') or "").split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500172 for p in (("egl", "libegl", "libegl1"),
173 ("dri", "libgl", "libgl1"),
174 ("gles", "libgles1", "libglesv1-cm1"),
175 ("gles", "libgles2", "libglesv2-2"),
176 ("gles", "libgles3",)):
177 if not p[0] in pkgconfig:
178 continue
179 fullp = p[1] + "-mesa"
180 pkgs = " ".join(p[1:])
181 d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1")
182 d.appendVar("RREPLACES_" + fullp, pkgs)
183 d.appendVar("RPROVIDES_" + fullp, pkgs)
184 d.appendVar("RCONFLICTS_" + fullp, pkgs)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500185
186 d.appendVar("RRECOMMENDS_" + fullp, " mesa-megadriver")
187
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500188 # For -dev, the first element is both the Debian and original name
189 fullp += "-dev"
190 pkgs = p[1] + "-dev"
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)
195}
196
197python mesa_populate_packages() {
198 pkgs = ['mesa', 'mesa-dev', 'mesa-dbg']
199 for pkg in pkgs:
200 d.setVar("RPROVIDES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
201 d.setVar("RCONFLICTS_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
202 d.setVar("RREPLACES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
203
204 import re
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500205 dri_drivers_root = oe.path.join(d.getVar('PKGD'), d.getVar('libdir'), "dri")
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600206 if os.path.isdir(dri_drivers_root):
207 dri_pkgs = os.listdir(dri_drivers_root)
208 lib_name = d.expand("${MLPREFIX}mesa-megadriver")
209 for p in dri_pkgs:
Brad Bishop19323692019-04-05 15:28:33 -0400210 m = re.match(r'^(.*)_dri\.so$', p)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600211 if m:
212 pkg_name = " ${MLPREFIX}mesa-driver-%s" % legitimize_package_name(m.group(1))
213 d.appendVar("RPROVIDES_%s" % lib_name, pkg_name)
214 d.appendVar("RCONFLICTS_%s" % lib_name, pkg_name)
215 d.appendVar("RREPLACES_%s" % lib_name, pkg_name)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500216
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500217 pipe_drivers_root = os.path.join(d.getVar('libdir'), "gallium-pipe")
Brad Bishop19323692019-04-05 15:28:33 -0400218 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 -0500219}
220
221PACKAGESPLITFUNCS_prepend = "mesa_populate_packages "
222
223PACKAGES_DYNAMIC += "^mesa-driver-.*"
224
Brad Bishop19323692019-04-05 15:28:33 -0400225FILES_mesa-megadriver = "${libdir}/dri/* ${datadir}/drirc.d/00-mesa-defaults.conf"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500226FILES_mesa-vulkan-drivers = "${libdir}/libvulkan_*.so ${datadir}/vulkan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500227FILES_libegl-mesa = "${libdir}/libEGL.so.*"
228FILES_libgbm = "${libdir}/libgbm.so.*"
229FILES_libgles1-mesa = "${libdir}/libGLESv1*.so.*"
230FILES_libgles2-mesa = "${libdir}/libGLESv2.so.*"
231FILES_libgl-mesa = "${libdir}/libGL.so.*"
232FILES_libglapi = "${libdir}/libglapi.so.*"
233FILES_libosmesa = "${libdir}/libOSMesa.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500234FILES_libxatracker = "${libdir}/libxatracker.so.*"
235
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500236FILES_${PN}-dev = "${libdir}/pkgconfig/dri.pc ${includedir}/vulkan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500237FILES_libegl-mesa-dev = "${libdir}/libEGL.* ${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc"
238FILES_libgbm-dev = "${libdir}/libgbm.* ${libdir}/pkgconfig/gbm.pc ${includedir}/gbm.h"
239FILES_libgl-mesa-dev = "${libdir}/libGL.* ${includedir}/GL ${libdir}/pkgconfig/gl.pc"
240FILES_libglapi-dev = "${libdir}/libglapi.*"
241FILES_libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc"
242FILES_libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc"
243FILES_libgles3-mesa-dev = "${includedir}/GLES3"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500244FILES_libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500245FILES_libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \
246 ${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \
247 ${libdir}/pkgconfig/xatracker.pc"
Brad Bishop19323692019-04-05 15:28:33 -0400248
249# Fix upgrade path from mesa to mesa-megadriver
250RREPLACES_mesa-megadriver = "mesa"
251RCONFLICTS_mesa-megadriver = "mesa"
252RPROVIDES_mesa-megadriver = "mesa"