Package: guix-patches;
Reported by: The Man <squishypinkelephant <at> gmail.com>
Date: Mon, 25 Nov 2024 03:40:02 UTC
Severity: normal
Tags: patch
View this message in rfc822 format
From: The Man <squishypinkelephant <at> gmail.com> To: 74522 <at> debbugs.gnu.org Cc: The Man <squishypinkelephant <at> gmail.com> Subject: [bug#74522] [PATCH 73/73] move libgl provider from mesa to libglvnd+mesa Date: Sun, 24 Nov 2024 21:42:06 -0600
Change-Id: I3e9235f3d9755058462679ebd63de0484384d184 --- gnu/packages/gl.scm | 155 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 122 insertions(+), 33 deletions(-) diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm index 0a285dfc30..81803519de 100644 --- a/gnu/packages/gl.scm +++ b/gnu/packages/gl.scm @@ -74,6 +74,7 @@ (define-module (gnu packages gl) #:use-module (guix build-system cmake) #:use-module (guix build-system meson) #:use-module (guix build-system python) + #:use-module (guix build-system trivial) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix gexp) @@ -102,7 +103,7 @@ (define-public glu automake libtool)) (propagated-inputs - (list mesa)) ; according to glu.pc + (list libgl)) ; according to glu.pc (home-page "http://www.opengl.org/archives/resources/faq/technical/glu.htm") (synopsis "Mesa OpenGL Utility library") (description @@ -137,7 +138,7 @@ (define-public freeglut (inputs (list libx11 libxi libxrandr libxxf86vm)) (propagated-inputs ;; Headers from Mesa and GLU are needed. - (list glu mesa)) + (list glu libgl)) (home-page "https://freeglut.sourceforge.net/") (synopsis "Alternative to the OpenGL Utility Toolkit (GLUT)") (description @@ -189,7 +190,7 @@ (define-public ftgl `(#:configure-flags '("--disable-static"))) ;; The pkg-config file lists "freetype2" as Requires.private. (propagated-inputs (list freetype)) - (inputs (list libx11 mesa glu)) + (inputs (list libx11 libgl glu)) (native-inputs (list pkg-config autoconf automake libtool)) (synopsis "Font rendering library for OpenGL applications") @@ -292,7 +293,7 @@ (define libva-without-mesa (inherit libva) (name "libva-without-mesa") (inputs (fold alist-delete (package-inputs libva) - '("mesa" "wayland"))) + '("libgl" "wayland"))) (arguments (strip-keyword-arguments '(#:make-flags) @@ -329,6 +330,7 @@ (define-public mesa (list elfutils ;libelf required for r600 when using llvm expat (force libva-without-mesa) + libglvnd-headers libxml2 libxrandr libxvmc @@ -398,6 +400,8 @@ (define-public mesa ;; "-Domx=true" "-Dosmesa=true" "-Dgallium-xa=enabled" + ;; libglvnd support + "-Dglvnd=true" ;; features required by wayland "-Dgles2=enabled" @@ -634,7 +638,14 @@ (define-public mesa (((string-append "\"lib" layer-name ".so\"")) (string-append "\"" out "/lib/lib" layer-name ".so\""))))))) (for-each fix-layer-path '("VkLayer_MESA_device_select" - "VkLayer_MESA_overlay")))))))) + "VkLayer_MESA_overlay"))))) + (add-after 'install 'fix-egl-vendor-path + (lambda _ + (substitute* + (string-append #$output + "/share/glvnd/egl_vendor.d/50_mesa.json") + (("libEGL_mesa") + (string-append #$output "/lib/libEGL_mesa")))))))) (native-search-paths (list (search-path-specification ;; Ensure the Mesa VDPAU drivers can be found. @@ -721,7 +732,7 @@ (define-public mesa-utils (source (mesa-demos-source version)) (build-system gnu-build-system) (inputs - (list mesa freeglut glew)) + (list libgl freeglut glew)) (native-inputs (list pkg-config)) (arguments @@ -782,7 +793,7 @@ (define-public glew (delete-file (string-append #$output "/lib/libGLEW.a"))))) #:tests? #f)) ;no 'check' target (inputs - (list libxi libxmu libx11 mesa)) + (list libxi libxmu libx11 libgl)) ;; <GL/glew.h> includes <GL/glu.h>. (propagated-inputs (list glu)) @@ -809,7 +820,7 @@ (define-public guile-opengl "0rbc2wf9x63ilj3n85h8wyllzc2b22abmhs2p2ghjgc253n8gw5q")))) (build-system gnu-build-system) (native-inputs (list pkg-config)) - (inputs (list guile-2.2 mesa glu freeglut)) + (inputs (list guile-2.2 libgl glu freeglut)) (arguments '(#:phases (modify-phases %standard-phases (add-before 'build 'patch-dynamic-link @@ -817,7 +828,7 @@ (define-public guile-opengl (substitute* "gl/runtime.scm" (("\\(dynamic-link\\)") (string-append "(dynamic-link \"" - (assoc-ref inputs "mesa") + (assoc-ref inputs "libgl") "/lib/libGL.so" "\")"))) (define (dynamic-link-substitute file lib input) (substitute* file @@ -827,7 +838,7 @@ (define-public guile-opengl "/lib/lib" lib "\"")))) ;; Replace dynamic-link calls for libGL, libGLU, and ;; libglut with absolute paths to the store. - (dynamic-link-substitute "glx/runtime.scm" "GL" "mesa") + (dynamic-link-substitute "glx/runtime.scm" "GL" "libgl") (dynamic-link-substitute "glu/runtime.scm" "GLU" "glu") (dynamic-link-substitute "glut/runtime.scm" "glut" "freeglut")))))) @@ -843,7 +854,7 @@ (define-public guile3.0-opengl (inherit guile-opengl) (name "guile3.0-opengl") (inputs - (list guile-3.0 mesa glu freeglut)))) + (list guile-3.0 libgl glu freeglut)))) (define-public libepoxy (package @@ -863,20 +874,20 @@ (define-public libepoxy #~(modify-phases %standard-phases (add-before 'configure 'patch-paths (lambda* (#:key inputs #:allow-other-keys) - (let ((mesa-lib + (let ((libgl-lib (lambda (file) (search-input-file inputs (string-append "lib/" file))))) (substitute* (find-files "." "\\.[ch]$") - (("libGL.so.1") (mesa-lib "libGL.so.1")) - (("libEGL.so.1") (mesa-lib "libEGL.so.1")) - (("libGLESv1_CM.so.1") (mesa-lib "libGLESv1_CM.so.1")) - (("libGLESv2.so.2") (mesa-lib "libGLESv2.so.2"))))))))) + (("libGL.so.1") (libgl-lib "libGL.so.1")) + (("libEGL.so.1") (libgl-lib "libEGL.so.1")) + (("libGLESv1_CM.so.1") (libgl-lib "libGLESv1_CM.so.1")) + (("libGLESv2.so.2") (libgl-lib "libGLESv2.so.2"))))))))) (build-system meson-build-system) (native-inputs (list pkg-config python)) (propagated-inputs ;; epoxy.pc: 'Requires.private: gl egl' - (list mesa)) + (list libgl)) (synopsis "Library for handling OpenGL function pointer management") (description "A library for handling OpenGL function pointer management.") @@ -897,21 +908,46 @@ (define-public libglvnd (base32 "07v3bmwzmg0d4g2zp835v1g7j22j8vz7hjfmqrdqjgxjj6v4jkyr")))) (build-system meson-build-system) - (arguments - '(#:configure-flags '("-Dx11=enabled") - #:phases (modify-phases %standard-phases + (arguments (list + #:configure-flags #~(list + "-Dx11=enabled" + (string-append "-Dc_link_args=-Wl,-rpath=$ORIGIN:" + ;; or else runpath errors with libGLdispatch.so + #$(this-package-input "mesa") "/lib")) + ;; we also need mesa visibility at te very least + #:phases #~(modify-phases %standard-phases (add-after 'unpack 'disable-glx-tests (lambda _ - ;; This package is meant to be used alongside Mesa. + ;; This package is meant to be used alongside mesonMesa. ;; To avoid a circular dependency, disable tests that ;; require a running Xorg server. (substitute* "tests/meson.build" (("if with_glx") - "if false"))))))) + "if false")))) + (delete 'shrink-runpath) ;; don't erase our hard work + (add-after 'install 'add-external-egl + (lambda _ + (mkdir-p (string-append #$output + "/share/egl/egl_external_platform.d"))))))) (native-inputs (list pkg-config)) + (propagated-inputs + (list mesa)) (inputs (list libx11 libxext xorgproto)) + (native-search-paths (list + (search-path-specification + (variable "GBM_BACKENDS_PATH") + (files '("lib"))) + (search-path-specification + (variable "XDG_DATA_DIRS") + (files '("share"))) + (search-path-specification + (variable "__EGL_EXTERNAL_PLATFORM_CONFIG_DIRS") + (files '("share/egl/egl_external_platform.d"))) + (search-path-specification + (variable "__EGL_VENDOR_LIBRARY_DIRS") + (files '("share/glvnd/egl_vendor.d"))))) (synopsis "Vendor-neutral OpenGL dispatch library") (description "libglvnd is a vendor-neutral dispatch layer for arbitrating OpenGL @@ -926,6 +962,59 @@ (define-public libglvnd license:x11 license:expat)))) +;; only mesa will use this, keep things small and simple +(define libglvnd-headers + (package + (inherit libglvnd) + (arguments (list + #:phases + #~(modify-phases %standard-phases + (delete 'configure) + (delete 'build) + (delete 'check) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (include (string-append out "/include")) + (pkgconfig (string-append out "/lib/pkgconfig"))) + (copy-recursively "include" include) + ;; clean up junk + (delete-file (string-append include "/Makefile.am")) + (delete-file (string-append include "/meson.build")) + (mkdir-p pkgconfig) + ;; generate the only .pc file needed to build mesa + (call-with-output-file (string-append pkgconfig "/libglvnd.pc") + (lambda (port) + (format port "prefix=~a +includedir=${prefix}/include + +datarootdir=${prefix}/share +datadir=${prefix}/share + +Name: libglvnd +Description: Vendor-neutral OpenGL dispatch library vendor interface +Version: ~a +Cflags: -I${includedir}" out #$(package-version this-package)))))))))) + (native-inputs '()) + (propagated-inputs '()) + (inputs '()))) + +(define-public libgl + (package/inherit libglvnd ;; can't be a literal empty shell or nothing will build + (name "libgl") + (version "glvnd") + (inputs '()) + (native-inputs '()) + (propagated-inputs (list libglvnd)) + (build-system trivial-build-system) + (arguments + (list #:modules '((guix build union)) + #:builder #~(begin (use-modules (guix build union)) + (union-build #$output '#$(list libglvnd))))) + (synopsis "LibGL package") + (description + "LibGL package"))) + (define-public libopenglrecorder (package (name "libopenglrecorder") @@ -986,7 +1075,7 @@ (define-public soil (native-inputs (list unzip)) (inputs - (list mesa)) + (list libgl)) (home-page "https://www.lonesock.net/soil.html") (synopsis "OpenGL texture loading library") (description @@ -1052,7 +1141,7 @@ (define-public glfw (native-inputs (list doxygen unzip)) (inputs (list libxkbcommon wayland vulkan-loader)) (propagated-inputs - (list mesa ;included in public headers + (list libgl ;included in public headers ;; These are in 'Requires.private' of 'glfw3.pc'. libx11 libxrandr @@ -1107,7 +1196,7 @@ (define-public nanovg-for-extempore (build-system cmake-build-system) (arguments `(#:tests? #f)) ; no tests included (inputs - (list mesa)) + (list libgl)) ;; Extempore refuses to build on architectures other than x86_64 (supported-systems '("x86_64-linux")) (home-page "https://github.com/extemporelang/nanovg") @@ -1132,7 +1221,7 @@ (define-public gl2ps (base32 "1sgzv547h7hrskb9qd0x5yp45kmhvibjwj2mfswv95lg070h074d")))) (build-system cmake-build-system) (inputs - (list libpng mesa zlib)) + (list libpng libgl zlib)) (arguments `(#:tests? #f)) ; no tests (home-page "https://www.geuz.org/gl2ps/") @@ -1168,7 +1257,7 @@ (define-public virtualgl (assoc-ref %outputs "out") "/lib") "-DVGL_USESSL=1"))) ; use OpenSSL (build-system cmake-build-system) - (inputs (list glu libjpeg-turbo libxtst mesa openssl)) + (inputs (list glu libjpeg-turbo libxtst libgl openssl)) (native-inputs (list pkg-config)) (home-page "https://www.virtualgl.org") (synopsis "Redirects 3D commands from an OpenGL application onto a 3D @@ -1283,11 +1372,11 @@ (define-public glmark2 (modify-phases %standard-phases (add-after 'unpack 'patch-paths (lambda* (#:key inputs #:allow-other-keys) - (let ((mesa (assoc-ref inputs "mesa"))) + (let ((libgl (assoc-ref inputs "libgl"))) (substitute* (find-files "src" "gl-state-.*\\.cpp$") - (("libGL.so") (string-append mesa "/lib/libGL.so")) - (("libEGL.so") (string-append mesa "/lib/libEGL.so")) - (("libGLESv2.so") (string-append mesa "/lib/libGLESv2.so"))) + (("libGL.so") (string-append libgl "/lib/libGL.so")) + (("libEGL.so") (string-append libgl "/lib/libEGL.so")) + (("libGLESv2.so") (string-append libgl "/lib/libGLESv2.so"))) #t)))))) (native-inputs (list pkg-config)) @@ -1298,7 +1387,7 @@ (define-public glmark2 libpng libx11 libxcb - mesa + libgl wayland wayland-protocols)) (home-page "https://github.com/glmark2/glmark2") @@ -1329,7 +1418,7 @@ (define-public waffle (delete-file-recursively f))) (scandir "."))))))) (build-system meson-build-system) - (propagated-inputs (list mesa wayland)) + (propagated-inputs (list libgl wayland)) (native-inputs (list cmocka pkg-config)) (home-page "https://waffle.freedesktop.org/") (synopsis "Choose OpenGL API at runtime") -- 2.46.0
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.