From efd1df32066a85d1485754365041307721a61961 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Tue, 9 May 2017 07:37:56 +0100 Subject: [PATCH] Build a test version of libespeak-ng that exposes the internal APIs. --- .gitignore | 4 ++++ Makefile.am | 33 +++++++++++++++++++------------ src/libespeak-ng/espeak_command.c | 4 ++++ src/libespeak-ng/fifo.c | 4 ++++ 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 7b1f08dc..0dbeb4bb 100644 --- a/.gitignore +++ b/.gitignore @@ -79,6 +79,10 @@ libespeak-ng.a libespeak-ng.la libespeak-ng.so* +libespeak-ng-test.a +libespeak-ng-test.la +libespeak-ng-test.so* + # build output *.html diff --git a/Makefile.am b/Makefile.am index bf6c34a6..91cabcbe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,6 +30,9 @@ man1_MANS = noinst_bin_PROGRAMS = noinst_bindir = +noinst_lib_LTLIBRARIES = +noinst_libdir = + ##### ChangeLog: ChangeLog: @@ -141,16 +144,13 @@ src_libespeak_ng_la_CFLAGS = \ -pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -DLIBESPEAK_NG_EXPORT \ ${PCAUDIOLIB_CFLAGS} ${AM_CFLAGS} -UCD_TOOLS_SOURCES = \ +src_libespeak_ng_la_SOURCES = \ src/ucd-tools/src/case.c \ src/ucd-tools/src/categories.c \ src/ucd-tools/src/ctype.c \ src/ucd-tools/src/proplist.c \ src/ucd-tools/src/scripts.c \ - src/ucd-tools/src/tostring.c - -src_libespeak_ng_la_SOURCES = \ - $(UCD_TOOLS_SOURCES) \ + src/ucd-tools/src/tostring.c \ src/libespeak-ng/compiledata.c \ src/libespeak-ng/compiledict.c \ src/libespeak-ng/compilembrola.c \ @@ -217,6 +217,17 @@ src_espeak_ng_SOURCES = src/espeak-ng.c ##### tests: +# Test version of libespeak-ng.so with access to the internal APIs, so they can +# be accessed in the test code. This version should not be installed, as the +# internal APIs are not guaranteed to be stable between releases. +lib_LTLIBRARIES += src/libespeak-ng-test.la + +src_libespeak_ng_test_la_LDFLAGS = $(src_libespeak_ng_la_LDFLAGS) +src_libespeak_ng_test_la_CFLAGS = \ + -fPIC -pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -DLIBESPEAK_NG_EXPORT \ + ${PCAUDIOLIB_CFLAGS} ${AM_CFLAGS} +src_libespeak_ng_test_la_SOURCES = $(src_libespeak_ng_la_SOURCES) + noinst_bin_PROGRAMS += tests/encoding.test tests_encoding_test_LDADD = src/libespeak-ng.la @@ -224,17 +235,13 @@ tests_encoding_test_SOURCES = tests/encoding.c noinst_bin_PROGRAMS += tests/tokenizer.test -tests_tokenizer_test_CFLAGS = -Isrc/libespeak-ng ${AM_CFLAGS} -tests_tokenizer_test_SOURCES = \ - $(UCD_TOOLS_SOURCES) \ - src/libespeak-ng/encoding.c \ - src/libespeak-ng/mnemonics.c \ - src/libespeak-ng/tokenizer.c \ - tests/tokenizer.c +tests_tokenizer_test_CFLAGS = -Isrc/libespeak-ng ${AM_CFLAGS} +tests_tokenizer_test_LDADD = src/libespeak-ng-test.la +tests_tokenizer_test_SOURCES = tests/tokenizer.c noinst_bin_PROGRAMS += tests/voices.test -tests_voices_test_LDADD = src/libespeak-ng.la +tests_voices_test_LDADD = src/libespeak-ng-test.la tests_voices_test_CFLAGS = -Isrc/libespeak-ng ${AM_CFLAGS} tests_voices_test_SOURCES = tests/voices.c diff --git a/src/libespeak-ng/espeak_command.c b/src/libespeak-ng/espeak_command.c index da010766..8ccd23da 100644 --- a/src/libespeak-ng/espeak_command.c +++ b/src/libespeak-ng/espeak_command.c @@ -28,6 +28,8 @@ #include "speech.h" #include "espeak_command.h" +#ifdef USE_ASYNC + static unsigned int my_current_text_id = 0; t_espeak_command *create_espeak_text(const void *text, size_t size, unsigned int position, espeak_POSITION_TYPE position_type, unsigned int end_position, unsigned int flags, void *user_data) @@ -372,3 +374,5 @@ void process_espeak_command(t_espeak_command *the_command) break; } } + +#endif diff --git a/src/libespeak-ng/fifo.c b/src/libespeak-ng/fifo.c index ddb3c65e..6076492b 100644 --- a/src/libespeak-ng/fifo.c +++ b/src/libespeak-ng/fifo.c @@ -37,6 +37,8 @@ #include "fifo.h" #include "event.h" +#ifdef USE_ASYNC + // my_mutex: protects my_thread_is_talking, // my_stop_is_required, and the command fifo static pthread_mutex_t my_mutex; @@ -442,3 +444,5 @@ void fifo_terminate() init(0); // purge fifo } + +#endif