blob: 928899008e6258f3dca8ef3dffdf5d08b7927876 [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"
Andrew Geissler87f5cff2022-09-30 13:13:31 -050013LIC_FILES_CHKSUM = "file://docs/license.rst;md5=63779ec98d78d823a9dc533a0735ef10"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050014
15PE = "2"
16
Andrew Geissler4ed12e12020-06-05 18:00:41 -050017SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
18 file://0001-meson.build-check-for-all-linux-host_os-combinations.patch \
Andrew Geissler4ed12e12020-06-05 18:00:41 -050019 file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
Andrew Geissler8f840682023-07-21 09:09:43 -050020 file://0001-gallium-Fix-build-with-llvm-17.patch \
Andrew Geissler4ed12e12020-06-05 18:00:41 -050021 "
22
Andrew Geissler8f840682023-07-21 09:09:43 -050023SRC_URI[sha256sum] = "2f6d7381bc10fbd2d6263ad1022785b8b511046c1a904162f8f7da18eea8aed9"
Andrew Geissler4ed12e12020-06-05 18:00:41 -050024
25UPSTREAM_CHECK_GITTAGREGEX = "mesa-(?P<pver>\d+(\.\d+)+)"
26
27#because we cannot rely on the fact that all apps will use pkgconfig,
28#make eglplatform.h independent of MESA_EGL_NO_X11_HEADER
Patrick Williams213cb262021-08-07 19:21:33 -050029do_install:append() {
Andrew Geissler517393d2023-01-13 08:55:19 -060030 # sed can't find EGL/eglplatform.h as it doesn't get installed when glvnd enabled.
31 # So, check if EGL/eglplatform.h exists before running sed.
32 if ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'true', 'false', d)} && [ -f ${D}${includedir}/EGL/eglplatform.h ]; then
33 sed -i -e 's/^#elif defined(__unix__) && defined(EGL_NO_X11)$/#elif defined(__unix__) \&\& defined(EGL_NO_X11) || ${@bb.utils.contains('PACKAGECONFIG', 'x11', '0', '1', d)}/' ${D}${includedir}/EGL/eglplatform.h
34 fi
Andrew Geissler4ed12e12020-06-05 18:00:41 -050035}
36
Brad Bishop393846f2019-05-20 12:24:11 -040037DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native python3-mako-native gettext-native"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050038EXTRANATIVEPATH += "chrpath-native"
Brad Bishop316dfdd2018-06-25 12:45:53 -040039PROVIDES = " \
40 ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'virtual/libgl', '', d)} \
Andrew Geissler517393d2023-01-13 08:55:19 -060041 ${@bb.utils.contains('PACKAGECONFIG', 'glvnd', 'virtual/libglx', '', d)} \
Andrew Geissler595f6302022-01-24 19:11:47 +000042 ${@bb.utils.contains('PACKAGECONFIG', 'gles', 'virtual/libgles1 virtual/libgles2 virtual/libgles3', '', d)} \
Brad Bishop316dfdd2018-06-25 12:45:53 -040043 ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'virtual/egl', '', d)} \
44 ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'virtual/libgbm', '', d)} \
45 virtual/mesa \
46 "
Patrick Williamsc124f4f2015-09-15 14:41:29 -050047
Brad Bishop6dbb3162019-11-25 09:41:34 -050048inherit meson pkgconfig python3native gettext features_check
Patrick Williamsc124f4f2015-09-15 14:41:29 -050049
Brad Bishop19323692019-04-05 15:28:33 -040050BBCLASSEXTEND = "native nativesdk"
51
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050052ANY_OF_DISTRO_FEATURES = "opengl vulkan"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050053
Andrew Geisslerd1e89492021-02-12 15:35:20 -060054PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050055
Andrew Geissler82c905d2020-04-13 13:39:40 -050056# set the MESA_BUILD_TYPE to either 'release' (default) or 'debug'
57# by default the upstream mesa sources build a debug release
58# here we assume the user will want a release build by default
59MESA_BUILD_TYPE ?= "release"
60def check_buildtype(d):
61 _buildtype = d.getVar('MESA_BUILD_TYPE')
62 if _buildtype not in ['release', 'debug']:
63 bb.fatal("unknown build type (%s), please set MESA_BUILD_TYPE to either 'release' or 'debug'" % _buildtype)
64 if _buildtype == 'debug':
65 return 'debugoptimized'
66 return 'plain'
67MESON_BUILDTYPE = "${@check_buildtype(d)}"
68
Brad Bishop393846f2019-05-20 12:24:11 -040069EXTRA_OEMESON = " \
Andrew Geisslerd1e89492021-02-12 15:35:20 -060070 -Dshared-glapi=enabled \
Brad Bishop393846f2019-05-20 12:24:11 -040071 -Dglx-read-only-text=true \
72 -Dplatforms='${@",".join("${PLATFORMS}".split())}' \
Brad Bishop19323692019-04-05 15:28:33 -040073"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050074
Andrew Geissler6ce62a22020-11-30 19:58:47 -060075def strip_comma(s):
76 return s.strip(',')
77
Andrew Geissler9aee5002022-03-30 16:27:02 +000078PACKAGECONFIG = " \
79 gallium \
80 ${@bb.utils.filter('DISTRO_FEATURES', 'x11 vulkan wayland', d)} \
81 ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl egl gles gbm virgl', '', d)} \
82 ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'dri3', '', d)} \
83 ${@bb.utils.contains('DISTRO_FEATURES', 'x11 vulkan', 'dri3', '', d)} \
Andrew Geissler87f5cff2022-09-30 13:13:31 -050084 ${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'zink', '', d)} \
Patrick Williams864cc432023-02-09 14:54:44 -060085 ${@bb.utils.contains('LICENSE_FLAGS_ACCEPTED', 'commercial', 'video-codecs', '', d)} \
Andrew Geissler9aee5002022-03-30 16:27:02 +000086"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050087
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050088PACKAGECONFIG:append:class-native = "gallium-llvm r600"
89
Andrew Geissler9aee5002022-03-30 16:27:02 +000090# "gbm" requires "opengl"
Andrew Geisslerd1e89492021-02-12 15:35:20 -060091PACKAGECONFIG[gbm] = "-Dgbm=enabled,-Dgbm=disabled"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060092
Brad Bishop19323692019-04-05 15:28:33 -040093X11_DEPS = "xorgproto virtual/libx11 libxext libxxf86vm libxdamage libxfixes xrandr"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050094# "x11" requires "opengl"
Brad Bishop393846f2019-05-20 12:24:11 -040095PACKAGECONFIG[x11] = ",-Dglx=disabled,${X11_DEPS}"
Brad Bishop316dfdd2018-06-25 12:45:53 -040096PACKAGECONFIG[wayland] = ",,wayland-native wayland libdrm wayland-protocols"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050097
Andrew Geisslerd1e89492021-02-12 15:35:20 -060098PACKAGECONFIG[dri3] = "-Ddri3=enabled, -Ddri3=disabled, xorgproto libxshmfence"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050099
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500100# Vulkan drivers need dri3 enabled
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600101# amd could be enabled as well but requires gallium-llvm with llvm >= 3.9
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500102VULKAN_DRIVERS = ""
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500103VULKAN_DRIVERS:append:x86 = ",intel"
104VULKAN_DRIVERS:append:x86-64 = ",intel"
105# i686 is a 32 bit override for mesa-native
106VULKAN_DRIVERS:append:i686 = ",intel"
Patrick Williams213cb262021-08-07 19:21:33 -0500107VULKAN_DRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'freedreno', ',freedreno', '', d)}"
Andrew Geissler595f6302022-01-24 19:11:47 +0000108VULKAN_DRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'broadcom', ',broadcom', '', d)}"
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500109PACKAGECONFIG[vulkan] = "-Dvulkan-drivers=${@strip_comma('${VULKAN_DRIVERS}')}, -Dvulkan-drivers='',glslang-native vulkan-loader vulkan-headers"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500110
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600111# mesa development and testing tools support, per driver
112TOOLS = ""
113TOOLS_DEPS = ""
114TOOLS:append = "${@bb.utils.contains('PACKAGECONFIG', 'etnaviv', ',etnaviv', '', d)}"
115TOOLS:append = "${@bb.utils.contains('PACKAGECONFIG', 'freedreno', ',freedreno', '', d)}"
116TOOLS:append = "${@bb.utils.contains('PACKAGECONFIG', 'lima', ',lima', '', d)}"
117TOOLS:append = "${@bb.utils.contains('PACKAGECONFIG', 'panfrost', ',panfrost', '', d)}"
118
119# dependencies for tools.
120TOOLS_DEPS:append = "${@bb.utils.contains('PACKAGECONFIG', 'freedreno', ' ncurses libxml2 ', '', d)}"
121
122# the fdperf tool requires libconfig (a part of meta-oe) so it needs special
123# treatment in addition to the usual 'freedreno tools'.
124PACKAGECONFIG[freedreno-fdperf] = ",,libconfig"
125
126PACKAGECONFIG[tools] = "-Dtools=${@strip_comma('${TOOLS}')}, -Dtools='', ${TOOLS_DEPS}"
127
Brad Bishop393846f2019-05-20 12:24:11 -0400128PACKAGECONFIG[opengl] = "-Dopengl=true, -Dopengl=false"
Andrew Geissler517393d2023-01-13 08:55:19 -0600129PACKAGECONFIG[glvnd] = "-Dglvnd=true, -Dglvnd=false, libglvnd"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500130
131# "gles" requires "opengl"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600132PACKAGECONFIG[gles] = "-Dgles1=enabled -Dgles2=enabled, -Dgles1=disabled -Dgles2=disabled"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500133
Andrew Geissler9aee5002022-03-30 16:27:02 +0000134# "egl" requires "opengl"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600135PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500136
Andrew Geissler9aee5002022-03-30 16:27:02 +0000137# "opencl" requires libclc from meta-clang and spirv-tools from OE-Core
Patrick Williams92b42cb2022-09-03 06:53:57 -0500138OPENCL_NATIVE = "${@bb.utils.contains('PACKAGECONFIG', 'freedreno', '-Dopencl-native=true', '', d)}"
139PACKAGECONFIG[opencl] = "-Dgallium-opencl=icd -Dopencl-spirv=true ${OPENCL_NATIVE},-Dgallium-opencl=disabled -Dopencl-spirv=false,libclc spirv-tools"
Andrew Geissler9aee5002022-03-30 16:27:02 +0000140
Andrew Geissler595f6302022-01-24 19:11:47 +0000141PACKAGECONFIG[broadcom] = ""
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500142PACKAGECONFIG[etnaviv] = ""
Brad Bishop00e122a2019-10-05 11:10:57 -0400143PACKAGECONFIG[freedreno] = ""
Brad Bishop393846f2019-05-20 12:24:11 -0400144PACKAGECONFIG[kmsro] = ""
Brad Bishopc68388fc2019-08-26 01:33:31 -0400145PACKAGECONFIG[vc4] = ""
146PACKAGECONFIG[v3d] = ""
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500147PACKAGECONFIG[zink] = ""
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500148
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500149GALLIUMDRIVERS = "swrast"
Brad Bishop79641f22019-09-10 07:20:22 -0400150# gallium swrast was found to crash Xorg on startup in x32 qemu
Patrick Williams213cb262021-08-07 19:21:33 -0500151GALLIUMDRIVERS:x86-x32 = ""
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500152GALLIUMDRIVERS:append:x86 = ",i915,iris,crocus"
153GALLIUMDRIVERS:append:x86-64 = ",i915,iris,crocus"
154# i686 is a 32 bit override for mesa-native
155GALLIUMDRIVERS:append:i686 = ",i915,iris,crocus"
Brad Bishop79641f22019-09-10 07:20:22 -0400156
Patrick Williams213cb262021-08-07 19:21:33 -0500157GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'etnaviv', ',etnaviv', '', d)}"
158GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'freedreno', ',freedreno', '', d)}"
159GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'kmsro', ',kmsro', '', d)}"
160GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'vc4', ',vc4', '', d)}"
161GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'v3d', ',v3d', '', d)}"
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500162GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'zink', ',zink', '', d)}"
Brad Bishop19323692019-04-05 15:28:33 -0400163
164# radeonsi requires LLVM
Andrew Geissler6ce62a22020-11-30 19:58:47 -0600165GALLIUMDRIVERS_RADEONSI = "${@bb.utils.contains('PACKAGECONFIG', 'r600', ',radeonsi', '', d)}"
Andrew Geisslereff27472021-10-29 15:35:00 -0500166GALLIUMDRIVERS_LLVM = "r300,nouveau${GALLIUMDRIVERS_RADEONSI}"
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500167GALLIUMDRIVERS_LLVM:append:x86 = ",svga"
168GALLIUMDRIVERS_LLVM:append:x86-64 = ",svga"
169# i686 is a 32 bit override for mesa-native
170GALLIUMDRIVERS_LLVM:append:i686 = ",svga"
Brad Bishop19323692019-04-05 15:28:33 -0400171
172PACKAGECONFIG[r600] = ""
Andrew Geissler82c905d2020-04-13 13:39:40 -0500173PACKAGECONFIG[virgl] = ""
Brad Bishop19323692019-04-05 15:28:33 -0400174
Patrick Williams213cb262021-08-07 19:21:33 -0500175GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}"
176GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'r600', ',r600', '', d)}"
177GALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'virgl', ',virgl', '', d)}"
Brad Bishop19323692019-04-05 15:28:33 -0400178
Andrew Geissler3b8a17c2021-04-15 15:55:55 -0500179PACKAGECONFIG[gallium] = "-Dgallium-drivers=${@strip_comma('${GALLIUMDRIVERS}')}, -Dgallium-drivers='', libdrm"
Patrick Williamse760df82023-05-26 11:10:49 -0500180PACKAGECONFIG[gallium-llvm] = "-Dllvm=enabled -Dshared-llvm=enabled, -Dllvm=disabled, llvm llvm-native elfutils"
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600181PACKAGECONFIG[xa] = "-Dgallium-xa=enabled, -Dgallium-xa=disabled"
182PACKAGECONFIG[va] = "-Dgallium-va=enabled,-Dgallium-va=disabled,libva-initial"
Andrew Geisslerc182c622020-05-15 14:13:32 -0500183
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600184PACKAGECONFIG[vdpau] = "-Dgallium-vdpau=enabled,-Dgallium-vdpau=disabled,libvdpau"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500185
Brad Bishop96ff1982019-08-19 13:50:42 -0400186PACKAGECONFIG[lima] = ""
Patrick Williams213cb262021-08-07 19:21:33 -0500187GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'lima', ',lima', '', d)}"
Brad Bishop96ff1982019-08-19 13:50:42 -0400188
Brad Bishop79641f22019-09-10 07:20:22 -0400189PACKAGECONFIG[panfrost] = ""
Patrick Williams213cb262021-08-07 19:21:33 -0500190GALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'panfrost', ',panfrost', '', d)}"
Brad Bishop79641f22019-09-10 07:20:22 -0400191
Andrew Geissler87f5cff2022-09-30 13:13:31 -0500192PACKAGECONFIG[vulkan-beta] = "-Dvulkan-beta=true,-Dvulkan-beta=false"
193
Andrew Geissler95ac1b82021-03-31 14:34:31 -0500194PACKAGECONFIG[osmesa] = "-Dosmesa=true,-Dosmesa=false"
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500195
Patrick Williams2390b1b2022-11-03 13:47:49 -0500196PACKAGECONFIG[perfetto] = "-Dperfetto=true,-Dperfetto=false,libperfetto"
197
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600198PACKAGECONFIG[unwind] = "-Dlibunwind=enabled,-Dlibunwind=disabled,libunwind"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800199
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700200PACKAGECONFIG[lmsensors] = "-Dlmsensors=enabled,-Dlmsensors=disabled,lmsensors"
201
Patrick Williams864cc432023-02-09 14:54:44 -0600202VIDEO_CODECS = "vc1dec,h264dec,h264enc,h265dec,h265enc"
203PACKAGECONFIG[video-codecs] = "-Dvideo-codecs=${@strip_comma('${VIDEO_CODECS}')}, -Dvideo-codecs=''"
204
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500205# llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2)
Patrick Williams213cb262021-08-07 19:21:33 -0500206FULL_OPTIMIZATION:append = " -fno-omit-frame-pointer"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500207
Patrick Williams213cb262021-08-07 19:21:33 -0500208CFLAGS:append:armv5 = " -DMISSING_64BIT_ATOMICS"
209CFLAGS:append:armv6 = " -DMISSING_64BIT_ATOMICS"
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500210
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500211# Remove the mesa dependency on mesa-dev, as mesa is empty
Andrew Geissler615f2f12022-07-15 14:00:58 -0500212DEV_PKG_DEPENDENCY = ""
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500213
Andrew Geissler595f6302022-01-24 19:11:47 +0000214# Khronos documentation says that include/GLES2/gl2ext.h can be used for
215# OpenGL ES 3 specification as well as for OpenGL ES 2.
216# There can be applications including GLES2/gl2ext.h instead of GLES3/gl3ext.h
217# meaning we should probably bring in GLES2/gl2ext.h if someone asks for
218# development package of libgles3.
219RDEPENDS:libgles3-mesa-dev += "libgles2-mesa-dev"
Brad Bishop37a0e4d2017-12-04 01:01:44 -0500220
Andrew Geissler9aee5002022-03-30 16:27:02 +0000221RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'libclc spirv-tools', '', d)}"
222
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500223PACKAGES =+ "libegl-mesa libegl-mesa-dev \
224 libosmesa libosmesa-dev \
225 libgl-mesa libgl-mesa-dev \
Andrew Geissler517393d2023-01-13 08:55:19 -0600226 libglx-mesa libglx-mesa-dev \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500227 libglapi libglapi-dev \
228 libgbm libgbm-dev \
229 libgles1-mesa libgles1-mesa-dev \
230 libgles2-mesa libgles2-mesa-dev \
231 libgles3-mesa libgles3-mesa-dev \
Andrew Geissler9aee5002022-03-30 16:27:02 +0000232 libopencl-mesa libopencl-mesa-dev \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500233 libxatracker libxatracker-dev \
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500234 mesa-megadriver mesa-vulkan-drivers \
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600235 mesa-vdpau-drivers mesa-tools \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500236 "
237
Patrick Williams213cb262021-08-07 19:21:33 -0500238do_install:append () {
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500239 # Drivers never need libtool .la files
240 rm -f ${D}${libdir}/dri/*.la
241 rm -f ${D}${libdir}/egl/*.la
242 rm -f ${D}${libdir}/gallium-pipe/*.la
243 rm -f ${D}${libdir}/gbm/*.la
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500244
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800245 # libwayland-egl has been moved to wayland 1.15+
246 rm -f ${D}${libdir}/libwayland-egl*
247 rm -f ${D}${libdir}/pkgconfig/wayland-egl.pc
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500248}
249
250# For the packages that make up the OpenGL interfaces, inject variables so that
251# they don't get Debian-renamed (which would remove the -mesa suffix), and
252# RPROVIDEs/RCONFLICTs on the generic libgl name.
253python __anonymous() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500254 pkgconfig = (d.getVar('PACKAGECONFIG') or "").split()
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600255 suffix = ""
256 if "-native" in d.getVar("PN"):
257 suffix = "-native"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500258 for p in (("egl", "libegl", "libegl1"),
Andrew Geissler9aee5002022-03-30 16:27:02 +0000259 ("opengl", "libgl", "libgl1"),
Andrew Geissler517393d2023-01-13 08:55:19 -0600260 ("glvnd", "libglx",),
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500261 ("gles", "libgles1", "libglesv1-cm1"),
262 ("gles", "libgles2", "libglesv2-2"),
Andrew Geissler9aee5002022-03-30 16:27:02 +0000263 ("gles", "libgles3",),
264 ("opencl", "libopencl",)):
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500265 if not p[0] in pkgconfig:
266 continue
Andrew Geissler1e34c2d2020-05-29 16:02:59 -0500267 mlprefix = d.getVar("MLPREFIX")
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600268 fullp = mlprefix + p[1] + "-mesa" + suffix
Andrew Geissler1e34c2d2020-05-29 16:02:59 -0500269 mlprefix = d.getVar("MLPREFIX")
Patrick Williams213cb262021-08-07 19:21:33 -0500270 pkgs = " " + " ".join(mlprefix + x + suffix for x in p[1:])
271 d.setVar("DEBIAN_NOAUTONAME:" + fullp, "1")
272 d.appendVar("RREPLACES:" + fullp, pkgs)
273 d.appendVar("RPROVIDES:" + fullp, pkgs)
274 d.appendVar("RCONFLICTS:" + fullp, pkgs)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500275
Patrick Williams213cb262021-08-07 19:21:33 -0500276 d.appendVar("RRECOMMENDS:" + fullp, " ${MLPREFIX}mesa-megadriver" + suffix)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500277
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500278 # For -dev, the first element is both the Debian and original name
Andrew Geisslerd1e89492021-02-12 15:35:20 -0600279 fullp = mlprefix + p[1] + "-mesa-dev" + suffix
Patrick Williams213cb262021-08-07 19:21:33 -0500280 pkgs = " " + mlprefix + p[1] + "-dev" + suffix
281 d.setVar("DEBIAN_NOAUTONAME:" + fullp, "1")
282 d.appendVar("RREPLACES:" + fullp, pkgs)
283 d.appendVar("RPROVIDES:" + fullp, pkgs)
284 d.appendVar("RCONFLICTS:" + fullp, pkgs)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500285}
286
287python mesa_populate_packages() {
288 pkgs = ['mesa', 'mesa-dev', 'mesa-dbg']
289 for pkg in pkgs:
Patrick Williams213cb262021-08-07 19:21:33 -0500290 d.setVar("RPROVIDES:%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
291 d.setVar("RCONFLICTS:%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
292 d.setVar("RREPLACES:%s" % pkg, pkg.replace("mesa", "mesa-dri", 1))
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500293
294 import re
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500295 dri_drivers_root = oe.path.join(d.getVar('PKGD'), d.getVar('libdir'), "dri")
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600296 if os.path.isdir(dri_drivers_root):
Patrick Williams93c203f2021-10-06 16:15:23 -0500297 dri_pkgs = sorted(os.listdir(dri_drivers_root))
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600298 lib_name = d.expand("${MLPREFIX}mesa-megadriver")
299 for p in dri_pkgs:
Brad Bishop19323692019-04-05 15:28:33 -0400300 m = re.match(r'^(.*)_dri\.so$', p)
Patrick Williamsc0f7c042017-02-23 20:41:17 -0600301 if m:
302 pkg_name = " ${MLPREFIX}mesa-driver-%s" % legitimize_package_name(m.group(1))
Patrick Williams213cb262021-08-07 19:21:33 -0500303 d.appendVar("RPROVIDES:%s" % lib_name, pkg_name)
304 d.appendVar("RCONFLICTS:%s" % lib_name, pkg_name)
305 d.appendVar("RREPLACES:%s" % lib_name, pkg_name)
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500306
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500307 pipe_drivers_root = os.path.join(d.getVar('libdir'), "gallium-pipe")
Brad Bishop19323692019-04-05 15:28:33 -0400308 do_split_packages(d, pipe_drivers_root, r'^pipe_(.*)\.so$', 'mesa-driver-pipe-%s', 'Mesa %s pipe driver', extra_depends='')
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500309}
310
Andrew Geissler517393d2023-01-13 08:55:19 -0600311PACKAGESPLITFUNCS =+ "mesa_populate_packages"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500312
313PACKAGES_DYNAMIC += "^mesa-driver-.*"
Patrick Williams213cb262021-08-07 19:21:33 -0500314PACKAGES_DYNAMIC:class-native = "^mesa-driver-.*-native"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500315
Andrew Geisslerd5838332022-05-27 11:33:10 -0500316FILES:mesa-megadriver = "${libdir}/dri/* ${datadir}/drirc.d"
Patrick Williams213cb262021-08-07 19:21:33 -0500317FILES:mesa-vulkan-drivers = "${libdir}/libvulkan_*.so ${datadir}/vulkan"
318FILES:${PN}-vdpau-drivers = "${libdir}/vdpau/*.so.*"
Andrew Geissler517393d2023-01-13 08:55:19 -0600319FILES:libegl-mesa = "${libdir}/libEGL*.so.* ${datadir}/glvnd/egl_vendor.d"
Patrick Williams213cb262021-08-07 19:21:33 -0500320FILES:libgbm = "${libdir}/libgbm.so.*"
321FILES:libgles1-mesa = "${libdir}/libGLESv1*.so.*"
322FILES:libgles2-mesa = "${libdir}/libGLESv2.so.*"
323FILES:libgl-mesa = "${libdir}/libGL.so.*"
Andrew Geissler517393d2023-01-13 08:55:19 -0600324FILES:libglx-mesa = "${libdir}/libGLX*.so.*"
Patrick Williams92b42cb2022-09-03 06:53:57 -0500325FILES:libopencl-mesa = "${libdir}/libMesaOpenCL.so.* ${libdir}/gallium-pipe/*.so ${sysconfdir}/OpenCL/vendors/mesa.icd"
Patrick Williams213cb262021-08-07 19:21:33 -0500326FILES:libglapi = "${libdir}/libglapi.so.*"
327FILES:libosmesa = "${libdir}/libOSMesa.so.*"
328FILES:libxatracker = "${libdir}/libxatracker.so.*"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500329
Patrick Williams213cb262021-08-07 19:21:33 -0500330FILES:${PN}-dev = "${libdir}/pkgconfig/dri.pc ${includedir}/vulkan ${libdir}/vdpau/*.so"
Andrew Geissler517393d2023-01-13 08:55:19 -0600331FILES:libegl-mesa-dev = "${libdir}/libEGL*.* ${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc"
Patrick Williams213cb262021-08-07 19:21:33 -0500332FILES:libgbm-dev = "${libdir}/libgbm.* ${libdir}/pkgconfig/gbm.pc ${includedir}/gbm.h"
333FILES:libgl-mesa-dev = "${libdir}/libGL.* ${includedir}/GL ${libdir}/pkgconfig/gl.pc"
Andrew Geissler517393d2023-01-13 08:55:19 -0600334FILES:libglx-mesa-dev = "${libdir}/libGLX*.*"
Patrick Williams213cb262021-08-07 19:21:33 -0500335FILES:libglapi-dev = "${libdir}/libglapi.*"
336FILES:libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc"
337FILES:libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc"
338FILES:libgles3-mesa-dev = "${includedir}/GLES3"
Andrew Geissler9aee5002022-03-30 16:27:02 +0000339FILES:libopencl-mesa-dev = "${libdir}/libMesaOpenCL.so"
Patrick Williams213cb262021-08-07 19:21:33 -0500340FILES:libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc"
341FILES:libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500342 ${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \
343 ${libdir}/pkgconfig/xatracker.pc"
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600344# catch all to get all the tools and data
345FILES:${PN}-tools = "${bindir} ${datadir}"
346ALLOW_EMPTY:${PN}-tools = "1"
Brad Bishop19323692019-04-05 15:28:33 -0400347
348# Fix upgrade path from mesa to mesa-megadriver
Patrick Williams213cb262021-08-07 19:21:33 -0500349RREPLACES:mesa-megadriver = "mesa"
350RCONFLICTS:mesa-megadriver = "mesa"
351RPROVIDES:mesa-megadriver = "mesa"