1*4882a593SmuzhiyunSUMMARY = "A free implementation of the OpenGL API" 2*4882a593SmuzhiyunDESCRIPTION = "Mesa is an open-source implementation of the OpenGL specification - \ 3*4882a593Smuzhiyuna system for rendering interactive 3D graphics. \ 4*4882a593SmuzhiyunA variety of device drivers allows Mesa to be used in many different environments \ 5*4882a593Smuzhiyunranging from software emulation to complete hardware acceleration for modern GPUs. \ 6*4882a593SmuzhiyunMesa is used as part of the overall Direct Rendering Infrastructure and X.org \ 7*4882a593Smuzhiyunenvironment." 8*4882a593Smuzhiyun 9*4882a593SmuzhiyunHOMEPAGE = "http://mesa3d.org" 10*4882a593SmuzhiyunBUGTRACKER = "https://bugs.freedesktop.org" 11*4882a593SmuzhiyunSECTION = "x11" 12*4882a593SmuzhiyunLICENSE = "MIT" 13*4882a593SmuzhiyunLIC_FILES_CHKSUM = "file://docs/license.rst;md5=9a383ee9f65a4e939d6630e9b067ff58" 14*4882a593Smuzhiyun 15*4882a593SmuzhiyunPE = "2" 16*4882a593Smuzhiyun 17*4882a593SmuzhiyunSRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \ 18*4882a593Smuzhiyun file://0001-meson.build-check-for-all-linux-host_os-combinations.patch \ 19*4882a593Smuzhiyun file://0002-meson.build-make-TLS-ELF-optional.patch \ 20*4882a593Smuzhiyun file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \ 21*4882a593Smuzhiyun file://0001-futex.h-Define-__NR_futex-if-it-does-not-exist.patch \ 22*4882a593Smuzhiyun file://0001-util-format-Check-for-NEON-before-using-it.patch \ 23*4882a593Smuzhiyun file://0001-Revert-egl-wayland-deprecate-drm_handle_format-and-d.patch \ 24*4882a593Smuzhiyun " 25*4882a593Smuzhiyun 26*4882a593SmuzhiyunSRC_URI[sha256sum] = "9f2b30f5276a9abaf71aafc6979685e2636189de1a87aea2c9e69744a6d0ebb9" 27*4882a593Smuzhiyun 28*4882a593SmuzhiyunUPSTREAM_CHECK_GITTAGREGEX = "mesa-(?P<pver>\d+(\.\d+)+)" 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun#because we cannot rely on the fact that all apps will use pkgconfig, 31*4882a593Smuzhiyun#make eglplatform.h independent of MESA_EGL_NO_X11_HEADER 32*4882a593Smuzhiyundo_install:append() { 33*4882a593Smuzhiyun if ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'true', 'false', d)}; then 34*4882a593Smuzhiyun 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 35*4882a593Smuzhiyun fi 36*4882a593Smuzhiyun} 37*4882a593Smuzhiyun 38*4882a593SmuzhiyunDEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native python3-mako-native gettext-native" 39*4882a593SmuzhiyunEXTRANATIVEPATH += "chrpath-native" 40*4882a593SmuzhiyunPROVIDES = " \ 41*4882a593Smuzhiyun ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'virtual/libgl', '', d)} \ 42*4882a593Smuzhiyun ${@bb.utils.contains('PACKAGECONFIG', 'gles', 'virtual/libgles1 virtual/libgles2 virtual/libgles3', '', d)} \ 43*4882a593Smuzhiyun ${@bb.utils.contains('PACKAGECONFIG', 'egl', 'virtual/egl', '', d)} \ 44*4882a593Smuzhiyun ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'virtual/libgbm', '', d)} \ 45*4882a593Smuzhiyun virtual/mesa \ 46*4882a593Smuzhiyun " 47*4882a593Smuzhiyun 48*4882a593Smuzhiyuninherit meson pkgconfig python3native gettext features_check 49*4882a593Smuzhiyun 50*4882a593SmuzhiyunBBCLASSEXTEND = "native nativesdk" 51*4882a593Smuzhiyun 52*4882a593SmuzhiyunANY_OF_DISTRO_FEATURES:class-target = "opengl vulkan" 53*4882a593Smuzhiyun 54*4882a593SmuzhiyunPLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)}" 55*4882a593Smuzhiyun 56*4882a593Smuzhiyunexport YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config" 57*4882a593Smuzhiyunexport YOCTO_ALTERNATE_MULTILIB_NAME = "${base_libdir}" 58*4882a593Smuzhiyunexport LLVM_CONFIG = "${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}" 59*4882a593Smuzhiyunexport WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}" 60*4882a593Smuzhiyun 61*4882a593SmuzhiyunMESA_LLVM_RELEASE ?= "${LLVMVERSION}" 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun# set the MESA_BUILD_TYPE to either 'release' (default) or 'debug' 64*4882a593Smuzhiyun# by default the upstream mesa sources build a debug release 65*4882a593Smuzhiyun# here we assume the user will want a release build by default 66*4882a593SmuzhiyunMESA_BUILD_TYPE ?= "release" 67*4882a593Smuzhiyundef check_buildtype(d): 68*4882a593Smuzhiyun _buildtype = d.getVar('MESA_BUILD_TYPE') 69*4882a593Smuzhiyun if _buildtype not in ['release', 'debug']: 70*4882a593Smuzhiyun bb.fatal("unknown build type (%s), please set MESA_BUILD_TYPE to either 'release' or 'debug'" % _buildtype) 71*4882a593Smuzhiyun if _buildtype == 'debug': 72*4882a593Smuzhiyun return 'debugoptimized' 73*4882a593Smuzhiyun return 'plain' 74*4882a593SmuzhiyunMESON_BUILDTYPE = "${@check_buildtype(d)}" 75*4882a593Smuzhiyun 76*4882a593SmuzhiyunEXTRA_OEMESON = " \ 77*4882a593Smuzhiyun -Dshared-glapi=enabled \ 78*4882a593Smuzhiyun -Dglx-read-only-text=true \ 79*4882a593Smuzhiyun -Dplatforms='${@",".join("${PLATFORMS}".split())}' \ 80*4882a593Smuzhiyun" 81*4882a593Smuzhiyun 82*4882a593Smuzhiyundef strip_comma(s): 83*4882a593Smuzhiyun return s.strip(',') 84*4882a593Smuzhiyun 85*4882a593SmuzhiyunPACKAGECONFIG = " \ 86*4882a593Smuzhiyun gallium \ 87*4882a593Smuzhiyun ${@bb.utils.filter('DISTRO_FEATURES', 'x11 vulkan wayland', d)} \ 88*4882a593Smuzhiyun ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl egl gles gbm virgl', '', d)} \ 89*4882a593Smuzhiyun ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'dri3', '', d)} \ 90*4882a593Smuzhiyun ${@bb.utils.contains('DISTRO_FEATURES', 'x11 vulkan', 'dri3', '', d)} \ 91*4882a593Smuzhiyun ${@bb.utils.contains('TCLIBC', 'glibc', 'elf-tls', '', d)} \ 92*4882a593Smuzhiyun" 93*4882a593Smuzhiyun 94*4882a593Smuzhiyun# "gbm" requires "opengl" 95*4882a593SmuzhiyunPACKAGECONFIG[gbm] = "-Dgbm=enabled,-Dgbm=disabled" 96*4882a593Smuzhiyun 97*4882a593SmuzhiyunX11_DEPS = "xorgproto virtual/libx11 libxext libxxf86vm libxdamage libxfixes xrandr" 98*4882a593Smuzhiyun# "x11" requires "opengl" 99*4882a593SmuzhiyunPACKAGECONFIG[x11] = ",-Dglx=disabled,${X11_DEPS}" 100*4882a593SmuzhiyunPACKAGECONFIG[elf-tls] = "-Delf-tls=true, -Delf-tls=false" 101*4882a593SmuzhiyunPACKAGECONFIG[xvmc] = "-Dgallium-xvmc=enabled,-Dgallium-xvmc=disabled,libxvmc" 102*4882a593SmuzhiyunPACKAGECONFIG[wayland] = ",,wayland-native wayland libdrm wayland-protocols" 103*4882a593Smuzhiyun 104*4882a593SmuzhiyunPACKAGECONFIG[dri3] = "-Ddri3=enabled, -Ddri3=disabled, xorgproto libxshmfence" 105*4882a593Smuzhiyun 106*4882a593Smuzhiyun# Vulkan drivers need dri3 enabled 107*4882a593Smuzhiyun# amd could be enabled as well but requires gallium-llvm with llvm >= 3.9 108*4882a593SmuzhiyunVULKAN_DRIVERS = "" 109*4882a593SmuzhiyunVULKAN_DRIVERS:append:x86:class-target = ",intel" 110*4882a593SmuzhiyunVULKAN_DRIVERS:append:x86-64:class-target = ",intel" 111*4882a593SmuzhiyunVULKAN_DRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'freedreno', ',freedreno', '', d)}" 112*4882a593SmuzhiyunVULKAN_DRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'broadcom', ',broadcom', '', d)}" 113*4882a593SmuzhiyunPACKAGECONFIG[vulkan] = "-Dvulkan-drivers=${@strip_comma('${VULKAN_DRIVERS}')}, -Dvulkan-drivers=''," 114*4882a593Smuzhiyun 115*4882a593SmuzhiyunPACKAGECONFIG[opengl] = "-Dopengl=true, -Dopengl=false" 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun# "gles" requires "opengl" 118*4882a593SmuzhiyunPACKAGECONFIG[gles] = "-Dgles1=enabled -Dgles2=enabled, -Dgles1=disabled -Dgles2=disabled" 119*4882a593Smuzhiyun 120*4882a593Smuzhiyun# "egl" requires "opengl" 121*4882a593SmuzhiyunPACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled" 122*4882a593Smuzhiyun 123*4882a593Smuzhiyun# "opencl" requires libclc from meta-clang and spirv-tools from OE-Core 124*4882a593SmuzhiyunPACKAGECONFIG[opencl] = "-Dgallium-opencl=icd -Dopencl-spirv=true,-Dgallium-opencl=disabled -Dopencl-spirv=false,libclc spirv-tools" 125*4882a593Smuzhiyun 126*4882a593SmuzhiyunPACKAGECONFIG[broadcom] = "" 127*4882a593SmuzhiyunPACKAGECONFIG[etnaviv] = "" 128*4882a593SmuzhiyunPACKAGECONFIG[freedreno] = "" 129*4882a593SmuzhiyunPACKAGECONFIG[kmsro] = "" 130*4882a593SmuzhiyunPACKAGECONFIG[vc4] = "" 131*4882a593SmuzhiyunPACKAGECONFIG[v3d] = "" 132*4882a593Smuzhiyun 133*4882a593SmuzhiyunGALLIUMDRIVERS = "swrast" 134*4882a593Smuzhiyun# gallium swrast was found to crash Xorg on startup in x32 qemu 135*4882a593SmuzhiyunGALLIUMDRIVERS:x86-x32 = "" 136*4882a593SmuzhiyunGALLIUMDRIVERS:append:x86:class-target = ",i915,iris,crocus" 137*4882a593SmuzhiyunGALLIUMDRIVERS:append:x86-64:class-target = ",i915,iris,crocus" 138*4882a593Smuzhiyun 139*4882a593SmuzhiyunGALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'etnaviv', ',etnaviv', '', d)}" 140*4882a593SmuzhiyunGALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'freedreno', ',freedreno', '', d)}" 141*4882a593SmuzhiyunGALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'kmsro', ',kmsro', '', d)}" 142*4882a593SmuzhiyunGALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'vc4', ',vc4', '', d)}" 143*4882a593SmuzhiyunGALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'v3d', ',v3d', '', d)}" 144*4882a593Smuzhiyun 145*4882a593Smuzhiyun# radeonsi requires LLVM 146*4882a593SmuzhiyunGALLIUMDRIVERS_RADEONSI = "${@bb.utils.contains('PACKAGECONFIG', 'r600', ',radeonsi', '', d)}" 147*4882a593SmuzhiyunGALLIUMDRIVERS_LLVM = "r300,nouveau${GALLIUMDRIVERS_RADEONSI}" 148*4882a593SmuzhiyunGALLIUMDRIVERS_LLVM:append:x86:class-target = ",svga" 149*4882a593SmuzhiyunGALLIUMDRIVERS_LLVM:append:x86-64:class-target = ",svga" 150*4882a593Smuzhiyun 151*4882a593SmuzhiyunPACKAGECONFIG[r600] = "" 152*4882a593SmuzhiyunPACKAGECONFIG[virgl] = "" 153*4882a593Smuzhiyun 154*4882a593SmuzhiyunGALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}" 155*4882a593SmuzhiyunGALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'r600', ',r600', '', d)}" 156*4882a593SmuzhiyunGALLIUMDRIVERS:append = "${@bb.utils.contains('PACKAGECONFIG', 'virgl', ',virgl', '', d)}" 157*4882a593Smuzhiyun 158*4882a593SmuzhiyunPACKAGECONFIG[gallium] = "-Dgallium-drivers=${@strip_comma('${GALLIUMDRIVERS}')}, -Dgallium-drivers='', libdrm" 159*4882a593SmuzhiyunPACKAGECONFIG[gallium-llvm] = "-Dllvm=enabled -Dshared-llvm=enabled, -Dllvm=disabled, llvm${MESA_LLVM_RELEASE} llvm-native \ 160*4882a593Smuzhiyun elfutils" 161*4882a593SmuzhiyunPACKAGECONFIG[xa] = "-Dgallium-xa=enabled, -Dgallium-xa=disabled" 162*4882a593SmuzhiyunPACKAGECONFIG[va] = "-Dgallium-va=enabled,-Dgallium-va=disabled,libva-initial" 163*4882a593Smuzhiyun 164*4882a593SmuzhiyunPACKAGECONFIG[vdpau] = "-Dgallium-vdpau=enabled,-Dgallium-vdpau=disabled,libvdpau" 165*4882a593Smuzhiyun 166*4882a593SmuzhiyunPACKAGECONFIG[lima] = "" 167*4882a593SmuzhiyunGALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'lima', ',lima', '', d)}" 168*4882a593Smuzhiyun 169*4882a593SmuzhiyunPACKAGECONFIG[panfrost] = "" 170*4882a593SmuzhiyunGALLIUMDRIVERS:append ="${@bb.utils.contains('PACKAGECONFIG', 'panfrost', ',panfrost', '', d)}" 171*4882a593Smuzhiyun 172*4882a593SmuzhiyunPACKAGECONFIG[osmesa] = "-Dosmesa=true,-Dosmesa=false" 173*4882a593Smuzhiyun 174*4882a593SmuzhiyunPACKAGECONFIG[unwind] = "-Dlibunwind=enabled,-Dlibunwind=disabled,libunwind" 175*4882a593Smuzhiyun 176*4882a593SmuzhiyunPACKAGECONFIG[lmsensors] = "-Dlmsensors=enabled,-Dlmsensors=disabled,lmsensors" 177*4882a593Smuzhiyun 178*4882a593Smuzhiyun# llvmpipe is slow if compiled with -fomit-frame-pointer (e.g. -O2) 179*4882a593SmuzhiyunFULL_OPTIMIZATION:append = " -fno-omit-frame-pointer" 180*4882a593Smuzhiyun 181*4882a593SmuzhiyunCFLAGS:append:armv5 = " -DMISSING_64BIT_ATOMICS" 182*4882a593SmuzhiyunCFLAGS:append:armv6 = " -DMISSING_64BIT_ATOMICS" 183*4882a593Smuzhiyun 184*4882a593Smuzhiyun# Remove the mesa dependency on mesa-dev, as mesa is empty 185*4882a593SmuzhiyunRDEPENDS:${PN}-dev = "" 186*4882a593Smuzhiyun 187*4882a593Smuzhiyun# Khronos documentation says that include/GLES2/gl2ext.h can be used for 188*4882a593Smuzhiyun# OpenGL ES 3 specification as well as for OpenGL ES 2. 189*4882a593Smuzhiyun# There can be applications including GLES2/gl2ext.h instead of GLES3/gl3ext.h 190*4882a593Smuzhiyun# meaning we should probably bring in GLES2/gl2ext.h if someone asks for 191*4882a593Smuzhiyun# development package of libgles3. 192*4882a593SmuzhiyunRDEPENDS:libgles3-mesa-dev += "libgles2-mesa-dev" 193*4882a593Smuzhiyun 194*4882a593SmuzhiyunRDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'libclc spirv-tools', '', d)}" 195*4882a593Smuzhiyun 196*4882a593SmuzhiyunPACKAGES =+ "libegl-mesa libegl-mesa-dev \ 197*4882a593Smuzhiyun libosmesa libosmesa-dev \ 198*4882a593Smuzhiyun libgl-mesa libgl-mesa-dev \ 199*4882a593Smuzhiyun libglapi libglapi-dev \ 200*4882a593Smuzhiyun libgbm libgbm-dev \ 201*4882a593Smuzhiyun libgles1-mesa libgles1-mesa-dev \ 202*4882a593Smuzhiyun libgles2-mesa libgles2-mesa-dev \ 203*4882a593Smuzhiyun libgles3-mesa libgles3-mesa-dev \ 204*4882a593Smuzhiyun libopencl-mesa libopencl-mesa-dev \ 205*4882a593Smuzhiyun libxatracker libxatracker-dev \ 206*4882a593Smuzhiyun mesa-megadriver mesa-vulkan-drivers \ 207*4882a593Smuzhiyun mesa-vdpau-drivers \ 208*4882a593Smuzhiyun " 209*4882a593Smuzhiyun 210*4882a593Smuzhiyundo_install:append () { 211*4882a593Smuzhiyun # Drivers never need libtool .la files 212*4882a593Smuzhiyun rm -f ${D}${libdir}/dri/*.la 213*4882a593Smuzhiyun rm -f ${D}${libdir}/egl/*.la 214*4882a593Smuzhiyun rm -f ${D}${libdir}/gallium-pipe/*.la 215*4882a593Smuzhiyun rm -f ${D}${libdir}/gbm/*.la 216*4882a593Smuzhiyun 217*4882a593Smuzhiyun # it was packaged in libdricore9.1.3-1 and preventing upgrades when debian.bbclass was used 218*4882a593Smuzhiyun chrpath --delete ${D}${libdir}/dri/*_dri.so || true 219*4882a593Smuzhiyun 220*4882a593Smuzhiyun # libwayland-egl has been moved to wayland 1.15+ 221*4882a593Smuzhiyun rm -f ${D}${libdir}/libwayland-egl* 222*4882a593Smuzhiyun rm -f ${D}${libdir}/pkgconfig/wayland-egl.pc 223*4882a593Smuzhiyun} 224*4882a593Smuzhiyun 225*4882a593Smuzhiyun# For the packages that make up the OpenGL interfaces, inject variables so that 226*4882a593Smuzhiyun# they don't get Debian-renamed (which would remove the -mesa suffix), and 227*4882a593Smuzhiyun# RPROVIDEs/RCONFLICTs on the generic libgl name. 228*4882a593Smuzhiyunpython __anonymous() { 229*4882a593Smuzhiyun pkgconfig = (d.getVar('PACKAGECONFIG') or "").split() 230*4882a593Smuzhiyun suffix = "" 231*4882a593Smuzhiyun if "-native" in d.getVar("PN"): 232*4882a593Smuzhiyun suffix = "-native" 233*4882a593Smuzhiyun for p in (("egl", "libegl", "libegl1"), 234*4882a593Smuzhiyun ("opengl", "libgl", "libgl1"), 235*4882a593Smuzhiyun ("gles", "libgles1", "libglesv1-cm1"), 236*4882a593Smuzhiyun ("gles", "libgles2", "libglesv2-2"), 237*4882a593Smuzhiyun ("gles", "libgles3",), 238*4882a593Smuzhiyun ("opencl", "libopencl",)): 239*4882a593Smuzhiyun if not p[0] in pkgconfig: 240*4882a593Smuzhiyun continue 241*4882a593Smuzhiyun mlprefix = d.getVar("MLPREFIX") 242*4882a593Smuzhiyun fullp = mlprefix + p[1] + "-mesa" + suffix 243*4882a593Smuzhiyun mlprefix = d.getVar("MLPREFIX") 244*4882a593Smuzhiyun pkgs = " " + " ".join(mlprefix + x + suffix for x in p[1:]) 245*4882a593Smuzhiyun d.setVar("DEBIAN_NOAUTONAME:" + fullp, "1") 246*4882a593Smuzhiyun d.appendVar("RREPLACES:" + fullp, pkgs) 247*4882a593Smuzhiyun d.appendVar("RPROVIDES:" + fullp, pkgs) 248*4882a593Smuzhiyun d.appendVar("RCONFLICTS:" + fullp, pkgs) 249*4882a593Smuzhiyun 250*4882a593Smuzhiyun d.appendVar("RRECOMMENDS:" + fullp, " ${MLPREFIX}mesa-megadriver" + suffix) 251*4882a593Smuzhiyun 252*4882a593Smuzhiyun # For -dev, the first element is both the Debian and original name 253*4882a593Smuzhiyun fullp = mlprefix + p[1] + "-mesa-dev" + suffix 254*4882a593Smuzhiyun pkgs = " " + mlprefix + p[1] + "-dev" + suffix 255*4882a593Smuzhiyun d.setVar("DEBIAN_NOAUTONAME:" + fullp, "1") 256*4882a593Smuzhiyun d.appendVar("RREPLACES:" + fullp, pkgs) 257*4882a593Smuzhiyun d.appendVar("RPROVIDES:" + fullp, pkgs) 258*4882a593Smuzhiyun d.appendVar("RCONFLICTS:" + fullp, pkgs) 259*4882a593Smuzhiyun} 260*4882a593Smuzhiyun 261*4882a593Smuzhiyunpython mesa_populate_packages() { 262*4882a593Smuzhiyun pkgs = ['mesa', 'mesa-dev', 'mesa-dbg'] 263*4882a593Smuzhiyun for pkg in pkgs: 264*4882a593Smuzhiyun d.setVar("RPROVIDES:%s" % pkg, pkg.replace("mesa", "mesa-dri", 1)) 265*4882a593Smuzhiyun d.setVar("RCONFLICTS:%s" % pkg, pkg.replace("mesa", "mesa-dri", 1)) 266*4882a593Smuzhiyun d.setVar("RREPLACES:%s" % pkg, pkg.replace("mesa", "mesa-dri", 1)) 267*4882a593Smuzhiyun 268*4882a593Smuzhiyun import re 269*4882a593Smuzhiyun dri_drivers_root = oe.path.join(d.getVar('PKGD'), d.getVar('libdir'), "dri") 270*4882a593Smuzhiyun if os.path.isdir(dri_drivers_root): 271*4882a593Smuzhiyun dri_pkgs = sorted(os.listdir(dri_drivers_root)) 272*4882a593Smuzhiyun lib_name = d.expand("${MLPREFIX}mesa-megadriver") 273*4882a593Smuzhiyun for p in dri_pkgs: 274*4882a593Smuzhiyun m = re.match(r'^(.*)_dri\.so$', p) 275*4882a593Smuzhiyun if m: 276*4882a593Smuzhiyun pkg_name = " ${MLPREFIX}mesa-driver-%s" % legitimize_package_name(m.group(1)) 277*4882a593Smuzhiyun d.appendVar("RPROVIDES:%s" % lib_name, pkg_name) 278*4882a593Smuzhiyun d.appendVar("RCONFLICTS:%s" % lib_name, pkg_name) 279*4882a593Smuzhiyun d.appendVar("RREPLACES:%s" % lib_name, pkg_name) 280*4882a593Smuzhiyun 281*4882a593Smuzhiyun pipe_drivers_root = os.path.join(d.getVar('libdir'), "gallium-pipe") 282*4882a593Smuzhiyun do_split_packages(d, pipe_drivers_root, r'^pipe_(.*)\.so$', 'mesa-driver-pipe-%s', 'Mesa %s pipe driver', extra_depends='') 283*4882a593Smuzhiyun} 284*4882a593Smuzhiyun 285*4882a593SmuzhiyunPACKAGESPLITFUNCS:prepend = "mesa_populate_packages " 286*4882a593Smuzhiyun 287*4882a593SmuzhiyunPACKAGES_DYNAMIC += "^mesa-driver-.*" 288*4882a593SmuzhiyunPACKAGES_DYNAMIC:class-native = "^mesa-driver-.*-native" 289*4882a593Smuzhiyun 290*4882a593SmuzhiyunFILES:mesa-megadriver = "${libdir}/dri/* ${datadir}/drirc.d" 291*4882a593SmuzhiyunFILES:mesa-vulkan-drivers = "${libdir}/libvulkan_*.so ${datadir}/vulkan" 292*4882a593SmuzhiyunFILES:${PN}-vdpau-drivers = "${libdir}/vdpau/*.so.*" 293*4882a593SmuzhiyunFILES:libegl-mesa = "${libdir}/libEGL.so.*" 294*4882a593SmuzhiyunFILES:libgbm = "${libdir}/libgbm.so.*" 295*4882a593SmuzhiyunFILES:libgles1-mesa = "${libdir}/libGLESv1*.so.*" 296*4882a593SmuzhiyunFILES:libgles2-mesa = "${libdir}/libGLESv2.so.*" 297*4882a593SmuzhiyunFILES:libgl-mesa = "${libdir}/libGL.so.*" 298*4882a593SmuzhiyunFILES:libopencl-mesa = "${libdir}/libMesaOpenCL.so.* ${sysconfdir}/OpenCL/vendors/mesa.icd" 299*4882a593SmuzhiyunFILES:libglapi = "${libdir}/libglapi.so.*" 300*4882a593SmuzhiyunFILES:libosmesa = "${libdir}/libOSMesa.so.*" 301*4882a593SmuzhiyunFILES:libxatracker = "${libdir}/libxatracker.so.*" 302*4882a593Smuzhiyun 303*4882a593SmuzhiyunFILES:${PN}-dev = "${libdir}/pkgconfig/dri.pc ${includedir}/vulkan ${libdir}/vdpau/*.so" 304*4882a593SmuzhiyunFILES:libegl-mesa-dev = "${libdir}/libEGL.* ${includedir}/EGL ${includedir}/KHR ${libdir}/pkgconfig/egl.pc" 305*4882a593SmuzhiyunFILES:libgbm-dev = "${libdir}/libgbm.* ${libdir}/pkgconfig/gbm.pc ${includedir}/gbm.h" 306*4882a593SmuzhiyunFILES:libgl-mesa-dev = "${libdir}/libGL.* ${includedir}/GL ${libdir}/pkgconfig/gl.pc" 307*4882a593SmuzhiyunFILES:libglapi-dev = "${libdir}/libglapi.*" 308*4882a593SmuzhiyunFILES:libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc" 309*4882a593SmuzhiyunFILES:libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc" 310*4882a593SmuzhiyunFILES:libgles3-mesa-dev = "${includedir}/GLES3" 311*4882a593SmuzhiyunFILES:libopencl-mesa-dev = "${libdir}/libMesaOpenCL.so" 312*4882a593SmuzhiyunFILES:libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc" 313*4882a593SmuzhiyunFILES:libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \ 314*4882a593Smuzhiyun ${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \ 315*4882a593Smuzhiyun ${libdir}/pkgconfig/xatracker.pc" 316*4882a593Smuzhiyun 317*4882a593Smuzhiyun# Fix upgrade path from mesa to mesa-megadriver 318*4882a593SmuzhiyunRREPLACES:mesa-megadriver = "mesa" 319*4882a593SmuzhiyunRCONFLICTS:mesa-megadriver = "mesa" 320*4882a593SmuzhiyunRPROVIDES:mesa-megadriver = "mesa" 321