From 4597903ce98dea0c66df59837c3f3d4d8d0082f7 Mon Sep 17 00:00:00 2001 From: Bjørn Forsman Date: Mon, 2 Sep 2013 21:53:57 +0200 Subject: espeakedit: version bump 1.46.02 -> 1.48.03 (and add to channel) The one-liner gcc buildPhase doesn't work anymore, so I'm using upstream Makefile instead. The Makefile needs a tiny patch to work (not nixpkgs specific). Also fixup path to 'sox' and espeak-data/ (runtime deps) by providing full paths. TODO: Uhm, seems like espeakedit still wants espeak-data/ in $HOME, even thought I've told it to 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 --- pkgs/applications/audio/espeak/edit.nix | 52 ++++++++++++++++------ .../espeakedit-configurable-path-espeak-data.patch | 15 +++++++ .../espeak/espeakedit-configurable-sox-path.patch | 27 +++++++++++ .../audio/espeak/espeakedit-fix-makefile.patch | 26 +++++++++++ 4 files changed, 107 insertions(+), 13 deletions(-) create mode 100644 pkgs/applications/audio/espeak/espeakedit-configurable-path-espeak-data.patch create mode 100644 pkgs/applications/audio/espeak/espeakedit-configurable-sox-path.patch create mode 100644 pkgs/applications/audio/espeak/espeakedit-fix-makefile.patch diff --git a/pkgs/applications/audio/espeak/edit.nix b/pkgs/applications/audio/espeak/edit.nix index eb34335721f..0e59a42614f 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+"; + 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 00000000000..e5c761a11b3 --- /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 00000000000..1c5dfc21941 --- /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 00000000000..9f8a65d2b0c --- /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` \ -- cgit 1.4.1