void-packages/srcpkgs/mesa/template
2020-03-24 04:35:52 +01:00

343 lines
10 KiB
Bash

# Template file for 'mesa'
pkgname=mesa
version=20.0.2
revision=2
wrksrc="mesa-${version}"
build_style=meson
configure_args="-Dglvnd=true -Dshared-glapi=true -Dgbm=true -Degl=true
-Dgallium-vdpau=true -Dgallium-xvmc=true -Dosmesa=gallium
-Dgles1=true -Dgles2=true -Dgallium-va=true -Dlmsensors=true
-Dplatforms=x11,drm,$(vopt_if wayland wayland),surfaceless -Dllvm=true
-Db_lto=false"
hostmakedepends="gettext flex libxml2-python llvm pkg-config
python3-Mako $(vopt_if wayland 'wayland-protocols wayland-devel')
glslang"
makedepends="elfutils-devel expat-devel libXdamage-devel libXvMC-devel
libXxf86vm-devel libatomic-devel libdrm-devel libffi-devel libva-devel
libvdpau-devel libxshmfence-devel ncurses-devel talloc-devel zlib-devel
$(vopt_if wayland 'wayland-devel wayland-protocols') llvm
libsensors-devel libXrandr-devel libglvnd-devel libzstd-devel"
depends="libglvnd"
short_desc="Graphics library similar to SGI's OpenGL"
maintainer="Juan RP <xtraeme@gmail.com>"
license="MIT, LGPL-2.1-or-later"
homepage="https://www.mesa3d.org/"
changelog="https://www.mesa3d.org/relnotes/${version}.html"
distfiles="https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz"
checksum=aa54f1cb669550606aab8ceb475105d15aeb814fca5a778ce70d0fd10e98e86f
build_options="wayland"
build_options_default="wayland"
# Set subpackages manually to set proper rdeps in 32bit pkgs.
subpackages="libglapi libgbm libOSMesa"
# Replace old mesa pkgs, superseded by libglvnd.
replaces="libGL>=10_1<19.2.5_2 libEGL>=10_1<19.2.5_2 libGLES>=10_1<19.2.5_2"
case "$XBPS_TARGET_MACHINE" in
i686*|x86_64*)
# Enable all x86 drivers.
configure_args+=" -Dgallium-drivers=auto"
configure_args+=" -Ddri-drivers=auto"
configure_args+=" -Dgallium-xa=true -Ddri3=true -Dgallium-nine=true"
configure_args+=" -Dvulkan-drivers=auto"
configure_args+=" -Dgallium-opencl=icd"
configure_args+=" -Dvulkan-overlay-layer=true"
hostmakedepends+=" clang"
makedepends+=" libclc-git"
subpackages+=" libxatracker mesa-opencl mesa-dri mesa-vaapi mesa-vdpau"
subpackages+=" mesa-XvMC mesa-vulkan-intel mesa-vulkan-radeon mesa-vulkan-overlay-layer"
# Transitional dummy packages
subpackages+=" mesa-ati-dri mesa-intel-dri mesa-nouveau-dri mesa-vmwgfx-dri"
;;
ppc*)
# Enable all ppc drivers.
configure_args+=" -Dgallium-drivers=r300,r600,radeonsi,swrast,nouveau,virgl"
configure_args+=" -Ddri-drivers=r100,r200,nouveau"
configure_args+=" -Dgallium-xa=false -Ddri3=true -Dgallium-opencl=icd"
configure_args+=" -Dvulkan-drivers=amd"
configure_args+=" -Dvulkan-overlay-layer=true"
# Explicitly control power8 feature usage, disable on BE
case "$XBPS_TARGET_MACHINE" in
ppc64le*) configure_args+=" -Dpower8=true";;
*) configure_args+=" -Dpower8=false";;
esac
hostmakedepends+=" clang"
makedepends+=" libclc-git"
subpackages+=" mesa-opencl mesa-dri mesa-vaapi mesa-vdpau mesa-XvMC mesa-vulkan-radeon"
subpackages+=" mesa-vulkan-overlay-layer"
# Transitional dummy packages
subpackages+=" mesa-ati-dri mesa-nouveau-dri"
;;
aarch64*)
# Enable all ARM drivers
configure_args+=" -Dgallium-drivers=auto"
configure_args+=" -Dvulkan-drivers= -Ddri-drivers="
configure_args+=" -Dgallium-xa=false -Ddri3=true"
subpackages+=" mesa-dri mesa-vaapi mesa-vdpau mesa-XvMC"
# Transitional dummy packages
subpackages+=" mesa-kmsro-dri mesa-tegra-dri mesa-nouveau-dri mesa-v3d-dri mesa-vc4-dri"
subpackages+=" mesa-etnaviv-dri mesa-freedreno-dri mesa-lima-dri mesa-panfrost-dri"
;;
armv7l*)
configure_args+=" -Dgallium-drivers=auto"
configure_args+=" -Dvulkan-drivers= -Ddri-drivers= -Dgallium-xvmc=false"
configure_args+=" -Dgallium-xa=false -Dgallium-vdpau=false -Dgallium-va=false"
subpackages+=" mesa-dri"
# Transitional dummy packages
subpackages+=" mesa-etnaviv-dri mesa-freedreno-dri mesa-kmsro-dri mesa-lima-dri mesa-panfrost-dri mesa-vc4-dri"
;;
*)
# Enable swrast driver.
configure_args+=" -Dgallium-drivers=swrast"
configure_args+=" -Ddri-drivers= -Dvulkan-drivers= -Dgallium-va=false"
configure_args+=" -Dgallium-vdpau=false -Dgallium-xvmc=false"
configure_args+=" -Dgallium-xa=false"
subpackages+=" mesa-dri"
;;
esac
# -devel must be the last one for proper order.
subpackages+=" MesaLib-devel"
case "$XBPS_TARGET_MACHINE" in
i686) configure_args+=" -Ddri-drivers-path=/usr/lib32/xorg/modules/drivers";;
*) configure_args+=" -Ddri-drivers-path=/usr/lib/xorg/modules/drivers";;
esac
case "$XBPS_TARGET_MACHINE" in
# Disable TLS with musl: https://gitlab.freedesktop.org/mesa/mesa/issues/966
*-musl) configure_args+=" -Duse-elf-tls=false";;
*) configure_args+=" -Dglx=dri";;
esac
post_configure() {
if [ "$CROSS_BUILD" ]; then
find -iname "*.ninja" -exec sed -i "{}" \
-e "s; /usr/lib/; ${XBPS_CROSS_BASE}/usr/lib/;g" \
-e "s;-L/usr/lib;-L${XBPS_CROSS_BASE}/usr/lib;g" \
-e "s;-I/usr/include;-I${XBPS_CROSS_BASE}/usr/include;g" \
\;
fi
}
post_install() {
vlicense docs/license.html
case "$XBPS_TARGET_MACHINE" in
i686*)
vsed -e 's#/usr/lib/#/usr/lib32/#g' \
-i ${DESTDIR}/usr/share/vulkan/icd.d/radeon_icd.i686.json \
-i ${DESTDIR}/usr/share/vulkan/icd.d/intel_icd.i686.json
;;
esac
}
libglapi_package() {
depends="libglvnd"
short_desc="Free implementation of the GL API - shared library"
pkg_install() {
vmove "usr/lib/libglapi.so.*"
}
}
libgbm_package() {
short_desc="Mesa Generic buffer management API - runtime"
pkg_install() {
vmove "usr/lib/libgbm.so.*"
}
}
libOSMesa_package() {
short_desc="Mesa Off-Screen interface library"
pkg_install() {
vmove "usr/lib/libOSMesa.so.*"
}
}
MesaLib-devel_package() {
depends="xorgproto libxshmfence-devel libXext-devel libXxf86vm-devel
libXdamage-devel expat-devel libXfixes-devel libX11-devel libxcb-devel
libdrm-devel libglvnd-devel
libOSMesa>=${version}_${revision} libgbm>=${version}_${revision}
mesa>=${version}_${revision}"
case "$XBPS_TARGET_MACHINE" in
i686*|x86_64*) depends+=" libxatracker>=${version}_${revision}";;
esac
short_desc+=" - development files"
pkg_install() {
vmove usr/include
vmove usr/lib/pkgconfig
vmove "usr/lib/*.so"
}
}
libxatracker_package() {
short_desc="Mesa XA tracker interface library"
pkg_install() {
vmove "usr/lib/libxatracker*.so.*"
}
}
mesa-opencl_package() {
short_desc="Mesa implementation of OpenCL (r600+ only)"
depends="libclc libOpenCL"
pkg_install() {
vmove etc/OpenCL
vmove "usr/lib/libMesaOpenCL.so.*"
}
}
mesa-dri_package() {
short_desc="Mesa DRI drivers"
depends="mesa-${version}_${revision}"
shlib_provides="libgallium_dri.so" # workaround for mesa-dri-32bit
pkg_install() {
# Only strip each megadriver once, via its master filename
nostrip_files=$(find "${DESTDIR}/usr/lib/xorg/modules/drivers" \
! -name 'libmesa_dri_drivers.so' ! -name 'libgallium_dri.so' \
-type f -printf '%f ')
vmove "usr/lib/xorg/modules/drivers";
if [ -d "$DESTDIR/usr/lib/gallium-pipe" ]; then
vmove "usr/lib/gallium-pipe/pipe_*.so"
fi
}
}
mesa-vaapi_package() {
short_desc="Mesa VA-API drivers"
shlib_provides="libgallium_drv_video.so" # workaround for mesa-vaapi-32bit
pkg_install() {
nostrip_files=$(find "${DESTDIR}/usr/lib/dri" \
! -name 'libgallium_drv_video.so' -type f -printf '%f ')
vmove "usr/lib/dri/*_drv_video.so"
}
}
mesa-vdpau_package() {
short_desc="Mesa VDPAU drivers"
pkg_install() {
nostrip_files=$(find "${DESTDIR}/usr/lib/vdpau" \
! -name 'libvdpau_gallium.so*' -type f -printf '%f ')
vmove "usr/lib/vdpau/libvdpau_*"
}
}
mesa-XvMC_package() {
short_desc="Mesa XvMC drivers"
pkg_install() {
nostrip_files=$(find "${DESTDIR}/usr/lib/libXvMC"* \
! -name 'libXvMCgallium.so' -type f -printf '%f ')
vmove "usr/lib/libXvMC*"
}
}
mesa-vulkan-intel_package() {
short_desc="Mesa Intel Vulkan driver"
lib32files="/usr/share/vulkan/icd.d/intel_icd.i686.json"
pkg_install() {
vmove "usr/share/vulkan/icd.d/intel_icd*.json"
vmove "usr/lib/libvulkan_intel.so"
}
}
mesa-vulkan-radeon_package() {
short_desc="Mesa Radeon Vulkan driver"
lib32files="/usr/share/vulkan/icd.d/radeon_icd.i686.json"
pkg_install() {
vmove "usr/share/vulkan/icd.d/radeon_icd*.json"
vmove "usr/lib/libvulkan_radeon.so"
}
}
mesa-vulkan-overlay-layer_package() {
short_desc="Vulkan layer to display information about the running application"
pkg_install() {
vmove usr/lib/libVkLayer_MESA_overlay.so
vmove usr/share/vulkan/explicit_layer.d/VkLayer_MESA_overlay.json
}
}
mesa-ati-dri_package() {
build_style=meta
lib32mode=full
short_desc="Mesa DRI drivers for ATI GPUs (transitional dummy package)"
depends="mesa-dri mesa-vaapi mesa-vdpau mesa-XvMC mesa-vulkan-radeon"
}
mesa-etnaviv-dri_package() {
build_style=meta
lib32mode=full
short_desc="Mesa DRI drivers for Vivante GPUs (transitional dummy package)"
depends="mesa-dri"
}
mesa-freedreno-dri_package() {
build_style=meta
lib32mode=full
short_desc="Mesa DRI drivers for Adreno GPUs (transitional dummy package)"
depends="mesa-dri"
}
mesa-intel-dri_package() {
build_style=meta
lib32mode=full
short_desc="Mesa DRI drivers for Intel GPUs (transitional dummy package)"
depends="mesa-dri mesa-vulkan-intel"
}
mesa-kmsro-dri_package() {
build_style=meta
lib32mode=full
short_desc="KMS Render-only Mesa DRI drivers (transitional dummy package)"
depends="mesa-dri"
}
mesa-lima-dri_package() {
build_style=meta
lib32mode=full
short_desc="Mesa DRI drivers for Mali GPUs (Utgard) (transitional dummy package)"
depends="mesa-dri"
}
mesa-nouveau-dri_package() {
build_style=meta
lib32mode=full
short_desc="Mesa DRI drivers for NVIDIA GPUs (transitional dummy package)"
depends="mesa-dri mesa-vaapi mesa-vdpau mesa-XvMC"
}
mesa-panfrost-dri_package() {
build_style=meta
lib32mode=full
short_desc="Mesa DRI drivers for Mali GPUs (Midgard/Bifrost) (dummy package)"
depends="mesa-dri"
}
mesa-tegra-dri_package() {
build_style=meta
lib32mode=full
short_desc="Mesa DRI drivers for Tegra GPU (transitional dummy package)"
depends="mesa-dri"
}
mesa-v3d-dri_package() {
build_style=meta
lib32mode=full
short_desc="Mesa DRI drivers for Videocore VI GPU (transitional dummy package)"
depends="mesa-dri"
}
mesa-vmwgfx-dri_package() {
build_style=meta
lib32mode=full
short_desc="Mesa DRI drivers for VMware (transitional dummy package)"
depends="mesa-dri"
}
mesa-vc4-dri_package() {
build_style=meta
lib32mode=full
short_desc="Mesa DRI drivers for Videocore IV GPU (transitional dummy package)"
depends="mesa-dri"
}