summary refs log tree commit diff
path: root/gnu/packages/gl.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/gl.scm')
-rw-r--r--gnu/packages/gl.scm75
1 files changed, 62 insertions, 13 deletions
diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index 421e946bed..fe7d2252ea 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -160,6 +160,8 @@ the X-Consortium license.")
     (inputs `(("libx11" ,libx11)
               ("mesa" ,mesa)
               ("glu" ,glu)))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
     (home-page "http://ftgl.sourceforge.net")
     (synopsis "Font rendering library for OpenGL applications")
     (description
@@ -220,7 +222,7 @@ also known as DXTn or DXTC) for Mesa.")
 (define-public mesa
   (package
     (name "mesa")
-    (version "17.2.1")
+    (version "17.3.1")
     (source
       (origin
         (method url-fetch)
@@ -232,7 +234,7 @@ also known as DXTn or DXTC) for Mesa.")
                                   version "/mesa-" version ".tar.xz")))
         (sha256
          (base32
-          "07msr6xismw2jq87irwhz7vygvzj6hi38d71paij9zvwh8bmsf3p"))
+          "1h94m2nkxa1y4n415d5idk2x2lkgbvjcikv6r2r6yn4ak7h0grls"))
         (patches
          (search-patches "mesa-wayland-egl-symbols-check-mips.patch"
                          "mesa-skip-disk-cache-test.patch"))))
@@ -263,12 +265,12 @@ also known as DXTn or DXTC) for Mesa.")
              `()))
         ("makedepend" ,makedepend)
         ("presentproto" ,presentproto)
-        ("s2tc" ,s2tc)
         ("wayland" ,wayland)
         ("wayland-protocols" ,wayland-protocols)))
     (native-inputs
       `(("pkg-config" ,pkg-config)
         ("python" ,python-2)
+        ("python2-mako" ,python2-mako)
         ("which" ,(@ (gnu packages base) which))))
     (arguments
      `(#:configure-flags
@@ -278,9 +280,9 @@ also known as DXTn or DXTC) for Mesa.")
               '("--with-gallium-drivers=freedreno,nouveau,r300,r600,swrast,vc4,virgl"))
              ("aarch64-linux"
               ;; TODO: Fix svga driver for aarch64 and armhf.
-              '("--with-gallium-drivers=freedreno,nouveau,r300,r600,swrast,vc4,virgl"))
+              '("--with-gallium-drivers=freedreno,nouveau,pl111,r300,r600,swrast,vc4,virgl"))
              (_
-              '("--with-gallium-drivers=i915,nouveau,r300,r600,svga,swrast,virgl")))
+              '("--with-gallium-drivers=i915,nouveau,r300,r600,radeonsi,svga,swrast,virgl")))
          ;; Enable various optional features.  TODO: opencl requires libclc,
          ;; omx requires libomxil-bellagio
          "--with-platforms=x11,drm,wayland,surfaceless"
@@ -297,6 +299,16 @@ also known as DXTn or DXTC) for Mesa.")
          ;; are stuck at OpenGL 2.1 instead of OpenGL 3.0+.
          "--enable-texture-float"
 
+         ;; Enable Vulkan on i686-linux and x86-64-linux.
+         ,@(match (%current-system)
+             ("x86_64-linux"
+              '("--with-vulkan-drivers=intel,radeon"))
+             ;; TODO: Fix intel driver on i686-linux.
+             ("i686-linux"
+              '("--with-vulkan-drivers=radeon"))
+             (_
+              '("")))
+
          ;; Also enable the tests.
          "--enable-gallium-tests"
 
@@ -308,6 +320,10 @@ also known as DXTn or DXTC) for Mesa.")
                 "--enable-llvm"))         ; default is x86/x86_64 only
              (_
               '("--with-dri-drivers=nouveau,r200,radeon,swrast"))))
+       #:modules ((ice-9 match)
+                  (srfi srfi-1)
+                  (guix build utils)
+                  (guix build gnu-build-system))
        #:phases
        (modify-phases %standard-phases
          (add-after
@@ -342,13 +358,48 @@ also known as DXTn or DXTC) for Mesa.")
                  ;; egl_gallium support.
                  (("\"gbm_dri\\.so")
                   (string-append "\"" out "/lib/dri/gbm_dri.so")))
+               #t)))
+         (add-after 'install 'symlinks-instead-of-hard-links
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; All the drivers and gallium targets create hard links upon
+             ;; installation (search for "hardlink each megadriver instance"
+             ;; in the makefiles).  This is no good for us since we'd produce
+             ;; nars that contain several copies of these files.  Thus, turn
+             ;; them into symlinks, which saves ~124 MiB.
+             (let* ((out    (assoc-ref outputs "out"))
+                    (lib    (string-append out "/lib"))
+                    (files  (find-files lib
+                                        (lambda (file stat)
+                                          (and (string-contains file ".so")
+                                               (eq? 'regular
+                                                    (stat:type stat))))))
+                    (inodes (map (compose stat:ino stat) files)))
+               (for-each (lambda (inode)
+                           (match (filter-map (match-lambda
+                                                ((file ino)
+                                                 (and (= ino inode) file)))
+                                              (zip files inodes))
+                             ((_)
+                              #f)
+                             ((reference others ..1)
+                              (format #t "creating ~a symlinks to '~a'~%"
+                                      (length others) reference)
+                              (for-each delete-file others)
+                              (for-each (lambda (file)
+                                          (if (string=? (dirname file)
+                                                        (dirname reference))
+                                              (symlink (basename reference)
+                                                       file)
+                                              (symlink reference file)))
+                                        others))))
+                         (delete-duplicates inodes))
                #t))))))
     (home-page "https://mesa3d.org/")
-    (synopsis "OpenGL implementation")
-    (description "Mesa is a free implementation of the OpenGL specification -
-a system for rendering interactive 3D graphics.  A variety of device drivers
-allows Mesa to be used in many different environments ranging from software
-emulation to complete hardware acceleration for modern GPUs.")
+    (synopsis "OpenGL and Vulkan implementations")
+    (description "Mesa is a free implementation of the OpenGL and Vulkan
+specifications - systems for rendering interactive 3D graphics.  A variety of
+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)))
 
 (define-public mesa-headers
@@ -696,9 +747,7 @@ mixed vector/bitmap output.")
          "0rnid3hwrry9d5d4m7sygq00xxx976rgk00a3557m9r5kxbmy476"))))
     (arguments
      `(#:tests? #f ;; no tests are available
-       #:configure-flags (list "-DVGL_USESSL=1" ;; use OpenSSL
-                          (string-append "-DCMAKE_INSTALL_LIBDIR="
-                                         (assoc-ref %outputs "out") "/lib"))))
+       #:configure-flags (list "-DVGL_USESSL=1"))) ;; use OpenSSL
     (build-system cmake-build-system)
     (inputs `(("glu" ,glu)
               ("libjpeg-turbo" ,libjpeg-turbo)