summaryrefslogtreecommitdiff
path: root/gnu/packages/gl.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/gl.scm')
-rw-r--r--gnu/packages/gl.scm154
1 files changed, 106 insertions, 48 deletions
diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index 865e0ab161..02951473df 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -12,7 +12,7 @@
;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
-;;; Copyright © 2020, 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2020, 2021, 2022, 2023, 2025 Maxim Cournoyer <maxim@guixotic.coop>
;;; Copyright © 2020 Kei Kebreau <kkebreau@posteo.net>
;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
;;; Copyright © 2021-2025 John Kehayias <john.kehayias@protonmail.com>
@@ -23,6 +23,7 @@
;;; Copyright © 2024 Artyom V. Poptsov <poptsov.artyom@gmail.com>
;;; Copyright © 2024 Arnaud Lechevallier <arnaud.lechevallier@free.fr>
;;; Copyright © 2024 aurtzy <aurtzy@gmail.com>
+;;; Copyright © 2025 Sughosha <sughosha@disroot.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -61,6 +62,7 @@
#:use-module (gnu packages python-build)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages rust)
+ #:use-module (gnu packages rust-apps)
#:use-module (gnu packages tls)
#:use-module (gnu packages video)
#:use-module (gnu packages vulkan)
@@ -313,7 +315,7 @@ also known as DXTn or DXTC) for Mesa.")
(define-public mesa
(package
(name "mesa")
- (version "25.1.3")
+ (version "25.2.3")
(source
(origin
(method url-fetch)
@@ -323,7 +325,7 @@ also known as DXTn or DXTC) for Mesa.")
"mesa-" version ".tar.xz")))
(sha256
(base32
- "0zxsvly6xjinaicgcf81ycljjjzy3mj0hqwf01b6sdgxnnnnrjzz"))))
+ "1y5lj9zy2hfvx9ji1rvsjapmzap7mpp5i3pf2yfcpmpica2v5mpj"))))
(build-system meson-build-system)
(propagated-inputs
;; The following are in the Requires.private field of gl.pc.
@@ -350,13 +352,12 @@ also known as DXTn or DXTC) for Mesa.")
(native-inputs
(append
(list bison
- clang-18
+ clang-18 ;ensure rust-bindgen-cli uses the same
flex
gettext-minimal
glslang
libclc
pkg-config
- python-libxml2 ;for OpenGL ES 1.1 and 2.0 support
python-mako
python-ply
python-pyyaml
@@ -405,13 +406,12 @@ panfrost,r300,r600,svga,softpipe,llvmpipe,tegra,v3d,vc4,virgl,zink"))
"-Dglx=dri" ;Thread Local Storage, improves performance
;; "-Dopencl=true"
;; "-Domx=true"
- "-Dosmesa=true"
- "-Dgallium-xa=enabled"
;; features required by wayland
"-Dgles2=enabled"
"-Dgbm=enabled"
"-Dshared-glapi=enabled"
+ "--wrap-mode=nodownload" ; XXX: disable
#$@(cond
((target-x86-32?)
@@ -438,6 +438,9 @@ panfrost,r300,r600,svga,softpipe,llvmpipe,tegra,v3d,vc4,virgl,zink"))
;; Also enable the tests.
"-Dbuild-tests=true"
+ ;; Re-enable X11 protocol support for the DRI2 extension.
+ "-Dlegacy-x11=dri2"
+
"-Dllvm=enabled") ; default is x86/x86_64 only
;; XXX: 'debugoptimized' causes LTO link failures on some drivers. The
@@ -520,7 +523,9 @@ panfrost,r300,r600,svga,softpipe,llvmpipe,tegra,v3d,vc4,virgl,zink"))
"subprojects/" name))
(overlay-dir (string-append
"subprojects/packagefiles/" name)))
- (copy-recursively source subproject-dest)
+ (mkdir-p subproject-dest)
+ (invoke "tar" "xf" source "-C" subproject-dest
+ "--strip-components=1")
;; Normally when the patch_directory wrap file property
;; is specified, meson automatically copies from
;; packagefiles, but this is not the case here (only
@@ -534,23 +539,9 @@ panfrost,r300,r600,svga,softpipe,llvmpipe,tegra,v3d,vc4,virgl,zink"))
directory = ~a
"
name))))))
- '#+(map (lambda (pkg)
- (let ((name (package-upstream-name* pkg))
- (version (package-version pkg)))
- (list (package-upstream-name* pkg)
- (file-append pkg
- "/share/cargo/src/"
- name "-" version))))
- (let ((from-crates-io
- (cut module-ref
- (resolve-interface
- '(gnu packages crates-io))
- <>)))
- (list (from-crates-io 'rust-syn-2)
- (from-crates-io 'rust-unicode-ident-1)
- (from-crates-io 'rust-quote-1)
- (from-crates-io 'rust-proc-macro2-1)
- (from-crates-io 'rust-paste-1))))))))
+ '#+(module-ref (resolve-interface
+ '(gnu packages rust-crates))
+ 'mesa-cargo-inputs)))))
#~())
(add-after 'unpack 'set-home-directory
;; Build tries to use a shader cache (non-fatal error).
@@ -665,33 +656,38 @@ from software emulation to complete hardware acceleration for modern GPUs.")
(inherit (package-source mesa))))
(arguments
(substitute-keyword-arguments (package-arguments mesa)
+ ((#:modules modules)
+ (cons '(ice-9 textual-ports) modules))
((#:configure-flags flags)
- #~(cons "-Dgallium-opencl=standalone" #$flags))))))
-
-(define-public mesa-opencl-icd
- (package/inherit mesa-opencl
- (name "mesa-opencl-icd")
- (arguments
- (substitute-keyword-arguments (package-arguments mesa)
- ((#:configure-flags flags)
- #~(cons "-Dgallium-opencl=icd"
- (delete "-Dgallium-opencl=standalone" #$flags)))
- ((#:phases phases)
- #~(modify-phases #$phases
- (add-after 'install 'mesa-icd-absolute-path
+ #~(cons* "-Dgallium-rusticl=true"
+ ;; Enable all drivers by default.
+ (string-append "-Dgallium-rusticl-enable-drivers="
+ "iris,llvmpipe,nouveau,panfrost,radeonsi,r600")
+ #$flags))
+ ((#:phases phases)
+ #~(modify-phases #$phases
+ (add-after 'install 'use-absolute-file-name-in-rusticl.icd
(lambda _
- ;; Use absolute path for OpenCL platform library.
- ;; Otherwise we would have to set LD_LIBRARY_PATH=LIBRARY_PATH
- ;; for ICD in our applications to find OpenCL platform.
- (use-modules (guix build utils)
- (ice-9 textual-ports))
+ ;; Use absolute path for OpenCL platform library. Otherwise
+ ;; we would have to set LD_LIBRARY_PATH=LIBRARY_PATH for
+ ;; Rusticl in our applications to find the OpenCL platform.
(let* ((out #$output)
- (mesa-icd (string-append out "/etc/OpenCL/vendors/mesa.icd"))
- (old-path (call-with-input-file mesa-icd get-string-all))
- (new-path (string-append out "/lib/" (string-trim-both old-path))))
+ (rusticl.icd (string-append
+ out "/etc/OpenCL/vendors/rusticl.icd"))
+ (old-path (call-with-input-file rusticl.icd
+ get-string-all))
+ (new-path (string-append out "/lib/"
+ (string-trim-both old-path))))
(if (file-exists? new-path)
- (call-with-output-file mesa-icd
- (lambda (port) (format port "~a\n" new-path)))))))))))))
+ (call-with-output-file rusticl.icd
+ (lambda (port) (format port "~a\n" new-path)))))))))))
+ (native-inputs (modify-inputs (package-native-inputs mesa)
+ (replace "rust-bindgen-cli" rust-bindgen-cli-next)))))
+
+;;; ICD was part of the Gallium (Clover) OpenCL driver, which was replaced
+;;; with Rusticl.
+(define-public mesa-opencl-icd
+ (deprecated-package "mesa-opencl-icd" mesa-opencl))
(define-public mesa-headers
(package/inherit mesa
@@ -1100,6 +1096,68 @@ and surfaces, receiving input and events.")
(arguments (substitute-keyword-arguments (package-arguments glfw)
((#:out-of-source? _ #f) #f)))))
+(define-public nanovg
+ ;; No tags are available.
+ (let ((revision "0")
+ (commit "b83cf926525e7cea8d2483da2a75852b8c7b6d28"))
+ (package
+ (name "nanovg")
+ (version (git-version "0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/memononen/nanovg")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1zp355pw6xnb5mjarz67cxkglv7j1s0qzv705fz1wf0gl0sjhy8f"))
+ (modules '((guix build utils)))
+ (snippet
+ ;; Fix including freetype.
+ '(substitute* (find-files "." "\\.(c|h)$")
+ (("ft2build\\.h") "freetype2/ft2build.h")))))
+ (build-system gnu-build-system)
+ (arguments
+ (list #:tests? #f ;no test suite
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure) ;no configure script
+ ;; No Makefile exists.
+ (replace 'build
+ (lambda _
+ (invoke #$(cc-for-target)
+ "../source/src/nanovg.c" "-c" "-fPIC"
+ "-DFONS_USE_FREETYPE=1"
+ (string-append "-I"
+ #$(this-package-input "freetype")
+ "/include/freetype2"))
+ (invoke #$(cc-for-target)
+ "-shared" "-olibnanovg.so" "nanovg.o"
+ "-lfreetype")))
+ ;; No Makefile exists.
+ (replace 'install
+ (lambda _
+ (let ((lib (string-append #$output "/lib"))
+ (include (string-append #$output
+ "/include/nanovg")))
+ (install-file "libnanovg.so" lib)
+ (with-directory-excursion "../source"
+ (for-each
+ (lambda (file)
+ (install-file file include))
+ (append (find-files "src" "nanovg.*\\.h$")
+ '("example/perf.h"
+ "example/stb_image_write.h"))))))))))
+ (inputs
+ (list freetype))
+ (home-page "https://github.com/memononen/nanovg")
+ (synopsis "2D vector drawing library on top of OpenGL")
+ (description
+ "NanoVG is an antialiased vector graphics rendering library for OpenGL.
+It is aimed for building scalable user interfaces and visualizations.")
+ (license license:zlib))))
+
(define-public nanovg-for-extempore
(let ((version "0.7.1")
(revision "0")