blob: b501b7e726ddd1075518fef86cc45a3b11f80db3 [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 Bishopd7bf8c12018-02-25 22:55:05 -050017DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native"
18EXTRANATIVEPATH += "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 Bishop316dfdd2018-06-25 12:45:53 -040027inherit autotools pkgconfig python3native gettext distro_features_check
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028
Brad Bishopd7bf8c12018-02-25 22:55:05 -050029ANY_OF_DISTRO_FEATURES = "opengl vulkan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030
Brad Bishopd7bf8c12018-02-25 22:55:05 -050031PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)} \
32 ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'drm', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050033
Brad Bishopd7bf8c12018-02-25 22:55:05 -050034export LLVM_CONFIG = "${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}"
35export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config"
36EXTRA_OECONF = "--enable-shared-glapi \
37 --disable-opencl \
38 --with-llvm-prefix=${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE} \
39 --with-platforms='${PLATFORMS}'"
40
41PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland vulkan', d)} \
42 ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl egl gles gbm dri', '', d)} \
Brad Bishop316dfdd2018-06-25 12:45:53 -040043 ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11 dri3', '', d)} \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050044 ${@bb.utils.contains('DISTRO_FEATURES', 'x11 vulkan', 'dri3', '', d)} \
45 "
46
47# "gbm" requires "dri", "opengl"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060048PACKAGECONFIG[gbm] = "--enable-gbm,--disable-gbm"
49
Patrick Williamsc124f4f2015-09-15 14:41:29 -050050X11_DEPS = "xf86driproto glproto virtual/libx11 libxext libxxf86vm libxdamage libxfixes"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050051# "x11" requires "opengl"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050052PACKAGECONFIG[x11] = "--enable-glx-tls,--disable-glx,${X11_DEPS}"
53PACKAGECONFIG[xvmc] = "--enable-xvmc,--disable-xvmc,libxvmc"
Brad Bishop316dfdd2018-06-25 12:45:53 -040054PACKAGECONFIG[wayland] = ",,wayland-native wayland libdrm wayland-protocols"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050055
56DRIDRIVERS = "swrast"
57DRIDRIVERS_append_x86 = ",radeon,r200,nouveau,i965,i915"
58DRIDRIVERS_append_x86-64 = ",radeon,r200,nouveau,i965,i915"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050059# "dri" requires "opengl"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060060PACKAGECONFIG[dri] = "--enable-dri --with-dri-drivers=${DRIDRIVERS}, --disable-dri, dri2proto libdrm"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050061PACKAGECONFIG[dri3] = "--enable-dri3, --disable-dri3, dri3proto presentproto libxshmfence"
62
Brad Bishop6e60e8b2018-02-01 10:27:11 -050063# Vulkan drivers need dri3 enabled
64# radeon could be enabled as well but requires gallium-llvm with llvm >= 3.9
Brad Bishopd7bf8c12018-02-25 22:55:05 -050065VULKAN_DRIVERS = ""
66VULKAN_DRIVERS_append_x86 = ",intel"
67VULKAN_DRIVERS_append_x86-64 = ",intel"
Brad Bishop316dfdd2018-06-25 12:45:53 -040068PACKAGECONFIG[vulkan] = "--with-vulkan-drivers=${VULKAN_DRIVERS}, --without-vulkan-drivers, python3-mako-native"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050069
Brad Bishopd7bf8c12018-02-25 22:55:05 -050070PACKAGECONFIG[opengl] = "--enable-opengl, --disable-opengl"
71
72# "gles" requires "opengl"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050073PACKAGECONFIG[gles] = "--enable-gles1 --enable-gles2, --disable-gles1 --disable-gles2"
74
Brad Bishopd7bf8c12018-02-25 22:55:05 -050075# "egl" requires "dri", "opengl"
76PACKAGECONFIG[egl] = "--enable-egl, --disable-egl"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050077
Brad Bishop6e60e8b2018-02-01 10:27:11 -050078PACKAGECONFIG[etnaviv] = ""
79PACKAGECONFIG[imx] = ""
80
Patrick Williamsc124f4f2015-09-15 14:41:29 -050081GALLIUMDRIVERS = "swrast"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050082GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'etnaviv', ',etnaviv', '', d)}"
83GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'imx', ',imx', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050084GALLIUMDRIVERS_LLVM33 = "${@bb.utils.contains('PACKAGECONFIG', 'r600', 'radeonsi,r600', '', d)}"
85PACKAGECONFIG[r600] = ""
Brad Bishop316dfdd2018-06-25 12:45:53 -040086GALLIUMDRIVERS_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 -050087GALLIUMDRIVERS_LLVM = "r300,svga,nouveau${@',${GALLIUMDRIVERS_LLVM33}' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
88GALLIUMDRIVERS_append_x86 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}"
89GALLIUMDRIVERS_append_x86-64 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}"
90# keep --with-gallium-drivers separate, because when only one of gallium versions is enabled, other 2 were adding --without-gallium-drivers
Brad Bishopd7bf8c12018-02-25 22:55:05 -050091PACKAGECONFIG[gallium] = "--enable-texture-float --with-gallium-drivers=${GALLIUMDRIVERS}, --without-gallium-drivers"
Brad Bishop316dfdd2018-06-25 12:45:53 -040092MESA_LLVM_RELEASE ?= "6.0"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050093PACKAGECONFIG[gallium-llvm] = "--enable-llvm --enable-llvm-shared-libs, --disable-llvm, llvm${MESA_LLVM_RELEASE} llvm-native \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050094 ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
95export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}"
96PACKAGECONFIG[xa] = "--enable-xa, --disable-xa"
97
Brad Bishop6e60e8b2018-02-01 10:27:11 -050098OSMESA = "${@bb.utils.contains('PACKAGECONFIG', 'gallium', 'gallium-osmesa', 'osmesa', d)}"
99PACKAGECONFIG[osmesa] = "--enable-${OSMESA},--disable-${OSMESA}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500100
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500101PACKAGECONFIG[unwind] = "--enable-libunwind,--disable-libunwind,libunwind"
102
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500103# llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2)
104FULL_OPTIMIZATION_append = " -fno-omit-frame-pointer"
105
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500106CFLAGS_append_armv5 = " -DMISSING_64BIT_ATOMICS"
107
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500108# Remove the mesa dependency on mesa-dev, as mesa is empty
109RDEPENDS_${PN}-dev = ""
110
Brad Bishop37a0e4d2017-12-04 01:01:44 -0500111# Add dependency so that GLES3 header don't need to be added manually
112RDEPENDS_libgles2-mesa-dev += "libgles3-mesa-dev"
113
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500114PACKAGES =+ "libegl-mesa libegl-mesa-dev \
115 libosmesa libosmesa-dev \
116 libgl-mesa libgl-mesa-dev \
117 libglapi libglapi-dev \
118 libgbm libgbm-dev \
119 libgles1-mesa libgles1-mesa-dev \
120 libgles2-mesa libgles2-mesa-dev \
121 libgles3-mesa libgles3-mesa-dev \
122 libwayland-egl libwayland-egl-dev \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500123 libxatracker libxatracker-dev \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500124 mesa-megadriver mesa-vulkan-drivers \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500125 "
126
127do_install_append () {
128 # Drivers never need libtool .la files
129 rm -f ${D}${libdir}/dri/*.la
130 rm -f ${D}${libdir}/egl/*.la
131 rm -f ${D}${libdir}/gallium-pipe/*.la
132 rm -f ${D}${libdir}/gbm/*.la
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500133
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500134 # it was packaged in libdricore9.1.3-1 and preventing upgrades when debian.bbclass was used
135 rm -f ${D}${sysconfdir}/drirc
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500136 chrpath --delete ${D}${libdir}/dri/*_dri.so || true
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500137}
138
139# For the packages that make up the OpenGL interfaces, inject variables so that
140# they don't get Debian-renamed (which would remove the -mesa suffix), and
141# RPROVIDEs/RCONFLICTs on the generic libgl name.
142python __anonymous() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500143 pkgconfig = (d.getVar('PACKAGECONFIG') or "").split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500144 for p in (("egl", "libegl", "libegl1"),
145 ("dri", "libgl", "libgl1"),
146 ("gles", "libgles1", "libglesv1-cm1"),
147 ("gles", "libgles2", "libglesv2-2"),
148 ("gles", "libgles3",)):
149 if not p[0] in pkgconfig:
150 continue
151 fullp = p[1] + "-mesa"
152 pkgs = " ".join(p[1:])
153 d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1")
154 d.appendVar("RREPLACES_" + fullp, pkgs)
155 d.appendVar("RPROVIDES_" + fullp, pkgs)
156 d.appendVar("RCONFLICTS_" + fullp, pkgs)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500157
158 d.appendVar("RRECOMMENDS_" + fullp, " mesa-megadriver")
159
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500160 # For -dev, the first element is both the Debian and original name
161 fullp += "-dev"
162 pkgs = p[1] + "-dev"
163 d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1")
164 d.appendVar("RREPLACES_" + fullp, pkgs)
165 d.appendVar("RPROVIDES_" + fullp, pkgs)
166 d.appendVar("RCONFLICTS_" + fullp, pkgs)
167}
168
169python mesa_populate_packages() {
170 pkgs = ['mesa', 'mesa-dev', 'mesa-dbg']
171 for pkg in pkgs:
172 d.setVar("RPROVIDES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
173 d.setVar("RCONFLICTS_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
174 d.setVar("RREPLACES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
175
176 import re
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500177 dri_drivers_root = oe.path.join(d.getVar('PKGD'), d.getVar('libdir'), "dri")
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600178 if os.path.isdir(dri_drivers_root):
179 dri_pkgs = os.listdir(dri_drivers_root)
180 lib_name = d.expand("${MLPREFIX}mesa-megadriver")
181 for p in dri_pkgs:
182 m = re.match('^(.*)_dri\.so$', p)
183 if m:
184 pkg_name = " ${MLPREFIX}mesa-driver-%s" % legitimize_package_name(m.group(1))
185 d.appendVar("RPROVIDES_%s" % lib_name, pkg_name)
186 d.appendVar("RCONFLICTS_%s" % lib_name, pkg_name)
187 d.appendVar("RREPLACES_%s" % lib_name, pkg_name)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500188
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500189 pipe_drivers_root = os.path.join(d.getVar('libdir'), "gallium-pipe")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500190 do_split_packages(d, pipe_drivers_root, '^pipe_(.*)\.so$', 'mesa-driver-pipe-%s', 'Mesa %s pipe driver', extra_depends='')
191}
192
193PACKAGESPLITFUNCS_prepend = "mesa_populate_packages "
194
195PACKAGES_DYNAMIC += "^mesa-driver-.*"
196
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500197FILES_${PN} += "${sysconfdir}/drirc"
198FILES_mesa-megadriver = "${libdir}/dri/*"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500199FILES_mesa-vulkan-drivers = "${libdir}/libvulkan_*.so ${datadir}/vulkan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500200FILES_libegl-mesa = "${libdir}/libEGL.so.*"
201FILES_libgbm = "${libdir}/libgbm.so.*"
202FILES_libgles1-mesa = "${libdir}/libGLESv1*.so.*"
203FILES_libgles2-mesa = "${libdir}/libGLESv2.so.*"
204FILES_libgl-mesa = "${libdir}/libGL.so.*"
205FILES_libglapi = "${libdir}/libglapi.so.*"
206FILES_libosmesa = "${libdir}/libOSMesa.so.*"
207FILES_libwayland-egl = "${libdir}/libwayland-egl.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500208FILES_libxatracker = "${libdir}/libxatracker.so.*"
209
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500210FILES_${PN}-dev = "${libdir}/pkgconfig/dri.pc ${includedir}/vulkan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500211FILES_libegl-mesa-dev = "${libdir}/libEGL.* ${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc"
212FILES_libgbm-dev = "${libdir}/libgbm.* ${libdir}/pkgconfig/gbm.pc ${includedir}/gbm.h"
213FILES_libgl-mesa-dev = "${libdir}/libGL.* ${includedir}/GL ${libdir}/pkgconfig/gl.pc"
214FILES_libglapi-dev = "${libdir}/libglapi.*"
215FILES_libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc"
216FILES_libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc"
217FILES_libgles3-mesa-dev = "${includedir}/GLES3"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500218FILES_libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500219FILES_libwayland-egl-dev = "${libdir}/pkgconfig/wayland-egl.pc ${libdir}/libwayland-egl.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500220FILES_libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \
221 ${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \
222 ${libdir}/pkgconfig/xatracker.pc"