Subject: [bug#72666] [PATCH] Add firefly-synth package

From: Apoorv <[email-masked]>
Date: Fri, 16 Aug 2024 12:43:19 +0200 (CEST)

This is a patch to add a new package, `firefly-synth` to `gnu/packages/music.scm`.

-- 
 Sent with Tuta; enjoy secure & ad-free emails: 
 https://tuta.com
>From 5d08a4fee0ac8906780c43f340d01e9d0b82c03b Mon Sep 17 00:00:00 2001
From: apoorv569 <[email-masked]>
Date: Fri, 16 Aug 2024 15:37:25 +0530
Subject: [PATCH 13/13] Add firefly-synth package

---
 gnu/packages/music.scm | 70 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)

diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index 5b89419b07..6a28d73429 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -8577,6 +8577,76 @@ (define-public bitrot-plugins
       "Audio effect plugins (LV2, VST2, LADSPA) for glitch effects")
      (license license:asl2.0))))
 
+(define-public firefly-synth
+  (let ((commit "b4ba5a90461d698000df73ebff736570667e42ac")
+        (revision "1"))
+    (package
+     (name "firefly-synth")
+     (version (git-version "1.8.5" revision commit))
+     (source
+      (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/sjoerdvankreel/firefly-synth")
+             (recursive? #t)
+             (commit commit)))
+       (sha256
+        (base32 "1j6cap45608jdybgj3zsqlfbzmqpqxl29jk7ikk3x7d29jaxw84r"))
+       (file-name (git-file-name name version))))
+     (build-system cmake-build-system)
+     (arguments
+      (list
+       #:tests? #f ;; No test target
+       #:build-type "Release"
+       #:phases
+       #~(modify-phases
+          %standard-phases
+          (add-after 'install 'plugin-base-ref-gen
+                     (lambda* (#:key outputs #:allow-other-keys)
+                       (let* ((out (assoc-ref outputs "out")))
+                         (with-directory-excursion
+                          "../source/dist/Release/linux"
+                          (system*
+                           "./plugin_base.ref_gen"
+                           "firefly_synth_1.vst3/Contents/x86_64-linux/firefly_synth_1.so"
+                           "../../../param_reference.html")))))
+          (add-after 'plugin-base-ref-gen 'copy-plugin-artefacts
+                     (lambda* (#:key inputs outputs #:allow-other-keys)
+                       (let* ((out (assoc-ref outputs "out"))
+                              (src (assoc-ref inputs "source"))
+                              (clap (string-append out "/lib/clap"))
+                              (vst3 (string-append out "/lib/vst3")))
+                         ;; Make clap and vst3 directories
+                         (mkdir-p clap)
+                         (mkdir-p vst3)
+                         (with-directory-excursion
+                          "../source/dist/Release/linux"
+                          ;; Install clap.
+                          (copy-recursively
+                           "firefly_synth_1.clap"
+                           (string-append clap "/firefly_synth_1.clap"))
+                          (copy-recursively
+                           "firefly_synth_fx_1.clap"
+                           (string-append clap "/firefly_synth_fx_1.clap"))
+                          ;; Install vst3.
+                          (copy-recursively
+                           "firefly_synth_1.vst3"
+                           (string-append vst3 "/firefly_synth_1.vst3"))
+                          (copy-recursively
+                           "firefly_synth_fx_1.vst3"
+                           (string-append vst3 "/firefly_synth_fx_1.vst3")))))))))
+     (inputs (list libxrandr
+                   libxinerama
+                   libxcursor
+                   freetype
+                   mesa
+                   alsa-lib))
+     (native-inputs (list pkg-config))
+     (home-page "https://github.com/sjoerdvankreel/firefly-synth")
+     (synopsis "Semi-modular synthesizer and FX plugin, VST3 and CLAP")
+     (description "A semi-modular software synthesizer and fx plugin")
+     (license license:gpl3))))
+
 ;;;
 ;;; Avoid adding new packages to the end of this file. To reduce the chances
 ;;; of a merge conflict, place them above by existing packages with similar
-- 
2.45.2