void-packages/srcpkgs/libGL/template
2017-07-15 08:16:50 +02:00

219 lines
6.8 KiB
Bash

# Template build file for 'libGL'.
pkgname=libGL
version=17.1.5
revision=1
wrksrc="mesa-${version}"
build_style=gnu-configure
configure_args="--enable-shared-glapi --enable-gbm
--enable-gles1 --enable-gles2 --enable-egl --enable-vdpau
--enable-xvmc --enable-osmesa --enable-texture-float
--with-egl-platforms=x11,drm,$(vopt_if wayland wayland)"
short_desc="Graphics library similar to SGI's OpenGL"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="http://www.mesa3d.org/"
license="MIT, LGPL-2.1"
distfiles="https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz"
checksum=378516b171712687aace4c7ea8b37c85895231d7a6d61e1e27362cf6034fded9
hostmakedepends="
automake libtool flex pkg-config llvm python-Mako libxml2-python $(vopt_if wayland wayland-devel)"
makedepends="
glproto dri2proto dri3proto presentproto libXext-devel libXxf86vm-devel
eudev-libudev-devel libdrm-devel expat-devel talloc-devel libvdpau-devel libva-devel
libXdamage-devel libXvMC-devel libxshmfence-devel $(vopt_if wayland wayland-devel)
elfutils-devel ncurses-devel zlib-devel libffi-devel"
conf_files="/etc/drirc"
# Package build options
build_options="wayland"
# Enable all options by default.
build_options_default="wayland"
# Set subpackages manually to set proper rdeps in 32bit pkgs.
subpackages="libglapi libgbm libEGL libGLES libOSMesa $(vopt_if wayland libwayland-egl)"
case "$XBPS_TARGET_MACHINE" in
i686*|x86_64*)
# Enable all x86 drivers.
configure_args+=" --with-gallium-drivers=r300,r600,radeonsi,svga,swrast,nouveau,virgl"
configure_args+=" --with-dri-drivers=i915,i965,r200,radeon,nouveau,swrast"
configure_args+=" --enable-xa --enable-dri3 --enable-nine"
configure_args+=" --with-vulkan-drivers=intel,radeon"
configure_args+=" --enable-opencl --enable-opencl-icd"
hostmakedepends+=" clang libclc-git"
subpackages+=" libxatracker mesa-ati-dri mesa-intel-dri mesa-nouveau-dri"
subpackages+=" mesa-vmwgfx-dri mesa-opencl"
;;
armv[67]l*)
# Enable Videocore IV and swrast for RaspberryPi
configure_args+=" --with-gallium-drivers=swrast,vc4"
configure_args+=" --with-dri-drivers=swrast"
configure_args+=" --disable-xa"
subpackages+=" mesa-vc4-dri"
;;
*)
# Enable swrast driver.
configure_args+=" --with-gallium-drivers=swrast"
configure_args+=" --with-dri-drivers=swrast"
configure_args+=" --disable-xa"
;;
esac
if [ "$XBPS_GCC_VERSION_MAJOR" -ge 7 ]; then
case "$XBPS_TARGET_MACHINE" in
armv[5-6]*)
# Enable MISSING_64BIT_ATOMICS for armv6*
CFLAGS+=" -DMISSING_64BIT_ATOMICS=1"
CXXFLAGS+=" -DMISSING_64BIT_ATOMICS=1"
;;
esac
fi
# -devel must be the last one for proper order.
subpackages+=" MesaLib-devel"
case "$XBPS_TARGET_MACHINE" in
i686) configure_args+=" --with-dri-driverdir=/usr/lib32/xorg/modules/drivers";;
*) configure_args+=" --with-dri-driverdir=/usr/lib/xorg/modules/drivers";;
esac
case "$XBPS_TARGET_MACHINE" in
# Disable TLS with musl: https://bugs.freedesktop.org/show_bug.cgi?id=35268
# Disable D3D9 state tracker: needs fpu_control.h
*-musl) configure_args+=" --disable-glx-tls --disable-nine";;
*) configure_args+=" --enable-glx-tls";;
esac
pre_configure() {
libtoolize -f
NOCONFIGURE=1 ./autogen.sh
case "$XBPS_TARGET_MACHINE" in
armv6*) sed -i src/gallium/drivers/vc4/Makefile.am \
-e 's;\(libvc4_neon_la_SOURCES =\) vc4_tiling_lt.c;\1;' \
-e 's;\(libvc4_neon_la_CFLAGS = $(AM_CFLAGS)\) -DVC4_BUILD_NEON;\1;'
;;
esac
}
post_install() {
vmkdir usr/lib/xorg/modules/extensions
ln -s libglx-xorg.so ${DESTDIR}/usr/lib/xorg/modules/extensions/libglx.so
if [ -d "$DESTDIR/usr/lib32" ]; then
mv "$DESTDIR/usr/lib32/d3d" "$DESTDIR/usr/lib"
mv "$DESTDIR/usr/lib32/pkgconfig"/* "$DESTDIR/usr/lib/pkgconfig"
fi
}
libglapi_package() {
depends="libudev"
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() {
depends="libudev"
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*"
}
}
libwayland-egl_package() {
short_desc="Free implementation of the EGL API - wayland runtime"
pkg_install() {
vmove "usr/lib/libwayland-egl.so*"
}
}
MesaLib-devel_package() {
depends="glproto dri2proto>=2.1 dri3proto presentproto libxshmfence-devel
libXext-devel libXxf86vm-devel libXdamage-devel expat-devel
libXfixes-devel libX11-devel libxcb-devel libdrm-devel>=2.4.39
libGL>=${version}_${revision}
libGLES>=${version}_${revision} libEGL>=${version}_${revision}
libOSMesa>=${version}_${revision} libgbm>=${version}_${revision}
$(vopt_if wayland "libwayland-egl>=${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
}
}
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"
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/gallium-pipe/pipe_r[36]00.so"
vmove usr/lib/gallium-pipe/pipe_radeonsi.so
vmove usr/lib/dri/r*
vmove "usr/share/vulkan/icd.d/radeon_icd*.json"
vmove "usr/lib/libvulkan_radeon.so"
}
}
mesa-intel-dri_package() {
short_desc="Mesa DRI drivers for Intel GPUs"
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/gallium-pipe/pipe_nouveau.so
vmove usr/lib/dri/nouveau*
}
}
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/lib*OpenCL*"
}
}