1{
2 lib,
3 stdenv,
4 fetchurl,
5 pkg-config,
6 unzip,
7 portaudio,
8 wxGTK32,
9 sox,
10}:
11
12stdenv.mkDerivation rec {
13 pname = "espeakedit";
14 version = "1.48.03";
15
16 src = fetchurl {
17 url = "mirror://sourceforge/espeak/espeakedit-${version}.zip";
18 sha256 = "0x8s7vpb7rw5x37yjzy1f98m4f2csdg89libb74fm36gn8ly0hli";
19 };
20
21 nativeBuildInputs = [
22 pkg-config
23 unzip
24 ];
25 buildInputs = [
26 portaudio
27 wxGTK32
28 ];
29
30 # TODO:
31 # Uhm, seems like espeakedit still wants espeak-data/ in $HOME, even thought
32 # it should use $espeak/share/espeak-data. Have to contact upstream to get
33 # this fixed.
34 #
35 # Workaround:
36 # cp -r $(nix-build -A espeak)/share/espeak-data ~
37 # chmod +w ~/espeak-data
38
39 patches = [
40 ./gcc6.patch
41 ./espeakedit-fix-makefile.patch
42 ./espeakedit-configurable-sox-path.patch
43 ./espeakedit-configurable-path-espeak-data.patch
44 ./espeakedit-gcc6.patch
45 ./espeakedit-wxgtk30.patch
46 ];
47
48 postPatch = ''
49 # Disable -Wall flag because it's noisy
50 sed -i "s/-Wall//g" src/Makefile
51
52 # Fixup paths (file names from above espeak-configurable* patches)
53 for file in src/compiledata.cpp src/readclause.cpp src/speech.h; do
54 sed -e "s|@sox@|${sox}/bin/sox|" \
55 -e "s|@prefix@|$out|" \
56 -i "$file"
57 done
58 ''
59 + lib.optionalString (portaudio.api_version == 19) ''
60 cp src/portaudio19.h src/portaudio.h
61 '';
62
63 buildPhase = ''
64 make -C src
65 '';
66
67 installPhase = ''
68 mkdir -p "$out/bin"
69 cp src/espeakedit "$out/bin"
70 '';
71
72 meta = with lib; {
73 description = "Phoneme editor for espeak";
74 mainProgram = "espeakedit";
75 homepage = "https://espeak.sourceforge.net/";
76 license = licenses.gpl3Plus;
77 platforms = platforms.linux;
78 };
79}