festival: Prevent running ldconfig if not on system
[scm/bb/meta-tizen.git] / meta-tizen-common-base / recipes-extended / festival / festival.inc
1 DESCRIPTION = "A free speech synthesis and text-to-speech system"
2 HOMEPAGE = "http://www.cstr.ed.ac.uk/projects/festival/"
3 SECTION = "System/Libraries"
4 LICENSE = "MIT & GPL-2.0+ & TCL"
5 PV = "2.1"
6
7 SRC_URI = ""
8
9 S = "${WORKDIR}/git"
10
11 inherit manifest autotools-brokensep
12
13 BBCLASSEXTEND = ""
14 PROVIDES = ""
15
16 #PROVIDES by festival
17
18
19 #PROVIDES by festival-dev
20 PROVIDES += "festival-dev"
21
22
23 RDEPENDS = ""
24 #RDEPENDS of festival-dev (${PN}-dev)
25 RDEPENDS_${PN}-dev += "festival"
26
27
28 DEPENDS = ""
29 #DEPENDS of festival
30 DEPENDS += "ncurses"
31 inherit pkgconfig
32
33 do_prep() {
34  cd ${S}
35  #extracte source 1
36  CURDIR=$(pwd)
37  cd ${S}/../
38  tar -zxf ${S}/packaging/speech_tools-2.1-release.tar.gz
39  cd ${CURDIR}
40  #extracte source 2
41  CURDIR=$(pwd)
42  cd ${S}/../
43  tar -zxf ${S}/packaging/festlex_CMU.tar.gz
44  cd ${CURDIR}
45  #extracte source 3
46  CURDIR=$(pwd)
47  cd ${S}/../
48  tar -zxf ${S}/packaging/festvox_kallpc16k.tar.gz
49  cd ${CURDIR}
50  #extracte source 4
51  CURDIR=$(pwd)
52  cd ${S}/../
53  tar -zxf ${S}/packaging/festlex_POSLEX.tar.gz
54  cd ${CURDIR}
55  chmod -Rf a+rX,u+w,g-w,o-w ${S}
56  #setup -q -b 1 -b 2 -b 3 -b 4
57  mv ../festival/lib/* lib/
58  cat ${S}/packaging/festival-1.95-examples.patch | patch -s  -p1 --fuzz=2
59  #patch0 -p1
60  cat ${S}/packaging/festival-text2wave-manpage.patch | patch -s  -p1 --fuzz=2
61  #patch1 -p1
62  cat ${S}/packaging/festival-1.95-libdir.patch | patch -s  -p0 --fuzz=2
63  #patch2
64  cat ${S}/packaging/festival-1.95-audsp.patch | patch -s  -p0 --fuzz=2
65  #patch3
66  cat ${S}/packaging/festival-1.96-chroot.patch | patch -s  -p0 --fuzz=2
67  #patch4
68  cat ${S}/packaging/festival-no-LD_LIBRARY_PATH-extension.patch | patch -s  -p1 --fuzz=2
69  #patch5 -p1
70  cat ${S}/packaging/festival-safe-temp-file.patch | patch -s  -p1 --fuzz=2
71  #patch6 -p1
72  cat ${S}/packaging/festival-use-pacat.patch | patch -s  -p1 -b --suffix .use-pacat  --fuzz=2
73  #patch7 -p1 -b .use-pacat 
74  cd ../speech_tools
75  cat ${S}/packaging/speech_tools-undefined-operation.patch | patch -s  -p1 --fuzz=2
76  #patch101 -p1
77  cat ${S}/packaging/speech_tools-1.2.95-config.patch | patch -s  -p0 --fuzz=2
78  #patch102
79  cat ${S}/packaging/speech_tools-no-LD_LIBRARY_PATH-extension.patch | patch -s  -p1 --fuzz=2
80  #patch103 -p1
81  cat ${S}/packaging/speech_tools-gcc47.patch | patch -s  -p1 --fuzz=2
82  #patch104 -p1
83  cat ${S}/packaging/festival-1.96-speechtools-shared-build.patch | patch -s  -p2 -b --suffix .shared-build --fuzz=2
84  #patch200 -p2 -b .shared-build
85  cat ${S}/packaging/festival-1.96-bettersonamehack.patch | patch -s  -p2 -b --suffix .bettersoname --fuzz=2
86  #patch201 -p2 -b .bettersoname
87  cat ${S}/packaging/festival-1.96-main-speech_tools-shared-build.patch | patch -s  -p2 -b --suffix .shared --fuzz=2
88  #patch205 -p2 -b .shared
89  cd ../festival-2.1
90  cat ${S}/packaging/festival-1.96-main-festival-shared-build.patch | patch -s  -p1 -b --suffix .shared --fuzz=2
91  #patch206 -p1 -b .shared
92  cd ../speech_tools
93  cat ${S}/packaging/no-shared-data.patch | patch -s  -p1 -b --suffix .no-shared-data --fuzz=2
94  #patch210 -p1 -b .no-shared-data
95  cat ${S}/packaging/festival-1.96-speechtools-linklibswithotherlibs.patch | patch -s  -p1 -b --suffix .linklibswithotherlibs --fuzz=2
96  #patch211 -p1 -b .linklibswithotherlibs
97  
98  
99 }
100 do_patch_append() {
101     bb.build.exec_func('do_prep', d)
102 }
103
104 do_configure() {
105 }
106
107 do_compile() {
108  cd ${S}
109   LANG=C
110   export LANG
111   unset DISPLAY
112   LD_AS_NEEDED=1; export LD_AS_NEEDED ;
113   
114   # festival
115   
116   autotools_do_configure
117   
118   cd ..
119   export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/speech_tools/lib
120   export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/festival-2.1/src/lib
121   # speech tools
122   cd speech_tools
123   ./configure --host=${HOST_SYS} --prefix=${prefix}               --libdir=${prefix}/lib               --datadir=${prefix}/share/festival               --sysconfdir=${sysconfdir}
124   
125   oe_runmake CC="${CC} -fPIC $RPM_OPT_FLAGS" CXX="${CXX} $RPM_OPT_FLAGS -fPIC -Wno-non-template-friend -ffriend-injection -fno-strict-aliasing"
126   cd ../festival-2.1
127   oe_runmake CC="${CC} -fPIC $RPM_OPT_FLAGS" CXX="${CXX} $RPM_OPT_FLAGS -fPIC -Wno-non-template-friend -ffriend-injection -fno-strict-aliasing"
128   oe_runmake doc
129   
130   
131   
132   
133 }
134 EXTRA_OECONF += " --prefix=${prefix} --libdir=${prefix}/lib --datadir=${prefix}/share/festival --sysconfdir=${sysconfdir}"
135
136 do_install() {
137  export RPM_BUILD_ROOT=${D}
138  cd ${S}
139  LANG=C
140  export LANG
141  unset DISPLAY
142  rm -rf ${D}
143  mkdir -p ${D}
144  
145  cd ..
146  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/speech_tools/lib
147  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/festival-2.1/src/lib
148  cd -
149  #%make_install
150  #make INSTALLED_BIN=%{buildroot}%{_bindir} make_installed_bin_shared
151  cd ../speech_tools
152  
153    oe_runmake \
154          DESTDIR=${D} \
155          INSTALL_ROOT=${D} \
156          BINDIR=${prefix}/bin \
157    install  
158    rm -f ${D}${infodir}/dir 
159    find ${D} -regex ".*\.la$" | xargs rm -f -- 
160    find ${D} -regex ".*\.a$" | xargs rm -f --
161  cd ../festival-2.1
162  # install binarys
163  install -D bin/text2wave ${D}${prefix}/bin/text2wave
164  install -m 755 src/main/festival ${D}${prefix}/bin/
165  install -m 755 src/main/festival_client ${D}${prefix}/bin/
166  install -m 755 bin/festival_server* ${D}${prefix}/bin/
167  install -m 755 examples/saytime ${D}${prefix}/bin/
168  # install manpages
169  install -D -m 644 doc/festival.1 ${D}${mandir}/man1/festival.1
170  install -m 644 doc/festival_client.1 ${D}${mandir}/man1/
171  install -m 644 doc/text2wave.1 ${D}${mandir}/man1/
172  # install configs
173  install -D lib/festival.scm ${D}${sysconfdir}/festival.scm
174  # install dictionarys
175  install -D lib/dicts/cmu/cmudict-0.4.out ${D}${prefix}/share/festival/dicts/cmu/cmudict-0.4.out
176  install -m 644 lib/dicts/cmu/*.scm ${D}${prefix}/share/festival/dicts/cmu/
177  install -m 644 lib/dicts/wsj.wp39.poslexR ${D}${prefix}/share/festival/dicts/
178  install -m 644 lib/dicts/wsj.wp39.tri.ngrambin ${D}${prefix}/share/festival/dicts/
179  # install voices
180  mkdir -p ${D}${prefix}/share/festival/voices/english/kal_diphone/festvox
181  mkdir -p ${D}${prefix}/share/festival/voices/english/kal_diphone/group
182  cp lib/voices/english/kal_diphone/group/* ${D}${prefix}/share/festival/voices/english/kal_diphone/group/
183  cp lib/voices/english/kal_diphone/festvox/*.scm ${D}${prefix}/share/festival/voices/english/kal_diphone/festvox
184  # install data
185  cp lib/*.scm ${D}${prefix}/share/festival/
186  cp lib/*.ngrambin ${D}${prefix}/share/festival/
187  cp lib/*.gram ${D}${prefix}/share/festival/
188  cp lib/*.el ${D}${prefix}/share/festival/
189  install -D lib/etc/unknown_Linux/audsp ${D}${prefix}/lib/festival/audsp
190  # install libs
191  install -D src/lib/libFestival.so  ${D}${prefix}/lib/libFestival.so
192  # install includes
193  mkdir -p ${D}${prefix}/include/
194  install -m 644 src/include/*.h ${D}${prefix}/include/
195  cd ../speech_tools
196  # install includes
197  mkdir -p ${D}${prefix}/include/instantiate
198  mkdir -p ${D}${prefix}/include/ling_class
199  mkdir -p ${D}${prefix}/include/rxp
200  mkdir -p ${D}${prefix}/include/sigpr
201  mkdir -p ${D}${prefix}/include/unix
202  install -m 644 include/*h ${D}${prefix}/include
203  install -m 644 include/instantiate/*h ${D}${prefix}/include/instantiate
204  install -m 644 include/ling_class/*h ${D}${prefix}/include/ling_class
205  install -m 644 include/rxp/*h ${D}${prefix}/include/rxp
206  install -m 644 include/sigpr/*h ${D}${prefix}/include/sigpr
207  install -m 644 include/unix/*h ${D}${prefix}/include/unix
208  # make sure we have no static libs, install shared ones
209  install -m 644 lib/lib*.so* ${D}${prefix}/lib
210  rm -f ${D}${prefix}/lib/*.a
211  
212  # install init script
213  # install -m 755 -D %{S:6} %{buildroot}/etc/init.d/%name
214  # install -d %{buildroot}%_sbindir
215  # ln -sf ../../etc/init.d/%name %{buildroot}/usr/sbin/rc%name
216  # installl sysconfig file
217  #install -m 644 -D %{S:5} %{buildroot}/var/adm/fillup-templates/sysconfig.%name
218  
219  
220 }
221
222 pkg_postinst_${PN}() {
223     #!/bin/sh -e
224
225     [ "" != "$D" ] || ldconfig
226
227 }
228
229 pkg_postinst_${PN}() {
230     #!/bin/sh -e
231
232     [ "" != "$D" ] || ldconfig
233
234 }
235
236 pkg_postrm_${PN}() {
237     #!/bin/sh -e
238
239     [ "" != "$D" ] || ldconfig
240
241 }
242
243 pkg_postrm_${PN}() {
244     #!/bin/sh -e
245
246     [ "" != "$D" ] || ldconfig
247
248 }
249
250 PACKAGES = "${PN}-dbg ${PN}-doc ${PN}-locale"
251 PACKAGES += " festival "
252 PACKAGES += " festival-dev "
253
254 festival_files = ""
255 festival_files += "README INSTALL examples/*.text examples/ex1.* examples/*.scm examples/*.dtd"
256 festival_files += "${sysconfdir}/festival.scm"
257 festival_files += "${prefix}/bin/festival"
258 festival_files += "${prefix}/bin/festival_client"
259 festival_files += "${prefix}/bin/festival_server"
260 festival_files += "${prefix}/bin/festival_server_control"
261 festival_files += "${prefix}/bin/text2wave"
262 festival_files += "${prefix}/bin/saytime"
263 festival_files += "${prefix}/lib/libe*.so.*"
264 festival_files += "${prefix}/lib/libFestival.so"
265 festival_files += "${prefix}/lib/festival"
266 festival_files += "${prefix}/share/festival"
267 festival_files += "${mandir}/man1/*"
268
269 festival-dev_files = ""
270 festival-dev_files += "${prefix}/include/*"
271 festival-dev_files += "${prefix}/lib/libe*.so"
272
273 FILES_${PN} = "${festival_files}"
274 FILES_${PN}-dev = "${festival-dev_files}"
275
276 PKG_festival= "festival"
277 PKG_festival-dev= "festival-dev"
278
279 require festival-extraconf.inc
280