blob: 4f31ed255c3762cbe6c11a518114da15731e9e61 [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"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050019PROVIDES = "virtual/libgl virtual/libgles1 virtual/libgles2 virtual/egl virtual/mesa"
20
Brad Bishopd7bf8c12018-02-25 22:55:05 -050021inherit autotools pkgconfig gettext distro_features_check
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022
Brad Bishopd7bf8c12018-02-25 22:55:05 -050023ANY_OF_DISTRO_FEATURES = "opengl vulkan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050024
Brad Bishopd7bf8c12018-02-25 22:55:05 -050025PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)} \
26 ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'drm', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027
Brad Bishopd7bf8c12018-02-25 22:55:05 -050028export LLVM_CONFIG = "${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}"
29export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config"
30EXTRA_OECONF = "--enable-shared-glapi \
31 --disable-opencl \
32 --with-llvm-prefix=${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE} \
33 --with-platforms='${PLATFORMS}'"
34
35PACKAGECONFIG ??= "${@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 Williamsc0f7c042017-02-23 20:41:17 -060042PACKAGECONFIG[gbm] = "--enable-gbm,--disable-gbm"
43
Patrick Williamsc124f4f2015-09-15 14:41:29 -050044X11_DEPS = "xf86driproto glproto virtual/libx11 libxext libxxf86vm libxdamage libxfixes"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050045# "x11" requires "opengl"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050046PACKAGECONFIG[x11] = "--enable-glx-tls,--disable-glx,${X11_DEPS}"
47PACKAGECONFIG[xvmc] = "--enable-xvmc,--disable-xvmc,libxvmc"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050048PACKAGECONFIG[wayland] = ",,wayland-native wayland libdrm"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050049
50DRIDRIVERS = "swrast"
51DRIDRIVERS_append_x86 = ",radeon,r200,nouveau,i965,i915"
52DRIDRIVERS_append_x86-64 = ",radeon,r200,nouveau,i965,i915"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050053# "dri" requires "opengl"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060054PACKAGECONFIG[dri] = "--enable-dri --with-dri-drivers=${DRIDRIVERS}, --disable-dri, dri2proto libdrm"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050055PACKAGECONFIG[dri3] = "--enable-dri3, --disable-dri3, dri3proto presentproto libxshmfence"
56
Brad Bishop6e60e8b2018-02-01 10:27:11 -050057# Vulkan drivers need dri3 enabled
58# radeon could be enabled as well but requires gallium-llvm with llvm >= 3.9
Brad Bishopd7bf8c12018-02-25 22:55:05 -050059VULKAN_DRIVERS = ""
60VULKAN_DRIVERS_append_x86 = ",intel"
61VULKAN_DRIVERS_append_x86-64 = ",intel"
62PACKAGECONFIG[vulkan] = "--with-vulkan-drivers=${VULKAN_DRIVERS}, --without-vulkan-drivers"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050063
Brad Bishopd7bf8c12018-02-25 22:55:05 -050064PACKAGECONFIG[opengl] = "--enable-opengl, --disable-opengl"
65
66# "gles" requires "opengl"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050067PACKAGECONFIG[gles] = "--enable-gles1 --enable-gles2, --disable-gles1 --disable-gles2"
68
Brad Bishopd7bf8c12018-02-25 22:55:05 -050069# "egl" requires "dri", "opengl"
70PACKAGECONFIG[egl] = "--enable-egl, --disable-egl"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050071
Brad Bishop6e60e8b2018-02-01 10:27:11 -050072PACKAGECONFIG[etnaviv] = ""
73PACKAGECONFIG[imx] = ""
74
Patrick Williamsc124f4f2015-09-15 14:41:29 -050075GALLIUMDRIVERS = "swrast"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050076GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'etnaviv', ',etnaviv', '', d)}"
77GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'imx', ',imx', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050078GALLIUMDRIVERS_LLVM33 = "${@bb.utils.contains('PACKAGECONFIG', 'r600', 'radeonsi,r600', '', d)}"
79PACKAGECONFIG[r600] = ""
80GALLIUMDRIVERS_LLVM33_ENABLED = "${@base_version_less_or_equal('MESA_LLVM_RELEASE', '3.2', False, len('${GALLIUMDRIVERS_LLVM33}') > 0, d)}"
81GALLIUMDRIVERS_LLVM = "r300,svga,nouveau${@',${GALLIUMDRIVERS_LLVM33}' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
82GALLIUMDRIVERS_append_x86 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}"
83GALLIUMDRIVERS_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 Bishopd7bf8c12018-02-25 22:55:05 -050085PACKAGECONFIG[gallium] = "--enable-texture-float --with-gallium-drivers=${GALLIUMDRIVERS}, --without-gallium-drivers"
86MESA_LLVM_RELEASE ?= "5.0"
87PACKAGECONFIG[gallium-llvm] = "--enable-llvm --enable-llvm-shared-libs, --disable-llvm, llvm${MESA_LLVM_RELEASE} llvm-native \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050088 ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
89export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}"
90PACKAGECONFIG[xa] = "--enable-xa, --disable-xa"
91
Brad Bishop6e60e8b2018-02-01 10:27:11 -050092OSMESA = "${@bb.utils.contains('PACKAGECONFIG', 'gallium', 'gallium-osmesa', 'osmesa', d)}"
93PACKAGECONFIG[osmesa] = "--enable-${OSMESA},--disable-${OSMESA}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050094
Brad Bishopd7bf8c12018-02-25 22:55:05 -050095PACKAGECONFIG[unwind] = "--enable-libunwind,--disable-libunwind,libunwind"
96
Patrick Williamsc124f4f2015-09-15 14:41:29 -050097# llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2)
98FULL_OPTIMIZATION_append = " -fno-omit-frame-pointer"
99
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500100CFLAGS_append_armv5 = " -DMISSING_64BIT_ATOMICS"
101
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500102# Multiple virtual/gl providers being built breaks staging
103EXCLUDE_FROM_WORLD = "1"
104
105# Remove the mesa dependency on mesa-dev, as mesa is empty
106RDEPENDS_${PN}-dev = ""
107
Brad Bishop37a0e4d2017-12-04 01:01:44 -0500108# Add dependency so that GLES3 header don't need to be added manually
109RDEPENDS_libgles2-mesa-dev += "libgles3-mesa-dev"
110
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500111PACKAGES =+ "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 Williamsc124f4f2015-09-15 14:41:29 -0500120 libxatracker libxatracker-dev \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500121 mesa-megadriver mesa-vulkan-drivers \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500122 "
123
124do_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 Bishopd7bf8c12018-02-25 22:55:05 -0500130
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500131 # it was packaged in libdricore9.1.3-1 and preventing upgrades when debian.bbclass was used
132 rm -f ${D}${sysconfdir}/drirc
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500133 chrpath --delete ${D}${libdir}/dri/*_dri.so || true
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500134}
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.
139python __anonymous() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500140 pkgconfig = (d.getVar('PACKAGECONFIG') or "").split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500141 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 Williamsd8c66bc2016-06-20 12:57:21 -0500154
155 d.appendVar("RRECOMMENDS_" + fullp, " mesa-megadriver")
156
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500157 # 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
166python 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 Bishop6e60e8b2018-02-01 10:27:11 -0500174 dri_drivers_root = oe.path.join(d.getVar('PKGD'), d.getVar('libdir'), "dri")
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600175 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 Williamsc124f4f2015-09-15 14:41:29 -0500185
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500186 pipe_drivers_root = os.path.join(d.getVar('libdir'), "gallium-pipe")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500187 do_split_packages(d, pipe_drivers_root, '^pipe_(.*)\.so$', 'mesa-driver-pipe-%s', 'Mesa %s pipe driver', extra_depends='')
188}
189
190PACKAGESPLITFUNCS_prepend = "mesa_populate_packages "
191
192PACKAGES_DYNAMIC += "^mesa-driver-.*"
193
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500194FILES_${PN} += "${sysconfdir}/drirc"
195FILES_mesa-megadriver = "${libdir}/dri/*"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500196FILES_mesa-vulkan-drivers = "${libdir}/libvulkan_*.so ${datadir}/vulkan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500197FILES_libegl-mesa = "${libdir}/libEGL.so.*"
198FILES_libgbm = "${libdir}/libgbm.so.*"
199FILES_libgles1-mesa = "${libdir}/libGLESv1*.so.*"
200FILES_libgles2-mesa = "${libdir}/libGLESv2.so.*"
201FILES_libgl-mesa = "${libdir}/libGL.so.*"
202FILES_libglapi = "${libdir}/libglapi.so.*"
203FILES_libosmesa = "${libdir}/libOSMesa.so.*"
204FILES_libwayland-egl = "${libdir}/libwayland-egl.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500205FILES_libxatracker = "${libdir}/libxatracker.so.*"
206
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500207FILES_${PN}-dev = "${libdir}/pkgconfig/dri.pc ${includedir}/vulkan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500208FILES_libegl-mesa-dev = "${libdir}/libEGL.* ${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc"
209FILES_libgbm-dev = "${libdir}/libgbm.* ${libdir}/pkgconfig/gbm.pc ${includedir}/gbm.h"
210FILES_libgl-mesa-dev = "${libdir}/libGL.* ${includedir}/GL ${libdir}/pkgconfig/gl.pc"
211FILES_libglapi-dev = "${libdir}/libglapi.*"
212FILES_libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc"
213FILES_libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc"
214FILES_libgles3-mesa-dev = "${includedir}/GLES3"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500215FILES_libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500216FILES_libwayland-egl-dev = "${libdir}/pkgconfig/wayland-egl.pc ${libdir}/libwayland-egl.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500217FILES_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"