void-packages/srcpkgs/libGL/template
Jürgen Buchmüller 76c20fc57a
libGL: fix cross build for ppc* from x86_64*
Signed-off-by: Jürgen Buchmüller <pullmoll@t-online.de>
2019-11-16 17:14:23 +01:00

259 lines
7.7 KiB
Bash

# Template file for 'libGL'
pkgname=libGL
version=19.2.4
revision=1
wrksrc="mesa-${version}"
build_style=meson
configure_args="-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="flex libxml2-python llvm pkg-config
python3-Mako $(vopt_if wayland 'wayland-protocols wayland-devel')"
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"
short_desc="Graphics library similar to SGI's OpenGL"
maintainer="Orphaned <orphan@voidlinux.org>"
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=09000a0f7dbbd82e193b81a8f1bf0c118eab7ca975c0329181968596e548e30f
build_options="wayland"
build_options_default="wayland"
# Set subpackages manually to set proper rdeps in 32bit pkgs.
subpackages="libglapi libgbm libEGL libGLES libOSMesa"
case "$XBPS_TARGET_MACHINE" in
i686*|x86_64*)
# Enable all x86 drivers.
configure_args+=" -Dgallium-drivers=r300,r600,radeonsi,svga,swrast,nouveau,virgl"
configure_args+=" -Ddri-drivers=i915,i965,r100,r200,nouveau"
configure_args+=" -Dgallium-xa=true -Ddri3=true -Dgallium-nine=true"
configure_args+=" -Dvulkan-drivers=intel,amd"
configure_args+=" -Dgallium-opencl=icd"
hostmakedepends+=" clang"
makedepends+=" libclc-git"
subpackages+=" libxatracker mesa-ati-dri mesa-intel-dri mesa-nouveau-dri"
subpackages+=" mesa-vmwgfx-dri mesa-opencl"
;;
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"
# 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-ati-dri mesa-nouveau-dri"
subpackages+=" mesa-opencl"
;;
aarch64*)
configure_args+=" -Dgallium-drivers=nouveau,tegra,swrast,vc4"
configure_args+=" -Dvulkan-drivers= -Ddri-drivers="
configure_args+=" -Dgallium-xa=false -Ddri3=true"
subpackages+=" mesa-tegra-dri mesa-nouveau-dri mesa-vc4-dri"
;;
armv7l*)
# Enable Videocore IV and swrast for RaspberryPi
configure_args+=" -Dgallium-drivers=swrast,vc4"
configure_args+=" -Dvulkan-drivers= -Ddri-drivers= -Dgallium-xvmc=false"
configure_args+=" -Dgallium-xa=false -Dgallium-vdpau=false -Dgallium-va=false"
subpackages+=" 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"
;;
esac
case "$XBPS_TARGET_MACHINE" in
armv[5-6]*)
# Enable MISSING_64BIT_ATOMICS for armv[56]*
CFLAGS+=" -DMISSING_64BIT_ATOMICS=1"
CXXFLAGS+=" -DMISSING_64BIT_ATOMICS=1"
;;
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://bugs.freedesktop.org/show_bug.cgi?id=35268
*-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
vmkdir usr/lib/xorg/modules/extensions
ln -s libglx-xorg.so ${DESTDIR}/usr/lib/xorg/modules/extensions/libglx.so
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() {
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.*"
}
}
libEGL_package() {
short_desc="Free implementation of the EGL API - runtime"
pkg_install() {
vmove "usr/lib/libEGL*.so.*"
}
}
libGLES_package() {
short_desc="Free implementation of the OpenGL|ES 1.x and 2.x API"
pkg_install() {
vmove "usr/lib/libGLES*.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 libGL>=${version}_${revision} libEGL>=${version}_${revision}
libOSMesa>=${version}_${revision} libgbm>=${version}_${revision}
libGLES>=${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-ati-dri_package() {
short_desc="Mesa DRI drivers for ATI GPUs"
lib32files="/usr/share/vulkan/icd.d/radeon_icd.i686.json"
pkg_install() {
vmove "usr/lib/libXvMCr[36]00.so.*"
vmove "usr/lib/vdpau/libvdpau_r[36]00.so*"
vmove "usr/lib/vdpau/libvdpau_radeon*.so*"
vmove "usr/lib/xorg/modules/drivers/radeon*"
vmove "usr/lib/xorg/modules/drivers/r[236]00*"
vmove usr/lib/dri/r*
vmove "usr/share/vulkan/icd.d/radeon_icd*.json"
vmove "usr/lib/libvulkan_radeon.so"
vmove "usr/lib/gallium-pipe/pipe_r[36]00.so"
vmove usr/lib/gallium-pipe/pipe_radeonsi.so
}
}
mesa-intel-dri_package() {
short_desc="Mesa DRI drivers for Intel GPUs"
lib32files="/usr/share/vulkan/icd.d/intel_icd.i686.json"
pkg_install() {
vmove "usr/lib/xorg/modules/drivers/i9[16]5_dri.*"
vmove "usr/share/vulkan/icd.d/intel_icd*.json"
vmove "usr/lib/libvulkan_intel.so"
}
}
mesa-nouveau-dri_package() {
short_desc="Mesa DRI drivers for NVIDIA GPUs (nouveau dri)"
pkg_install() {
vmove "usr/lib/libXvMCnouveau.so.*"
vmove "usr/lib/vdpau/libvdpau_nouveau.so*"
vmove "usr/lib/xorg/modules/drivers/nouveau*"
vmove "usr/lib/dri/nouveau*"
case "$XBPS_TARGET_MACHINE" in
aarch64*) ;;
*) vmove usr/lib/gallium-pipe/pipe_nouveau.so ;;
esac
}
}
mesa-vmwgfx-dri_package() {
short_desc="Mesa DRI drivers for VMware"
pkg_install() {
vmove "usr/lib/xorg/modules/drivers/vmwgfx*"
vmove usr/lib/gallium-pipe/pipe_vmwgfx.so
}
}
mesa-vc4-dri_package() {
short_desc="Mesa DRI drivers for Videocore IV GPU"
pkg_install() {
vmove "usr/lib/xorg/modules/drivers/vc4*"
}
}
mesa-opencl_package() {
short_desc="Mesa implementation of OpenCL (r600+ only)"
depends="libclc libOpenCL"
pkg_install() {
vmove etc/OpenCL
vmove "usr/lib/libMesaOpenCL*"
}
}
mesa-tegra-dri_package() {
short_desc="Mesa DRI drivers for Tegra GPU"
depends="mesa-nouveau-dri"
pkg_install() {
vmove "usr/lib/xorg/modules/drivers/tegra*"
}
}