Hi Guix, I managed to build ZynFusion after some help from its developer (see attachment for the current working package definitions), but we have a small problem.
~ Background info ~ ZynFusion uses the exact same source code as ZynAddSubFX but passing a compilation flag enables a different, more modern-looking UI called "ZynFusion". In addition to stand-alone binaries, they both come as LV2 plugins. Each LV2 plugin is identified by its unique URI, and each plugin UI is also identified by a separate unique URI (usually in the form of <plugin URI>#UI). Plugins can have multiple UIs, and there is usually 1 UI for each supported platform. ~ End background info ~ The problem appears when when you install both ZynFusion and ZynAddSubFX and you want to use them as plugins. If you only run their binary versions (bin/zynaddsubfx) there shouldn't be a problem, but when you attempt to open them as LV2 plugins, they currently use the same URI so hosts will ignore one of them since most hosts use the lilv library for detecting and loading plugins, which skips duplicates (I believe it is undefined which one gets skipped - I think only the first one found is used). Since plugins can have multiple UIs, we could patch zynaddsubfx to present itself as having 2 X11 UIs, one for zynfusion and one for its current one, however current hosts don't offer an option to choose a UI and simply choose whatever's found first. I believe this is the correct behavior - the users are usually musicians and plugin format stuff should be hidden as much as possible. Also, it is very rare for a plugin to have more than 1 UI on the same platform, so hosts usually just pick up whatever supported UI is found first. Anyway, there will be problems if we allow users to install both packages as-is, so here are our options as far as i can tell: a) Change the URI of the plugin itself so that it's different from ZynAddSubFX - this IMO is out of the question because presets won't be portable anymore as they are bound to a plugin's URI. b) Patch the plugin's turtle code to make it list both UIs as available. The problem with this is mentioned above - current hosts don't offer an option to choose a UI (and probably shouldn't) so one of them (undefined which one - depends on the host's logic) will be ignored. c) Deprecate zynaddsubfx - this will mean users will no longer be able to use the old UI if they prefer it, but it will probably be a good solution for the majority of users and no changes are required to guix d) Implement a "conflicts" variable in package definitions where you can list incompatible packages, so guix won't allow you to install zynfusion if you have zynaddsubfx installed, and vice versa. I am personally fine with either c/d, although I believe d) is the cleanest solution. Any suggestions welcome. Thanks, Alex
(define-public libuv-static
(package/inherit
libuv
(arguments
'(#:tests? #f
#:make-flags (list "CFLAGS=-fPIC")))
(version "1.9.1")))
(define-public mruby-zest
(package
(name "mruby-zest")
(version "3.0.5-ba39aabd")
(source
(origin
(method git-fetch)
(uri (git-reference
;; this is a meta repo that packs the mruby dependencies
;; as submodules
(url "https://github.com/mruby-zest/mruby-zest-build.git")
;; ghaction branch - suggested by the developer to avoid
;; automatic downloading of some unneeded and
;; hard-to-package dependencies used only for debugging
(commit "ba39aabd8d4ddc5f14137083b6f9a96c536f5f12")
(recursive? #t)))
(file-name (git-file-name name version))
(sha256
(base32
"1vqzdds30sr982dp7fclg4r19l44rv8pbz6h4a8vcginj494gvjn"))))
(build-system gnu-build-system)
(arguments
`(#:tests? #f ; no check target
#:make-flags
(list (string-append "CC=gcc"))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'use-installed-libuv
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((libuv (assoc-ref inputs "libuv-static")))
(copy-file (string-append libuv "/lib/libuv.a")
"deps/libuv.a")
(substitute* "Makefile"
(("\\.\\./\\.\\./deps/\\$\\(UV_DIR\\)/include")
(string-append libuv "/include")))
(substitute* "Makefile"
(("\\./deps/\\$\\(UV_DIR\\)/\\.libs/libuv\\.a")
(string-append libuv "/lib/libuv.a"))))))
(add-after 'unpack 'disable-unused-deps
(lambda _
(substitute* "build_config.rb"
(("conf\\.gem 'deps/mruby-file-stat'")
"#"))
(substitute* "deps/mruby-dir-glob/mrbgem.rake"
(("spec\\.add_dependency 'mruby-file-stat'")
"#"))
#t))
(replace 'configure
(lambda _
(invoke "make" "builddep")))
(add-before 'install 'pack
(lambda _
(setenv "CC" "gcc")
(invoke "make" "pack")))
(replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(lib (string-append out "/lib/zynfusion")))
(mkdir-p lib)
(copy-recursively "package" lib)
#t)))
(add-after 'install 'rename-to-zyn-fusion
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref %outputs "out"))
(lib (string-append out "/lib/zynfusion")))
(rename-file (string-append lib "/zest")
(string-append lib "/zyn-fusion"))
#t))))))
(inputs
`(("libx11" ,libx11)
("cairo" ,cairo)
("mesa" ,mesa)
("libuv-static" ,libuv-static)
("ruby" ,ruby)
("mruby" ,mruby)))
(native-inputs
`(("pkg-config" ,pkg-config)
("bison" ,bison)
("autoconf" ,autoconf)
("automake" ,automake)
("libtool" ,libtool)
("python-2" ,python-2)))
(home-page "https://github.com/mruby-zest/mruby-zest")
(synopsis "Widget classes for ZynFusion")
(description
"MRuby-Zest is a set of widgets needed to create the 'ZynFusion'
user interface of ZynAddSubFX.")
(license license:lgpl2.1+)))
(define-public zynaddsubfx
(package
(name "zynaddsubfx")
(version "3.0.5")
(source (origin
(method url-fetch)
(uri (string-append
"mirror://sourceforge/zynaddsubfx/zynaddsubfx/"
version "/zynaddsubfx-" version ".tar.bz2"))
(sha256
(base32
"0qwzg14h043rmyf9jqdylxhyfy4sl0vsr0gjql51wjhid0i34ivl"))))
(build-system cmake-build-system)
(arguments
`(#: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)))))
(inputs
`(("liblo" ,liblo)
("ntk" ,ntk)
("mesa" ,mesa)
("alsa-lib" ,alsa-lib)
("jack" ,jack-1)
("fftw" ,fftw)
("minixml" ,minixml)
("libxpm" ,libxpm)
("zlib" ,zlib)))
(native-inputs
`(("pkg-config" ,pkg-config)))
(home-page "http://zynaddsubfx.sf.net/")
(synopsis "Software synthesizer")
(description
"ZynAddSubFX is a feature heavy realtime software synthesizer. It offers
three synthesizer engines, multitimbral and polyphonic synths, microtonal
capabilities, custom envelopes, effects, etc.")
(license license:gpl2+)))
(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))
;; Modify zest path so that the ZynFusion UI can be found
(add-after 'unpack 'patch-zest-path
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((zest (assoc-ref inputs "mruby-zest"))
(out (assoc-ref %outputs "out")))
(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\"")))
#t)))
;; Rename to ZynFusion so it can co-exist with the older UI
(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.")))
signature.asc
Description: This is a digitally signed message part
