more unwinding of diffs
[debian/freetts] / build.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!-- ********************************************************** -->
4 <!-- *                                                        * -->
5 <!-- * Apache Ant build file used to build FreeTTS.  To build * -->
6 <!-- * everything, just type the following:                   * -->
7 <!-- *                                                        * -->
8 <!-- *     ant                                                * -->
9 <!-- *                                                        * -->
10 <!-- * For more information:  http://ant.apache.org/          * -->
11 <!-- *                                                        * -->
12 <!-- ********************************************************** -->
13 <project basedir="." default="all" name="FreeTTS">
14
15     <!-- ********************************************************** -->
16     <!-- *                                                        * -->
17     <!-- * Where to find things...                                * -->
18     <!-- *                                                        * -->
19     <!-- ********************************************************** -->
20     <property name="version" value="1.2.2" />
21     <path id="libs">
22         <fileset dir="lib" includes="**/jsapi.jar" />
23     </path>
24     <property name="src_dir" value="src" />
25     <property name="build_dir" value="bld" />
26     <property name="classes_dir" value="${build_dir}/classes" />
27     <property name="demo_classes_dir" value="${build_dir}/demo_classes" />
28     <property name="lib_dir" value="lib" />
29     <property name="mbrola_dir" value="mbrola" />
30     <property name="bin_dir" value="bin" />
31     <property name="javadoc_dir" value="javadoc" />
32     <property name="webstart_dir" value="${build_dir}/webstart" />
33     <property name="deploy_dir" value="deploy" />
34
35
36     <!-- ********************************************************** -->
37     <!-- *                                                        * -->
38     <!-- * Determine which sources should be compiled depending   * -->
39     <!-- * on the availability of lib/jsapi.jar.  This creates a  * -->
40     <!-- * property called "patternset_to_compile" and sets its   * -->
41     <!-- * val to either "all_files" or "no_jsapi", which refers  * -->
42     <!-- * to the name of a patternset. The value of              * -->
43     <!-- * srcs_to_compile will be used in the javac target as a  * -->
44     <!-- * patternset refid.                                      * -->
45     <!-- *                                                        * -->
46     <!-- ********************************************************** -->
47     <patternset id="all_files" includes="com/**,de/**" />
48
49     <patternset id="no_jsapi"
50                 includes="com/**,de/**"
51                 excludes="com/sun/speech/engine/**,
52                           com/sun/speech/freetts/jsapi/**" />
53
54     <target name="set_patternset_to_compile">
55         <condition property="patternset_to_compile" value="all_files">
56             <available file="lib/jsapi.jar" />
57         </condition>
58         <condition property="patternset_to_compile" value="no_jsapi">
59             <not>
60                 <available file="lib/jsapi.jar" />
61             </not>
62         </condition>
63     </target>
64
65     <!-- ********************************************************** -->
66     <!-- *                                                        * -->
67     <!-- * Handle JSAPI:                                          * -->
68     <!-- *                                                        * -->
69     <!-- *    1) If a jsapi.jar file can be found, use it and     * -->
70     <!-- *       compile all the sources.                         * -->
71     <!-- *                                                        * -->
72     <!-- *    2) If a jsapi.jar file cannot be found, issue a     * -->
73     <!-- *       message and just compile the sources that do     * -->
74     <!-- *       not depend upon jsapi.jar.                       * -->
75     <!-- *                                                        * -->
76     <!-- ********************************************************** -->
77     <target name="check_jsapi_jar.isPresent">
78         <available file="lib/jsapi.jar" property="jsapi_jar.isPresent" />
79     </target>
80
81     <target name="issue_jsapi_warning" unless="jsapi_jar.isPresent">
82         <echo>
83 Cannot find lib/jsapi.jar needed to build Java Speech API
84 (JSAPI) support for FreeTTS.  Will not build any sources
85 that require jsapi.jar.  If you'd like to enable JSAPI
86 support, please extract jsapi.jar by running jsapi.sh or 
87 jsapi.exe from the lib directory.
88         </echo>
89     </target>
90
91     <target name="handle_jsapi"
92             depends="check_jsapi_jar.isPresent,
93                      issue_jsapi_warning,
94                      set_patternset_to_compile" />
95
96
97     <!-- ********************************************************** -->
98     <!-- *                                                        * -->
99     <!-- * Builds srcs, voices, lexicons, jars, demos             * -->
100     <!-- *                                                        * -->
101     <!-- ********************************************************** -->
102     <target name="all"
103             depends="compile,jars,demos"
104             description="Build everything">
105         <echo message="Build complete." />
106     </target>
107
108
109     <!-- compile everything -->
110     <target name="compile"
111             depends="compile_src,compile_voices,compile_lexicons"
112             description="Build srcs, voices, and lexicons" />
113
114
115     <!-- ********************************************************** -->
116     <!-- *                                                        * -->
117     <!-- * Builds just the srcs.  The tests are omitted.          * -->
118     <!-- *                                                        * -->
119     <!-- ********************************************************** -->
120     <target name="compile_src"
121             depends="check_jsapi_jar.isPresent,
122                      issue_jsapi_warning,
123                      set_patternset_to_compile"
124             description="Build just the srcs">
125         <mkdir dir="${classes_dir}" />
126         <javac debug="true"
127                source="1.4"
128                deprecation="true"
129                srcdir="${src_dir}"
130                excludes="tests/**"
131                destdir="${classes_dir}">
132             <patternset refid="${patternset_to_compile}" />
133             <classpath refid="libs" />
134         </javac>
135     </target>
136
137
138     <!-- ********************************************************** -->
139     <!-- *                                                        * -->
140     <!-- * Builds just the tests - these need JUnit.              * -->
141     <!-- *                                                        * -->
142     <!-- ********************************************************** -->
143     <target name="compile_tests"
144             depends="compile"
145             description="Build just the tests">
146         <mkdir dir="${classes_dir}" />
147         <javac debug="true"
148                source="1.4"
149                deprecation="true"
150                srcdir="${src_dir}"
151                includes="tests/**"
152                destdir="${classes_dir}">
153             <classpath refid="libs" />
154         </javac>
155     </target>
156
157
158     <!-- ********************************************************** -->
159     <!-- *                                                        * -->
160     <!-- * Generates the binaries for the voices.                 * -->
161     <!-- *                                                        * -->
162     <!-- ********************************************************** -->
163     <target name="compile_voices"
164             depends="kal8_db,kal16_db,time_awb_db,user_voice_db"
165             description="Generate all of the voice binaries">
166     </target>
167
168
169     <!-- kal8 -->
170     <property name="kal8_data" value="cmu_us_kal.txt" />
171     <property name="kal8_path"
172               value="com/sun/speech/freetts/en/us/cmu_us_kal" />
173     <target name="check_kal8_db.isUpToDate"
174             description="Compares timestamps of kal8 ASCII and binary">
175         <uptodate property="kal8_db.isUpToDate"
176                   srcfile="${src_dir}/${kal8_path}/${kal8_data}"
177                   targetfile="${classes_dir}/${kal8_path}/cmu_us_kal.bin" />
178     </target>
179
180     <target name="kal8_db"
181             depends="compile_src,check_kal8_db.isUpToDate"
182             unless="kal8_db.isUpToDate"
183             description="Generate kal8 voice binaries">
184         <java classname="com.sun.speech.freetts.diphone.DiphoneUnitDatabase"
185               failonerror="true"
186               fork="true">
187             <classpath>
188                 <path refid="libs" />
189                 <pathelement location="${classes_dir}" />
190             </classpath>
191             <arg line="-src ${src_dir}/${kal8_path}" />
192             <arg line="-dest ${classes_dir}/${kal8_path}" />
193             <arg line="-generate_binary ${kal8_data}" />
194         </java>
195     </target>
196
197     <!-- kal16 -->
198     <property name="kal16_data" value="cmu_us_kal16.txt" />
199     <property name="kal16_path"
200               value="com/sun/speech/freetts/en/us/cmu_us_kal" />
201     <target name="check_kal16_db.isUpToDate"
202             description="Compares timestamps of kal16 ASCII and binary">
203         <uptodate property="kal16_db.isUpToDate"
204                   srcfile="${src_dir}/${kal16_path}/${kal16_data}"
205                   targetfile="${classes_dir}/${kal16_path}/cmu_us_kal16.bin" />
206     </target>
207
208     <target name="kal16_db"
209             depends="compile_src,check_kal16_db.isUpToDate"
210             unless="kal16_db.isUpToDate"
211             description="Generate kal16 binaries">
212         <java classname="com.sun.speech.freetts.diphone.DiphoneUnitDatabase"
213               failonerror="true"
214               fork="true">
215             <classpath>
216                 <path refid="libs" />
217                 <pathelement location="${classes_dir}" />
218             </classpath>
219             <arg line="-src ${src_dir}/${kal16_path}" />
220             <arg line="-dest ${classes_dir}/${kal16_path}" />
221             <arg line="-generate_binary ${kal16_data}" />
222         </java>
223     </target>
224
225     <!-- time_awb -->
226     <property name="time_awb_data" value="cmu_time_awb.txt" />
227     <property name="time_awb_path"
228               value="com/sun/speech/freetts/en/us/cmu_time_awb" />
229     <target name="check_time_awb_db.isUpToDate"
230             description="Compares timestamps of time_awb ASCII and binary">
231         <uptodate property="time_awb_db.isUpToDate"
232                   srcfile="${src_dir}/${time_awb_path}/${time_awb_data}"
233                   targetfile="${classes_dir}/${time_awb_path}/cmu_time_awb.bin" />
234     </target>
235
236     <target name="time_awb_db"
237             depends="compile_src,check_time_awb_db.isUpToDate"
238             unless="time_awb_db.isUpToDate"
239             description="Generate time_awb binaries">
240         <java classname="com.sun.speech.freetts.clunits.ClusterUnitDatabase"
241               failonerror="true"
242               fork="true">
243             <classpath>
244                 <path refid="libs" />
245                 <pathelement location="${classes_dir}" />
246             </classpath>
247             <arg line="-src ${src_dir}/${time_awb_path}" />
248             <arg line="-dest ${classes_dir}/${time_awb_path}" />
249             <arg line="-generate_binary ${time_awb_data}" />
250         </java>
251     </target>
252
253
254     <!-- ********************************************************** -->
255     <!-- *                                                        * -->
256     <!-- * User defined voices (e.g., those created by the        * -->
257     <!-- * FestVoxToFreeTTS tool) can be compiled by running      * -->
258     <!-- * ant with the -D parameter to define either the         * -->
259     <!-- * 'clunit_voice' or 'diphone_voice' property:            * -->
260     <!-- *                                                        * -->
261     <!-- *     -Darctic_voice=cmu_us_bdl_arctic                   * -->
262     <!-- *     -Dclunit_voice=sun_time_wdw                        * -->
263     <!-- *     -Ddiphone_voice=sun_us_wdw                         * -->
264     <!-- *                                                        * -->
265     <!-- * If the voice is to be created at a custom path         * -->
266     <!-- * (e.g., for non-us-English voices), the following       * -->
267     <!-- * property can OPTIONALLY be set:                        * -->
268     <!-- *                                                        * -->
269     <!-- *     -Duser_voice_base_path=de/dfki/lt/freetts/de       * -->
270     <!-- *                                                        * -->
271     <!-- ********************************************************** -->
272     <target name="set_user_voice_to_clunit_voice" if="clunit_voice">
273         <property name="user_voice" value="${clunit_voice}" />
274     </target>
275     <target name="set_user_voice_to_diphone_voice" if="diphone_voice">
276         <property name="user_voice" value="${diphone_voice}" />
277     </target>
278     <target name="set_user_voice"
279             depends="set_user_voice_to_clunit_voice,
280                      set_user_voice_to_diphone_voice">
281         <property name="user_voice_base_path"
282                   value="com/sun/speech/freetts/en/us" />
283         <property name="user_voice_path"
284                   value="${user_voice_base_path}/${user_voice}" />
285     </target>
286
287     <target name="check_user_voice_db.isUpToDate"
288             depends="set_user_voice"
289             description="Compares timestamps of user voice ASCII and binary">
290         <uptodate property="user_voice_db.isUpToDate"
291                   srcfile="${src_dir}/${user_voice_path}/${user_voice}.txt"
292                   targetfile="${classes_dir}/${user_voice_path}/${user_voice}.bin" />
293     </target>
294
295     <target name="user_voice_db"
296             depends="set_user_voice,
297                      clunit_voice_db,
298                      diphone_voice_db"
299             if="user_voice"
300             description="Generate user voice binaries" />
301
302     <target name="clunit_voice_db"
303             depends="compile_src,check_user_voice_db.isUpToDate"
304             if="clunit_voice"
305             unless="user_voice_db.isUpToDate"
306             description="Generate user voice binaries">
307         <java classname="com.sun.speech.freetts.clunits.ClusterUnitDatabase"
308               failonerror="true"
309               fork="true">
310             <classpath>
311                 <path refid="libs" />
312                 <pathelement location="${classes_dir}" />
313             </classpath>
314             <arg line="-src ${src_dir}/${user_voice_path}" />
315             <arg line="-dest ${classes_dir}/${user_voice_path}" />
316             <arg line="-generate_binary ${user_voice}.txt" />
317         </java>
318         <copy todir="${classes_dir}/${user_voice_path}" failonerror="false">
319             <fileset dir="${src_dir}/${user_voice_path}"
320                      includes="phoneset.txt ${user_voice}.debug" />
321         </copy>
322     </target>
323
324     <target name="diphone_voice_db"
325             depends="compile_src,check_user_voice_db.isUpToDate"
326             if="diphone_voice"
327             unless="user_voice_db.isUpToDate"
328             description="Generate user voice binaries">
329         <java classname="com.sun.speech.freetts.diphone.DiphoneUnitDatabase"
330               failonerror="true"
331               fork="true">
332             <classpath>
333                 <path refid="libs" />
334                 <pathelement location="${classes_dir}" />
335             </classpath>
336             <arg line="-src ${src_dir}/${user_voice_path}" />
337             <arg line="-dest ${classes_dir}/${user_voice_path}" />
338             <arg line="-generate_binary ${user_voice}.txt" />
339         </java>
340     </target>
341
342
343     <!-- ********************************************************** -->
344     <!-- *                                                        * -->
345     <!-- * Generate the binaries for the lexicons                 * -->
346     <!-- *                                                        * -->
347     <!-- ********************************************************** -->
348     <target name="compile_lexicons"
349             depends="cmulex_db,cmudict04_db,cmutimelex_db"
350             description="Generate cmulex, cmudict04, and cmutimelex binaries">
351     </target>
352
353     <!-- cmulex -->
354     <property name="cmulex_data" value="cmulex" />
355     <property name="cmulex_path" value="com/sun/speech/freetts/en/us" />
356
357     <!-- The *_{compiled,addenda}.bin files are created at once.
358          So, if any of the *.txt files are newer than one of these
359          files (I chose *_compiled.bin), then recreate the *.bin files.
360     -->
361     <target name="check_cmulex_db.isUpToDate"
362             description="Compares timestamps of cmulex ASCII and binary">
363         <uptodate property="cmulex_db.isUpToDate"
364                   targetfile="${classes_dir}/${cmulex_path}/${cmulex_data}_compiled.bin">
365             <srcfiles dir="${src_dir}/${cmulex_path}"
366                       includes="${cmulex_data}_*.txt" />
367         </uptodate>
368     </target>
369
370     <target name="cmulex_db"
371             depends="compile_src,
372                      check_cmulex_db.isUpToDate,
373                      cmulex_lts_db"
374             unless="cmulex_db.isUpToDate"
375             description="Generate cmulex compiled and addenda binaries">
376         <java classname="com.sun.speech.freetts.en.us.CMULexicon"
377               failonerror="true"
378               fork="true">
379             <classpath>
380                 <path refid="libs" />
381                 <pathelement location="${classes_dir}" />
382             </classpath>
383             <arg line="-src ${src_dir}/${cmulex_path}" />
384             <arg line="-dest ${classes_dir}/${cmulex_path}" />
385             <arg line="-name ${cmulex_data}" />
386             <arg line="-generate_binary" />
387         </java>
388     </target>
389
390
391     <target name="check_cmulex_lts_db.isUpToDate"
392             description="Compares timestamps of cmulex_lts ASCII and binary">
393         <uptodate property="cmulex_lts_db.isUpToDate"
394                   srcfile="${src_dir}/${cmulex_path}/${cmulex_data}_lts.txt"
395                   targetfile="${classes_dir}/${cmulex_path}/${cmulex_data}_lts.bin" />
396     </target>
397
398     <target name="cmulex_lts_db"
399             depends="compile_src,check_cmulex_lts_db.isUpToDate"
400             unless="cmulex_lts_db.isUpToDate"
401             description="Generate cmulex lts binary">
402         <java classname="com.sun.speech.freetts.lexicon.LetterToSoundImpl"
403               failonerror="true"
404               fork="true">
405             <classpath>
406                 <path refid="libs" />
407                 <pathelement location="${classes_dir}" />
408             </classpath>
409             <arg line="-src ${src_dir}/${cmulex_path}" />
410             <arg line="-dest ${classes_dir}/${cmulex_path}" />
411             <arg line="-name ${cmulex_data}_lts" />
412             <arg line="-generate_binary" />
413         </java>
414     </target>
415
416
417     <!-- cmudict04 -->
418     <property name="cmudict04_data" value="cmudict04" />
419     <property name="cmudict04_path" value="com/sun/speech/freetts/en/us" />
420
421     <!-- The *_{compiled,addenda}.bin files are created at once.
422          So, if any of the *.txt files are newer than one of these
423          files (I chose *_compiled.bin), then recreate the *.bin files.
424     -->
425     <target name="check_cmudict04_db.isUpToDate"
426             description="Compares timestamps of cmudict04 ASCII and binary">
427         <uptodate property="cmudict04_db.isUpToDate"
428                   targetfile="${classes_dir}/${cmudict04_path}/${cmudict04_data}_compiled.bin">
429             <srcfiles dir="${src_dir}/${cmudict04_path}"
430                       includes="${cmudict04_data}_*.txt" />
431         </uptodate>
432     </target>
433
434     <target name="cmudict04_db"
435             depends="compile_src,
436                      check_cmudict04_db.isUpToDate,
437                      cmudict04_lts_db"
438             unless="cmudict04_db.isUpToDate"
439             description="Generate cmudict04 compiled and addenda binaries">
440         <java classname="com.sun.speech.freetts.en.us.CMULexicon"
441               failonerror="true"
442               fork="true">
443             <classpath>
444                 <path refid="libs" />
445                 <pathelement location="${classes_dir}" />
446             </classpath>
447             <arg line="-src ${src_dir}/${cmudict04_path}" />
448             <arg line="-dest ${classes_dir}/${cmudict04_path}" />
449             <arg line="-name ${cmudict04_data}" />
450             <arg line="-generate_binary" />
451         </java>
452     </target>
453
454
455     <target name="check_cmudict04_lts_db.isUpToDate"
456             description="Compares timestamps of cmudict04_lts ASCII and binary">
457         <uptodate property="cmudict04_lts_db.isUpToDate"
458                   srcfile="${src_dir}/${cmudict04_path}/${cmudict04_data}_lts.txt"
459                   targetfile="${classes_dir}/${cmudict04_path}/${cmudict04_data}_lts.bin" />
460     </target>
461
462     <target name="cmudict04_lts_db"
463             depends="compile_src,check_cmudict04_lts_db.isUpToDate"
464             unless="cmudict04_lts_db.isUpToDate"
465             description="Generate cmudict04 lts binary">
466         <java classname="com.sun.speech.freetts.lexicon.LetterToSoundImpl"
467               failonerror="true"
468               fork="true">
469             <classpath>
470                 <path refid="libs" />
471                 <pathelement location="${classes_dir}" />
472             </classpath>
473             <arg line="-src ${src_dir}/${cmudict04_path}" />
474             <arg line="-dest ${classes_dir}/${cmudict04_path}" />
475             <arg line="-name ${cmudict04_data}_lts" />
476             <arg line="-generate_binary" />
477         </java>
478     </target>
479
480
481     <!-- cmulextime -->
482     <property name="cmutimelex_data" value="cmutimelex" />
483     <property name="cmutimelex_path" value="com/sun/speech/freetts/en/us" />
484
485     <!-- The *_{compiled,addenda}.bin files are created at once.
486          So, if any of the *.txt files are newer than one of these
487          files (I chose *_compiled.bin), then recreate the *.bin files.
488     -->
489     <target name="check_cmutimelex_db.isUpToDate"
490             description="Compares timestamps of cmulextime ASCII and binary">
491         <uptodate property="cmutimelex_db.isUpToDate"
492                   targetfile="${classes_dir}/${cmutimelex_path}/${cmutimelex_data}_compiled.bin">
493             <srcfiles dir="${src_dir}/${cmutimelex_path}"
494                       includes="${cmutimelex_data}_*.txt" />
495         </uptodate>
496     </target>
497
498     <target name="cmutimelex_db"
499             depends="compile_src,
500                      check_cmutimelex_db.isUpToDate,
501                      cmutimelex_lts_db"
502             unless="cmutimelex_db.isUpToDate"
503             description="Generate cmutimelex compiled and addenda binaries">
504         <java classname="com.sun.speech.freetts.en.us.CMULexicon"
505               failonerror="true"
506               fork="true">
507             <classpath>
508                 <path refid="libs" />
509                 <pathelement location="${classes_dir}" />
510             </classpath>
511             <arg line="-src ${src_dir}/${cmutimelex_path}" />
512             <arg line="-dest ${classes_dir}/${cmutimelex_path}" />
513             <arg line="-name ${cmutimelex_data}" />
514             <arg line="-generate_binary" />
515         </java>
516     </target>
517
518
519     <target name="check_cmutimelex_lts_db.isUpToDate"
520             description="Compares timestamps of cmulextime_lts ASCII and binary">
521         <uptodate property="cmutimelex_lts_db.isUpToDate"
522                   srcfile="${src_dir}/${cmutimelex_path}/${cmutimelex_data}_lts.txt"
523                   targetfile="${classes_dir}/${cmutimelex_path}/${cmutimelex_data}_lts.bin" />
524     </target>
525
526     <target name="cmutimelex_lts_db"
527             depends="compile_src,check_cmutimelex_lts_db.isUpToDate"
528             unless="cmutimelex_lts_db.isUpToDate"
529             description="Generate cmutimelex lts binary">
530         <java classname="com.sun.speech.freetts.lexicon.LetterToSoundImpl"
531               failonerror="true"
532               fork="true">
533             <classpath>
534                 <path refid="libs" />
535                 <pathelement location="${classes_dir}" />
536             </classpath>
537             <arg line="-src ${src_dir}/${cmutimelex_path}" />
538             <arg line="-dest ${classes_dir}/${cmutimelex_path}" />
539             <arg line="-name ${cmutimelex_data}_lts" />
540             <arg line="-generate_binary" />
541         </java>
542     </target>
543
544
545     <!-- German dummy lexicon -->
546     <!-- As this is only a dummy at the moment, it is not added -->
547     <!-- to the general compile_lexicons targert -->
548     <property name="germanlex_data" value="germanlex" />
549     <property name="germanlex_path" value="de/dfki/lt/freetts/de" />
550
551     <!-- The *_{compiled,addenda}.bin files are created at once.
552          So, if any of the *.txt files are newer than one of these
553          files (I chose *_compiled.bin), then recreate the *.bin files.
554     -->
555     <target name="check_germanlex_db.isUpToDate"
556             description="Compares timestamps of ASCII and binary">
557         <uptodate property="germanlex_db.isUpToDate"
558                   targetfile="${classes_dir}/${germanlex_path}/${germanlex_data}_compiled.bin">
559             <srcfiles dir="${src_dir}/${germanlex_path}"
560                       includes="${germanlex_data}_*.txt" />
561         </uptodate>
562     </target>
563
564     <target name="germanlex_db"
565             depends="compile_src,
566                      check_germanlex_db.isUpToDate,
567                      germanlex_lts_db"
568             unless="germanlex_db.isUpToDate"
569             description="Generate compiled and addenda binaries">
570         <java classname="de.dfki.lt.freetts.de.GermanLexicon"
571               failonerror="true"
572               fork="true">
573             <classpath>
574                 <path refid="libs" />
575                 <pathelement location="${classes_dir}" />
576             </classpath>
577             <arg line="-src ${src_dir}/${germanlex_path}" />
578             <arg line="-dest ${classes_dir}/${germanlex_path}" />
579             <arg line="-name ${germanlex_data}" />
580             <arg line="-generate_binary" />
581         </java>
582     </target>
583
584
585     <target name="check_germanlex_lts_db.isUpToDate"
586             description="Compares timestamps of germanlex_lts ASCII and binary">
587         <uptodate property="germanlex_lts_db.isUpToDate"
588                   srcfile="${src_dir}/${germanlex_path}/${germanlex_data}_lts.txt"
589                   targetfile="${classes_dir}/${germanlex_path}/${germanlex_data}_lts.bin" />
590     </target>
591
592     <target name="germanlex_lts_db"
593             depends="compile_src,check_germanlex_lts_db.isUpToDate"
594             unless="germanlex_lts_db.isUpToDate"
595             description="Generate germanlex lts binary">
596         <java classname="com.sun.speech.freetts.lexicon.LetterToSoundImpl"
597               failonerror="true"
598               fork="true">
599             <classpath>
600                 <path refid="libs" />
601                 <pathelement location="${classes_dir}" />
602             </classpath>
603             <arg line="-src ${src_dir}/${germanlex_path}" />
604             <arg line="-dest ${classes_dir}/${germanlex_path}" />
605             <arg line="-name ${germanlex_data}_lts" />
606             <arg line="-generate_binary" />
607         </java>
608     </target>
609
610
611     <!-- ********************************************************** -->
612     <!-- *                                                        * -->
613     <!-- * Generates the jar files.                               * -->
614     <!-- *                                                        * -->
615     <!-- ********************************************************** -->
616     <target name="jars"
617             depends="freetts_jar,
618                      mbrola_jar,
619                      en_us_jar,
620                      cmulex_jar,
621                      cmudict04_jar,
622                      cmutimelex_jar,
623                      cmu_us_kal_jar,
624                      cmu_time_awb_jar,
625                      arctic_voice_jar,
626                      user_voice_jar"
627             description="Builds all the jar files" />
628
629     <!-- freetts.jar -->
630     <property name="freetts__jsapi10_jar"\r
631               value="${lib_dir}/freetts-jsapi10.jar" />\r
632     <property name="freetts_jar" value="${lib_dir}/freetts.jar" />
633 \r
634     <target name="-freetts_jsapi10_jar" depends="compile_src">\r
635         <mkdir dir="${lib_dir}" />\r
636         <jar destfile="${freetts__jsapi10_jar}" compress="true">\r
637             <manifest>\r
638                 <attribute name="Built-By" value="${user.name}" />\r
639                 <section name="common">\r
640                   <attribute name="Implementation-Title"\r
641                       value="FreeTTS JSAPI 1.0 layer" />\r
642                 </section>\r
643             </manifest>\r
644             <fileset dir="${classes_dir}">\r
645                 <include name="com/sun/speech/engine/**"/>\r
646                 <include name="com/sun/speech/freetts/jsapi/**"/>\r
647             </fileset>\r
648         </jar>\r
649     </target>\r
650 \r
651     <target name="freetts_jar"
652             depends="-freetts_jsapi10_jar,compile_src"
653             description="Create ${lib_dir}/freetts.jar">
654         <mkdir dir="${lib_dir}" />
655         <jar destfile="${freetts_jar}" compress="true">\r
656             <manifest>\r
657                 <attribute name="Built-By" value="${user.name}" />\r
658                 <attribute name="Main-Class"\r
659                       value="com.sun.speech.freetts.FreeTTS" />\r
660                 <section name="common">\r
661                   <attribute name="Implementation-Title"\r
662                       value="FreeTTS core library" />\r
663                 </section>\r
664             </manifest>\r
665             <fileset dir="${classes_dir}">\r
666                 <include name="com/sun/speech/freetts/**"/>\r
667                 <exclude name="com/sun/speech/freetts/en/**"/>\r
668                 <exclude name="com/sun/speech/freetts/jsapi/**"/>\r
669                 <include name="de/dfki/lt/freetts/**"/>\r
670                 <exclude name="de/dfki/lt/freetts/en/**"/>\r
671                 <exclude name="de/dfki/lt/freetts/de/**"/>\r
672                 <exclude name="de/dfki/lt/mbrola/**"/>\r
673                 <exclude name="tests/**"/>\r
674                 <exclude name="**/*.bin"/>\r
675                 <exclude name="**/*.idx"/>\r
676             </fileset>\r
677             <fileset dir="${src_dir}">\r
678                 <include name="com/sun/speech/freetts/internal_voices.txt"/>\r
679             </fileset>
680         </jar>
681     </target>
682
683
684     <!-- mbrola.jar -->
685     <property name="mbrola_jar" value="${mbrola_dir}/mbrola.jar" />
686
687     <target name="mbrola_jar"
688             depends="compile_src"
689             description="Create ${mbrola_dir}/mbrola.jar">
690         <mkdir dir="${mbrola_dir}" />
691         <jar destfile="${mbrola_jar}"
692              manifest="${src_dir}/de/dfki/lt/freetts/en/us/Manifest"
693              compress="true">
694             <fileset dir="${classes_dir}"
695                      includes="de/dfki/lt/freetts/mbrola/**,
696                           de/dfki/lt/freetts/en/us//**" />
697         </jar>
698     </target>
699
700
701     <!-- en_us.jar -->
702     <property name="en_us_jar" value="${lib_dir}/en_us.jar" />
703
704     <target name="en_us_jar"
705             depends="compile_src"
706             description="Create ${lib_dir}/en_us.jar">
707         <mkdir dir="${lib_dir}" />
708         <jar destfile="${en_us_jar}"
709              manifest="${src_dir}/com/sun/speech/freetts/en/us/en_us.Manifest"
710              filesonly="true"
711              compress="true">
712             <fileset dir="${classes_dir}"
713                      includes="com/sun/speech/freetts/en/*.class,
714                           com/sun/speech/freetts/en/us/*.class" />
715             <fileset dir="${src_dir}"
716                      includes="com/sun/speech/freetts/en/us/*.txt"
717                      excludes="**/cmu*lex*.txt" />
718         </jar>
719     </target>
720
721     <!-- de.jar -->
722     <!-- As this is only a dummy at the moment, it is not added -->
723     <!-- to the general jars target -->
724     <property name="de_jar" value="${lib_dir}/de.jar" />
725
726     <target name="de_jar"
727             depends="compile_src"
728             description="Create ${lib_dir}/de.jar">
729         <mkdir dir="${lib_dir}" />
730         <jar destfile="${de_jar}"
731              manifest="${src_dir}/de/dfki/lt/freetts/de/de.Manifest"
732              filesonly="true"
733              compress="true">
734             <fileset dir="${classes_dir}"
735                      includes="de/dfki/lt/freetts/de/*.class" />
736             <fileset dir="${src_dir}"
737                      includes="de/dfki/lt/freetts/de/*.txt"
738                      excludes="**/*lex*.txt" />
739         </jar>
740     </target>
741
742
743     <!-- cmulex.jar -->
744     <property name="cmulex_jar" value="${lib_dir}/cmulex.jar" />
745
746     <target name="cmulex_jar"
747             depends="compile_lexicons"
748             description="Create ${lib_dir}/cmulex.jar">
749         <mkdir dir="${lib_dir}" />
750         <jar destfile="${cmulex_jar}"
751              manifest="${src_dir}/com/sun/speech/freetts/en/us/cmulex.Manifest"
752              filesonly="true"
753              compress="true">
754             <fileset dir="${classes_dir}"
755                      includes="com/sun/speech/freetts/en/us/cmulex_*.bin" />
756         </jar>
757     </target>
758
759
760     <!-- cmudict04.jar -->
761     <property name="cmudict04_jar" value="${lib_dir}/cmudict04.jar" />
762
763     <target name="cmudict04_jar"
764             depends="compile_lexicons"
765             description="Create ${lib_dir}/cmudict04.jar">
766         <mkdir dir="${lib_dir}" />
767         <jar destfile="${cmudict04_jar}"
768              manifest="${src_dir}/com/sun/speech/freetts/en/us/cmudict04.Manifest"
769              filesonly="true"
770              compress="true">
771             <fileset dir="${classes_dir}"
772                      includes="com/sun/speech/freetts/en/us/cmudict04_*.bin" />
773         </jar>
774     </target>
775
776
777     <!-- cmutimelex.jar -->
778     <property name="cmutimelex_jar" value="${lib_dir}/cmutimelex.jar" />
779
780     <target name="cmutimelex_jar"
781             depends="compile_lexicons"
782             description="Create ${lib_dir}/cmutimelex.jar">
783         <mkdir dir="${lib_dir}" />
784         <jar destfile="${cmutimelex_jar}"
785              manifest="${src_dir}/com/sun/speech/freetts/en/us/cmutimelex.Manifest"
786              filesonly="true"
787              compress="true">
788             <fileset dir="${classes_dir}"
789                      includes="com/sun/speech/freetts/en/us/cmutimelex_*.bin" />
790
791         </jar>
792     </target>
793
794
795     <!-- germanlex.jar -->
796     <!-- As this is only a dummy at the moment, it is not added -->
797     <!-- to the general jars target -->
798     <property name="germanlex_jar" value="${lib_dir}/germanlex.jar" />
799
800     <target name="germanlex_jar"
801             depends="germanlex_db"
802             description="Create ${lib_dir}/germanlex.jar">
803         <mkdir dir="${lib_dir}" />
804         <jar destfile="${germanlex_jar}"
805              manifest="${src_dir}/de/dfki/lt/freetts/de/germanlex.Manifest"
806              filesonly="true"
807              compress="true">
808             <fileset dir="${classes_dir}"
809                      includes="de/dfki/lt/freetts/de/germanlex_*.bin" />
810         </jar>
811     </target>
812
813
814     <!-- cmu_us_kal.jar -->
815     <property name="cmu_us_kal_jar" value="${lib_dir}/cmu_us_kal.jar" />
816
817     <target name="cmu_us_kal_jar"
818             depends="compile_voices"
819             description="Create ${lib_dir}/cmu_us_kal.jar">
820         <mkdir dir="${lib_dir}" />
821         <jar destfile="${cmu_us_kal_jar}"
822              manifest="${src_dir}/com/sun/speech/freetts/en/us/cmu_us_kal/voice.Manifest"
823              filesonly="true"
824              compress="true">
825             <fileset dir="${classes_dir}"
826                      includes="com/sun/speech/freetts/en/us/cmu_us_kal/*" />
827         </jar>
828     </target>
829
830
831     <!-- cmu_time_awb.jar -->
832     <property name="cmu_time_awb_jar" value="${lib_dir}/cmu_time_awb.jar" />
833
834     <target name="cmu_time_awb_jar"
835             depends="compile_voices"
836             description="Create ${lib_dir}/cmu_time_awb.jar">
837         <mkdir dir="${lib_dir}" />
838         <jar destfile="${cmu_time_awb_jar}"
839              manifest="${src_dir}/com/sun/speech/freetts/en/us/cmu_time_awb/voice.Manifest"
840              filesonly="true"
841              compress="true">
842             <fileset dir="${classes_dir}"
843                      includes="com/sun/speech/freetts/en/us/cmu_time_awb/*" />
844         </jar>
845     </target>
846
847
848     <!-- arctic voice -->
849     <target name="arctic_voice_jar"
850             depends="compile"
851             if="arctic_voice"
852             description="Create ${lib_dir}/${arctic_voice}.jar">
853         <mkdir dir="${lib_dir}" />
854         <jar destfile="${lib_dir}/${arctic_voice}.jar"
855              manifest="${src_dir}/com/sun/speech/freetts/en/us/${arctic_voice}/voice.Manifest"
856              filesonly="true"
857              compress="true">
858             <fileset dir="${classes_dir}"
859                      includes="com/sun/speech/freetts/en/us/${arctic_voice}/*" />
860             <fileset dir="${src_dir}"
861                      includes="com/sun/speech/freetts/en/us/${arctic_voice}/*.txt" />
862         </jar>
863     </target>
864
865     <!-- user voice -->
866     <target name="user_voice_jar"
867             depends="compile_voices"
868             if="user_voice"
869             description="Create ${lib_dir}/${user_voice}.jar">
870         <mkdir dir="${lib_dir}" />
871         <jar destfile="${lib_dir}/${user_voice}.jar"
872              manifest="${src_dir}/${user_voice_path}/voice.Manifest"
873              filesonly="true"
874              compress="true">
875             <fileset dir="${classes_dir}" includes="${user_voice_path}/*" />
876         </jar>
877     </target>
878
879
880     <!-- ********************************************************** -->
881     <!-- *                                                        * -->
882     <!-- * Generates the javadoc                                  * -->
883     <!-- *                                                        * -->
884     <!-- ********************************************************** -->
885     <property name="javadoc_desc" value="FreeTTS 1.2" />
886     <property name="javadoc_pkgs"
887               value="com.sun.speech.engine,
888                      com.sun.speech.engine.synthesis,
889                      com.sun.speech.engine.synthesis.text,
890                      com.sun.speech.freetts,
891                      com.sun.speech.freetts.jsapi,
892                      com.sun.speech.freetts.en,
893                      com.sun.speech.freetts.en.us,
894                      com.sun.speech.freetts.audio,
895                      com.sun.speech.freetts.cart,
896                      com.sun.speech.freetts.clunits,
897                      com.sun.speech.freetts.diphone,
898                      com.sun.speech.freetts.lexicon,
899                      com.sun.speech.freetts.relp,
900                      com.sun.speech.freetts.util,
901                      de.dfki.lt.freetts.mbrola,
902                      de.dfki.lt.freetts.en.us" />
903
904     <target name="javadoc" description="Generate javadoc">
905         <mkdir dir="${javadoc_dir}" />
906         <javadoc sourcepath="${src_dir}"
907                  source="1.4"
908                  additionalparam="-breakiterator"
909                  destdir="${javadoc_dir}"
910                  packagenames="${javadoc_pkgs}"
911                  overview="overview.html"
912                  windowtitle="${javadoc_desc}"
913                  doctitle="${javadoc_desc}"
914                  access="protected">
915             <classpath refid="libs" />
916         </javadoc>
917     </target>
918
919
920     <!-- ********************************************************** -->
921     <!-- *                                                        * -->
922     <!-- * Builds just the demos.                                 * -->
923     <!-- *                                                        * -->
924     <!-- ********************************************************** -->
925     <target name="demos"
926             depends="freetts_jar"
927             description="Compiles and jars the demos">
928         <ant antfile="demo.xml" inheritall="false" />
929     </target>
930
931
932     <!-- ********************************************************** -->
933     <!-- *                                                        * -->
934     <!-- * Convenience for emacspeak-server.                      * -->
935     <!-- *                                                        * -->
936     <!-- ********************************************************** -->
937     <target name="emacspeak-server" depends="compile,jars" description="">
938         <ant antfile="demo.xml" target="emacspeak-server" />
939     </target>
940
941
942     <!-- ********************************************************** -->
943     <!-- *                                                        * -->
944     <!-- * Runs the unit tests.                                   * -->
945     <!-- *                                                        * -->
946     <!-- * This will execute AllTests.java from the test          * -->
947     <!-- * directory.  You can also tell ant to run one test by   * -->
948     <!-- * adding the following to the ant command line:          * -->
949     <!-- *                                                        * -->
950     <!-- *    -Dtestcase=<fully qualified classname>              * -->
951     <!-- *                                                        * -->
952     <!-- ********************************************************** -->
953     <path id="test_classpath">
954         <pathelement location="${lib_dir}/freetts.jar" />
955         <pathelement location="${classes_dir}" />
956         <pathelement location="${src_dir}" />
957         <pathelement location="${junit.jar}" />
958         <path refid="libs" />
959     </path>
960     <target name="junit" depends="jars">
961         <junit dir="tests" fork="yes" printsummary="false" haltonfailure="true">
962             <classpath refid="test_classpath" />
963             <formatter type="plain" usefile="false" />
964             <test name="${testcase}" if="testcase" />
965             <batchtest unless="testcase">
966                 <fileset dir="${classes_dir}" includes="tests/AllTests.class" />
967             </batchtest>
968         </junit>
969     </target>
970
971     <!-- [[[WDW - don't know why this will not work anywhere, but
972             it doesn't.]]]
973     <target name="regression" depends="jars">
974         <echo message="Running regression tests."/>
975         <echo message="NOTE:  these will not run on Windows."/>
976         <exec dir="tests" executable="regression.sh"/>
977     </target>
978     -->
979
980     <!-- ********************************************************** -->
981     <!-- *                                                        * -->
982     <!-- * Make the packages for deployment.                      * -->
983     <!-- *                                                        * -->
984     <!-- ********************************************************** -->
985     <fileset id="srcs" dir="${src_dir}" includes="com/**,de/**" />
986
987     <fileset id="legal"
988              dir="${src_dir}"
989              includes="acknowledgments.txt,
990                        license.terms" />
991
992     <fileset id="docs"
993              dir="."
994              includes="index.html,overview.html,README.txt,RELEASE_NOTES,
995                        ANNOUNCE.txt,
996                        docs/**,mbrola/*.html,
997                        javadoc/**"
998              excludes="docs/*.awk" />
999
1000     <fileset id="demos" dir="." includes="demo/**" />
1001
1002     <fileset id="tools" dir="." includes="tools/**" />
1003
1004     <fileset id="tests" dir="." includes="tests/**" />
1005
1006     <fileset id="binaries"
1007              dir="."
1008              includes="lib/*.jar,bin/*.jar,mbrola/*.jar"
1009              excludes="lib/jsapi.jar" />
1010
1011     <fileset id="jsapi_sh"
1012              dir="."
1013              includes="lib/jsapi.sh,lib/jsapi.exe,lib/README.txt" />
1014
1015     <target name="deploy"
1016             depends="deploy_init,
1017                      deploy_src,
1018                      deploy_bin,
1019                      deploy_tst,
1020                      deploy_webstartclock"
1021             description="Creates *.zip files for deployment" />
1022
1023     <target name="deploy_init"
1024             description="Copies files to the deploy staging directory."
1025             depends="all,javadoc">
1026         <mkdir dir="${deploy_dir}/freetts-${version}" />
1027         <copy todir="${deploy_dir}/freetts-${version}" includeEmptyDirs="false">
1028             <fileset dir="."
1029                      includes="build.xml,
1030                                 demo.xml,
1031                         speech.properties,
1032                                 lib/voices.txt" />
1033             <fileset refid="srcs" />
1034             <fileset refid="legal" />
1035             <fileset refid="docs" />
1036             <fileset refid="demos" />
1037             <fileset refid="tools" />
1038             <fileset refid="tests" />
1039             <fileset refid="binaries" />
1040             <fileset refid="jsapi_sh" />
1041         </copy>
1042     </target>
1043
1044     <!-- freetts-srcs -->
1045     <target name="deploy_src" depends="deploy_init">
1046         <jar destfile="${deploy_dir}/freetts-${version}-src.zip"
1047              basedir="${deploy_dir}"
1048              filesonly="true"
1049              compress="true"
1050              includes="freetts-${version}/**"
1051              excludes="**/*.jar,**/tests/**" />
1052     </target>
1053
1054     <!-- debian .. builds only what's needed for Debian packaging -->
1055     <target name="debian" depends="all,javadoc">
1056         <mkdir dir="${deploy_dir}/freetts-${version}" />
1057         <copy todir="${deploy_dir}/freetts-${version}" includeEmptyDirs="false">
1058             <fileset refid="binaries" />
1059         </copy>
1060     </target>
1061
1062     <!-- freetts-bin -->
1063     <target name="deploy_bin" depends="deploy_init">
1064         <jar destfile="${deploy_dir}/freetts-${version}-bin.zip"
1065              basedir="${deploy_dir}"
1066              filesonly="true"
1067              compress="true"
1068              includes="freetts-${version}/**"
1069              excludes="freetts-${version}/build.xml,
1070                        freetts-${version}/overview.html,
1071                        **/tests/**,
1072                        freetts-${version}/de/**,
1073                        freetts-${version}/com/**" />
1074     </target>
1075
1076
1077     <!-- freetts-tests -->
1078     <target name="deploy_tst">
1079         <jar destfile="${deploy_dir}/freetts-${version}-tst.zip"
1080              basedir="${deploy_dir}"
1081              filesonly="true"
1082              compress="true"
1083              includes="freetts-${version}/acknowledgments.txt,
1084                        freetts-${version}/license.terms,
1085                        freetts-${version}/tests/**" />
1086     </target>
1087
1088
1089     <!-- webstartclock -->
1090     <target name="deploy_webstartclock"
1091             depends="demos"
1092             description="Signs jars and creates tarball for web start demo">
1093         <ant antfile="demo.xml" target="deploy_webstartclock" />
1094     </target>
1095
1096
1097     <!-- ********************************************************** -->
1098     <!-- *                                                        * -->
1099     <!-- * Make a tarball containing things free of JSAPI         * -->
1100     <!-- * dependencies.  Also omits the tests.                   * -->
1101     <!-- *                                                        * -->
1102     <!-- ********************************************************** -->
1103     <target name="freetts_only_tarball"
1104             depends="set_patternset_to_compile"
1105             description="Create a tarball of sources free of JSAPI dependencies.">
1106         <delete dir="${deploy_dir}/freetts-only-${version}" />
1107         <mkdir dir="${deploy_dir}/freetts-only-${version}" />
1108         <copy todir="${deploy_dir}/freetts-only-${version}"
1109               includeEmptyDirs="false">
1110             <fileset dir="."
1111                      includes="build.xml,
1112                                 demo.xml,
1113                                 overview.html,
1114                                 ANNOUNCE.txt,
1115                                 README.txt,
1116                                 RELEASE_NOTES,
1117                                 acknowledgments.txt,
1118                                 license.terms,
1119                                 lib/voices.txt,
1120                                 docs/**,
1121                                 mbrola/*.html,
1122                                 demo/**,
1123                                 tools/**"
1124                      excludes="demo/JSAPI/**,
1125                                 docs/*.awk" />
1126             <fileset dir=".">
1127                 <patternset refid="${patternset_to_compile}" />
1128             </fileset>
1129         </copy>
1130         <copy file="docs/emacspeak_index.html"
1131               tofile="${deploy_dir}/freetts-only-${version}/index.html" />
1132         <tar destfile="${deploy_dir}/freetts-only-${version}.tar.gz"
1133              basedir="${deploy_dir}"
1134              includes="freetts-only-${version}/**"
1135              compression="gzip" />
1136     </target>
1137
1138     <!-- ********************************************************** -->
1139     <!-- *                                                        * -->
1140     <!-- * Deletes all build output and *~ file droppings         * -->
1141     <!-- *                                                        * -->
1142     <!-- ********************************************************** -->
1143     <target name="clean" description="Delete all build output">
1144         <delete quiet="true" includeEmptyDirs="true">
1145             <fileset defaultexcludes="no" dir="." includes="**/*~" />
1146             <fileset defaultexcludes="no"
1147                      dir="lib"
1148                      includes="**/*.jar"
1149                      excludes="**/jsapi.jar" />
1150             <fileset defaultexcludes="no"
1151                      dir="mbrola"
1152                      includes="**/mbrola.jar" />
1153         </delete>
1154         <delete dir="${bin_dir}" />
1155         <delete dir="${build_dir}" />
1156         <delete dir="${javadoc_dir}" />
1157         <delete dir="${deploy_dir}" />
1158     </target>
1159
1160     <target name="debug"
1161             depends="all"
1162             if="netbeans.home"
1163             description="Debug Project">
1164         <java fork="true" classname="FreeTTSHelloWorld">
1165             <jvmarg value="-Xdebug" />
1166             <jvmarg value="-Xnoagent" />
1167             <jvmarg value="-Djava.compiler=none" />
1168             <jvmarg value="-Dfreetts.voices=com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory" />
1169             <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y" />
1170             <classpath>
1171                 <pathelement path="${src_dir}" />
1172                 <pathelement path="bld/demo_classes/freetts/HelloWorld" />
1173                 <pathelement path="${classes_dir}" />
1174                 <pathelement location="lib/jsapi.jar" />
1175             </classpath>
1176         </java>
1177     </target>
1178
1179 </project>