summary refs log tree commit diff
path: root/pkgs/applications/audio/zynaddsubfx
diff options
context:
space:
mode:
authorKira Bruneau <kira.bruneau@pm.me>2022-08-04 17:16:30 -0400
committerKira Bruneau <kira.bruneau@pm.me>2022-08-13 19:54:45 -0400
commit1c395dbabe0bef15698c10959b82752f29facbdf (patch)
tree661b6ce25ac85029acc2250ac5b174ed22824e13 /pkgs/applications/audio/zynaddsubfx
parentfbaac3ad4fbce6b9abaa031c1dddf96640f27a13 (diff)
downloadnixpkgs-1c395dbabe0bef15698c10959b82752f29facbdf.tar
nixpkgs-1c395dbabe0bef15698c10959b82752f29facbdf.tar.gz
nixpkgs-1c395dbabe0bef15698c10959b82752f29facbdf.tar.bz2
nixpkgs-1c395dbabe0bef15698c10959b82752f29facbdf.tar.lz
nixpkgs-1c395dbabe0bef15698c10959b82752f29facbdf.tar.xz
nixpkgs-1c395dbabe0bef15698c10959b82752f29facbdf.tar.zst
nixpkgs-1c395dbabe0bef15698c10959b82752f29facbdf.zip
zynaddsubfx: 3.0.5 → 3.0.6
Diffstat (limited to 'pkgs/applications/audio/zynaddsubfx')
-rw-r--r--pkgs/applications/audio/zynaddsubfx/default.nix35
-rw-r--r--pkgs/applications/audio/zynaddsubfx/mruby-zest/default.nix104
-rw-r--r--pkgs/applications/audio/zynaddsubfx/mruby-zest/force-cxx-as-linker.patch (renamed from pkgs/applications/audio/zynaddsubfx/mruby-zest/force-gcc-as-linker.patch)8
-rw-r--r--pkgs/applications/audio/zynaddsubfx/mruby-zest/system-libuv.patch113
4 files changed, 58 insertions, 202 deletions
diff --git a/pkgs/applications/audio/zynaddsubfx/default.nix b/pkgs/applications/audio/zynaddsubfx/default.nix
index 101d4dc9379..fae337c079f 100644
--- a/pkgs/applications/audio/zynaddsubfx/default.nix
+++ b/pkgs/applications/audio/zynaddsubfx/default.nix
@@ -15,7 +15,7 @@
 , zlib
 
   # Optional dependencies
-, alsaSupport ? true
+, alsaSupport ? stdenv.isLinux
 , alsa-lib
 , dssiSupport ? false
 , dssi
@@ -27,11 +27,13 @@
 , ossSupport ? true
 , portaudioSupport ? true
 , portaudio
+, sndioSupport ? stdenv.isOpenBSD
+, sndio
 
   # Optional GUI dependencies
 , guiModule ? "off"
 , cairo
-, fltk13
+, fltk
 , libGL
 , libjpeg
 , libX11
@@ -40,6 +42,7 @@
 
   # Test dependencies
 , cxxtest
+, ruby
 }:
 
 assert builtins.any (g: guiModule == g) [ "fltk" "ntk" "zest" "off" ];
@@ -50,22 +53,24 @@ let
     "ntk" = "NTK";
     "zest" = "Zyn-Fusion";
   }.${guiModule};
+
   mruby-zest = callPackage ./mruby-zest { };
 in stdenv.mkDerivation rec {
   pname = "zynaddsubfx";
-  version = "3.0.5";
+  version = "3.0.6";
 
   src = fetchFromGitHub {
     owner = pname;
     repo = pname;
-    rev = version;
-    sha256 = "1vh1gszgjxwn8m32rk5222z1j2cnjax0bqpag7b47v6i36p2q4x8";
+    rev = "refs/tags/${version}";
     fetchSubmodules = true;
+    sha256 = "sha256-0siAx141DZx39facXWmKbsi0rHBNpobApTdey07EcXg=";
   };
 
   outputs = [ "out" "doc" ];
 
   postPatch = ''
+    patchShebangs rtosc/test/test-port-checker.rb src/Tests/check-ports.rb
     substituteInPlace src/Misc/Config.cpp --replace /usr $out
   '';
 
@@ -77,7 +82,8 @@ in stdenv.mkDerivation rec {
     ++ lib.optionals jackSupport [ libjack2 ]
     ++ lib.optionals lashSupport [ lash ]
     ++ lib.optionals portaudioSupport [ portaudio ]
-    ++ lib.optionals (guiModule == "fltk") [ fltk13 libjpeg libXpm ]
+    ++ lib.optionals sndioSupport [ sndio ]
+    ++ lib.optionals (guiModule == "fltk") [ fltk libjpeg libXpm ]
     ++ lib.optionals (guiModule == "ntk") [ ntk cairo libXpm ]
     ++ lib.optionals (guiModule == "zest") [ libGL libX11 ];
 
@@ -89,7 +95,7 @@ in stdenv.mkDerivation rec {
     ++ lib.optional (guiModule == "fltk") "-DFLTK_SKIP_OPENGL=ON";
 
   doCheck = true;
-  checkInputs = [ cxxtest ];
+  checkInputs = [ cxxtest ruby ];
 
   # TODO: Update cmake hook to make it simpler to selectively disable cmake tests: #113829
   checkPhase = let
@@ -107,7 +113,9 @@ in stdenv.mkDerivation rec {
   '';
 
   # Use Zyn-Fusion logo for zest build
-  # Manually derived from https://github.com/mruby-zest/mruby-zest-build/blob/3.0.6/src/mruby-zest/example/ZynLogo.qml#L65-L97
+  # 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
   postInstall = lib.optionalString (guiModule == "zest") ''
     rm -r "$out/share/pixmaps"
     mkdir -p "$out/share/icons/hicolor/scalable/apps"
@@ -133,8 +141,15 @@ in stdenv.mkDerivation rec {
       then "https://zynaddsubfx.sourceforge.io/zyn-fusion.html"
       else "https://zynaddsubfx.sourceforge.io";
 
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     maintainers = with maintainers; [ goibhniu kira-bruneau ];
-    platforms = platforms.linux;
+    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;
   };
 }
diff --git a/pkgs/applications/audio/zynaddsubfx/mruby-zest/default.nix b/pkgs/applications/audio/zynaddsubfx/mruby-zest/default.nix
index 1c9cb0a463d..797b4624b96 100644
--- a/pkgs/applications/audio/zynaddsubfx/mruby-zest/default.nix
+++ b/pkgs/applications/audio/zynaddsubfx/mruby-zest/default.nix
@@ -1,9 +1,8 @@
-{ lib, stdenv
+{ lib
+, stdenv
 , fetchFromGitHub
-, fetchpatch
 , bison
-, git
-, python2
+, pkg-config
 , rake
 , ruby
 , libGL
@@ -11,87 +10,42 @@
 , libX11
 }:
 
-let
-  mgem-list = fetchFromGitHub {
-    owner = "mruby";
-    repo = "mgem-list";
-    rev = "2033837203c8a141b1f9d23bb781fe0cbaefbd24";
-    sha256 = "0igf2nsx5i6g0yf7sjxxkngyriv213d0sjs3yidrflrabiywpxmm";
-  };
-
-  mruby-dir = fetchFromGitHub {
-    owner = "iij";
-    repo = "mruby-dir";
-    rev = "89dceefa1250fb1ae868d4cb52498e9e24293cd1";
-    sha256 = "0zrhiy9wmwmc9ls62iyb2z86j2ijqfn7rn4xfmrbrfxygczarsm9";
-  };
-
-  mruby-errno = fetchFromGitHub {
-    owner = "iij";
-    repo = "mruby-errno";
-    rev = "b4415207ff6ea62360619c89a1cff83259dc4db0";
-    sha256 = "12djcwjjw0fygai5kssxbfs3pzh3cpnq07h9m2h5b51jziw380xj";
-  };
-
-  mruby-file-stat = fetchFromGitHub {
-    owner = "ksss";
-    repo = "mruby-file-stat";
-    rev = "aa474589f065c71d9e39ab8ba976f3bea6f9aac2";
-    sha256 = "1clarmr67z133ivkbwla1a42wcjgj638j9w0mlv5n21mhim9rid5";
-  };
-
-  mruby-process = fetchFromGitHub {
-    owner = "iij";
-    repo = "mruby-process";
-    rev = "fe171fbe2a6cc3c2cf7d713641bddde71024f7c8";
-    sha256 = "00yrzc371f90gl5m1gbkw0qq8c394bpifssjr8p1wh5fmzhxqyml";
-  };
-
-  mruby-pack = fetchFromGitHub {
-    owner = "iij";
-    repo = "mruby-pack";
-    rev = "383a9c79e191d524a9a2b4107cc5043ecbf6190b";
-    sha256 = "003glxgxifk4ixl12sy4gn9bhwvgb79b4wga549ic79isgv81w2d";
-  };
-in
 stdenv.mkDerivation rec {
   pname = "mruby-zest";
-  version = "3.0.5";
+  version = "3.0.6";
 
   src = fetchFromGitHub {
     owner = pname;
     repo = "${pname}-build";
-    rev = version;
-    sha256 = "0fxljrgamgz2rm85mclixs00b0f2yf109jc369039n1vf0l5m57d";
+    rev = "refs/tags/${version}";
     fetchSubmodules = true;
+    sha256 = "sha256-rIb6tQimwrUj+623IU5zDyKNWsNYYBElLQClOsP+5Dc=";
   };
 
-  nativeBuildInputs = [ bison git python2 rake ruby ];
-  buildInputs = [ libGL libuv libX11 ];
-
   patches = [
-    ./force-gcc-as-linker.patch
-    ./system-libuv.patch
+    ./force-cxx-as-linker.patch
+  ];
+
+  nativeBuildInputs = [
+    bison
+    pkg-config
+    rake
+    ruby
+  ];
 
-    # Pull upstream fix for -fno-common toolchains:
-    #   https://github.com/mruby-zest/mruby-zest-build/issues/25
-    (fetchpatch {
-      name = "fno-common.patch";
-      url = "https://github.com/mruby-zest/mruby-zest-build/commit/4eb88250f22ee684acac95d4d1f114df504e37a7.patch";
-      sha256 = "0wg7qy1vg0mzcxagf35bv35dlr0q17pxjicigpf86yqppvgrzrsb";
-    })
+  buildInputs = [
+    libGL
+    libuv
+    libX11
   ];
 
-  # Add missing dependencies of deps/mruby-dir-glob/mrbgem.rake
-  # Should be fixed in next release, see bcadb0a5490bd6d599f1a0e66ce09b46363c9dae
-  postPatch = ''
-    mkdir -p mruby/build/mrbgems
-    ln -s ${mgem-list} mruby/build/mrbgems/mgem-list
-    ln -s ${mruby-dir} mruby/build/mrbgems/mruby-dir
-    ln -s ${mruby-errno} mruby/build/mrbgems/mruby-errno
-    ln -s ${mruby-file-stat} mruby/build/mrbgems/mruby-file-stat
-    ln -s ${mruby-process} mruby/build/mrbgems/mruby-process
-    ln -s ${mruby-pack} mruby/build/mrbgems/mruby-pack
+  # Force optimization to fix:
+  # warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O)
+  NIX_CFLAGS_COMPILE = "-O3";
+
+  # Remove pre-built y.tab.c to generate with nixpkgs bison
+  preBuild = ''
+    rm mruby/mrbgems/mruby-compiler/core/y.tab.c
   '';
 
   installTargets = [ "pack" ];
@@ -102,8 +56,8 @@ stdenv.mkDerivation rec {
 
     # mruby-widget-lib/src/api.c requires MainWindow.qml as part of a
     # sanity check, even though qml files are compiled into the binary
-    # https://github.com/mruby-zest/mruby-zest-build/tree/3.0.5/src/mruby-widget-lib/src/api.c#L99-L116
-    # https://github.com/mruby-zest/mruby-zest-build/tree/3.0.5/linux-pack.sh#L17-L18
+    # https://github.com/mruby-zest/mruby-zest-build/blob/3.0.6/src/mruby-widget-lib/src/api.c#L107-L124
+    # https://github.com/mruby-zest/mruby-zest-build/blob/3.0.6/linux-pack.sh#L17-L18
     mkdir -p "$out/qml"
     touch "$out/qml/MainWindow.qml"
   '';
@@ -111,7 +65,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "The Zest Framework used in ZynAddSubFX's UI";
     homepage = "https://github.com/mruby-zest";
-    license = licenses.lgpl21;
+    license = licenses.lgpl21Plus;
     maintainers = with maintainers; [ kira-bruneau ];
     platforms = platforms.all;
   };
diff --git a/pkgs/applications/audio/zynaddsubfx/mruby-zest/force-gcc-as-linker.patch b/pkgs/applications/audio/zynaddsubfx/mruby-zest/force-cxx-as-linker.patch
index c521d240774..bd5cd1edd8e 100644
--- a/pkgs/applications/audio/zynaddsubfx/mruby-zest/force-gcc-as-linker.patch
+++ b/pkgs/applications/audio/zynaddsubfx/mruby-zest/force-cxx-as-linker.patch
@@ -1,13 +1,13 @@
 diff --git a/mruby/tasks/toolchains/gcc.rake b/mruby/tasks/toolchains/gcc.rake
-index f370c0ab..e5ab9f60 100644
+index 51bda6517..9bc96d0e2 100644
 --- a/mruby/tasks/toolchains/gcc.rake
 +++ b/mruby/tasks/toolchains/gcc.rake
-@@ -22,7 +22,7 @@ MRuby::Toolchain.new(:gcc) do |conf, _params|
+@@ -23,7 +23,7 @@ MRuby::Toolchain.new(:gcc) do |conf, params|
    end
  
    conf.linker do |linker|
--    linker.command = ENV['LD'] || 'gcc'
-+    linker.command = 'gcc'
+-    linker.command = ENV['LD'] || ENV['CXX'] || ENV['CC'] || default_command
++    linker.command = ENV['CXX'] || ENV['CC'] || default_command
      linker.flags = [ENV['LDFLAGS'] || %w()]
      linker.libraries = %w(m)
      linker.library_paths = []
diff --git a/pkgs/applications/audio/zynaddsubfx/mruby-zest/system-libuv.patch b/pkgs/applications/audio/zynaddsubfx/mruby-zest/system-libuv.patch
deleted file mode 100644
index b7050abc123..00000000000
--- a/pkgs/applications/audio/zynaddsubfx/mruby-zest/system-libuv.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-diff --git a/Makefile b/Makefile
-index f3e3be2..2398852 100644
---- a/Makefile
-+++ b/Makefile
-@@ -1,8 +1,3 @@
--UV_DIR    = libuv-v1.9.1
--UV_FILE   = $(UV_DIR).tar.gz
--UV_URL    = http://dist.libuv.org/dist/v1.9.1/$(UV_FILE)
--	 
--
- all:
- 	ruby ./rebuild-fcache.rb
- 	cd deps/nanovg/src   && $(CC) nanovg.c -c -fPIC
-@@ -10,12 +5,12 @@ all:
- #	cd deps/pugl         && python2 ./waf configure --no-cairo --static
- 	cd deps/pugl         && python2 ./waf configure --no-cairo --static --debug
- 	cd deps/pugl         && python2 ./waf
--	cd src/osc-bridge    && CFLAGS="-I ../../deps/$(UV_DIR)/include " make lib
-+	cd src/osc-bridge    && make lib
- 	cd mruby             && MRUBY_CONFIG=../build_config.rb rake
- 	$(CC) -shared -o libzest.so `find mruby/build/host -type f | grep -e "\.o$$" | grep -v bin` ./deps/libnanovg.a \
- 		./deps/libnanovg.a \
- 		src/osc-bridge/libosc-bridge.a \
--		./deps/$(UV_DIR)/.libs/libuv.a  -lm -lX11 -lGL -lpthread
-+		-luv -lm -lX11 -lGL -lpthread
- 	$(CC) test-libversion.c deps/pugl/build/libpugl-0.a -ldl -o zest -lX11 -lGL -lpthread -I deps/pugl -std=gnu99
- 
- osx:
-@@ -25,12 +20,12 @@ osx:
- 	cd deps/pugl         && python2 ./waf configure --no-cairo --static
- #	cd deps/pugl         && python2 ./waf configure --no-cairo --static --debug
- 	cd deps/pugl         && python2 ./waf
--	cd src/osc-bridge    && CFLAGS="-I ../../deps/$(UV_DIR)/include " make lib
-+	cd src/osc-bridge    && make lib
- 	cd mruby             && MRUBY_CONFIG=../build_config.rb rake
- 	$(CC) -shared -o libzest.so `find mruby/build/host -type f | grep -e "\.o$$" | grep -v bin` ./deps/libnanovg.a \
- 		./deps/libnanovg.a \
- 		src/osc-bridge/libosc-bridge.a \
--		./deps/$(UV_DIR)/.libs/libuv.a  -lm -framework OpenGL -lpthread
-+		-luv -lm -framework OpenGL -lpthread
- 	$(CC) test-libversion.c deps/pugl/build/libpugl-0.a -ldl -o zest -framework OpenGL -framework AppKit -lpthread -I deps/pugl -std=gnu99
- 
- windows:
-@@ -38,38 +33,14 @@ windows:
- 	$(AR) rc deps/libnanovg.a deps/nanovg/src/*.o
- 	cd deps/pugl         && CFLAGS="-mstackrealign" python2 ./waf configure --no-cairo --static --target=win32
- 	cd deps/pugl         && python2 ./waf
--	cd src/osc-bridge    && CFLAGS="-mstackrealign -I ../../deps/$(UV_DIR)/include " make lib
-+	cd src/osc-bridge    && CFLAGS="-mstackrealign" make lib
- 	cd mruby             && WINDOWS=1 MRUBY_CONFIG=../build_config.rb rake
- 	$(CC) -mstackrealign -shared -o libzest.dll -static-libgcc `find mruby/build/w64 -type f | grep -e "\.o$$" | grep -v bin` \
-         ./deps/libnanovg.a \
-         src/osc-bridge/libosc-bridge.a \
--        ./deps/libuv-win.a \
--        -lm -lpthread -lws2_32 -lkernel32 -lpsapi -luserenv -liphlpapi -lglu32 -lgdi32 -lopengl32
-+        -luv -lm -lpthread -lws2_32 -lkernel32 -lpsapi -luserenv -liphlpapi -lglu32 -lgdi32 -lopengl32
- 	$(CC) -mstackrealign -DWIN32 test-libversion.c deps/pugl/build/libpugl-0.a -o zest.exe -lpthread -I deps/pugl -std=c99 -lws2_32 -lkernel32 -lpsapi -luserenv -liphlpapi -lglu32 -lgdi32 -lopengl32
- 
--
--builddep: deps/libuv.a
--deps/libuv.a:
--	cd deps/$(UV_DIR)    && ./autogen.sh
--	cd deps/$(UV_DIR)    && CFLAGS=-fPIC ./configure
--	cd deps/$(UV_DIR)    && CFLAGS=-fPIC make
--	cp deps/$(UV_DIR)/.libs/libuv.a deps/
--
--builddepwin: deps/libuv-win.a
--deps/libuv-win.a:
--	cd deps/$(UV_DIR)   && ./autogen.sh
--	cd deps/$(UV_DIR)   && CFLAGS="-mstackrealign" ./configure  --host=x86_64-w64-mingw32
--	cd deps/$(UV_DIR)   && LD=x86_64-w64-mingw32-gcc make
--	cp deps/$(UV_DIR)/.libs/libuv.a deps/libuv-win.a
--
--deps/$(UV_DIR):
--	cd deps              && wget -4 $(UV_URL) && tar xvf $(UV_FILE)
--setup: deps/$(UV_DIR)
--
--setupwin:
--	cd deps              && wget -4 $(UV_URL)
--	cd deps              && tar xvf $(UV_FILE)
--
- push:
- 	cd src/osc-bridge      && git push
- 	cd src/mruby-qml-parse  && git push
-diff --git a/build_config.rb b/build_config.rb
-index 00f1f69..11ac15b 100644
---- a/build_config.rb
-+++ b/build_config.rb
-@@ -96,7 +96,6 @@ build_type.new(build_name) do |conf|
-   conf.cc do |cc|
-       cc.include_paths << "#{`pwd`.strip}/../deps/nanovg/src"
-       cc.include_paths << "#{`pwd`.strip}/../deps/pugl/"
--      cc.include_paths << "#{`pwd`.strip}/../deps/libuv-v1.9.1/include/"
-       cc.include_paths << "/usr/share/mingw-w64/include/" if windows
-       cc.include_paths << "/usr/x86_64-w64-mingw32/include/" if windows
-       cc.flags << "-DLDBL_EPSILON=1e-6" if windows
-@@ -117,14 +116,14 @@ build_type.new(build_name) do |conf|
-       linker.flags_after_libraries  << "#{`pwd`.strip}/../deps/pugl/build/libpugl-0.a"
-       linker.flags_after_libraries  << "#{`pwd`.strip}/../deps/libnanovg.a"
-       if(!windows)
--        linker.flags_after_libraries  << "#{`pwd`.strip}/../deps/libuv.a"
-+        linker.flags_after_libraries  << "-luv"
-         if(ENV['OS'] != "Mac")
-           linker.libraries << 'GL'
-           linker.libraries << 'X11'
-         end
-         linker.flags_after_libraries  << "-lpthread -ldl -lm"
-       else
--        linker.flags_after_libraries  << "#{`pwd`.strip}/../deps/libuv-win.a"
-+        linker.flags_after_libraries  << "-luv"
-         linker.flags_after_libraries  << "-lws2_32 -lkernel32 -lpsapi -luserenv -liphlpapi"
-         linker.flags_after_libraries  << "-lglu32 -lgdi32 -lopengl32"
-       end