add upstream wrapper to Use Zink bypassing the problematic NVIDIA OpenGL stack while retaining hardware acceleration

This commit is contained in:
lod 2025-04-08 12:10:10 +02:00
parent b325a2ce7c
commit a7958b7866
3 changed files with 48 additions and 5 deletions

View file

@ -13,6 +13,7 @@ pkgbase = orca-slicer
makedepends = ninja makedepends = ninja
makedepends = pkgconf makedepends = pkgconf
makedepends = wayland-protocols makedepends = wayland-protocols
depends = bash
depends = cairo depends = cairo
depends = dbus depends = dbus
depends = expat depends = expat
@ -36,14 +37,19 @@ pkgbase = orca-slicer
depends = wayland depends = wayland
depends = webkit2gtk-4.1 depends = webkit2gtk-4.1
depends = zlib depends = zlib
optdepends = mesa: Enables Zink fallback workaround for NVIDIA on Wayland
optdepends = mesa-utils: for detecting renderer
optdepends = nvidia-utils: for querying driver version
provides = orca-slicer provides = orca-slicer
options = !debug options = !debug
options = !emptydirs options = !emptydirs
source = orca-slicer::git+https://github.com/SoftFever/OrcaSlicer.git#tag=v2.3.0 source = orca-slicer::git+https://github.com/SoftFever/OrcaSlicer.git#tag=v2.3.0
source = orca-slicer-wrapper.sh
source = https://github.com/Open-Cascade-SAS/OCCT/commit/7236e83dcc1e7284e66dc61e612154617ef715d6.patch source = https://github.com/Open-Cascade-SAS/OCCT/commit/7236e83dcc1e7284e66dc61e612154617ef715d6.patch
source = cmake-min-version.patch source = cmake-min-version.patch
source = wxWidgets-cmake-min-version.patch source = wxWidgets-cmake-min-version.patch
b2sums = 543653c5769e2f022877608c14bad64ea05dbc30d41a58dc1a82eaca6615c0183f7573ced790a263b8509f6a4abdfa6b259ae0701a2468e10c15eb40d1926555 b2sums = 543653c5769e2f022877608c14bad64ea05dbc30d41a58dc1a82eaca6615c0183f7573ced790a263b8509f6a4abdfa6b259ae0701a2468e10c15eb40d1926555
b2sums = 5475dc53f1364a7228e339da503bc8dc8b0a3d4f06bdd88734d59b8d02de84ccc35388ff27d13558b044d02326fded4a36df29056d555f1ae25033fd366353c1
b2sums = cc7791841533e07787a4921b688fdd885782a67320936d445ad04102a68e8e044b5bf52a58d987d158ae522ae4f02a56a3525ccfd1831ef6a3b6459be14bd408 b2sums = cc7791841533e07787a4921b688fdd885782a67320936d445ad04102a68e8e044b5bf52a58d987d158ae522ae4f02a56a3525ccfd1831ef6a3b6459be14bd408
b2sums = 562dcd07530faef0d9fdddf1e009075f67105c8239e4b1402cd890f7a89be8b11671dd6ecc7b55a155f2d05247070bb0b8ff84f2170ce2454ab818018be80e48 b2sums = 562dcd07530faef0d9fdddf1e009075f67105c8239e4b1402cd890f7a89be8b11671dd6ecc7b55a155f2d05247070bb0b8ff84f2170ce2454ab818018be80e48
b2sums = 1459ce126dd80a891006d2c40a001e75dc146ac9eb6ad8e975a3e4672ebb914baabecd8a4048742fab03e2820242f614449dd23a8e721bd5c945c8765e986a5a b2sums = 1459ce126dd80a891006d2c40a001e75dc146ac9eb6ad8e975a3e4672ebb914baabecd8a4048742fab03e2820242f614449dd23a8e721bd5c945c8765e986a5a

View file

@ -6,17 +6,22 @@ pkgdesc="G-code generator for 3D printers (Bambu, Prusa, Voron, VzBot, RatRig, C
arch=('x86_64') arch=('x86_64')
url="https://github.com/SoftFever/OrcaSlicer" url="https://github.com/SoftFever/OrcaSlicer"
license=('AGPL-3.0-only') license=('AGPL-3.0-only')
depends=('cairo' 'dbus' 'expat' 'fontconfig' 'freetype2' 'gcc-libs' 'gdk-pixbuf2' 'glib2' 'glibc' depends=('bash' 'cairo' 'dbus' 'expat' 'fontconfig' 'freetype2' 'gcc-libs' 'gdk-pixbuf2' 'glib2' 'glibc'
'gst-plugins-base-libs' 'gstreamer' 'gtk3' 'hicolor-icon-theme' 'libglvnd' 'libjpeg-turbo' 'gst-plugins-base-libs' 'gstreamer' 'gtk3' 'hicolor-icon-theme' 'libglvnd' 'libjpeg-turbo'
'libspnav' 'libtiff' 'libx11' 'pango' 'python' 'wayland' 'webkit2gtk-4.1' 'zlib') 'libspnav' 'libtiff' 'libx11' 'pango' 'python' 'wayland' 'webkit2gtk-4.1' 'zlib')
makedepends=('cmake' 'extra-cmake-modules' 'git' 'glew' 'm4' 'ninja' 'pkgconf' 'wayland-protocols') makedepends=('cmake' 'extra-cmake-modules' 'git' 'glew' 'm4' 'ninja' 'pkgconf' 'wayland-protocols')
optdepends=('mesa: Enables Zink fallback workaround for NVIDIA on Wayland'
'mesa-utils: for detecting renderer'
'nvidia-utils: for querying driver version')
options=('!debug' '!emptydirs') options=('!debug' '!emptydirs')
provides=("orca-slicer") provides=("orca-slicer")
source=("$pkgname::git+https://github.com/SoftFever/OrcaSlicer.git#tag=v$pkgver" source=($pkgname::git+https://github.com/SoftFever/OrcaSlicer.git#tag=v$pkgver
"https://github.com/Open-Cascade-SAS/OCCT/commit/7236e83dcc1e7284e66dc61e612154617ef715d6.patch" orca-slicer-wrapper.sh
"cmake-min-version.patch" https://github.com/Open-Cascade-SAS/OCCT/commit/7236e83dcc1e7284e66dc61e612154617ef715d6.patch
"wxWidgets-cmake-min-version.patch") cmake-min-version.patch
wxWidgets-cmake-min-version.patch)
b2sums=('543653c5769e2f022877608c14bad64ea05dbc30d41a58dc1a82eaca6615c0183f7573ced790a263b8509f6a4abdfa6b259ae0701a2468e10c15eb40d1926555' b2sums=('543653c5769e2f022877608c14bad64ea05dbc30d41a58dc1a82eaca6615c0183f7573ced790a263b8509f6a4abdfa6b259ae0701a2468e10c15eb40d1926555'
'5475dc53f1364a7228e339da503bc8dc8b0a3d4f06bdd88734d59b8d02de84ccc35388ff27d13558b044d02326fded4a36df29056d555f1ae25033fd366353c1'
'cc7791841533e07787a4921b688fdd885782a67320936d445ad04102a68e8e044b5bf52a58d987d158ae522ae4f02a56a3525ccfd1831ef6a3b6459be14bd408' 'cc7791841533e07787a4921b688fdd885782a67320936d445ad04102a68e8e044b5bf52a58d987d158ae522ae4f02a56a3525ccfd1831ef6a3b6459be14bd408'
'562dcd07530faef0d9fdddf1e009075f67105c8239e4b1402cd890f7a89be8b11671dd6ecc7b55a155f2d05247070bb0b8ff84f2170ce2454ab818018be80e48' '562dcd07530faef0d9fdddf1e009075f67105c8239e4b1402cd890f7a89be8b11671dd6ecc7b55a155f2d05247070bb0b8ff84f2170ce2454ab818018be80e48'
'1459ce126dd80a891006d2c40a001e75dc146ac9eb6ad8e975a3e4672ebb914baabecd8a4048742fab03e2820242f614449dd23a8e721bd5c945c8765e986a5a') '1459ce126dd80a891006d2c40a001e75dc146ac9eb6ad8e975a3e4672ebb914baabecd8a4048742fab03e2820242f614449dd23a8e721bd5c945c8765e986a5a')
@ -70,6 +75,9 @@ build() {
package() { package() {
cd $pkgname cd $pkgname
DESTDIR="$pkgdir" ninja -C build install DESTDIR="$pkgdir" ninja -C build install
install -d "$pkgdir/usr/lib/orca-slicer/"
mv "$pkgdir/usr/bin/orca-slicer" "$pkgdir/usr/lib/orca-slicer/"
install -Dm755 "$srcdir/orca-slicer-wrapper.sh" "$pkgdir/usr/bin/orca-slicer"
install -Dm644 doc/*.md -t "$pkgdir/usr/share/doc/OrcaSlicer/" install -Dm644 doc/*.md -t "$pkgdir/usr/share/doc/OrcaSlicer/"
install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/OrcaSlicer/LICENSE" install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/OrcaSlicer/LICENSE"
rm -rf "$pkgdir/usr/LICENSE.txt" rm -rf "$pkgdir/usr/LICENSE.txt"

29
orca-slicer-wrapper.sh Normal file
View file

@ -0,0 +1,29 @@
#!/bin/bash
DIR="/usr/lib/orca-slicer"
export LD_LIBRARY_PATH="$DIR/bin:$LD_LIBRARY_PATH"
# OrcaSlicer will segfault on systems where locale info is not as expected
export LC_ALL=C
# Use Zink to run OpenGL on top of Vulkan bypassing the problematic NVIDIA OpenGL stack while retaining hardware acceleration.
if [ "$XDG_SESSION_TYPE" = "wayland" ] && [ "$ZINK_DISABLE_OVERRIDE" != "1" ]; then
if command -v glxinfo >/dev/null 2>&1; then
RENDERER=$(glxinfo | grep "OpenGL renderer string:" | sed 's/.*: //')
if echo "$RENDERER" | grep -qi "NVIDIA"; then
if command -v nvidia-smi >/dev/null 2>&1; then
DRIVER_VERSION=$(nvidia-smi --query-gpu=driver_version --format=csv,noheader | head -n1)
DRIVER_MAJOR=$(echo "$DRIVER_VERSION" | cut -d. -f1)
[ "$DRIVER_MAJOR" -gt 555 ] && ZINK_FORCE_OVERRIDE=1
fi
if [ "$ZINK_FORCE_OVERRIDE" = "1" ]; then
export __GLX_VENDOR_LIBRARY_NAME=mesa
export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json
export MESA_LOADER_DRIVER_OVERRIDE=zink
export GALLIUM_DRIVER=zink
export WEBKIT_DISABLE_DMABUF_RENDERER=1
fi
fi
fi
fi
exec "$DIR/orca-slicer" "$@"