gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / gl.scm
index 41fc8ae..7b5a0b4 100644 (file)
@@ -4,15 +4,16 @@
 ;;; Copyright © 2014, 2016 David Thompson <davet@gnu.org>
 ;;; Copyright © 2014, 2015, 2016, 2017 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016 Nikita <nikita@n0.is>
-;;; Copyright © 2016, 2017, 2018, 2020 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2016, 2017, 2018, 2020, 2021 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2016 David Thompson <davet@gnu.org>
-;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017, 2018, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
-;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
+;;; Copyright © 2020 Kei Kebreau <kkebreau@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -60,6 +61,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system meson)
+  #:use-module (guix build-system waf)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix utils)
@@ -193,7 +195,7 @@ Polygon meshes, and Extruded polygon meshes.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/divVerent/s2tc.git")
+             (url "https://github.com/divVerent/s2tc")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
@@ -233,14 +235,7 @@ also known as DXTn or DXTC) for Mesa.")
 (define-public mesa
   (package
     (name "mesa")
-    (version "20.0.7")
-
-    ;; Mesa 20.0.5 through 20.0.7 has problems with some graphic drivers, so
-    ;; we need this newer version.
-    ;; https://gitlab.freedesktop.org/mesa/mesa/-/issues/2882
-    ;; https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4861
-    (replacement mesa-20.0.8)
-
+    (version "20.2.4")
     (source
       (origin
         (method url-fetch)
@@ -252,9 +247,9 @@ also known as DXTn or DXTC) for Mesa.")
                                   version "/mesa-" version ".tar.xz")))
         (sha256
          (base32
-          "0y517qpdg6v6dsdgzb365p03m30511sbyh8pq0mcvhvjwy7javpy"))
+          "14m09bk7akj0k02lg8fhvvzbdsashlbdsgl2cw7wbqfj2mhdqwh5"))
         (patches
-         (search-patches "mesa-skip-disk-cache-test.patch"))))
+         (search-patches "mesa-skip-tests.patch"))))
     (build-system meson-build-system)
     (propagated-inputs
       `(;; The following are in the Requires.private field of gl.pc.
@@ -275,9 +270,9 @@ also known as DXTn or DXTC) for Mesa.")
         ("libxrandr" ,libxrandr)
         ("libxvmc" ,libxvmc)
         ,@(match (%current-system)
-            ((or "x86_64-linux" "i686-linux")
+            ((or "x86_64-linux" "i686-linux" "powerpc64le-linux")
              ;; Note: update the 'clang' input of mesa-opencl when bumping this.
-             `(("llvm" ,llvm-10)))
+             `(("llvm" ,llvm-11)))
             (_
              `()))
         ("wayland" ,wayland)
@@ -287,7 +282,7 @@ also known as DXTn or DXTC) for Mesa.")
         ("flex" ,flex)
         ("gettext" ,gettext-minimal)
         ,@(match (%current-system)
-            ((or "x86_64-linux" "i686-linux")
+            ((or "x86_64-linux" "i686-linux" "powerpc64le-linux")
              `(("glslang" ,glslang)))
             (_
              `()))
@@ -300,8 +295,10 @@ also known as DXTn or DXTC) for Mesa.")
      `(#:configure-flags
        '(,@(match (%current-system)
              ((or "armhf-linux" "aarch64-linux")
-              ;; TODO: Fix svga driver for aarch64 and armhf.
+              ;; TODO: Fix svga driver for non-Intel architectures.
               '("-Dgallium-drivers=etnaviv,freedreno,kmsro,lima,nouveau,panfrost,r300,r600,swrast,tegra,v3d,vc4,virgl"))
+             ("powerpc64le-linux"
+              '("-Dgallium-drivers=nouveau,r300,r600,radeonsi,swrast,virgl"))
              (_
               '("-Dgallium-drivers=iris,nouveau,r300,r600,radeonsi,svga,swrast,virgl")))
          ;; Enable various optional features.  TODO: opencl requires libclc,
@@ -318,16 +315,18 @@ also known as DXTn or DXTC) for Mesa.")
          "-Dgbm=true"
          "-Dshared-glapi=true"
 
-         ;; Enable Vulkan on i686-linux and x86-64-linux.
+         ;; Explicitly enable Vulkan on some architectures.
          ,@(match (%current-system)
              ((or "i686-linux" "x86_64-linux")
               '("-Dvulkan-drivers=intel,amd"))
+             ("powerpc64le-linux"
+              '("-Dvulkan-drivers=amd"))
              (_
               '("-Dvulkan-drivers=auto")))
 
-         ;; Enable the Vulkan overlay layer on i686-linux and x86-64-linux.
+         ;; Enable the Vulkan overlay layer on architectures using llvm.
          ,@(match (%current-system)
-             ((or "x86_64-linux" "i686-linux")
+             ((or "x86_64-linux" "i686-linux" "powerpc64le-linux")
               '("-Dvulkan-overlay-layer=true"))
              (_
               '()))
@@ -341,6 +340,9 @@ also known as DXTn or DXTC) for Mesa.")
              ((or "x86_64-linux" "i686-linux")
               '("-Ddri-drivers=i915,i965,nouveau,r200,r100"
                 "-Dllvm=true"))         ; default is x86/x86_64 only
+             ("powerpc64le-linux"
+              '("-Ddri-drivers=nouveau,r200,r100"
+                "-Dllvm=true"))
              (_
               '("-Ddri-drivers=nouveau,r200,r100"))))
 
@@ -354,6 +356,15 @@ also known as DXTn or DXTC) for Mesa.")
                   (guix build meson-build-system))
        #:phases
        (modify-phases %standard-phases
+         ,@(if (string-prefix? "powerpc64le" (or (%current-target-system)
+                                                 (%current-system)))
+               ;; Disable some of the llvmpipe tests.
+               `((add-after 'unpack 'disable-failing-test
+                   (lambda _
+                     (substitute* "src/gallium/drivers/llvmpipe/lp_test_arit.c"
+                       (("0\\.5, ") ""))
+                     #t)))
+               '())
          ,@(if (string-prefix? "i686" (or (%current-target-system)
                                           (%current-system)))
                ;; Disable new test from Mesa 19 that fails on i686.  Upstream
@@ -388,7 +399,7 @@ also known as DXTn or DXTC) for Mesa.")
              (let ((out (assoc-ref outputs "out"))
                    (bin (assoc-ref outputs "bin")))
                ,@(match (%current-system)
-                   ((or "i686-linux" "x86_64-linux")
+                   ((or "i686-linux" "x86_64-linux" "powerpc64le-linux")
                     ;; Install the Vulkan overlay control script to a separate
                     ;; output to prevent a reference on Python, saving ~70 MiB
                     ;; on the closure size.
@@ -446,21 +457,6 @@ device drivers allows Mesa to be used in many different environments ranging
 from software emulation to complete hardware acceleration for modern GPUs.")
     (license license:x11)))
 
-;; Replacement package to fix <https://gitlab.freedesktop.org/mesa/mesa/-/issues/2863>.
-(define mesa-20.0.8
-  (package
-    (inherit mesa)
-    (version "20.0.8")
-    (source (origin
-              (inherit (package-source mesa))
-              (uri (list (string-append "https://mesa.freedesktop.org/archive/"
-                                        "mesa-" version ".tar.xz")
-                         (string-append "ftp://ftp.freedesktop.org/pub/mesa/"
-                                        "mesa-" version ".tar.xz")))
-              (sha256
-               (base32
-                "0v0bfh3ay07s6msxmklvwfaif0q02kq2yhy65fdhys49vw8c1w3c"))))))
-
 (define-public mesa-opencl
   (package/inherit mesa
     (name "mesa-opencl")
@@ -472,7 +468,7 @@ from software emulation to complete hardware acceleration for modern GPUs.")
      `(("libclc" ,libclc)
        ,@(package-inputs mesa)))
     (native-inputs
-     `(("clang" ,clang-10)
+     `(("clang" ,clang-11)
        ,@(package-native-inputs mesa)))))
 
 (define-public mesa-opencl-icd
@@ -620,6 +616,11 @@ extension functionality is exposed in a single header file.")
                         "godir = $(moddir)\n"))))
                  (add-before 'build 'patch-dynamic-link
                    (lambda* (#:key inputs outputs #:allow-other-keys)
+                     (substitute* "gl/runtime.scm"
+                       (("\\(dynamic-link\\)")
+                        (string-append "(dynamic-link \""
+                                       (assoc-ref inputs "mesa")
+                                       "/lib/libGL.so" "\")")))
                      (define (dynamic-link-substitute file lib input)
                        (substitute* file
                          (("dynamic-link \"lib([a-zA-Z]+)\"" _ lib)
@@ -701,7 +702,7 @@ OpenGL graphics API.")
 (define-public libglvnd
   (package
     (name "libglvnd")
-    (version "1.3.1")
+    (version "1.3.2")
     (home-page "https://gitlab.freedesktop.org/glvnd/libglvnd")
     (source (origin
               (method git-fetch)
@@ -711,7 +712,7 @@ OpenGL graphics API.")
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0mkzdzdxjxjl794rblq4mq33wmb8ikqmfswbqdbr8gw2kw4wlhdl"))))
+                "10x7fgb114r4gikdg6flszl3kwzcb9y5qa7sj9936mk0zxhjaylz"))))
     (build-system meson-build-system)
     (arguments
      '(#:configure-flags '("-Dx11=enabled")
@@ -735,7 +736,7 @@ OpenGL graphics API.")
     (description
      "libglvnd is a vendor-neutral dispatch layer for arbitrating OpenGL
 API calls between multiple vendors.  It allows multiple drivers from
-different vendors to coexist on the same filesystem, and determines which
+different vendors to coexist on the same file system, and determines which
 vendor to dispatch each API call to at runtime.
 
 Both GLX and EGL are supported, in any combination with OpenGL and OpenGL ES.")
@@ -790,7 +791,7 @@ OpenGL.")
 (define-public glfw
   (package
     (name "glfw")
-    (version "3.2.1")
+    (version "3.3.4")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://github.com/glfw/glfw"
@@ -798,7 +799,7 @@ OpenGL.")
                                   "/glfw-" version ".zip"))
               (sha256
                (base32
-                "09kk5yc1zhss9add8ryqrngrr16hdmc94rszgng135bhw09mxmdp"))))
+                "1kcrpl4d6b6h23ib5j9q670d9w3knd07whgbanbmwwhbcqnc9lmv"))))
     (build-system cmake-build-system)
     (arguments
      '(#:tests? #f ; no test target
@@ -812,6 +813,7 @@ OpenGL.")
        ;; These are in 'Requires.private' of 'glfw3.pc'.
        ("libx11" ,libx11)
        ("libxrandr" ,libxrandr)
+       ("libxi" ,libxi)
        ("libxinerama" ,libxinerama)
        ("libxcursor" ,libxcursor)
        ("libxxf86vm" ,libxxf86vm)))
@@ -833,7 +835,7 @@ and surfaces, receiving input and events.")
       (source (origin
                 (method git-fetch)
                 (uri (git-reference
-                      (url "https://github.com/extemporelang/nanovg.git")
+                      (url "https://github.com/extemporelang/nanovg")
                       (commit commit)))
                 (file-name (git-file-name name version))
                 (sha256
@@ -893,7 +895,7 @@ mixed vector/bitmap output.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/VirtualGL/virtualgl.git")
+             (url "https://github.com/VirtualGL/virtualgl")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
@@ -1035,3 +1037,62 @@ the glProgramViewportFlip before it was replaced with glProgramViewportInfo.")
 The C# wrapper was written to be used for FNA's platform support.  However, this
 is written in a way that can be used for any general C# application.")
       (license license:zlib))))
+
+(define-public glmark2
+  (package
+    (name "glmark2")
+    (version "2020.04")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/glmark2/glmark2")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0ywpzp0imi3f8iyp7d1739576zx2nsr3db5hp2as4yhflfyq1as2"))
+              (modules '((guix build utils)))
+              ;; Fix Python 3 incompatibility.
+              (snippet
+               '(begin
+                  (substitute* "wscript"
+                    (("(sorted\\()FLAVORS\\.keys\\(\\)(.*)" _ beginning end)
+                     (string-append beginning "list(FLAVORS)" end)))
+                  #t))))
+    (build-system waf-build-system)
+    (arguments
+     '(#:tests? #f                      ; no check target
+       #:configure-flags
+       (list (string-append "--with-flavors="
+                            (string-join '("x11-gl" "x11-glesv2"
+                                           "drm-gl" "drm-glesv2"
+                                           "wayland-gl" "wayland-glesv2")
+                                         ",")))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-paths
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((mesa (assoc-ref inputs "mesa")))
+               (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")))
+               #t))))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("eudev" ,eudev)
+       ("libdrm" ,libdrm)
+       ("libjpeg-turbo" ,libjpeg-turbo)
+       ("libpng" ,libpng)
+       ("libx11" ,libx11)
+       ("libxcb" ,libxcb)
+       ("mesa" ,mesa)
+       ("wayland" ,wayland)
+       ("wayland-protocols" ,wayland-protocols)))
+    (home-page "https://github.com/glmark2/glmark2")
+    (synopsis "OpenGL 2.0 and OpenGL ES 2.0 benchmark")
+    (description
+     "glmark2 is an OpenGL 2.0 and OpenGL ES 2.0 benchmark based on the
+original glmark benchmark by Ben Smith.")
+    (license license:gpl3+)))