about summary refs log tree commit diff
path: root/pkgs/applications/audio/espeak/edit.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/audio/espeak/edit.nix')
-rw-r--r--pkgs/applications/audio/espeak/edit.nix54
1 files changed, 40 insertions, 14 deletions
diff --git a/pkgs/applications/audio/espeak/edit.nix b/pkgs/applications/audio/espeak/edit.nix
index eb34335721f0..524a95bcca06 100644
--- a/pkgs/applications/audio/espeak/edit.nix
+++ b/pkgs/applications/audio/espeak/edit.nix
@@ -1,31 +1,57 @@
-{stdenv, fetchurl, unzip, portaudio, wxGTK}:
+{ stdenv, fetchurl, pkgconfig, unzip, portaudio, wxGTK, sox }:
+
+stdenv.mkDerivation rec {
+  name = "espeakedit-1.48.03";
 
-stdenv.mkDerivation {
-  name = "espeakedit-1.46.02";
   src = fetchurl {
-    url = mirror://sourceforge/espeak/espeakedit-1.46.02.zip;
-    sha256 = "1cc5r89sn8zz7b8wj4grx9xb7aqyi0ybj0li9hpy7hd67r56kqkl";
+    url = "mirror://sourceforge/espeak/${name}.zip";
+    sha256 = "0x8s7vpb7rw5x37yjzy1f98m4f2csdg89libb74fm36gn8ly0hli";
   };
 
-  buildInputs = [ unzip portaudio wxGTK ];
+  buildInputs = [ pkgconfig unzip portaudio wxGTK ];
+
+  # TODO:
+  # Uhm, seems like espeakedit still wants espeak-data/ in $HOME, even thought
+  # it should use $espeak/share/espeak-data. Have to contact upstream to get
+  # this fixed.
+  #
+  # Workaround:
+  #  cp -r $(nix-build -A espeak)/share/espeak-data ~
+  #  chmod +w ~/espeak-data
+
+  patches = [
+    ./espeakedit-fix-makefile.patch
+    ./espeakedit-configurable-sox-path.patch
+    ./espeakedit-configurable-path-espeak-data.patch
+  ];
 
-  patchPhase = if portaudio.api_version == 19 then ''
+  postPatch = ''
+    # Disable -Wall flag because it's noisy
+    sed -i "s/-Wall//g" src/Makefile
+
+    # Fixup paths (file names from above espeak-configurable* patches)
+    for file in src/compiledata.cpp src/readclause.cpp src/speech.h; do
+        sed -e "s|@sox@|${sox}/bin/sox|" \
+            -e "s|@prefix@|$out|" \
+            -i "$file"
+    done
+  '' + stdenv.lib.optionalString (portaudio.api_version == 19) ''
     cp src/portaudio19.h src/portaudio.h
-  '' else "";
+  '';
 
   buildPhase = ''
-    cd src
-    gcc -o espeakedit *.cpp `wx-config --cxxflags --libs`
+    make -C src
   '';
 
   installPhase = ''
-    ensureDir $out/bin
-    cp espeakedit $out/bin
+    mkdir -p "$out/bin"
+    cp src/espeakedit "$out/bin"
   '';
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "Phoneme editor for espeak";
     homepage = http://espeak.sourceforge.net/;
-    license = "GPLv3+";
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux;
   };
 }