diff mbox series

[bug#40441,3/3] gnu: Add zynfusion.

Message ID a704e345c488d12dfb6ae25cd757c0ab7ce187ac.camel@zrythm.org
State Work in progress
Headers show
Series [bug#40439,1/3] gnu: Add libuv-static. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job

Commit Message

Alexandros Theodotou April 4, 2020, 9:14 p.m. UTC
Hi,

This patch adds zynfusion. The LV2 plugin seems to work well and its
LV2 presets also work.

Some problems that are still pending:
- the binary (standalone) version doesn't work (needs some rtpath-
related patch I'm not sure how to do)
- preset banks are not found by the plugin, even though I patched what
appears to be the paths it looks at

Feel free to edit it.

Thanks,
Alex
diff mbox series

Patch

From 8bf94ba51559ae4357b6619d61ef13b48e886940 Mon Sep 17 00:00:00 2001
From: Alexandros Theodotou <alex@zrythm.org>
Date: Sat, 4 Apr 2020 22:06:27 +0100
Subject: [PATCH 3/3] gnu: Add zynfusion.

* gnu/packages/music.scm (zynfusion): New variable.
---
 gnu/packages/music.scm | 69 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index 7d0cfe8665..2b5c6cc462 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -128,6 +128,7 @@ 
   #:use-module (gnu packages rdf)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages rsync)
+  #:use-module (gnu packages ruby)
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages tcl)
@@ -5383,3 +5384,71 @@  filtered, pitch shifted and ultimately disintegrated.  This is an unofficial
 port of the Regrader plugin created by Igorski.  It is available as an LV2
 plugin and a standalone JACK application.")
     (license license:expat)))
+
+(define-public zynfusion
+  (package/inherit zynaddsubfx
+    (name "zynfusion")
+    (arguments
+     `(#:configure-flags
+       ;; Enable ZynFusion mode
+       '("-DGuiModule=zest" "-DDemoMode=false")
+       #:phases
+       (modify-phases %standard-phases
+         ;; Move SSE compiler optimization flags from generic target to
+         ;; athlon64 and core2 targets, because otherwise the build would fail
+         ;; on non-Intel machines.
+         (add-after 'unpack 'remove-sse-flags-from-generic-target
+          (lambda _
+            (substitute* "src/CMakeLists.txt"
+              (("-msse -msse2 -mfpmath=sse") "")
+              (("-march=(athlon64|core2)" flag)
+               (string-append flag " -msse -msse2 -mfpmath=sse")))
+            #t))
+         (add-after 'unpack 'patch-paths
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((zest (assoc-ref inputs "mruby-zest"))
+                   (out (assoc-ref %outputs "out")))
+             ;; Patch zest path so that the ZynFusion UI can be found
+              (substitute* "src/Plugin/ZynAddSubFX/ZynAddSubFX-UI-Zest.cpp"
+                           (("\\./libzest\\.so")
+                            (string-append zest "/lib/zynfusion/libzest.so")))
+              (substitute* "src/main.cpp"
+                           (("\\./zyn-fusion")
+                            (string-append zest "/lib/zynfusion/zyn-fusion")))
+              (substitute* "src/main.cpp"
+                           (("\\\"zyn-fusion\\\"")
+                            (string-append "\"" zest "/lib/zynfusion/zyn-fusion\"")))
+              ;; Patch banks path FIXME banks are still not found
+              (substitute* "src/Misc/Config.cpp"
+                           (("cfg.bankRootDirList\\[4\\] =.*$")
+                            (string-append "cfg.bankRootDirList[4] = \""
+                                           out "/share/zynaddsubfx/banks\";\n")))
+               #t)))
+         ;; Rename to avoid clashes with the zynaddsubfx package
+         (add-after 'install 'rename-to-zyn-fusion
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref %outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (share (string-append out "/share")))
+               (rename-file (string-append bin "/zynaddsubfx")
+                            (string-append bin "/zynfusion"))
+               (substitute* (find-files (string-append share "/applications")
+                                        "\\.desktop$")
+                            (("Exec=zynaddsubfx")
+                             "Exec=zynfusion"))
+               #t))))))
+    (inputs
+     `(("alsa-lib" ,alsa-lib)
+       ("cairo" ,cairo)
+       ("fftw" ,fftw)
+       ("jack" ,jack-1)
+       ("liblo" ,liblo)
+       ("libxpm" ,libxpm)
+       ("mesa" ,mesa)
+       ("minixml" ,minixml)
+       ("mruby-zest" ,mruby-zest)
+       ("ruby" ,ruby)
+       ("zlib" ,zlib)))
+    (description
+     "ZynFusion is an alternative, modern UI for the ZynAddSubFX
+synthesizer.")))
-- 
2.26.0