From 6d552d2ad19eea4982db532e5fd6a44eb8d992b6 Mon Sep 17 00:00:00 2001 From: Sughosha Date: Mon, 18 Aug 2025 22:03:35 +0530 Subject: [PATCH] gnu: zynaddsubfx: Switch to Zyn-Fusion interface. * gnu/packages/patches/zynaddsubfx-3.0.6-system-rtosc.patch: New file. * gnu/packages/music.scm (zynaddsubfx)[source]: Add it. [arguments]<#:configure-flags>: New argument. <#:phases>: Add 'patch-paths phase. [inputs]: Add mruby-zest and rtosc; remove ntk. * gnu/local.mk: Add the patch file. Change-Id: I8522f92707f45915f87d15fd14b0f5d7dc5db224 Signed-off-by: Gabriel Wicki --- gnu/local.mk | 3 +- gnu/packages/music.scm | 25 ++++- .../zynaddsubfx-3.0.6-system-rtosc.patch | 106 ++++++++++++++++++ 3 files changed, 129 insertions(+), 5 deletions(-) create mode 100644 gnu/packages/patches/zynaddsubfx-3.0.6-system-rtosc.patch diff --git a/gnu/local.mk b/gnu/local.mk index 7a37a6d346e..ef4a44470fa 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -2515,7 +2515,8 @@ dist_patch_DATA = \ %D%/packages/patches/zsh-egrep-failing-test.patch \ %D%/packages/patches/zuo-bin-sh.patch \ %D%/packages/patches/zxing-cpp-1.2.0-gcc-14.patch \ - %D%/packages/patches/zynaddsubfx-3.0.6-include-cstdint.patch + %D%/packages/patches/zynaddsubfx-3.0.6-include-cstdint.patch \ + %D%/packages/patches/zynaddsubfx-3.0.6-system-rtosc.patch MISC_DISTRO_FILES = \ %D%/packages/ld-wrapper.in diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm index 22bf9d3e52b..7aa8b75987d 100644 --- a/gnu/packages/music.scm +++ b/gnu/packages/music.scm @@ -167,6 +167,7 @@ #:use-module (gnu packages man) #:use-module (gnu packages mp3) #:use-module (gnu packages mpd) + #:use-module (gnu packages mruby-xyz) #:use-module (gnu packages ncurses) #:use-module (gnu packages netpbm) #:use-module (gnu packages networking) @@ -3604,10 +3605,17 @@ instrument or MIDI file player.") (base32 "1bkirvcg0lz1i7ypnz3dyh218yhrqpnijxs8n3wlgwbcixvn1lfb")) (patches - (search-patches "zynaddsubfx-3.0.6-include-cstdint.patch")))) + (search-patches "zynaddsubfx-3.0.6-system-rtosc.patch" + "zynaddsubfx-3.0.6-include-cstdint.patch")))) (build-system cmake-build-system) (arguments - `(#:phases + `(#:configure-flags + `("-DGuiModule=zest" + ,(string-append "-DZYN_DATADIR=" + (assoc-ref %outputs "out") + "/share/zynaddsubfx") + "-DZYN_SYSTEM_RTOSC=ON") + #:phases (modify-phases %standard-phases ;; Move SSE compiler optimization flags from generic target to ;; athlon64 and core2 targets, because otherwise the build would fail @@ -3617,10 +3625,19 @@ instrument or MIDI file player.") (substitute* "src/CMakeLists.txt" (("-msse -msse2 -mfpmath=sse") "") (("-march=(athlon64|core2)" flag) - (string-append flag " -msse -msse2 -mfpmath=sse")))))))) + (string-append flag " -msse -msse2 -mfpmath=sse"))))) + (add-after 'unpack 'patch-paths + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "src/main.cpp" + (("\\./zyn-fusion") + (search-input-file inputs "/bin/zyn-fusion"))) + (substitute* "src/Plugin/ZynAddSubFX/ZynAddSubFX-UI-Zest.cpp" + (("\\./libzest\\.so") + (search-input-file inputs "/lib/libzest.so")))))))) (inputs (list liblo - ntk + mruby-zest + rtosc mesa alsa-lib jack-1 diff --git a/gnu/packages/patches/zynaddsubfx-3.0.6-system-rtosc.patch b/gnu/packages/patches/zynaddsubfx-3.0.6-system-rtosc.patch new file mode 100644 index 00000000000..3ed8a7c4957 --- /dev/null +++ b/gnu/packages/patches/zynaddsubfx-3.0.6-system-rtosc.patch @@ -0,0 +1,106 @@ +Adding the option ZYN_SYSTEM_RTOSC to let the use of the system provided RtOSC +instead of using the bundled one. + +--- a/CMakeLists.txt 2022-01-22 02:46:21.000000000 +0100 ++++ b/CMakeLists.txt 2023-05-03 23:17:58.411667901 +0200 +@@ -10,24 +10,34 @@ + add_definitions(-DZYN_DATADIR="${ZYN_DATADIR}") + endif() + ++option(ZYN_SYSTEM_RTOSC "Use system provided librtosc and librtosc-cpp" OFF) ++ + #Include RTOSC +-if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/rtosc/CMakeLists.txt") +- message(STATUS "RTOSC NOT FOUND") +- message(STATUS "Attempting to checkout submodule") +- find_package(Git REQUIRED) +- execute_process(COMMAND git submodule update --init --recursive) ++if(ZYN_SYSTEM_RTOSC) ++ include(FindPkgConfig) ++ pkg_check_modules(RTOSC REQUIRED librtosc) ++ pkg_check_modules(RTOSC_CPP REQUIRED librtosc-cpp) ++ include_directories(${RTOSC_INCLUDE_DIR}) ++ message(STATUS "Found system provided librtosc and librtosc-cpp...") ++else() + if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/rtosc/CMakeLists.txt") +- message(FATAL_ERROR "FAILED TO CHECKOUT RTOSC\n" +- "please check file permissions and your network") ++ message(STATUS "RTOSC NOT FOUND") ++ message(STATUS "Attempting to checkout submodule") ++ find_package(Git REQUIRED) ++ execute_process(COMMAND git submodule update --init --recursive) ++ if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/rtosc/CMakeLists.txt") ++ message(FATAL_ERROR "FAILED TO CHECKOUT RTOSC\n" ++ "please check file permissions and your network") ++ endif() ++ else() ++ message(STATUS "Found Rtosc Submodule...") + endif() +-else() +- message(STATUS "Found Rtosc Submodule...") +-endif() + +-set(RTOSC_NO_INSTALL TRUE) +-include("rtosc/cmake/ColorMessage.cmake") +-add_subdirectory(rtosc) +-include_directories(rtosc/include) ++ set(RTOSC_NO_INSTALL TRUE) ++ include("rtosc/cmake/ColorMessage.cmake") ++ add_subdirectory(rtosc) ++ include_directories(rtosc/include) ++endif() + + enable_testing() + include(CTestConfig.cmake) +--- a/src/CMakeLists.txt 2022-01-22 02:46:21.000000000 +0100 ++++ b/src/CMakeLists.txt 2023-05-03 23:17:58.411667901 +0200 +@@ -575,13 +575,27 @@ + set(PTHREAD_LIBRARY pthread) + endif() + +-target_link_libraries(zynaddsubfx_core +- ${ZLIB_LIBRARIES} +- ${FFTW3F_LIBRARIES} +- ${MXML_LIBRARIES} +- ${OS_LIBRARIES} +- ${PTHREAD_LIBRARY} +- rtosc rtosc-cpp) ++if(ZYN_SYSTEM_RTOSC) ++ target_link_libraries(zynaddsubfx_core ++ ${ZLIB_LIBRARIES} ++ ${FFTW3F_LIBRARIES} ++ ${MXML_LIBRARIES} ++ ${OS_LIBRARIES} ++ ${PTHREAD_LIBRARY} ++ ${RTOSC_LIBRARIES} ++ ${RTOSC_CPP_LIBRARIES} ++ ) ++else() ++ target_link_libraries(zynaddsubfx_core ++ ${ZLIB_LIBRARIES} ++ ${FFTW3F_LIBRARIES} ++ ${MXML_LIBRARIES} ++ ${OS_LIBRARIES} ++ ${PTHREAD_LIBRARY} ++ rtosc ++ rtosc-cpp ++ ) ++endif() + + if(IwyuErr) + message (STATUS "Include what you use: ${IwyuErr}") + + +When ZYN_SYSTEM_RTOSC is ON, port-checker file is not available and the test +fails. + +--- a/src/Tests/CMakeLists.txt 2022-01-22 02:46:21.000000000 +0100 ++++ b/src/Tests/CMakeLists.txt 2023-05-04 00:19:01.635383149 +0200 +@@ -65,7 +65,6 @@ + + if(LIBLO_FOUND) + cp_script(check-ports.rb) +- add_test(PortChecker check-ports.rb) + endif() + add_executable(save-osc SaveOSC.cpp) + target_link_libraries(save-osc