about summary refs log tree commit diff
path: root/pkgs/applications/audio/easyabc
diff options
context:
space:
mode:
authorMauricio Scheffer <mauricioscheffer@gmail.com>2023-06-09 15:57:36 +0100
committerAnderson Torres <torres.anderson.85@protonmail.com>2023-06-22 23:31:52 -0300
commit644fed2285c00e2b232f271773b2c1d0d26e7234 (patch)
treea58c7285a31c3834f9f786c9df82ddfb947b072d /pkgs/applications/audio/easyabc
parent989d3e9122f47052e16298999f8e106a5a5f188a (diff)
easyabc: init at 1.3.8.6
Diffstat (limited to 'pkgs/applications/audio/easyabc')
-rw-r--r--pkgs/applications/audio/easyabc/default.nix65
-rw-r--r--pkgs/applications/audio/easyabc/hardcoded-paths.patch43
2 files changed, 108 insertions, 0 deletions
diff --git a/pkgs/applications/audio/easyabc/default.nix b/pkgs/applications/audio/easyabc/default.nix
new file mode 100644
index 0000000000000..9f45d04524132
--- /dev/null
+++ b/pkgs/applications/audio/easyabc/default.nix
@@ -0,0 +1,65 @@
+{ lib, fetchFromGitHub, substituteAll, makeWrapper, python39, fluidsynth, soundfont-fluid, wrapGAppsHook, abcmidi, abcm2ps, ghostscript }:
+
+# requires python39 due to https://stackoverflow.com/a/71902541 https://github.com/jwdj/EasyABC/issues/52
+python39.pkgs.buildPythonApplication {
+  pname = "easyabc";
+  version = "1.3.8.6";
+
+  src = fetchFromGitHub {
+    owner = "jwdj";
+    repo = "easyabc";
+    rev = "6461b2c14280cb64224fc5299c31cfeef9b7d43c";
+    hash = "sha256-leC3A4HQMeJNeZXArb3YAYr2mddGPcws618NrRh2Q1Y=";
+  };
+
+  nativeBuildInputs = [ wrapGAppsHook ];
+
+  propagatedBuildInputs = with python39.pkgs; [
+    cx_Freeze
+    wxPython_4_2
+    pygame
+  ];
+
+  # apparently setup.py only supports Windows and Darwin
+  # everything is very non-standard in this project
+  dontBuild = true;
+  format = "other";
+
+  # https://discourse.nixos.org/t/packaging-mcomix3-python-gtk-missing-gsettings-schemas-issue/10190/2
+  strictDeps = false;
+
+  patches = [
+    (substituteAll {
+      src = ./hardcoded-paths.patch;
+      fluidsynth = "${fluidsynth}/lib/libfluidsynth.so";
+      soundfont = "${soundfont-fluid}/share/soundfonts/FluidR3_GM2-2.sf2";
+      ghostscript = "${ghostscript}/bin/gs";
+    })
+  ];
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/share/easyabc
+    mv * $out/share/easyabc
+
+    ln -s ${abcmidi}/bin/abc2midi $out/share/easyabc/bin/abc2midi
+    ln -s ${abcmidi}/bin/midi2abc $out/share/easyabc/bin/midi2abc
+    ln -s ${abcmidi}/bin/abc2abc $out/share/easyabc/bin/abc2abc
+    ln -s ${abcm2ps}/bin/abcm2ps $out/share/easyabc/bin/abcm2ps
+
+    makeWrapper ${python39.interpreter} $out/bin/easyabc \
+      --set PYTHONPATH "$PYTHONPATH:$out/share/easyabc" \
+      --add-flags "-O $out/share/easyabc/easy_abc.py"
+
+    runHook postInstall
+  '';
+
+  meta = {
+    description = "ABC music notation editor";
+    homepage = "https://easyabc.sourceforge.net/";
+    license = lib.licenses.gpl2Plus;
+    platforms = lib.platforms.linux;
+    maintainers = with lib.maintainers; [ mausch ];
+  };
+}
diff --git a/pkgs/applications/audio/easyabc/hardcoded-paths.patch b/pkgs/applications/audio/easyabc/hardcoded-paths.patch
new file mode 100644
index 0000000000000..e3ac1e58d7a9a
--- /dev/null
+++ b/pkgs/applications/audio/easyabc/hardcoded-paths.patch
@@ -0,0 +1,43 @@
+---
+ easy_abc.py   | 4 ++++
+ fluidsynth.py | 2 ++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/easy_abc.py b/easy_abc.py
+index 5be3e6a..40c999a 100644
+--- a/easy_abc.py
++++ b/easy_abc.py
+@@ -3960,6 +3960,8 @@ class MainFrame(wx.Frame):
+         else:
+             default_soundfont_path = '/usr/share/sounds/sf2/FluidR3_GM.sf2'
+
++        default_soundfont_path = '@soundfont@'
++
+         soundfont_path = settings.get('soundfont_path', default_soundfont_path)
+         self.uses_fluidsynth = False
+         if fluidsynth_available and soundfont_path and os.path.exists(soundfont_path):
+@@ -8367,6 +8369,8 @@ class MainFrame(wx.Frame):
+                 gs_path = '/usr/bin/pstopdf'
+                 settings['gs_path'] = gs_path
+
++            settings['gs_path'] = '@ghostscript@'
++
+         # 1.3.6.1 [SS] 2015-01-12 2015-01-22
+         gs_path = settings['gs_path'] #eliminate trailing \n
+         if gs_path and (os.path.exists(gs_path) == False):
+diff --git a/fluidsynth.py b/fluidsynth.py
+index 529ebbf..b5d9377 100644
+--- a/fluidsynth.py
++++ b/fluidsynth.py
+@@ -44,6 +44,8 @@ if platform.system() == 'Windows':
+ else:
+     lib_locations = ['./libfluidsynth.so.3', 'libfluidsynth.so.3', './libfluidsynth.so.2', 'libfluidsynth.so.2']
+
++lib_locations = ['@fluidsynth@']
++
+ i = 0
+ while i < len(lib_locations):
+     try:
+--
+2.38.5
+