summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c56c4b42fbb760f971568e21aa2fa72a6532b064 (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# $Id: PKGBUILD 255136 2015-12-10 04:45:16Z foutrelis $
# Maintainer: Lubosz Sarnecki <lubosz@gmail.com>
# Contributor: netcrusher < tobias AT miglix DOT eu >
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Simo Leone <neotuli@gmail.com>

pkgname=festival-ims
pkgver=2.4
pkgrel=2
pkgdesc="Festival with german patches from IMS Stuttgart"
arch=(i686 x86_64)
url="http://www.cstr.ed.ac.uk/projects/festival/"
license=(BSD GPL custom)
depends=(perl alsa-lib)
options=('!makeflags')
conflicts=('festival')
replaces=('festival')
source=(http://www.cstr.ed.ac.uk/downloads/${pkgname}/${pkgver}/$pkgname-$pkgver-release.tar.gz
        http://www.cstr.ed.ac.uk/downloads/${pkgname}/${pkgver}/speech_tools-$pkgver-release.tar.gz
        http://www.cstr.ed.ac.uk/downloads/${pkgname}/${pkgver}/festlex_CMU.tar.gz
        http://www.cstr.ed.ac.uk/downloads/${pkgname}/${pkgver}/festlex_OALD.tar.gz
        http://www.cstr.ed.ac.uk/downloads/${pkgname}/${pkgver}/festlex_POSLEX.tar.gz
        speechconfig.patch
        festconfig.patch
	      festival-2.4-compat.patch
        festival-shared-build.patch
        festival-gcc47.patch
        # uni stuttgart
        http://www2.ims.uni-stuttgart.de/phonetik/synthesis/festival/os940053/bomp_full.corr.tgz
        http://www2.ims.uni-stuttgart.de/phonetik/synthesis/festival/os940053/ims_german_1.3-os.tgz)
md5sums=('49707d2f6744d5a67f81a96c36f7cb59'
         '3d60e563135363eb2548d947f7ef4e14'
         '6a2ee4fed7c3ebedf197a3b8524ccb87'
         '84af32a914d996f57bc4cb36fe8cdc97'
         'aa80f9250065b318325f16fdad3a4484'
         '5a57ae18d71ba66dfd960519b97f4b18'
         '6e088931b5279550b2aea4bf704bc42b'
         '3bae028f01ef1fa523511f2ae452f0aa'
         '9e0c5ce8c0bd5872c76d0570847f7668'
         '253f00f5e0b10d4e36c06c7cb500f37c'
         "SKIP"
         "SKIP")

prepare() {
  patch -Np0 -i speechconfig.patch
  patch -Np0 -i festconfig.patch

  # fix build with new gcc versions and build shared libs - taken from Mageia
  patch -Np0 -i festival-shared-build.patch
  patch -Np0 -i festival-gcc47.patch

  patch -Np0 -i festival-2.4-compat.patch
  
  # Avoid make failure on making scripts and docs
  sed -i "s#examples bin doc#examples#" festival/Makefile
  
    # add ims config
    sed -i 's/ALSO_INCLUDE +=$/# IMS module for German\nALSO_INCLUDE += ims_german_text/' "$srcdir/festival/config/config.in"
cat<<EOF >> "$srcdir/festival/lib/sitevars.scm"
(set! mbrola-path "/usr/share/mbrola/")
(set! mbrola_progname "/usr/bin/mbrola -e")
EOF
    echo "(require 'ims_german_opensource)" >> "$srcdir/festival/lib/siteinit.scm"
}

build() {
  # Build Speech Tools first
  cd speech_tools
  ./configure --prefix=/usr --sysconfdir=/etc
  make OPTIMISE_CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing" OPTIMISE_CCFLAGS="${CFLAGS} -fno-strict-aliasing"

  # Build Festival itself
  cd ../festival
  ./configure --prefix=/usr --sysconfdir=/etc
  make OPTIMISE_CXXFLAGS="${CXXFLAGS}" OPTIMISE_CCFLAGS="${CFLAGS}"
}

package() {
  # Install Speech Tools first
  cd speech_tools
  install -dm755 "$pkgdir"/usr/{bin,lib,include/speech_tools/{,instantiate,ling_class,rxp,sigpr,unix}}

  #binaries
  #move binaries over wrappers (FS#7864)
  for i in $(grep -l 'EST shared script' bin/*); do
    cp -f main/$(basename $i) bin;
  done
  install -m755 -t "$pkgdir"/usr/bin bin/[a-z]*
  rm -f "$pkgdir"/usr/bin/{est_gdb,est_examples,est_program}

  #libraries
  install -m755 -t "$pkgdir"/usr/lib lib/lib*.so.*
  ln -sf libestbase.so.${pkgver}.1 "$pkgdir"/usr/lib/libestbase.so
  ln -sf libestools.so.${pkgver}.1 "$pkgdir"/usr/lib/libestools.so
  ln -sf libeststring.so.1.2 "$pkgdir"/usr/lib/libeststring.so

  #headers
  for dir in {.,instantiate,ling_class,rxp,sigpr,unix}; do
    install -m644 -t "$pkgdir"/usr/include/speech_tools/$dir include/$dir/*.h
  done

  # Install Festival itself
  cd "$srcdir"/festival

  #binaries
  install -m755 src/main/festival "$pkgdir"/usr/bin/
  install -m755 src/main/festival_client "$pkgdir"/usr/bin/
  install -m755 examples/benchmark "$pkgdir"/usr/bin/
  install -m755 examples/dumpfeats "$pkgdir"/usr/bin/
  install -m755 examples/durmeanstd "$pkgdir"/usr/bin/
  install -m755 examples/latest "$pkgdir"/usr/bin/
  install -m755 examples/make_utts "$pkgdir"/usr/bin/
  install -m755 examples/powmeanstd "$pkgdir"/usr/bin/
  install -m755 examples/run-festival-script "$pkgdir"/usr/bin/
  install -m755 examples/saytime "$pkgdir"/usr/bin/
  install -m755 examples/scfg_parse_text "$pkgdir"/usr/bin/
  install -m755 examples/text2pos "$pkgdir"/usr/bin/
  install -m755 examples/text2wave "$pkgdir"/usr/bin

  #libraries
  install -m755 src/lib/libFestival.so.* "$pkgdir"/usr/lib/
  ln -sf libFestival.so.2.4.0 "$pkgdir"/usr/lib/libFestival.so

  #headers
  install -dm755 "$pkgdir"/usr/include/festival
  install -m644 -t "$pkgdir"/usr/include/festival src/include/*.h

  mkdir -p "$pkgdir"/usr/share/festival
  cp -aR lib/* "$pkgdir"/usr/share/festival
  rm -fv $(find "$pkgdir"/usr/share/festival -name Makefile)
  rm -fv $(find "$pkgdir"/usr/bin -name Makefile)

  #create voices directory
  install -dm755 "$pkgdir"/usr/share/festival/voices

  #licenses
  install -D -m644 "$srcdir"/festival/COPYING \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
  install -D -m644 "$srcdir"/speech_tools/README \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.other

  # Ok now some general cleanups
  for i in $(find "$pkgdir"/usr/include/ -type f); do
    sed -i -e 's,"EST.*\.h",\<speech_tools/&\>,g' -e 's,speech_tools/\",speech_tools/,g' \
      -e 's,"siod.*\.h",\<speech_tools/&\>,g' -e 's,speech_tools/\",speech_tools/,g' \
      -e 's,"instantiate/.*\.h",\<speech_tools/&\>,g' -e 's,speech_tools/instantiate/\",speech_tools/instantiate/,g' -e 's,"instantiate,instantiate,g' \
      -e 's,"ling_class/.*\.h",\<speech_tools/&\>,g' -e 's,speech_tools/ling_class/\",speech_tools/ling_class/,g' -e 's,"ling_class,ling_class,g' \
      -e 's,"rxp/.*\.h",\<speech_tools/&\>,g' -e 's,speech_tools/rxp/\",speech_tools/rxp/,g' -e 's,"rxp,rxp,g' \
      -e 's,"sigpr/.*\.h",\<speech_tools/&\>,g' -e 's,speech_tools/sigpr/\",speech_tools/sigpr/,g' -e 's,"sigpr,sigpr,g' \
      -e 's,"unix/.*\.h",\<speech_tools/&\>,g' -e 's,speech_tools/unix/\",speech_tools/unix/,g' -e 's,\.h\">,.h\>,g' -e 's,"unix,unix,g' \
      -e 's,"festival\.h",\<festival/festival.h\>,g' \
      -e 's,"ModuleDescription\.h",\<festival/ModuleDescription.h\>,g' \
      -e 's,"Phone\.h",\<festival/Phone.h\>,g' $i
  done
}