2020-06-27 02:24:35 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, callPackage
|
|
|
|
|
|
|
|
# Required build tools
|
|
|
|
, cmake
|
|
|
|
, makeWrapper
|
|
|
|
, pkg-config
|
|
|
|
|
|
|
|
# Required dependencies
|
|
|
|
, fftw
|
|
|
|
, liblo
|
|
|
|
, minixml
|
|
|
|
, zlib
|
|
|
|
|
|
|
|
# Optional dependencies
|
2022-08-04 21:16:30 +00:00
|
|
|
, alsaSupport ? stdenv.isLinux
|
2021-06-10 02:57:09 +00:00
|
|
|
, alsa-lib
|
2020-06-27 02:24:35 +00:00
|
|
|
, dssiSupport ? false
|
|
|
|
, dssi
|
|
|
|
, ladspaH
|
|
|
|
, jackSupport ? true
|
|
|
|
, libjack2
|
|
|
|
, lashSupport ? false
|
|
|
|
, lash
|
|
|
|
, ossSupport ? true
|
|
|
|
, portaudioSupport ? true
|
|
|
|
, portaudio
|
2022-08-04 21:16:30 +00:00
|
|
|
, sndioSupport ? stdenv.isOpenBSD
|
|
|
|
, sndio
|
2020-06-27 02:24:35 +00:00
|
|
|
|
|
|
|
# Optional GUI dependencies
|
|
|
|
, guiModule ? "off"
|
|
|
|
, cairo
|
2022-08-04 21:16:30 +00:00
|
|
|
, fltk
|
2020-06-27 02:24:35 +00:00
|
|
|
, libGL
|
|
|
|
, libjpeg
|
|
|
|
, libX11
|
|
|
|
, libXpm
|
|
|
|
, ntk
|
|
|
|
|
|
|
|
# Test dependencies
|
|
|
|
, cxxtest
|
2022-08-04 21:16:30 +00:00
|
|
|
, ruby
|
2014-01-19 12:01:49 +00:00
|
|
|
}:
|
2011-04-07 22:24:56 +00:00
|
|
|
|
2020-06-27 02:24:35 +00:00
|
|
|
assert builtins.any (g: guiModule == g) [ "fltk" "ntk" "zest" "off" ];
|
|
|
|
|
|
|
|
let
|
|
|
|
guiName = {
|
|
|
|
"fltk" = "FLTK";
|
|
|
|
"ntk" = "NTK";
|
|
|
|
"zest" = "Zyn-Fusion";
|
|
|
|
}.${guiModule};
|
2022-08-04 21:16:30 +00:00
|
|
|
|
2020-06-27 02:24:35 +00:00
|
|
|
mruby-zest = callPackage ./mruby-zest { };
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "zynaddsubfx";
|
2022-08-04 21:16:30 +00:00
|
|
|
version = "3.0.6";
|
2011-04-07 22:24:56 +00:00
|
|
|
|
2020-06-27 02:24:35 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
2022-08-04 21:16:30 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2020-06-27 02:24:35 +00:00
|
|
|
fetchSubmodules = true;
|
2022-08-04 21:16:30 +00:00
|
|
|
sha256 = "sha256-0siAx141DZx39facXWmKbsi0rHBNpobApTdey07EcXg=";
|
2011-04-07 22:24:56 +00:00
|
|
|
};
|
|
|
|
|
2022-08-04 21:19:02 +00:00
|
|
|
outputs = [ "out" "doc" ];
|
|
|
|
|
2020-06-27 02:24:35 +00:00
|
|
|
postPatch = ''
|
2022-08-04 21:16:30 +00:00
|
|
|
patchShebangs rtosc/test/test-port-checker.rb src/Tests/check-ports.rb
|
2017-12-11 07:00:51 +00:00
|
|
|
substituteInPlace src/Misc/Config.cpp --replace /usr $out
|
|
|
|
'';
|
|
|
|
|
2020-06-27 02:24:35 +00:00
|
|
|
nativeBuildInputs = [ cmake makeWrapper pkg-config ];
|
|
|
|
|
|
|
|
buildInputs = [ fftw liblo minixml zlib ]
|
2021-06-10 02:57:09 +00:00
|
|
|
++ lib.optionals alsaSupport [ alsa-lib ]
|
2020-06-27 02:24:35 +00:00
|
|
|
++ lib.optionals dssiSupport [ dssi ladspaH ]
|
|
|
|
++ lib.optionals jackSupport [ libjack2 ]
|
|
|
|
++ lib.optionals lashSupport [ lash ]
|
|
|
|
++ lib.optionals portaudioSupport [ portaudio ]
|
2022-08-04 21:16:30 +00:00
|
|
|
++ lib.optionals sndioSupport [ sndio ]
|
|
|
|
++ lib.optionals (guiModule == "fltk") [ fltk libjpeg libXpm ]
|
2020-06-27 02:24:35 +00:00
|
|
|
++ lib.optionals (guiModule == "ntk") [ ntk cairo libXpm ]
|
|
|
|
++ lib.optionals (guiModule == "zest") [ libGL libX11 ];
|
|
|
|
|
|
|
|
cmakeFlags = [ "-DGuiModule=${guiModule}" ]
|
|
|
|
# OSS library is included in glibc.
|
|
|
|
# Must explicitly disable if support is not wanted.
|
|
|
|
++ lib.optional (!ossSupport) "-DOssEnable=OFF"
|
|
|
|
# Find FLTK without requiring an OpenGL library in buildInputs
|
|
|
|
++ lib.optional (guiModule == "fltk") "-DFLTK_SKIP_OPENGL=ON";
|
|
|
|
|
|
|
|
doCheck = true;
|
2022-08-04 21:16:30 +00:00
|
|
|
checkInputs = [ cxxtest ruby ];
|
2020-06-27 02:24:35 +00:00
|
|
|
|
2021-11-16 02:20:02 +00:00
|
|
|
# TODO: Update cmake hook to make it simpler to selectively disable cmake tests: #113829
|
|
|
|
checkPhase = let
|
2022-08-04 21:57:51 +00:00
|
|
|
disabledTests =
|
|
|
|
# PortChecker test fails when lashSupport is enabled because
|
|
|
|
# zynaddsubfx takes to long to start trying to connect to lash
|
|
|
|
lib.optionals lashSupport [ "PortChecker" ]
|
|
|
|
|
|
|
|
# Tests fail on aarch64
|
|
|
|
++ lib.optionals stdenv.isAarch64 [ "MessageTest" "UnisonTest" ];
|
2021-11-16 02:20:02 +00:00
|
|
|
in ''
|
|
|
|
runHook preCheck
|
|
|
|
ctest --output-on-failure -E '^${lib.concatStringsSep "|" disabledTests}$'
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
2021-01-16 19:41:53 +00:00
|
|
|
# Use Zyn-Fusion logo for zest build
|
2022-08-04 21:16:30 +00:00
|
|
|
# An SVG version of the logo isn't hosted anywhere we can fetch, I
|
|
|
|
# had to manually derive it from the code that draws it in-app:
|
|
|
|
# https://github.com/mruby-zest/mruby-zest-build/blob/3.0.6/src/mruby-zest/example/ZynLogo.qml#L65-L97
|
2021-01-16 19:41:53 +00:00
|
|
|
postInstall = lib.optionalString (guiModule == "zest") ''
|
|
|
|
rm -r "$out/share/pixmaps"
|
|
|
|
mkdir -p "$out/share/icons/hicolor/scalable/apps"
|
|
|
|
cp ${./ZynLogo.svg} "$out/share/icons/hicolor/scalable/apps/zynaddsubfx.svg"
|
|
|
|
'';
|
|
|
|
|
2020-06-27 02:24:35 +00:00
|
|
|
# When building with zest GUI, patch plugins
|
|
|
|
# and standalone executable to properly locate zest
|
2021-08-18 00:14:20 +00:00
|
|
|
postFixup = lib.optionalString (guiModule == "zest") ''
|
2022-08-04 21:21:09 +00:00
|
|
|
for lib in "$out/lib/lv2/ZynAddSubFX.lv2/ZynAddSubFX_ui.so" "$out/lib/vst/ZynAddSubFX.so"; do
|
|
|
|
patchelf --set-rpath "${mruby-zest}:$(patchelf --print-rpath "$lib")" "$lib"
|
|
|
|
done
|
2020-06-27 02:24:35 +00:00
|
|
|
|
|
|
|
wrapProgram "$out/bin/zynaddsubfx" \
|
|
|
|
--prefix PATH : ${mruby-zest} \
|
|
|
|
--prefix LD_LIBRARY_PATH : ${mruby-zest}
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "High quality software synthesizer (${guiName} GUI)";
|
|
|
|
homepage =
|
|
|
|
if guiModule == "zest"
|
|
|
|
then "https://zynaddsubfx.sourceforge.io/zyn-fusion.html"
|
|
|
|
else "https://zynaddsubfx.sourceforge.io";
|
2016-02-20 21:51:26 +00:00
|
|
|
|
2022-08-04 21:16:30 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2021-05-22 14:47:40 +00:00
|
|
|
maintainers = with maintainers; [ goibhniu kira-bruneau ];
|
2022-08-04 21:16:30 +00:00
|
|
|
platforms = platforms.all;
|
|
|
|
|
|
|
|
# On macOS:
|
|
|
|
# - Tests don't compile (ld: unknown option: --no-as-needed)
|
|
|
|
# - ZynAddSubFX LV2 & VST plugin fail to compile (not setup to use ObjC version of pugl)
|
|
|
|
# - TTL generation crashes (`pointer being freed was not allocated`) for all VST plugins using AbstractFX
|
|
|
|
# - Zest UI fails to start on pulg_setup: Could not open display, aborting.
|
|
|
|
broken = stdenv.isDarwin;
|
2011-04-07 22:24:56 +00:00
|
|
|
};
|
|
|
|
}
|