diff options
Diffstat (limited to 'pkgs/applications/audio/espeak')
5 files changed, 115 insertions, 19 deletions
diff --git a/pkgs/applications/audio/espeak/default.nix b/pkgs/applications/audio/espeak/default.nix index e1cf5fee1cc7..d47d82497ab6 100644 --- a/pkgs/applications/audio/espeak/default.nix +++ b/pkgs/applications/audio/espeak/default.nix @@ -1,10 +1,11 @@ -{stdenv, fetchurl, unzip, portaudio }: +{ stdenv, fetchurl, unzip, portaudio }: + +stdenv.mkDerivation rec { + name = "espeak-1.48.04"; -stdenv.mkDerivation { - name = "espeak-1.46.02"; src = fetchurl { - url = mirror://sourceforge/espeak/espeak-1.46.02-source.zip; - sha256 = "1fjlv5fm0gzvr5wzy1dp4nspw04k0bqv3jymha2p2qfjbfifp2zg"; + url = "mirror://sourceforge/espeak/${name}-source.zip"; + sha256 = "0n86gwh9pw0jqqpdz7mxggllfr8k0r7pc67ayy7w5z6z79kig6mz"; }; buildInputs = [ unzip portaudio ]; @@ -21,9 +22,10 @@ stdenv.mkDerivation { makeFlags="PREFIX=$out DATADIR=$out/share/espeak-data" ''; - meta = { + meta = with stdenv.lib; { description = "Compact open source software speech synthesizer"; homepage = http://espeak.sourceforge.net/; license = "GPLv3+"; + platforms = platforms.linux; }; } diff --git a/pkgs/applications/audio/espeak/edit.nix b/pkgs/applications/audio/espeak/edit.nix index 6627c6eb0e52..0e59a42614fd 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 = '' - mkdir -p $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+"; + platforms = platforms.linux; }; } diff --git a/pkgs/applications/audio/espeak/espeakedit-configurable-path-espeak-data.patch b/pkgs/applications/audio/espeak/espeakedit-configurable-path-espeak-data.patch new file mode 100644 index 000000000000..e5c761a11b35 --- /dev/null +++ b/pkgs/applications/audio/espeak/espeakedit-configurable-path-espeak-data.patch @@ -0,0 +1,15 @@ +Don't hardcode /usr, use @prefix@. + +Author: Bjørn Forsman +diff -uNr espeakedit-1.48.03.orig/src/speech.h espeakedit-1.48.03/src/speech.h +--- espeakedit-1.48.03.orig/src/speech.h 2014-03-04 17:48:12.000000000 +0100 ++++ espeakedit-1.48.03/src/speech.h 2014-07-22 18:21:40.860790719 +0200 +@@ -58,7 +58,7 @@ + + // will look for espeak_data directory here, and also in user's home directory + #ifndef PATH_ESPEAK_DATA +- #define PATH_ESPEAK_DATA "/usr/share/espeak-data" ++ #define PATH_ESPEAK_DATA "@prefix@/share/espeak-data" + #endif + + typedef unsigned short USHORT; diff --git a/pkgs/applications/audio/espeak/espeakedit-configurable-sox-path.patch b/pkgs/applications/audio/espeak/espeakedit-configurable-sox-path.patch new file mode 100644 index 000000000000..1c5dfc21941a --- /dev/null +++ b/pkgs/applications/audio/espeak/espeakedit-configurable-sox-path.patch @@ -0,0 +1,27 @@ +Make the path to 'sox' configurable by marking it '@sox@' (easy to match with sed). + +Author: Bjørn Forsman +diff -uNr espeakedit-1.48.03.orig/src/compiledata.cpp espeakedit-1.48.03/src/compiledata.cpp +--- espeakedit-1.48.03.orig/src/compiledata.cpp 2014-03-04 17:48:11.000000000 +0100 ++++ espeakedit-1.48.03/src/compiledata.cpp 2014-07-22 16:38:50.261388452 +0200 +@@ -1884,7 +1884,7 @@ + fname2 = msg; + } + +- sprintf(command,"sox \"%s%s.wav\" -r %d -c1 -t wav %s\n",path_source,fname2,samplerate_native, fname_temp); ++ sprintf(command,"@sox@ \"%s%s.wav\" -r %d -c1 -t wav %s\n",path_source,fname2,samplerate_native, fname_temp); + if(system(command) != 0) + { + failed = 1; +diff -uNr espeakedit-1.48.03.orig/src/readclause.cpp espeakedit-1.48.03/src/readclause.cpp +--- espeakedit-1.48.03.orig/src/readclause.cpp 2014-03-04 17:48:11.000000000 +0100 ++++ espeakedit-1.48.03/src/readclause.cpp 2014-07-22 16:38:37.190440504 +0200 +@@ -892,7 +892,7 @@ + if((fd_temp = mkstemp(fname_temp)) >= 0) + { + close(fd_temp); +- sprintf(command,"sox \"%s\" -r %d -c1 -t wav %s\n", fname, samplerate, fname_temp); ++ sprintf(command,"@sox@ \"%s\" -r %d -c1 -t wav %s\n", fname, samplerate, fname_temp); + if(system(command) == 0) + { + fname = fname_temp; diff --git a/pkgs/applications/audio/espeak/espeakedit-fix-makefile.patch b/pkgs/applications/audio/espeak/espeakedit-fix-makefile.patch new file mode 100644 index 000000000000..9f8a65d2b0ca --- /dev/null +++ b/pkgs/applications/audio/espeak/espeakedit-fix-makefile.patch @@ -0,0 +1,26 @@ +Fix broken Makefile: + +* fix syntax error (missing '\' to continue line): + Makefile:19: *** recipe commences before first target. Stop. +* Get portaudio library flags from pkg-config (to get -Lpath/to/portaudio/lib etc.) + +Author: Bjørn Forsman +diff -uNr espeakedit-1.48.03.orig/src/Makefile espeakedit-1.48.03/src/Makefile +--- espeakedit-1.48.03.orig/src/Makefile 2013-03-13 15:52:02.000000000 +0100 ++++ espeakedit-1.48.03/src/Makefile 2014-07-22 15:34:17.524114822 +0200 +@@ -12,12 +12,11 @@ + + WX_LIBS = -pthread `wx-config --libs` + +-LIBS=-lstdc++ -lportaudio ++LIBS=-lstdc++ `pkg-config --libs portaudio-2.0` + #LIBS=-lstdc++ /usr/lib/x86_64-linux-gnu/libportaudio.so.2 + +-CPPFLAGS = -Wall -g -fexceptions `wx-config --cflags` +- -I/usr/include/wx-2.8 \ +- -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES ++CPPFLAGS = -Wall -g -fexceptions `wx-config --cflags` \ ++ -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES \ + -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT + + CXXFLAGS = -O2 -Wall -fexceptions `wx-config --cflags` \ |