blob: 0cc0a82de49d2868ea1a0f683c567b8198eaa31e [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)} \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080032 ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'drm', '', d)} \
33 surfaceless"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050034
Brad Bishopd7bf8c12018-02-25 22:55:05 -050035export LLVM_CONFIG = "${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}"
36export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080037export YOCTO_ALTERNATE_MULTILIB_NAME = "${base_libdir}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050038EXTRA_OECONF = "--enable-shared-glapi \
39 --disable-opencl \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080040 --enable-glx-read-only-text \
41 PYTHON2=python2 \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050042 --with-llvm-prefix=${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE} \
43 --with-platforms='${PLATFORMS}'"
44
45PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'wayland vulkan', d)} \
46 ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl egl gles gbm dri', '', d)} \
Brad Bishop316dfdd2018-06-25 12:45:53 -040047 ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11 dri3', '', d)} \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050048 ${@bb.utils.contains('DISTRO_FEATURES', 'x11 vulkan', 'dri3', '', d)} \
49 "
50
51# "gbm" requires "dri", "opengl"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060052PACKAGECONFIG[gbm] = "--enable-gbm,--disable-gbm"
53
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080054X11_DEPS = "xorgproto virtual/libx11 libxext libxxf86vm libxdamage libxfixes"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050055# "x11" requires "opengl"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050056PACKAGECONFIG[x11] = "--enable-glx-tls,--disable-glx,${X11_DEPS}"
57PACKAGECONFIG[xvmc] = "--enable-xvmc,--disable-xvmc,libxvmc"
Brad Bishop316dfdd2018-06-25 12:45:53 -040058PACKAGECONFIG[wayland] = ",,wayland-native wayland libdrm wayland-protocols"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050059
60DRIDRIVERS = "swrast"
61DRIDRIVERS_append_x86 = ",radeon,r200,nouveau,i965,i915"
62DRIDRIVERS_append_x86-64 = ",radeon,r200,nouveau,i965,i915"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050063# "dri" requires "opengl"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080064PACKAGECONFIG[dri] = "--enable-dri --with-dri-drivers=${DRIDRIVERS}, --disable-dri, xorgproto libdrm"
65PACKAGECONFIG[dri3] = "--enable-dri3, --disable-dri3, xorgproto libxshmfence"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050066
Brad Bishop6e60e8b2018-02-01 10:27:11 -050067# Vulkan drivers need dri3 enabled
68# radeon could be enabled as well but requires gallium-llvm with llvm >= 3.9
Brad Bishopd7bf8c12018-02-25 22:55:05 -050069VULKAN_DRIVERS = ""
70VULKAN_DRIVERS_append_x86 = ",intel"
71VULKAN_DRIVERS_append_x86-64 = ",intel"
Brad Bishop316dfdd2018-06-25 12:45:53 -040072PACKAGECONFIG[vulkan] = "--with-vulkan-drivers=${VULKAN_DRIVERS}, --without-vulkan-drivers, python3-mako-native"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050073
Brad Bishopd7bf8c12018-02-25 22:55:05 -050074PACKAGECONFIG[opengl] = "--enable-opengl, --disable-opengl"
75
76# "gles" requires "opengl"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050077PACKAGECONFIG[gles] = "--enable-gles1 --enable-gles2, --disable-gles1 --disable-gles2"
78
Brad Bishopd7bf8c12018-02-25 22:55:05 -050079# "egl" requires "dri", "opengl"
80PACKAGECONFIG[egl] = "--enable-egl, --disable-egl"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050081
Brad Bishop6e60e8b2018-02-01 10:27:11 -050082PACKAGECONFIG[etnaviv] = ""
83PACKAGECONFIG[imx] = ""
84
Patrick Williamsc124f4f2015-09-15 14:41:29 -050085GALLIUMDRIVERS = "swrast"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050086GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'etnaviv', ',etnaviv', '', d)}"
87GALLIUMDRIVERS_append ="${@bb.utils.contains('PACKAGECONFIG', 'imx', ',imx', '', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050088GALLIUMDRIVERS_LLVM33 = "${@bb.utils.contains('PACKAGECONFIG', 'r600', 'radeonsi,r600', '', d)}"
89PACKAGECONFIG[r600] = ""
Brad Bishop316dfdd2018-06-25 12:45:53 -040090GALLIUMDRIVERS_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 -050091GALLIUMDRIVERS_LLVM = "r300,svga,nouveau${@',${GALLIUMDRIVERS_LLVM33}' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
92GALLIUMDRIVERS_append_x86 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}"
93GALLIUMDRIVERS_append_x86-64 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080094GALLIUMDRIVERS_append_x86 = ",virgl"
95GALLIUMDRIVERS_append_x86-64 = ",virgl"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050096# 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 -050097PACKAGECONFIG[gallium] = "--enable-texture-float --with-gallium-drivers=${GALLIUMDRIVERS}, --without-gallium-drivers"
Brad Bishop316dfdd2018-06-25 12:45:53 -040098MESA_LLVM_RELEASE ?= "6.0"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050099PACKAGECONFIG[gallium-llvm] = "--enable-llvm --enable-llvm-shared-libs, --disable-llvm, llvm${MESA_LLVM_RELEASE} llvm-native \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500100 ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
101export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}"
102PACKAGECONFIG[xa] = "--enable-xa, --disable-xa"
103
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500104OSMESA = "${@bb.utils.contains('PACKAGECONFIG', 'gallium', 'gallium-osmesa', 'osmesa', d)}"
105PACKAGECONFIG[osmesa] = "--enable-${OSMESA},--disable-${OSMESA}"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500106
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500107PACKAGECONFIG[unwind] = "--enable-libunwind,--disable-libunwind,libunwind"
108
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800109EXTRA_OECONF_remove_libc-musl = "--enable-glx-tls"
110EXTRA_OECONF_append_libc-musl = " --disable-glx-tls"
111EXTRA_OECONF_append_libc-musl_x86 = " --disable-asm"
112
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500113# llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2)
114FULL_OPTIMIZATION_append = " -fno-omit-frame-pointer"
115
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500116CFLAGS_append_armv5 = " -DMISSING_64BIT_ATOMICS"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800117EXTRA_OEMAKE += "WAYLAND_PROTOCOLS_DATADIR=${STAGING_DATADIR}/wayland-protocols"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500118
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500119# Remove the mesa dependency on mesa-dev, as mesa is empty
120RDEPENDS_${PN}-dev = ""
121
Brad Bishop37a0e4d2017-12-04 01:01:44 -0500122# Add dependency so that GLES3 header don't need to be added manually
123RDEPENDS_libgles2-mesa-dev += "libgles3-mesa-dev"
124
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500125PACKAGES =+ "libegl-mesa libegl-mesa-dev \
126 libosmesa libosmesa-dev \
127 libgl-mesa libgl-mesa-dev \
128 libglapi libglapi-dev \
129 libgbm libgbm-dev \
130 libgles1-mesa libgles1-mesa-dev \
131 libgles2-mesa libgles2-mesa-dev \
132 libgles3-mesa libgles3-mesa-dev \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500133 libxatracker libxatracker-dev \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500134 mesa-megadriver mesa-vulkan-drivers \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500135 "
136
137do_install_append () {
138 # Drivers never need libtool .la files
139 rm -f ${D}${libdir}/dri/*.la
140 rm -f ${D}${libdir}/egl/*.la
141 rm -f ${D}${libdir}/gallium-pipe/*.la
142 rm -f ${D}${libdir}/gbm/*.la
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500143
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500144 # it was packaged in libdricore9.1.3-1 and preventing upgrades when debian.bbclass was used
145 rm -f ${D}${sysconfdir}/drirc
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500146 chrpath --delete ${D}${libdir}/dri/*_dri.so || true
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800147
148 # libwayland-egl has been moved to wayland 1.15+
149 rm -f ${D}${libdir}/libwayland-egl*
150 rm -f ${D}${libdir}/pkgconfig/wayland-egl.pc
151 rmdir --ignore-fail-on-non-empty ${D}${libdir}/pkgconfig
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500152}
153
154# For the packages that make up the OpenGL interfaces, inject variables so that
155# they don't get Debian-renamed (which would remove the -mesa suffix), and
156# RPROVIDEs/RCONFLICTs on the generic libgl name.
157python __anonymous() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500158 pkgconfig = (d.getVar('PACKAGECONFIG') or "").split()
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500159 for p in (("egl", "libegl", "libegl1"),
160 ("dri", "libgl", "libgl1"),
161 ("gles", "libgles1", "libglesv1-cm1"),
162 ("gles", "libgles2", "libglesv2-2"),
163 ("gles", "libgles3",)):
164 if not p[0] in pkgconfig:
165 continue
166 fullp = p[1] + "-mesa"
167 pkgs = " ".join(p[1:])
168 d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1")
169 d.appendVar("RREPLACES_" + fullp, pkgs)
170 d.appendVar("RPROVIDES_" + fullp, pkgs)
171 d.appendVar("RCONFLICTS_" + fullp, pkgs)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500172
173 d.appendVar("RRECOMMENDS_" + fullp, " mesa-megadriver")
174
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500175 # For -dev, the first element is both the Debian and original name
176 fullp += "-dev"
177 pkgs = p[1] + "-dev"
178 d.setVar("DEBIAN_NOAUTONAME_" + fullp, "1")
179 d.appendVar("RREPLACES_" + fullp, pkgs)
180 d.appendVar("RPROVIDES_" + fullp, pkgs)
181 d.appendVar("RCONFLICTS_" + fullp, pkgs)
182}
183
184python mesa_populate_packages() {
185 pkgs = ['mesa', 'mesa-dev', 'mesa-dbg']
186 for pkg in pkgs:
187 d.setVar("RPROVIDES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
188 d.setVar("RCONFLICTS_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
189 d.setVar("RREPLACES_%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
190
191 import re
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500192 dri_drivers_root = oe.path.join(d.getVar('PKGD'), d.getVar('libdir'), "dri")
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600193 if os.path.isdir(dri_drivers_root):
194 dri_pkgs = os.listdir(dri_drivers_root)
195 lib_name = d.expand("${MLPREFIX}mesa-megadriver")
196 for p in dri_pkgs:
197 m = re.match('^(.*)_dri\.so$', p)
198 if m:
199 pkg_name = " ${MLPREFIX}mesa-driver-%s" % legitimize_package_name(m.group(1))
200 d.appendVar("RPROVIDES_%s" % lib_name, pkg_name)
201 d.appendVar("RCONFLICTS_%s" % lib_name, pkg_name)
202 d.appendVar("RREPLACES_%s" % lib_name, pkg_name)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500203
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500204 pipe_drivers_root = os.path.join(d.getVar('libdir'), "gallium-pipe")
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500205 do_split_packages(d, pipe_drivers_root, '^pipe_(.*)\.so$', 'mesa-driver-pipe-%s', 'Mesa %s pipe driver', extra_depends='')
206}
207
208PACKAGESPLITFUNCS_prepend = "mesa_populate_packages "
209
210PACKAGES_DYNAMIC += "^mesa-driver-.*"
211
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500212FILES_${PN} += "${sysconfdir}/drirc"
213FILES_mesa-megadriver = "${libdir}/dri/*"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500214FILES_mesa-vulkan-drivers = "${libdir}/libvulkan_*.so ${datadir}/vulkan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500215FILES_libegl-mesa = "${libdir}/libEGL.so.*"
216FILES_libgbm = "${libdir}/libgbm.so.*"
217FILES_libgles1-mesa = "${libdir}/libGLESv1*.so.*"
218FILES_libgles2-mesa = "${libdir}/libGLESv2.so.*"
219FILES_libgl-mesa = "${libdir}/libGL.so.*"
220FILES_libglapi = "${libdir}/libglapi.so.*"
221FILES_libosmesa = "${libdir}/libOSMesa.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500222FILES_libxatracker = "${libdir}/libxatracker.so.*"
223
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500224FILES_${PN}-dev = "${libdir}/pkgconfig/dri.pc ${includedir}/vulkan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500225FILES_libegl-mesa-dev = "${libdir}/libEGL.* ${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc"
226FILES_libgbm-dev = "${libdir}/libgbm.* ${libdir}/pkgconfig/gbm.pc ${includedir}/gbm.h"
227FILES_libgl-mesa-dev = "${libdir}/libGL.* ${includedir}/GL ${libdir}/pkgconfig/gl.pc"
228FILES_libglapi-dev = "${libdir}/libglapi.*"
229FILES_libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc"
230FILES_libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc"
231FILES_libgles3-mesa-dev = "${includedir}/GLES3"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500232FILES_libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500233FILES_libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \
234 ${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \
235 ${libdir}/pkgconfig/xatracker.pc"