Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | SUMMARY = "A free implementation of the OpenGL API" |
| 2 | DESCRIPTION = "Mesa is an open-source implementation of the OpenGL specification - \ |
| 3 | a system for rendering interactive 3D graphics. \ |
| 4 | A variety of device drivers allows Mesa to be used in many different environments \ |
| 5 | ranging from software emulation to complete hardware acceleration for modern GPUs. \ |
| 6 | Mesa is used as part of the overall Direct Rendering Infrastructure and X.org \ |
| 7 | environment." |
| 8 | |
| 9 | HOMEPAGE = "http://mesa3d.org" |
| 10 | BUGTRACKER = "https://bugs.freedesktop.org" |
| 11 | SECTION = "x11" |
| 12 | LICENSE = "MIT" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 13 | LIC_FILES_CHKSUM = "file://docs/license.html;md5=725f991a1cc322aa7a0cd3a2016621c4" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 14 | |
| 15 | PE = "2" |
| 16 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 17 | DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native" |
| 18 | EXTRANATIVEPATH += "chrpath-native" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 19 | PROVIDES = "virtual/libgl virtual/libgles1 virtual/libgles2 virtual/egl virtual/mesa" |
| 20 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 21 | inherit autotools pkgconfig gettext distro_features_check |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 22 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 23 | ANY_OF_DISTRO_FEATURES = "opengl vulkan" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 24 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 25 | PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)} \ |
| 26 | ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'drm', '', d)}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 27 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 28 | export LLVM_CONFIG = "${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}" |
| 29 | export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config" |
| 30 | EXTRA_OECONF = "--enable-shared-glapi \ |
| 31 | --disable-opencl \ |
| 32 | --with-llvm-prefix=${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE} \ |
| 33 | --with-platforms='${PLATFORMS}'" |
| 34 | |
| 35 | PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland vulkan', d)} \ |
| 36 | ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl egl gles gbm dri', '', d)} \ |
| 37 | ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11', '', d)} \ |
| 38 | ${@bb.utils.contains('DISTRO_FEATURES', 'x11 vulkan', 'dri3', '', d)} \ |
| 39 | " |
| 40 | |
| 41 | # "gbm" requires "dri", "opengl" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 42 | PACKAGECONFIG[gbm] = "--enable-gbm,--disable-gbm" |
| 43 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 44 | X11_DEPS = "xf86driproto glproto virtual/libx11 libxext libxxf86vm libxdamage libxfixes" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 45 | # "x11" requires "opengl" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 46 | PACKAGECONFIG[x11] = "--enable-glx-tls,--disable-glx,${X11_DEPS}" |
| 47 | PACKAGECONFIG[xvmc] = "--enable-xvmc,--disable-xvmc,libxvmc" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 48 | PACKAGECONFIG[wayland] = ",,wayland-native wayland libdrm" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 49 | |
| 50 | DRIDRIVERS = "swrast" |
| 51 | DRIDRIVERS_append_x86 = ",radeon,r200,nouveau,i965,i915" |
| 52 | DRIDRIVERS_append_x86-64 = ",radeon,r200,nouveau,i965,i915" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 53 | # "dri" requires "opengl" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 54 | PACKAGECONFIG[dri] = "--enable-dri --with-dri-drivers=${DRIDRIVERS}, --disable-dri, dri2proto libdrm" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 55 | PACKAGECONFIG[dri3] = "--enable-dri3, --disable-dri3, dri3proto presentproto libxshmfence" |
| 56 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 57 | # Vulkan drivers need dri3 enabled |
| 58 | # radeon could be enabled as well but requires gallium-llvm with llvm >= 3.9 |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 59 | VULKAN_DRIVERS = "" |
| 60 | VULKAN_DRIVERS_append_x86 = ",intel" |
| 61 | VULKAN_DRIVERS_append_x86-64 = ",intel" |
| 62 | PACKAGECONFIG[vulkan] = "--with-vulkan-drivers=${VULKAN_DRIVERS}, --without-vulkan-drivers" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 63 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 64 | PACKAGECONFIG[opengl] = "--enable-opengl, --disable-opengl" |
| 65 | |
| 66 | # "gles" requires "opengl" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 67 | PACKAGECONFIG[gles] = "--enable-gles1 --enable-gles2, --disable-gles1 --disable-gles2" |
| 68 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 69 | # "egl" requires "dri", "opengl" |
| 70 | PACKAGECONFIG[egl] = "--enable-egl, --disable-egl" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 71 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 72 | PACKAGECONFIG[etnaviv] = "" |
| 73 | PACKAGECONFIG[imx] = "" |
| 74 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 75 | GALLIUMDRIVERS = "swrast" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 76 | GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'etnaviv', ',etnaviv', '', d)}" |
| 77 | GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'imx', ',imx', '', d)}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 78 | GALLIUMDRIVERS_LLVM33 = "${@bb.utils.contains('PACKAGECONFIG', 'r600', 'radeonsi,r600', '', d)}" |
| 79 | PACKAGECONFIG[r600] = "" |
| 80 | GALLIUMDRIVERS_LLVM33_ENABLED = "${@base_version_less_or_equal('MESA_LLVM_RELEASE', '3.2', False, len('${GALLIUMDRIVERS_LLVM33}') > 0, d)}" |
| 81 | GALLIUMDRIVERS_LLVM = "r300,svga,nouveau${@',${GALLIUMDRIVERS_LLVM33}' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}" |
| 82 | GALLIUMDRIVERS_append_x86 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}" |
| 83 | GALLIUMDRIVERS_append_x86-64 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}" |
| 84 | # keep --with-gallium-drivers separate, because when only one of gallium versions is enabled, other 2 were adding --without-gallium-drivers |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 85 | PACKAGECONFIG[gallium] = "--enable-texture-float --with-gallium-drivers=${GALLIUMDRIVERS}, --without-gallium-drivers" |
| 86 | MESA_LLVM_RELEASE ?= "5.0" |
| 87 | PACKAGECONFIG[gallium-llvm] = "--enable-llvm --enable-llvm-shared-libs, --disable-llvm, llvm${MESA_LLVM_RELEASE} llvm-native \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 88 | ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}" |
| 89 | export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}" |
| 90 | PACKAGECONFIG[xa] = "--enable-xa, --disable-xa" |
| 91 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 92 | OSMESA = "${@bb.utils.contains('PACKAGECONFIG', 'gallium', 'gallium-osmesa', 'osmesa', d)}" |
| 93 | PACKAGECONFIG[osmesa] = "--enable-${OSMESA},--disable-${OSMESA}" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 94 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 95 | PACKAGECONFIG[unwind] = "--enable-libunwind,--disable-libunwind,libunwind" |
| 96 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 97 | # llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2) |
| 98 | FULL_OPTIMIZATION_append = " -fno-omit-frame-pointer" |
| 99 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 100 | CFLAGS_append_armv5 = " -DMISSING_64BIT_ATOMICS" |
| 101 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 102 | # Multiple virtual/gl providers being built breaks staging |
| 103 | EXCLUDE_FROM_WORLD = "1" |
| 104 | |
| 105 | # Remove the mesa dependency on mesa-dev, as mesa is empty |
| 106 | RDEPENDS_${PN}-dev = "" |
| 107 | |
Brad Bishop | 37a0e4d | 2017-12-04 01:01:44 -0500 | [diff] [blame] | 108 | # Add dependency so that GLES3 header don't need to be added manually |
| 109 | RDEPENDS_libgles2-mesa-dev += "libgles3-mesa-dev" |
| 110 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 111 | PACKAGES =+ "libegl-mesa libegl-mesa-dev \ |
| 112 | libosmesa libosmesa-dev \ |
| 113 | libgl-mesa libgl-mesa-dev \ |
| 114 | libglapi libglapi-dev \ |
| 115 | libgbm libgbm-dev \ |
| 116 | libgles1-mesa libgles1-mesa-dev \ |
| 117 | libgles2-mesa libgles2-mesa-dev \ |
| 118 | libgles3-mesa libgles3-mesa-dev \ |
| 119 | libwayland-egl libwayland-egl-dev \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 120 | libxatracker libxatracker-dev \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 121 | mesa-megadriver mesa-vulkan-drivers \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 122 | " |
| 123 | |
| 124 | do_install_append () { |
| 125 | # Drivers never need libtool .la files |
| 126 | rm -f ${D}${libdir}/dri/*.la |
| 127 | rm -f ${D}${libdir}/egl/*.la |
| 128 | rm -f ${D}${libdir}/gallium-pipe/*.la |
| 129 | rm -f ${D}${libdir}/gbm/*.la |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 130 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 131 | # it was packaged in libdricore9.1.3-1 and preventing upgrades when debian.bbclass was used |
| 132 | rm -f ${D}${sysconfdir}/drirc |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 133 | chrpath --delete ${D}${libdir}/dri/*_dri.so || true |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | # For the packages that make up the OpenGL interfaces, inject variables so that |
| 137 | # they don't get Debian-renamed (which would remove the -mesa suffix), and |
| 138 | # RPROVIDEs/RCONFLICTs on the generic libgl name. |
| 139 | python __anonymous() { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 140 | pkgconfig = (d.getVar('PACKAGECONFIG') or "").split() |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 141 | for p in (("egl", "libegl", "libegl1"), |
| 142 | ("dri", "libgl", "libgl1"), |
| 143 | ("gles", "libgles1", "libglesv1-cm1"), |
| 144 | ("gles", "libgles2", "libglesv2-2"), |
| 145 | ("gles", "libgles3",)): |
| 146 | if not p[0] in pkgconfig: |
| 147 | continue |
| 148 | fullp = p[1] + "-mesa" |
| 149 | pkgs = " ".join(p[1:]) |
| 150 | d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1") |
| 151 | d.appendVar("RREPLACES_" + fullp, pkgs) |
| 152 | d.appendVar("RPROVIDES_" + fullp, pkgs) |
| 153 | d.appendVar("RCONFLICTS_" + fullp, pkgs) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 154 | |
| 155 | d.appendVar("RRECOMMENDS_" + fullp, " mesa-megadriver") |
| 156 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 157 | # For -dev, the first element is both the Debian and original name |
| 158 | fullp += "-dev" |
| 159 | pkgs = p[1] + "-dev" |
| 160 | d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1") |
| 161 | d.appendVar("RREPLACES_" + fullp, pkgs) |
| 162 | d.appendVar("RPROVIDES_" + fullp, pkgs) |
| 163 | d.appendVar("RCONFLICTS_" + fullp, pkgs) |
| 164 | } |
| 165 | |
| 166 | python mesa_populate_packages() { |
| 167 | pkgs = ['mesa', 'mesa-dev', 'mesa-dbg'] |
| 168 | for pkg in pkgs: |
| 169 | d.setVar("RPROVIDES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1)) |
| 170 | d.setVar("RCONFLICTS_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1)) |
| 171 | d.setVar("RREPLACES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1)) |
| 172 | |
| 173 | import re |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 174 | dri_drivers_root = oe.path.join(d.getVar('PKGD'), d.getVar('libdir'), "dri") |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 175 | if os.path.isdir(dri_drivers_root): |
| 176 | dri_pkgs = os.listdir(dri_drivers_root) |
| 177 | lib_name = d.expand("${MLPREFIX}mesa-megadriver") |
| 178 | for p in dri_pkgs: |
| 179 | m = re.match('^(.*)_dri\.so$', p) |
| 180 | if m: |
| 181 | pkg_name = " ${MLPREFIX}mesa-driver-%s" % legitimize_package_name(m.group(1)) |
| 182 | d.appendVar("RPROVIDES_%s" % lib_name, pkg_name) |
| 183 | d.appendVar("RCONFLICTS_%s" % lib_name, pkg_name) |
| 184 | d.appendVar("RREPLACES_%s" % lib_name, pkg_name) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 185 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 186 | pipe_drivers_root = os.path.join(d.getVar('libdir'), "gallium-pipe") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 187 | do_split_packages(d, pipe_drivers_root, '^pipe_(.*)\.so$', 'mesa-driver-pipe-%s', 'Mesa %s pipe driver', extra_depends='') |
| 188 | } |
| 189 | |
| 190 | PACKAGESPLITFUNCS_prepend = "mesa_populate_packages " |
| 191 | |
| 192 | PACKAGES_DYNAMIC += "^mesa-driver-.*" |
| 193 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 194 | FILES_${PN} += "${sysconfdir}/drirc" |
| 195 | FILES_mesa-megadriver = "${libdir}/dri/*" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 196 | FILES_mesa-vulkan-drivers = "${libdir}/libvulkan_*.so ${datadir}/vulkan" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 197 | FILES_libegl-mesa = "${libdir}/libEGL.so.*" |
| 198 | FILES_libgbm = "${libdir}/libgbm.so.*" |
| 199 | FILES_libgles1-mesa = "${libdir}/libGLESv1*.so.*" |
| 200 | FILES_libgles2-mesa = "${libdir}/libGLESv2.so.*" |
| 201 | FILES_libgl-mesa = "${libdir}/libGL.so.*" |
| 202 | FILES_libglapi = "${libdir}/libglapi.so.*" |
| 203 | FILES_libosmesa = "${libdir}/libOSMesa.so.*" |
| 204 | FILES_libwayland-egl = "${libdir}/libwayland-egl.so.*" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 205 | FILES_libxatracker = "${libdir}/libxatracker.so.*" |
| 206 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 207 | FILES_${PN}-dev = "${libdir}/pkgconfig/dri.pc ${includedir}/vulkan" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 208 | FILES_libegl-mesa-dev = "${libdir}/libEGL.* ${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc" |
| 209 | FILES_libgbm-dev = "${libdir}/libgbm.* ${libdir}/pkgconfig/gbm.pc ${includedir}/gbm.h" |
| 210 | FILES_libgl-mesa-dev = "${libdir}/libGL.* ${includedir}/GL ${libdir}/pkgconfig/gl.pc" |
| 211 | FILES_libglapi-dev = "${libdir}/libglapi.*" |
| 212 | FILES_libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc" |
| 213 | FILES_libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc" |
| 214 | FILES_libgles3-mesa-dev = "${includedir}/GLES3" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 215 | FILES_libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 216 | FILES_libwayland-egl-dev = "${libdir}/pkgconfig/wayland-egl.pc ${libdir}/libwayland-egl.*" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 217 | FILES_libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \ |
| 218 | ${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \ |
| 219 | ${libdir}/pkgconfig/xatracker.pc" |