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
This commit is contained in:
Bjørn Forsman 2013-09-02 21:53:57 +02:00
parent 62adfd8570
commit 4597903ce9
4 changed files with 107 additions and 13 deletions

View file

@ -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 ];
patchPhase = if portaudio.api_version == 19 then ''
# 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
];
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;
};
}

View file

@ -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;

View file

@ -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;

View file

@ -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` \