Subject: [PATCH] gnu: Update zynaddsubfx to 3.0.6

From: Sughosha <[email-masked]>
Date: Wed, 21 Sep 2022 17:21:10 +0000

Empty Message

From 77f364a304e4510baafe86f5a641bdf84952bf06 Mon Sep 17 00:00:00 2001
From: Sughosha <[email-masked]>
Date: Wed, 21 Sep 2022 19:15:47 +0200
Subject: [PATCH] gnu: Update zynaddsubfx to 3.0.6

gnu/packages/music.scm (mruby-zest): New variable.

* gnu/packages/music.scm (zynaddsubfx): Update to 3.0.6.

  Upgrade to Zyn-Fusion with new UI called zest.
---
 gnu/packages/music.scm | 96 ++++++++++++++++++++++++++++++++++++++----
 1 file changed, 88 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index 66b4beae0c..c9081bfb69 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -167,6 +167,7 @@ (define-module (gnu packages music)
   #: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 serialization)
   #:use-module (gnu packages sphinx)
@@ -2989,10 +2990,69 @@ (define-public vmpk
 instrument or MIDI file player.")
     (license license:gpl3+)))
 
+(define mruby-zest
+  (package
+    (name "mruby-zest")
+    (version "3.0.6")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/mruby-zest/mruby-zest-build")
+                    (commit version)
+                    (recursive? #t)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0dz4zv1km9805lji2q2qqdd8s8hgfd723dxdzcivbhm612szm1mc"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f
+       #:make-flags `("CC=gcc" "CONFIG_SHELL=bash")
+       #:phases (modify-phases %standard-phases
+                  ;; no configure rule available
+                  (delete 'configure)
+                  ;; no install rule available
+                  (replace 'install
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let* ((out (string-append (assoc-ref outputs "out")
+                                                 "/opt/zest")))
+                        (install-file "zest" out)
+                        (install-file "libzest.so" out)
+                        (install-file "mruby/bin/mruby" out)
+                        (install-file "deps/nanovg/example/entypo.ttf"
+                                      (string-append out "/font"))
+                        (install-file "deps/nanovg/example/Roboto-Bold.ttf"
+                                      (string-append out "/font"))
+                        (install-file "deps/nanovg/example/Roboto-Light.ttf"
+                                      (string-append out "/font"))
+                        (install-file "deps/nanovg/example/Roboto-Regular.ttf"
+                         (string-append out "/font"))
+                        (copy-recursively "src/mruby-zest/qml"
+                                          (string-append out "/qml"))
+                        (copy-recursively "src/mruby-zest/example"
+                                          (string-append out "/qml"))
+                        (invoke "touch"
+                                (string-append out "/qml/MainWindow.qml"))
+                        (copy-recursively "src/osc-bridge/schema"
+                                          (string-append out "/schema"))
+                        (copy-file "completions/zyn-fusion"
+                                   (string-append out "/completions"))
+                        (wrap-program (string-append out "/zest")
+                                      `("LD_LIBRARY_PATH" =
+                                        (,out)))))))))
+    (native-inputs (list ruby libuv pkg-config))
+    (inputs (list libx11 mesa bash-minimal))
+    (home-page "https://github.com/mruby-zest/mruby-zest-build")
+    (synopsis "Widget classes for the mruby-zest framework")
+    (description
+     "This repository contains all of the widgets needed to create the
+@code{zyn-fusion} user interface for ZynAddSubFX.")
+    (license license:lgpl2.1)))
+
 (define-public zynaddsubfx
   (package
     (name "zynaddsubfx")
-    (version "3.0.5")
+    (version (package-version mruby-zest))
     (source (origin
               (method url-fetch)
               (uri (string-append
@@ -3000,10 +3060,11 @@ (define-public zynaddsubfx
                     version "/zynaddsubfx-" version ".tar.bz2"))
               (sha256
                (base32
-                "0qwzg14h043rmyf9jqdylxhyfy4sl0vsr0gjql51wjhid0i34ivl"))))
+                "1bkirvcg0lz1i7ypnz3dyh218yhrqpnijxs8n3wlgwbcixvn1lfb"))))
     (build-system cmake-build-system)
     (arguments
-     `(#:phases
+     `(#:configure-flags `("-DGuiModule=zest")
+       #:phases
        (modify-phases %standard-phases
          ;; Move SSE compiler optimization flags from generic target to
          ;; athlon64 and core2 targets, because otherwise the build would fail
@@ -3014,20 +3075,39 @@ (define-public zynaddsubfx
               (("-msse -msse2 -mfpmath=sse") "")
               (("-march=(athlon64|core2)" flag)
                (string-append flag " -msse -msse2 -mfpmath=sse")))
-            #t)))))
+            #t))
+         (add-after 'install 'link-zest
+          (lambda* (#:key inputs outputs #:allow-other-keys)
+            (let ((zestdir (string-append (assoc-ref inputs
+                                                     "mruby-zest")
+                                          "/opt/zest"))
+                  (bindir (string-append (assoc-ref outputs "out")
+                                         "/bin"))
+                  (libdir (string-append (assoc-ref outputs "out")
+                                         "/lib")))
+              (symlink (string-append zestdir "/libzest.so")
+                       (string-append libdir "/libzest.so"))
+              (symlink (string-append zestdir "/zest")
+                       (string-append bindir "/zyn-fusion"))
+              (symlink (string-append zestdir "/font")
+                       (string-append libdir "/font"))
+              (symlink (string-append zestdir "/qml")
+                       (string-append libdir "/qml"))
+              (symlink (string-append zestdir "/schema")
+                       (string-append libdir "/schema"))))))))
     (inputs
      (list liblo
-           ntk
+           mruby-zest
            mesa
            alsa-lib
            jack-1
-           fftw
+           fftwf
            minixml
            libxpm
            zlib))
     (native-inputs
-     (list pkg-config))
-    (home-page "http://zynaddsubfx.sf.net/")
+     (list pkg-config ruby doxygen))
+    (home-page "https://zynaddsubfx.sourceforge.io/")
     (synopsis "Software synthesizer")
     (description
      "ZynAddSubFX is a feature heavy realtime software synthesizer.  It offers
-- 
2.37.3