changeset 688:d13cafd27a68

graphics/mesa: improve user options
author David Demelier <markand@malikania.fr>
date Thu, 01 Aug 2019 21:00:00 +0200
parents 1477b925acaf
children 439aade5bee6
files graphics/mesa/mesa.sh
diffstat 1 files changed, 44 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/graphics/mesa/mesa.sh	Thu Aug 01 20:55:00 2019 +0200
+++ b/graphics/mesa/mesa.sh	Thu Aug 01 21:00:00 2019 +0200
@@ -22,7 +22,7 @@
 PKGSUMMARY="opensource OpenGL implementation"
 PKGDOWNLOAD="https://mesa.freedesktop.org/archive/$PKGNAME-$PKGVERSION.tar.xz"
 PKGDEPENDS="dev/meson:build"
-PKGOPTIONS="DRM LLVM WAYLAND X"
+PKGOPTIONS="DRM EGL GALLIUM GLVND LLVM PLATFORMS SELINUX VULKAN WAYLAND X"
 
 : ${CC:=clang}
 : ${CFLAGS:=-O2}
@@ -30,32 +30,65 @@
 : ${CXXFLAGS:=-O2}
 : ${LDFLAGS:=}
 : ${DRM:=yes}
+: ${EGL:=yes}
+: ${GALLIUM:=radeonsi r300 r600 virgl svga swrast}      # drivers list or "no"
+: ${GLVND:=yes}
 : ${LLVM:=yes}
+: ${SELINUX:=no}
+: ${VULKAN:=intel amd}                                  # drivers list or "no"
 : ${WAYLAND:=yes}
 : ${X:=yes}
 
+# Convert user options separated by spaces to comma.
 with_platforms=""
-with_gallium_drivers="r300,r600,virgl,svga,swrast"
-with_vulkan_drivers="intel"
+with_gallium_drivers=""
+with_vulkan_drivers=""
 
 if [ "$DRM" = "yes" ]; then
-	with_platforms="drm,$platforms"
+	PKGDEPENDS="graphics/libdrm $PKGDEPENDS"
+	with_platforms="drm"
+fi
+
+if [ "$EGL" = "yes" ]; then
+	with_egl="-D egl=true"
+else
+	with_egl="-D egl=false"
+fi
+
+if [ "$GALLIUM" != "no" ]; then
+	with_gallium_drivers=$(echo $GALLIUM | sed -e "s/ /,/")
+fi
+
+if [ "$GLVND" = "yes" ]; then
+	with_glvnd="-D glvnd=true"
+else
+	with_glvnd="-D glvnd=false"
 fi
 
 if [ "$LLVM" = "yes" ]; then
-	PKGDEPENDS="dev/llvm:build $PKGDEPENDS"
+	PKGDEPENDS="dev/llvm $PKGDEPENDS"
 	with_llvm="-D llvm=true"
-	with_gallium_drivers="radeonsi,$with_gallium_drivers"
-	with_vulkan_drivers="amd,$with_vulkan_drivers"
 else
 	with_llvm="-D llvm=false"
 fi
 
+if [ "$VULKAN" != "no" ]; then
+	with_vulkan_drivers=$(echo $VULKAN | sed -e "s/ /,/")
+fi
+
 if [ "$WAYLAND" = "yes" ]; then
+	PKGDEPENDS="graphics/wayland graphics/wayland-protocols $PKGDEPENDS"
 	with_platforms="wayland,$with_platforms"
 fi
 
 if [ "$X" = "yes" ]; then
+	PKGDEPENDS="x11/libx11
+	            x11/libxdamage
+	            x11/libxext
+	            x11/libxrandr
+	            x11/libxshmfence
+	            x11/libxxf86vm
+	            $PKGDEPENDS"
 	with_platforms="x11,$with_platforms"
 	with_dri="-D dri3=true"
 	with_glx="-D glx=dri"
@@ -83,14 +116,15 @@
 		--buildtype release \
 		--default-library shared \
 		-D libdir=lib \
-		-D egl=true \
 		-D bpm=true \
 		-D platforms=$with_platforms \
 		-D gallium-drivers=$with_gallium_drivers \
 		-D vulkan-drivers=$with_vulkan_drivers \
+		$with_dri \
+		$with_egl \
+		$with_glvnd \
+		$with_glx \
 		$with_llvm \
-		$with_dri \
-		$with_glx \
 		. build
 	ninja -C build
 	DESTDIR=$DESTDIR ninja -C build install
@@ -98,4 +132,3 @@
 	cd ..
 	rm -rf $PKGNAME-$PKGVERSION
 }
-