1SUMMARY = "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" 13LIC_FILES_CHKSUM = "file://docs/license.html;md5=725f991a1cc322aa7a0cd3a2016621c4" 14 15PE = "2" 16 17DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native python3-mako-native gettext-native" 18EXTRANATIVEPATH += "chrpath-native" 19PROVIDES = " \ 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 " 26 27inherit meson pkgconfig python3native gettext distro_features_check 28 29BBCLASSEXTEND = "native nativesdk" 30 31ANY_OF_DISTRO_FEATURES_class-target = "opengl vulkan" 32 33PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)} \ 34 ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'drm', '', d)} \ 35 surfaceless" 36 37export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config" 38export YOCTO_ALTERNATE_MULTILIB_NAME = "${base_libdir}" 39 40EXTRA_OEMESON = " \ 41 -Dshared-glapi=true \ 42 -Dgallium-opencl=disabled \ 43 -Dglx-read-only-text=true \ 44 -Dplatforms='${@",".join("${PLATFORMS}".split())}' \ 45" 46 47PACKAGECONFIG_class-target ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland vulkan', d)} \ 48 ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl egl gles gbm dri gallium', '', d)} \ 49 ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11 dri3', '', d)} \ 50 ${@bb.utils.contains('DISTRO_FEATURES', 'x11 vulkan', 'dri3', '', d)} \ 51 glx-tls \ 52 " 53PACKAGECONFIG_class-native ?= "gbm dri egl opengl" 54PACKAGECONFIG_class-nativesdk ?= "gbm dri egl opengl" 55 56PACKAGECONFIG_remove_libc-musl = "glx-tls" 57 58# "gbm" requires "dri", "opengl" 59PACKAGECONFIG[gbm] = "-Dgbm=true,-Dgbm=false" 60 61X11_DEPS = "xorgproto virtual/libx11 libxext libxxf86vm libxdamage libxfixes xrandr" 62# "x11" requires "opengl" 63PACKAGECONFIG[x11] = ",-Dglx=disabled,${X11_DEPS}" 64PACKAGECONFIG[glx-tls] = "-Dglx-tls=true, -Dglx-tls=false" 65PACKAGECONFIG[xvmc] = "-Dgallium-xvmc=true,-Dgallium-xvmc=false,libxvmc" 66PACKAGECONFIG[wayland] = ",,wayland-native wayland libdrm wayland-protocols" 67 68DRIDRIVERS_class-native = "swrast" 69DRIDRIVERS_class-nativesdk = "swrast" 70DRIDRIVERS_append_x86_class-target = ",r100,r200,nouveau,i965,i915" 71DRIDRIVERS_append_x86-64_class-target = ",r100,r200,nouveau,i965,i915" 72# "dri" requires "opengl" 73PACKAGECONFIG[dri] = "-Ddri=true -Ddri-drivers=${DRIDRIVERS}, -Ddri=false -Ddri-drivers='', xorgproto libdrm" 74PACKAGECONFIG[dri3] = "-Ddri3=true, -Ddri3=false, xorgproto libxshmfence" 75 76# Vulkan drivers need dri3 enabled 77# radeon could be enabled as well but requires gallium-llvm with llvm >= 3.9 78VULKAN_DRIVERS = "" 79VULKAN_DRIVERS_append_x86_class-target = ",intel" 80VULKAN_DRIVERS_append_x86-64_class-target = ",intel" 81PACKAGECONFIG[vulkan] = "-Dvulkan-drivers=${VULKAN_DRIVERS}, -Dvulkan-drivers=''," 82 83PACKAGECONFIG[opengl] = "-Dopengl=true, -Dopengl=false" 84 85# "gles" requires "opengl" 86PACKAGECONFIG[gles] = "-Dgles1=true -Dgles2=true, -Dgles1=false -Dgles2=false" 87 88# "egl" requires "dri", "opengl" 89PACKAGECONFIG[egl] = "-Degl=true, -Degl=false" 90 91PACKAGECONFIG[etnaviv] = "" 92PACKAGECONFIG[kmsro] = "" 93 94GALLIUMDRIVERS = "swrast" 95GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'etnaviv', ',etnaviv', '', d)}" 96GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'kmsro', ',kmsro', '', d)}" 97 98# radeonsi requires LLVM 99GALLIUMDRIVERS_LLVM33 = "${@bb.utils.contains('PACKAGECONFIG', 'r600', ',radeonsi', '', d)}" 100GALLIUMDRIVERS_LLVM33_ENABLED = "${@oe.utils.version_less_or_equal('MESA_LLVM_RELEASE', '3.2', False, len('${GALLIUMDRIVERS_LLVM33}') > 0, d)}" 101GALLIUMDRIVERS_LLVM = "r300,svga,nouveau${@',${GALLIUMDRIVERS_LLVM33}' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}" 102 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 109PACKAGECONFIG[gallium] = "-Dgallium-drivers=${GALLIUMDRIVERS}, -Dgallium-drivers=''" 110MESA_LLVM_RELEASE ?= "8.0.0" 111PACKAGECONFIG[gallium-llvm] = "-Dllvm=true -Dshared-llvm=true, -Dllvm=false, llvm${MESA_LLVM_RELEASE} llvm-native \ 112 ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}" 113export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}" 114PACKAGECONFIG[xa] = "-Dgallium-xa=true, -Dgallium-xa=false" 115 116PACKAGECONFIG[lima] = "" 117GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'lima', ',lima', '', d)}" 118 119OSMESA = "${@bb.utils.contains('PACKAGECONFIG', 'gallium', 'gallium', 'classic', d)}" 120PACKAGECONFIG[osmesa] = "-Dosmesa=${OSMESA},-Dosmesa=none" 121 122PACKAGECONFIG[unwind] = "-Dlibunwind=true,-Dlibunwind=false,libunwind" 123 124# mesa tries to run cross-built gen_matypes on build machine to get struct size information 125EXTRA_OEMESON_append = " -Dasm=false" 126 127# llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2) 128FULL_OPTIMIZATION_append = " -fno-omit-frame-pointer" 129 130CFLAGS_append_armv5 = " -DMISSING_64BIT_ATOMICS" 131 132# Remove the mesa dependency on mesa-dev, as mesa is empty 133RDEPENDS_${PN}-dev = "" 134 135# Add dependency so that GLES3 header don't need to be added manually 136RDEPENDS_libgles2-mesa-dev += "libgles3-mesa-dev" 137 138PACKAGES =+ "libegl-mesa libegl-mesa-dev \ 139 libosmesa libosmesa-dev \ 140 libgl-mesa libgl-mesa-dev \ 141 libglapi libglapi-dev \ 142 libgbm libgbm-dev \ 143 libgles1-mesa libgles1-mesa-dev \ 144 libgles2-mesa libgles2-mesa-dev \ 145 libgles3-mesa libgles3-mesa-dev \ 146 libxatracker libxatracker-dev \ 147 mesa-megadriver mesa-vulkan-drivers \ 148 " 149 150do_install_append () { 151 # Drivers never need libtool .la files 152 rm -f ${D}${libdir}/dri/*.la 153 rm -f ${D}${libdir}/egl/*.la 154 rm -f ${D}${libdir}/gallium-pipe/*.la 155 rm -f ${D}${libdir}/gbm/*.la 156 157 # it was packaged in libdricore9.1.3-1 and preventing upgrades when debian.bbclass was used 158 chrpath --delete ${D}${libdir}/dri/*_dri.so || true 159 160 # libwayland-egl has been moved to wayland 1.15+ 161 rm -f ${D}${libdir}/libwayland-egl* 162 rm -f ${D}${libdir}/pkgconfig/wayland-egl.pc 163} 164 165# For the packages that make up the OpenGL interfaces, inject variables so that 166# they don't get Debian-renamed (which would remove the -mesa suffix), and 167# RPROVIDEs/RCONFLICTs on the generic libgl name. 168python __anonymous() { 169 pkgconfig = (d.getVar('PACKAGECONFIG') or "").split() 170 for p in (("egl", "libegl", "libegl1"), 171 ("dri", "libgl", "libgl1"), 172 ("gles", "libgles1", "libglesv1-cm1"), 173 ("gles", "libgles2", "libglesv2-2"), 174 ("gles", "libgles3",)): 175 if not p[0] in pkgconfig: 176 continue 177 fullp = p[1] + "-mesa" 178 pkgs = " ".join(p[1:]) 179 d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1") 180 d.appendVar("RREPLACES_" + fullp, pkgs) 181 d.appendVar("RPROVIDES_" + fullp, pkgs) 182 d.appendVar("RCONFLICTS_" + fullp, pkgs) 183 184 d.appendVar("RRECOMMENDS_" + fullp, " mesa-megadriver") 185 186 # For -dev, the first element is both the Debian and original name 187 fullp += "-dev" 188 pkgs = p[1] + "-dev" 189 d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1") 190 d.appendVar("RREPLACES_" + fullp, pkgs) 191 d.appendVar("RPROVIDES_" + fullp, pkgs) 192 d.appendVar("RCONFLICTS_" + fullp, pkgs) 193} 194 195python mesa_populate_packages() { 196 pkgs = ['mesa', 'mesa-dev', 'mesa-dbg'] 197 for pkg in pkgs: 198 d.setVar("RPROVIDES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1)) 199 d.setVar("RCONFLICTS_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1)) 200 d.setVar("RREPLACES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1)) 201 202 import re 203 dri_drivers_root = oe.path.join(d.getVar('PKGD'), d.getVar('libdir'), "dri") 204 if os.path.isdir(dri_drivers_root): 205 dri_pkgs = os.listdir(dri_drivers_root) 206 lib_name = d.expand("${MLPREFIX}mesa-megadriver") 207 for p in dri_pkgs: 208 m = re.match(r'^(.*)_dri\.so$', p) 209 if m: 210 pkg_name = " ${MLPREFIX}mesa-driver-%s" % legitimize_package_name(m.group(1)) 211 d.appendVar("RPROVIDES_%s" % lib_name, pkg_name) 212 d.appendVar("RCONFLICTS_%s" % lib_name, pkg_name) 213 d.appendVar("RREPLACES_%s" % lib_name, pkg_name) 214 215 pipe_drivers_root = os.path.join(d.getVar('libdir'), "gallium-pipe") 216 do_split_packages(d, pipe_drivers_root, r'^pipe_(.*)\.so$', 'mesa-driver-pipe-%s', 'Mesa %s pipe driver', extra_depends='') 217} 218 219PACKAGESPLITFUNCS_prepend = "mesa_populate_packages " 220 221PACKAGES_DYNAMIC += "^mesa-driver-.*" 222 223FILES_mesa-megadriver = "${libdir}/dri/* ${datadir}/drirc.d/00-mesa-defaults.conf" 224FILES_mesa-vulkan-drivers = "${libdir}/libvulkan_*.so ${datadir}/vulkan" 225FILES_libegl-mesa = "${libdir}/libEGL.so.*" 226FILES_libgbm = "${libdir}/libgbm.so.*" 227FILES_libgles1-mesa = "${libdir}/libGLESv1*.so.*" 228FILES_libgles2-mesa = "${libdir}/libGLESv2.so.*" 229FILES_libgl-mesa = "${libdir}/libGL.so.*" 230FILES_libglapi = "${libdir}/libglapi.so.*" 231FILES_libosmesa = "${libdir}/libOSMesa.so.*" 232FILES_libxatracker = "${libdir}/libxatracker.so.*" 233 234FILES_${PN}-dev = "${libdir}/pkgconfig/dri.pc ${includedir}/vulkan" 235FILES_libegl-mesa-dev = "${libdir}/libEGL.* ${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc" 236FILES_libgbm-dev = "${libdir}/libgbm.* ${libdir}/pkgconfig/gbm.pc ${includedir}/gbm.h" 237FILES_libgl-mesa-dev = "${libdir}/libGL.* ${includedir}/GL ${libdir}/pkgconfig/gl.pc" 238FILES_libglapi-dev = "${libdir}/libglapi.*" 239FILES_libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc" 240FILES_libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc" 241FILES_libgles3-mesa-dev = "${includedir}/GLES3" 242FILES_libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc" 243FILES_libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \ 244 ${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \ 245 ${libdir}/pkgconfig/xatracker.pc" 246 247# Fix upgrade path from mesa to mesa-megadriver 248RREPLACES_mesa-megadriver = "mesa" 249RCONFLICTS_mesa-megadriver = "mesa" 250RPROVIDES_mesa-megadriver = "mesa" 251