summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/packages/xdisorg.scm52
1 files changed, 35 insertions, 17 deletions
diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index 21165f384f..facd63ab53 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -74,6 +74,7 @@
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages freedesktop)
+  #:use-module (gnu packages gawk)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
@@ -2188,21 +2189,6 @@ tools to complement clipnotify.")
       (arguments
        `(#:phases
          (modify-phases %standard-phases
-           (add-after 'unpack 'fix-hardcoded-paths
-             (lambda _
-               (substitute* "clipmenud"
-                 (("has_clipnotify=0")
-                  "has_clipnotify=1")
-                 (("command -v clipnotify >/dev/null 2>&1 && has_clipnotify=1")
-                  "")
-                 (("clipnotify \\|\\| .*")
-                  (string-append (which "clipnotify") "\n"))
-                 (("xsel --logfile")
-                  (string-append (which "xsel") " --logfile")))
-               (substitute* "clipmenu"
-                 (("xsel --logfile")
-                  (string-append (which "xsel") " --logfile")))
-               #t))
            (delete 'configure)
            (delete 'build)
            (replace 'install
@@ -2215,10 +2201,42 @@ tools to complement clipnotify.")
                  (install-file "clipmenu" bin)
                  (install-file "clipmenud" bin)
                  (install-file "README.md" doc)
-                 #t))))
-         #:tests? #f))
+                 #t)))
+           (add-after 'install 'wrap-script
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let* ((out               (assoc-ref outputs "out"))
+                      (clipnotify        (assoc-ref inputs "clipnotify"))
+                      (coreutils-minimal (assoc-ref inputs "coreutils-minimal"))
+                      (gawk              (assoc-ref inputs "gawk"))
+                      (util-linux        (assoc-ref inputs "util-linux"))
+                      (xdotool           (assoc-ref inputs "xdotool"))
+                      (xsel              (assoc-ref inputs "xsel")))
+                 (for-each
+                  (lambda (prog)
+                    (wrap-script (string-append out "/bin/" prog)
+                      `("PATH" ":" prefix
+                        ,(map (lambda (dir)
+                                (string-append dir "/bin"))
+                              (list clipnotify coreutils-minimal
+                                    gawk util-linux xdotool xsel)))))
+                  '("clipmenu" "clipmenud" "clipdel")))
+               #t))
+           (replace 'check
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               ;; substitute a shebang appearing inside a string (the test
+               ;; file writes this string to a temporary file):
+               (substitute* "tests/test-clipmenu"
+                 (("#!/usr/bin/env bash")
+                  (string-append "#!" (which "bash"))))
+               (invoke "tests/test-clipmenu")
+               #t)))))
       (inputs
        `(("clipnotify" ,clipnotify)
+         ("coreutils-minimal" ,coreutils-minimal)
+         ("gawk" ,gawk)
+         ("guile" ,guile-3.0) ; for wrap-script
+         ("util-linux" ,util-linux)
+         ("xdotool" ,xdotool)
          ("xsel" ,xsel)))
       (home-page "https://github.com/cdown/clipmenu")
       (synopsis "Simple clipboard manager using dmenu or rofi and xsel")