From a4ce6aa6830f1df13344a0f145d9733cbdfeb6da Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Fri, 29 Nov 2013 16:59:28 +0000 Subject: [PATCH] autotools: support optionally building the extended Russian and Chinese dictionaries --- .gitignore | 3 +++ Makefile.am | 18 ++++++++++++++++++ README.md | 15 +++++++++++---- configure.ac | 43 +++++++++++++++++++++++++++++++++++++++++++ mkdictlist | 18 +++++++++++++++++- 5 files changed, 92 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 3625b048..1821cdad 100644 --- a/.gitignore +++ b/.gitignore @@ -62,6 +62,9 @@ Makefile dictsource/*_extra dictsource/dict_log dictsource/dict_phonemes +dictsource/ru_listx +dictsource/zh_listx +dictsource/zhy_list phsource/compile_prog_log phsource/compile_report diff --git a/Makefile.am b/Makefile.am index d2da25e3..e8570bb8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -659,7 +659,13 @@ espeak-data/ro_dict: src/espeak phsource/phonemes.stamp dictsource/ro_list dicts ru: espeak-data/ru_dict dictsource/ru_extra: touch dictsource/ru_extra +dictsource/ru_listx: + ln -svf extra/ru_listx dictsource/ +if HAVE_RU_EXTENDED_DICTIONARY +espeak-data/ru_dict: src/espeak phsource/phonemes.stamp dictsource/ru_list dictsource/ru_rules dictsource/ru_extra dictsource/ru_listx +else espeak-data/ru_dict: src/espeak phsource/phonemes.stamp dictsource/ru_list dictsource/ru_rules dictsource/ru_extra +endif cd dictsource && ESPEAK_DATA_PATH=$(PWD) LD_LIBRARY_PATH=../src:${LD_LIBRARY_PATH} ../src/espeak --compile=ru && cd .. si: espeak-data/si_dict @@ -731,11 +737,23 @@ espeak-data/vi_dict: src/espeak phsource/phonemes.stamp dictsource/vi_list dicts zh: espeak-data/zh_dict dictsource/zh_extra: touch dictsource/zh_extra +dictsource/zh_listx: + ln -svf extra/zh_listx dictsource/ +if HAVE_ZH_EXTENDED_DICTIONARY +espeak-data/zh_dict: src/espeak phsource/phonemes.stamp dictsource/zh_list dictsource/zh_rules dictsource/zh_extra dictsource/zh_listx +else espeak-data/zh_dict: src/espeak phsource/phonemes.stamp dictsource/zh_list dictsource/zh_rules dictsource/zh_extra +endif cd dictsource && ESPEAK_DATA_PATH=$(PWD) LD_LIBRARY_PATH=../src:${LD_LIBRARY_PATH} ../src/espeak --compile=zh && cd .. zhy: espeak-data/zhy_dict dictsource/zhy_extra: touch dictsource/zhy_extra +dictsource/zhy_list: + ln -svf extra/zhy_list dictsource/ +if HAVE_ZHY_EXTENDED_DICTIONARY +espeak-data/zhy_dict: src/espeak phsource/phonemes.stamp dictsource/zhy_rules dictsource/zhy_extra dictsource/zhy_list +else espeak-data/zhy_dict: src/espeak phsource/phonemes.stamp dictsource/zhy_rules dictsource/zhy_extra +endif cd dictsource && ESPEAK_DATA_PATH=$(PWD) LD_LIBRARY_PATH=../src:${LD_LIBRARY_PATH} ../src/espeak --compile=zhy && cd .. diff --git a/README.md b/README.md index 984c064c..4b21bef7 100644 --- a/README.md +++ b/README.md @@ -33,14 +33,17 @@ This is a mirror of the eSpeak sources with the following improvements on the 1. An autotools-based build system that supports building the phoneme data and language dictionaries from source on POSIX systems. -2. Detection of the supported audio APIs via the `configure` script — no need to +2. Optional support for the extended Russian and Chinese dictionaries from + [http://espeak.sourceforge.net/data/](http://espeak.sourceforge.net/data/). + +3. Detection of the supported audio APIs via the `configure` script — no need to modify the build files. -3. The NVDA voice variants are included in the `espeak-data/voices/!v` directory. +4. The NVDA voice variants are included in the `espeak-data/voices/!v` directory. -4. Add support for the Oromo language (`om`, contributed by [gude432](https://github.com/gude432)). +5. Add support for the Oromo language (`om`, contributed by [gude432](https://github.com/gude432)). -5. Support for wxWidgets 3.0. +6. Support for wxWidgets 3.0. ## Build Dependencies @@ -239,6 +242,10 @@ fixes detailed in the sections below. In addition, it: 2. supports the Oromo language (`om`, contributed by [gude432](https://github.com/gude432)). +3. Optional support for the extended Russian (`ru`), Mandarin Chinese (`zh`) + and Cantonese Chinese (`zhy`) dictionaries from + [http://espeak.sourceforge.net/data/](http://espeak.sourceforge.net/data/). + #### Build System The build system for eSpeak has been changed on the *master* branch to use diff --git a/configure.ac b/configure.ac index 2f3ffb81..618e87bb 100644 --- a/configure.ac +++ b/configure.ac @@ -173,6 +173,44 @@ AM_CONDITIONAL(OPT_MBROLA, [test x"$have_mbrola" = xyes]) AM_CONDITIONAL(OPT_SONIC, [test x"$have_sonic" = xyes]) AM_CONDITIONAL(OPT_ASYNC, [test x"$have_async" = xyes]) +dnl ================================================================ +dnl Extended dictionary checks. +dnl ================================================================ + +AC_ARG_WITH([extdict-ru], + [AS_HELP_STRING([--with-extdict-ru], [use the extended Russian Dictionary file @<:@default=no@:>@])], + []) + +if test "$with_extdict_ru" = "yes" ; then + have_extdict_ru=yes +else + have_extdict_ru=no +fi + +AC_ARG_WITH([extdict-zh], + [AS_HELP_STRING([--with-extdict-zh], [use the extended Mandarin Chinese Dictionary file @<:@default=no@:>@])], + []) + +if test "$with_extdict_zh" = "yes" ; then + have_extdict_zh=yes +else + have_extdict_zh=no +fi + +AC_ARG_WITH([extdict-zhy], + [AS_HELP_STRING([--with-extdict-zhy], [use the extended Cantonese Chinese Dictionary file @<:@default=no@:>@])], + []) + +if test "$with_extdict_zhy" = "yes" ; then + have_extdict_zhy=yes +else + have_extdict_zhy=no +fi + +AM_CONDITIONAL(HAVE_RU_EXTENDED_DICTIONARY, [test x"$have_extdict_ru" = xyes]) +AM_CONDITIONAL(HAVE_ZH_EXTENDED_DICTIONARY, [test x"$have_extdict_zh" = xyes]) +AM_CONDITIONAL(HAVE_ZHY_EXTENDED_DICTIONARY, [test x"$have_extdict_zhy" = xyes]) + dnl ================================================================ dnl wxWidgets checks. dnl ================================================================ @@ -215,4 +253,9 @@ AC_MSG_NOTICE([ MBROLA: ${have_mbrola} Sonic: ${have_sonic} Async: ${have_async} + + Extended Dictionaries: + Russian: ${have_extdict_ru} + Chinese (Mandarin): ${have_extdict_zh} + Chinese (Cantonese): ${have_extdict_zhy} ]) diff --git a/mkdictlist b/mkdictlist index 5277a500..3ab730f3 100755 --- a/mkdictlist +++ b/mkdictlist @@ -19,6 +19,13 @@ special_voices = { 'zh-yue': 'zhy', } +# Support for extended dictionaries. +extended_dictionaries = { + 'ru': 'ru_listx', + 'zh': 'zh_listx', + 'zhy': 'zhy_list', +} + exclude_voices = [] def find_voices(path): @@ -43,7 +50,7 @@ find_voices('espeak-data/voices') find_phoneme_data('phsource') for filename in os.listdir('dictsource'): - if filename.endswith('_rules') or filename.endswith('_list') or filename.endswith('_listx'): + if filename.endswith('_rules') or filename.endswith('_list') or filename in ['bg_listx', 'it_listx']: dic, cat = filename.split('_') if dic in voices: if not dic in dictionaries.keys(): @@ -81,7 +88,16 @@ def write_dictionary_make_rules(f): f.write('%s: espeak-data/%s_dict\n' % (name, name)) f.write('dictsource/%s_extra:\n' % name) f.write('\ttouch dictsource/%s_extra\n' % name) + if name in extended_dictionaries.keys(): + ext = extended_dictionaries[name] + f.write('dictsource/%s:\n' % ext) + f.write('\tln -svf extra/%s dictsource/\n' % ext) + f.write('if HAVE_%s_EXTENDED_DICTIONARY\n' % name.upper()) + f.write('espeak-data/%s_dict: src/espeak phsource/phonemes.stamp %s dictsource/%s_extra dictsource/%s\n' % (name, ' '.join(sorted(files)), name, ext)) + f.write('else\n') f.write('espeak-data/%s_dict: src/espeak phsource/phonemes.stamp %s dictsource/%s_extra\n' % (name, ' '.join(sorted(files)), name)) + if name in extended_dictionaries.keys(): + f.write('endif\n') f.write('\tcd dictsource && ESPEAK_DATA_PATH=$(PWD) LD_LIBRARY_PATH=../src:${LD_LIBRARY_PATH} ../src/espeak --compile=%s && cd ..\n' % name) try: