Subject: [PATCH staging] libdrm/Mesa Meson patch series
From: Rutger Helling <[email-masked]>
To: [email-masked]
Date: Tue, 12 Mar 2019 14:16:15 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hey Guix,

this patch series changes libdrm and Mesa to use Meson.

A few notes to go along with the patches:

Patch #1: Libdrm on Github mentions that Autotools is the legacy build
system for libdrm, so it seems better to change this to use Meson.
Patch #2: Mesa is gonna drop support for Autotools entirely at some
point in 2019, so it seems good to make the switch sooner rather than
later. I think I converted all the configure flags to the new format.
Patches #3-6: For some reason these packages now need an explicit mesa
input. I haven't run into other packages that have this problem yet.
From e87f54563723c5dd8fd3fdcc0ce1772fa4c28284 Mon Sep 17 00:00:00 2001
From: Rutger Helling <[email-masked]>
Date: Tue, 12 Mar 2019 12:16:38 +0100
Subject: [PATCH] gnu: libdrm: Switch to meson-build-system.

* gnu/packages/xdisorg.scm (libdrm)[build-system]: Switch to
meson-build-system.
[arguments]: Adjust arguments to Meson.
---
 gnu/packages/xdisorg.scm | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index ed801d623..2cb8f3b13 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -391,20 +391,20 @@ rasterisation.")
          (base32
           "08yimlp6jir1rs5ajgdx74xa5qdzcqahpdzdk0rmkmhh7vdcrl3p"))
         (patches (search-patches "libdrm-symbol-check.patch"))))
-    (build-system gnu-build-system)
+    (build-system meson-build-system)
     (arguments
      `(#:configure-flags
        '(,@(match (%current-system)
              ("armhf-linux"
-              '("--enable-exynos-experimental-api"
-                "--enable-omap-experimental-api"
-                "--enable-etnaviv-experimental-api"
-                "--enable-tegra-experimental-api"
-                "--enable-freedreno-kgsl"))
-             ("aarch64-linux"
-              '("--enable-tegra-experimental-api"
-                "--enable-etnaviv-experimental-api"
-                "--enable-freedreno-kgsl"))
+              '("-Dexynos-experimental-api=true"
+                "-Domap-experimental-api=true"
+                "-Detnaviv-experimental-api=true"
+                "-Dtegra-experimental-api=true"
+                "-Dfreedreno-kgsl=true"))
+             ("aarch64-linux=true"
+              '("-Dtegra-experimental-api=true"
+                "-Detnaviv-experimental-api=true"
+                "-Dfreedreno-kgsl=true"))
              (_ '())))))
     (inputs
      `(("libpciaccess" ,libpciaccess)))
-- 
2.21.0

From d164ccb0220756444dcc46675ede0f706255d076 Mon Sep 17 00:00:00 2001
From: Rutger Helling <[email-masked]>
Date: Tue, 12 Mar 2019 14:05:09 +0100
Subject: [PATCH] gnu: mesa: Switch to meson-build-system.

* gnu/packages/gl.scm (mesa)[build-system]: Switch to meson-build-system.
[native-inputs]: Add "bison", "flex" and "gettext-minimal".
[arguments]: Adjust arguments to Meson.
---
 gnu/packages/gl.scm | 46 ++++++++++++++++++++++++---------------------
 1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index c3cb9cab2..daa5f54d7 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -236,7 +236,7 @@ also known as DXTn or DXTC) for Mesa.")
           "01xv03ah4l5lcfx015n3fg1620dh4nbbv6gmhh6zhdsx6sj4sc9j"))
         (patches
          (search-patches "mesa-skip-disk-cache-test.patch"))))
-    (build-system gnu-build-system)
+    (build-system meson-build-system)
     (propagated-inputs
       `(;; The following are in the Requires.private field of gl.pc.
         ("libdrm" ,libdrm)
@@ -264,7 +264,10 @@ also known as DXTn or DXTC) for Mesa.")
         ("wayland" ,wayland)
         ("wayland-protocols" ,wayland-protocols)))
     (native-inputs
-      `(("pkg-config" ,pkg-config)
+      `(("bison" ,bison)
+        ("flex" ,flex)
+        ("gettext" ,gettext-minimal)
+        ("pkg-config" ,pkg-config)
         ("python" ,python)
         ("python-mako" ,python-mako)
         ("which" ,(@ (gnu packages base) which))))
@@ -273,47 +276,48 @@ also known as DXTn or DXTC) for Mesa.")
        '(,@(match (%current-system)
              ((or "armhf-linux" "aarch64-linux")
               ;; TODO: Fix svga driver for aarch64 and armhf.
-              '("--with-gallium-drivers=etnaviv,freedreno,imx,nouveau,pl111,r300,r600,swrast,tegra,v3d,vc4,virgl"))
+              '("-Dgallium-drivers=etnaviv,freedreno,imx,nouveau,pl111,r300,r600,swrast,tegra,v3d,vc4,virgl"))
              (_
-              '("--with-gallium-drivers=i915,nouveau,r300,r600,radeonsi,svga,swrast,virgl")))
+              '("-Dgallium-drivers=nouveau,r300,r600,radeonsi,svga,swrast,virgl")))
          ;; Enable various optional features.  TODO: opencl requires libclc,
          ;; omx requires libomxil-bellagio
-         "--with-platforms=x11,drm,surfaceless,wayland"
-         "--enable-glx-tls"        ;Thread Local Storage, improves performance
-         ;; "--enable-opencl"
-         ;; "--enable-omx"
-         "--enable-osmesa"
-         "--enable-xa"
+         "-Dplatforms=x11,drm,surfaceless,wayland"
+         "-Dglx=dri"        ;Thread Local Storage, improves performance
+         ;; "-Dopencl=true"
+         ;; "-Domx=true"
+         "-Dosmesa=gallium"
+         "-Dgallium-xa=true"
+
          ;; features required by wayland
-         "--enable-gles2"
-         "--enable-gbm"
-         "--enable-shared-glapi"
+         "-Dgles2=true"
+         "-Dgbm=true"
+         "-Dshared-glapi=true"
 
          ;; Enable Vulkan on i686-linux and x86-64-linux.
          ,@(match (%current-system)
              ("x86_64-linux"
-              '("--with-vulkan-drivers=intel,radeon"))
+              '("-Dvulkan-drivers=intel,amd"))
              ;; TODO: Fix intel driver on i686-linux.
              ("i686-linux"
-              '("--with-vulkan-drivers=radeon"))
+              '("-Dvulkan-drivers=amd"))
              (_
               '("")))
 
          ;; Also enable the tests.
-         "--enable-gallium-tests"
+         "-Dbuild-tests=true"
 
          ;; on non-intel systems, drop i915 and i965
          ;; from the default dri drivers
          ,@(match (%current-system)
              ((or "x86_64-linux" "i686-linux")
-              '("--with-dri-drivers=i915,i965,nouveau,r200,radeon,swrast"
-                "--enable-llvm"))         ; default is x86/x86_64 only
+              '("-Ddri-drivers=i915,i965,nouveau,r200,r100"
+                "-Dllvm=true"))         ; default is x86/x86_64 only
              (_
-              '("--with-dri-drivers=nouveau,r200,radeon,swrast"))))
+              '("-Ddri-drivers=nouveau,r200,r100"))))
        #:modules ((ice-9 match)
                   (srfi srfi-1)
                   (guix build utils)
-                  (guix build gnu-build-system))
+                  (guix build meson-build-system))
        #:phases
        (modify-phases %standard-phases
          (add-after
@@ -323,7 +327,7 @@ also known as DXTn or DXTC) for Mesa.")
                (("/usr/bin/env python2") (which "python")))
              #t))
          (add-before
-           'build 'fix-dlopen-libnames
+           'configure 'fix-dlopen-libnames
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out")))
                ;; Remain agnostic to .so.X.Y.Z versions while doing
-- 
2.21.0

From 5c69bc199728d3928d65f5fd6ba2b2ba659193fb Mon Sep 17 00:00:00 2001
From: Rutger Helling <[email-masked]>
Date: Tue, 12 Mar 2019 12:52:34 +0100
Subject: [PATCH 1/4] gnu: libsmpeg: Add mesa input.

* gnu/packages/video.scm (libsmpeg)[inputs]: Add "mesa".
---
 gnu/packages/video.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index e9f5aa751..7eb225a61 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -2421,7 +2421,8 @@ Other features include a live preview and live streaming.")
      `(("autoconf" ,autoconf)
        ("automake" ,automake)))
     (inputs
-     `(("sdl" ,sdl2)))
+     `(("mesa" ,mesa)
+       ("sdl" ,sdl2)))
     (home-page "http://icculus.org/smpeg/")
     (synopsis "SDL MPEG decoding library")
     (description
-- 
2.21.0

From d38cf8a83e2e649f92e5c2259ba5b7ed4ae9c4d3 Mon Sep 17 00:00:00 2001
From: Rutger Helling <[email-masked]>
Date: Tue, 12 Mar 2019 12:53:48 +0100
Subject: [PATCH 2/4] gnu: sdl-image: Add mesa input.

* gnu/packages/sdl.scm (sdl-image)[inputs]: Add "mesa".
---
 gnu/packages/sdl.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index 8d2a02437..6d1cdba5f 100644
--- a/gnu/packages/sdl.scm
+++ b/gnu/packages/sdl.scm
@@ -214,6 +214,7 @@ other supporting functions for SDL.")
                            "--disable-tif-shared"
                            "--disable-webp-shared")))
     (native-inputs `(("pkg-config" ,pkg-config)))
+    (inputs `(("mesa" ,mesa)))
     ;; libjpeg, libpng, and libtiff are propagated inputs because the
     ;; SDL_image headers include the headers of these libraries.  SDL is a
     ;; propagated input because the pkg-config file refers to SDL's pkg-config
-- 
2.21.0

From 0dac26ad22330302b0068788bab8d0a4180491f8 Mon Sep 17 00:00:00 2001
From: Rutger Helling <[email-masked]>
Date: Tue, 12 Mar 2019 12:54:39 +0100
Subject: [PATCH 3/4] gnu: sdl-mixer: Add mesa input.

* gnu/packages/sdl.scm (sdl-mixer)[inputs]: Add "mesa".
---
 gnu/packages/sdl.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index 6d1cdba5f..634b77648 100644
--- a/gnu/packages/sdl.scm
+++ b/gnu/packages/sdl.scm
@@ -259,7 +259,8 @@ WEBP, XCF, XPM, and XV.")
               ("libflac" ,flac)
               ("libmad" ,libmad)
               ("libmikmod" ,libmikmod)
-              ("libmodplug" ,libmodplug)))
+              ("libmodplug" ,libmodplug)
+              ("mesa" ,mesa)))
     ;; FIXME: Add libfluidsynth
     (propagated-inputs `(("sdl" ,sdl)))
     (synopsis "SDL multi-channel audio mixer library")
-- 
2.21.0

From fd059a1b42a5ba4b21ffe996d65159fa93736bee Mon Sep 17 00:00:00 2001
From: Rutger Helling <[email-masked]>
Date: Tue, 12 Mar 2019 12:55:25 +0100
Subject: [PATCH 4/4] gnu: sdl-net: Add mesa input.

* gnu/packages/sdl.scm (sdl-net)[inputs]: Add "mesa".
---
 gnu/packages/sdl.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index 634b77648..0c4a5bee1 100644
--- a/gnu/packages/sdl.scm
+++ b/gnu/packages/sdl.scm
@@ -286,6 +286,7 @@ MIDI, Ogg Vorbis, and MP3.")
     (build-system gnu-build-system)
     (propagated-inputs `(("sdl" ,sdl)))
     (native-inputs `(("pkg-config" ,pkg-config)))
+    (inputs `(("mesa" ,mesa)))
     (outputs '("out" "debug"))
     (synopsis "SDL networking library")
     (description "SDL_net is a small, cross-platform networking library for
-- 
2.21.0