summary refs log tree commit diff
path: root/pkgs/applications/audio/espeak/edit.nix
blob: 6bcffcbc5c3467916ba3c82cfe22b886b299def3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{ stdenv, fetchurl, pkgconfig, unzip, portaudio, wxGTK, sox }:

stdenv.mkDerivation rec {
  name = "espeakedit-1.48.03";

  src = fetchurl {
    url = "mirror://sourceforge/espeak/${name}.zip";
    sha256 = "0x8s7vpb7rw5x37yjzy1f98m4f2csdg89libb74fm36gn8ly0hli";
  };

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [ 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 = [
    ./gcc6.patch
    ./espeakedit-fix-makefile.patch
    ./espeakedit-configurable-sox-path.patch
    ./espeakedit-configurable-path-espeak-data.patch
    ./espeakedit-gcc6.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
  '';

  buildPhase = ''
    make -C src
  '';

  installPhase = ''
    mkdir -p "$out/bin"
    cp src/espeakedit "$out/bin"
  '';

  meta = with stdenv.lib; {
    description = "Phoneme editor for espeak";
    homepage = "http://espeak.sourceforge.net/";
    license = licenses.gpl3Plus;
    platforms = platforms.linux;
  };
}