Subject: [PATCH v2] gnu: Add synthpod.

From: Ricardo Wurmus <[email-masked]>
Date: Sun, 22 Jan 2023 23:58:25 +0100

Hi,

I made these changes:

diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index ca058638f2..f2f5289dba 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -44,7 +44,7 @@
 ;;; Copyright © 2021 Simon Streit <[email-masked]>
 ;;; Copyright © 2021 Xinglu Chen <[email-masked]>
 ;;; Copyright © 2021 Thomas Albers Raviola <[email-masked]>
-;;; Copyright © 2022 Sughosha <[email-masked]>
+;;; Copyright © 2022, 2023 Sughosha <[email-masked]>
 ;;; Copyright © 2022 Remco van 't Veer <[email-masked]>
 ;;; Copyright © 2022 Maxim Cournoyer <[email-masked]>
 ;;; Copyright © 2022 Wamm K. D. <[email-masked]>
@@ -3566,44 +3566,53 @@ (define-public synthpod
     (source (origin
               (method git-fetch)
               (uri (git-reference
-                     (url "https://git.open-music-kontrollers.ch/lv2/synthpod")
-                     ;; Version is not tagged but mentioned in VERSION file.
-                     (commit "6e84a075ea8fea95094dcbc2b30f968717a81960")))
+                    (url "https://git.open-music-kontrollers.ch/lv2/synthpod")
+                    ;; Version is not tagged but mentioned in VERSION file.
+                    (commit "6e84a075ea8fea95094dcbc2b30f968717a81960")))
               (file-name (git-file-name name version))
               (sha256
-                (base32
-                 "1chazkdxjgjzfxqmlk4ywhilkj9l3bybd9xghjg9r67df2diqhbs"))))
+               (base32
+                "1chazkdxjgjzfxqmlk4ywhilkj9l3bybd9xghjg9r67df2diqhbs"))))
     (build-system meson-build-system)
     (arguments
      (list
       #:phases
       #~(modify-phases %standard-phases
-          (add-before 'check 'fix-home-directory
+          (add-after 'unpack 'patch-references
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* '("bin/synthpod_ui"
+                             "bin/synthpod_d2tk")
+                (("lv2info") (search-input-file inputs "/bin/lv2info"))
+                ((" synthpod_sandbox_x11")
+                 (string-append " " #$output "/bin/synthpod_sandbox_x11")))))
+          (add-before 'check 'set-home-directory
             (lambda _
               ;; Tests fail with: Fontconfig error: No writable cache
               ;; directories
               (setenv "HOME" "/tmp"))))))
-    (propagated-inputs (list lilv)) ;required for lv2info
-    (inputs (list alsa-lib
-                  cairo
-                  eudev
-                  freetype
-                  font-fira-code
-                  font-fira-sans
-                  fontconfig
-                  glew
-                  glu
-                  jack-1
-                  libevdev
-                  libinput
-                  libvterm
-                  lv2
-                  pixman
-                  sratom
-                  xcb-util
-                  xcb-util-wm
-                  xcb-util-xrm
-                  zita-alsa-pcmi))
+    (inputs
+     (list alsa-lib
+           cairo
+           eudev
+           freetype
+           font-fira-code
+           font-fira-sans
+           fontconfig
+           glew
+           glu
+           grep
+           jack-2
+           libevdev
+           libinput
+           libvterm
+           lilv ;for lv2info
+           lv2
+           pixman
+           sratom
+           xcb-util
+           xcb-util-wm
+           xcb-util-xrm
+           zita-alsa-pcmi))
     (native-inputs (list pkg-config))
     (home-page "https://open-music-kontrollers.ch/lv2/synthpod/")
     (synopsis "Nonlinear LV2 plugin container")

It avoids propagation of lilv and patches synthpod_ui to look for other
executables in a known location.

We should probably also wrap the scripts to set PATH to where “grep”,
“coreutils”, “sed”, and “gawk” are found, but I wasn’t able to add (gnu
packages gawk) to the imports of (gnu packages music).

Unfortunately, the program crashes because it can’t find the LV2 files
for Synthpod itself:

--8<---------------cut here---------------start------------->8---
$ /gnu/store/pp3rysfcssf3kigh01mrz7jc16dgp51p-synthpod-0.1.6507/bin/synthpod_ui
error: failed to open file /home/rekado/.lv2/Synthpod_default.preset.lv2/manifest.ttl (No such file or directory)
lilv_world_load_file(): error: Error loading file `file:///home/rekado/.lv2/Synthpod_default.preset.lv2/manifest.ttl'
lilv_world_load_bundle(): error: Error reading file:///home/rekado/.lv2/Synthpod_default.preset.lv2/manifest.ttl
Plugin not found.
Synthpod 0.1.6507
Copyright (c) 2015-2016 Hanspeter Portner ([email-masked])
Released under Artistic License 2.0 by Open Music Kontrollers
error: failed to open file /home/rekado/dev/gx/branches/master/manifest.ttl (No such file or directory)
lilv_world_load_file(): error: Error loading file `file:///home/rekado/dev/gx/branches/master/manifest.ttl'
lilv_world_load_bundle(): error: Error reading file:///home/rekado/dev/gx/branches/master/manifest.ttl
lilv_plugins_get_by_uri failed
Segmentation fault
--8<---------------cut here---------------end--------------->8---

These probably should be looked up in $out/lib/synthpod/lv2 instead of
searching the LV2 path.

-- 
Ricardo