Subject: [bug#65711] [PATCH v1] wlr-protocols / wl-mirror added

From: Julian Flake <[email-masked]>
Date: Tue, 5 Mar 2024 15:55:24 +0100

---
 gnu/packages/freedesktop.scm | 31 +++++++++++++++++
 gnu/packages/wm.scm          | 67 ++++++++++++++++++++++++++----------
 2 files changed, 80 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 7b5d2dbbf2..627a837801 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -1270,6 +1270,37 @@ (define-public wayland-protocols
         . "https://wayland.freedesktop.org/releases.html")))
     (license license:expat)))
 
+(define-public wlr-protocols
+  (let ((revision "0")
+	(commit "4264185db3b7e961e7f157e1cc4fd0ab75137568"))
+    (package
+      (name "wlr-protocols")
+      (version (git-version "0" revision commit))
+      (source (origin
+		(method git-fetch)
+		(uri (git-reference
+		      (url "https://gitlab.freedesktop.org/wlroots/wlr-protocols.git")
+		      (commit commit)))
+		(sha256
+		 (base32
+		  "045jj3mbhi7p2qn59krz0vap0wd3i6zgwkvpl97idy702bnk9mv6"))))
+      (build-system gnu-build-system)
+      (arguments
+       '(#:phases (modify-phases %standard-phases
+		    (delete 'configure)
+		    (add-before 'build 'set-prefix-in-makefile
+		      (lambda* (#:key outputs #:allow-other-keys)
+			(let ((out (assoc-ref outputs "out")))
+			  (substitute* "Makefile"
+			    (("PREFIX=.*") (string-append "PREFIX="out "\n")))))))))
+      (inputs
+       (list wayland))
+      (home-page "https://gitlab.freedesktop.org/wlroots/wlr-protocols")
+      (synopsis "Wayland protocols designed for use in wlroots (and other compositors).")
+      (description
+       "Wayland protocols designed for use in wlroots (and other compositors).")
+      (license expat))))
+
 (define-public wayland-utils
   (package
     (name "wayland-utils")
diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index 8ed3ed1107..f661140d28 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -1759,6 +1759,37 @@ (define-public wlroots-0.16
     (propagated-inputs (modify-inputs (package-propagated-inputs wlroots)
                          (delete libdisplay-info)))))
 
+(define-public wl-mirror
+  (package
+    (name "wl-mirror")
+    (version "0.16.1")
+    (source (origin
+              (method git-fetch)
+	      (uri (git-reference
+		    (url "https://github.com/Ferdi265/wl-mirror")
+		    (commit "v0.16.1")))
+	      (sha256
+	       (base32
+		"0464m60xsbpfwvsszrdkjsxfvrbkr71hp7phsz05cqyvjwf6cism"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:tests? #f
+      #:configure-flags
+      #~(list "-DFORCE_SYSTEM_WL_PROTOCOLS=ON"
+	      (string-append "-DWL_PROTOCOL_DIR="
+                             #$(this-package-input "wayland-protocols") "/share/wayland-protocols")
+	      "-DFORCE_SYSTEM_WLR_PROTOCOLS=ON"
+	      (string-append "-DWLR_PROTOCOL_DIR="
+                             #$(this-package-input "wlr-protocols") "/share/wlr-protocols"))))
+    (inputs
+     (list pkg-config egl-wayland mesa wayland wayland-protocols wlr-protocols))
+    (home-page "https://github.com/Ferdi265/wl-mirror")
+    (synopsis "A simple Wayland output mirror client")
+    (description
+     "wl-mirror attempts to provide a solution to sway's lack of output mirroring by mirroring an output onto a client surface.")
+    (license gpl3)))
+
 (define-public sway
   (package
     (name "sway")
@@ -1777,21 +1808,21 @@ (define-public sway
      `(;; elogind is propagated by wlroots -> libseat
        ;; and would otherwise shadow basu.
        #:configure-flags '("-Dsd-bus-provider=basu")
-       #:phases
-       (modify-phases %standard-phases
-         (add-before 'configure 'hardcode-paths
-           (lambda* (#:key inputs #:allow-other-keys)
-             ;; Hardcode path to swaybg.
-             (substitute* "sway/config.c"
-               (("strdup..swaybg..")
-                (string-append "strdup(\"" (assoc-ref inputs "swaybg")
-                               "/bin/swaybg\")")))
-             ;; Hardcode path to scdoc.
-             (substitute* "meson.build"
-               (("scdoc.get_pkgconfig_variable..scdoc..")
-                (string-append "'" (assoc-ref inputs "scdoc")
-                               "/bin/scdoc'")))
-             #t)))))
+                         #:phases
+                         (modify-phases %standard-phases
+                           (add-before 'configure 'hardcode-paths
+                             (lambda* (#:key inputs #:allow-other-keys)
+                               ;; Hardcode path to swaybg.
+                               (substitute* "sway/config.c"
+                                 (("strdup..swaybg..")
+                                  (string-append "strdup(\"" (assoc-ref inputs "swaybg")
+                                                 "/bin/swaybg\")")))
+                               ;; Hardcode path to scdoc.
+                               (substitute* "meson.build"
+                                 (("scdoc.get_pkgconfig_variable..scdoc..")
+                                  (string-append "'" (assoc-ref inputs "scdoc")
+                                                 "/bin/scdoc'")))
+                               #t)))))
     (inputs (list basu
                   cairo
                   gdk-pixbuf
@@ -1807,9 +1838,9 @@ (define-public sway
     (native-inputs
      (cons* linux-pam mesa pkg-config scdoc wayland-protocols
             (if (%current-target-system)
-              (list pkg-config-for-build
-                    wayland)
-              '())))
+                (list pkg-config-for-build
+                      wayland)
+                '())))
     (home-page "https://github.com/swaywm/sway")
     (synopsis "Wayland compositor compatible with i3")
     (description "Sway is a i3-compatible Wayland compositor.")

base-commit: b6dec0108f99d75066bad15aaa124b84bb0261f3
-- 
2.41.0