1noinst_LTLIBRARIES = libfts.la
2
3# I$(top_srcdir)/src/lib-fts needed to include
4# word-break-data.c and word-boundary-data.c
5# in fts-tokenizer-generic.c
6AM_CPPFLAGS = \
7	-I$(top_srcdir)/src/lib \
8	-I$(top_srcdir)/src/lib-test \
9	-I$(top_srcdir)/src/lib-mail \
10	-I$(top_srcdir)/src/lib-fts \
11	$(LIBEXTTEXTCAT_CFLAGS) \
12	$(LIBICU_CFLAGS) \
13	-DUDHRDIR=\""$(top_srcdir)/src/lib-fts"\" \
14	-DDATADIR=\"$(pkgdatadir)\" \
15	-DTEST_STOPWORDS_DIR=\""$(top_srcdir)/src/lib-fts/stopwords"\"
16
17stopwordsdir = $(datadir)/${PACKAGE_TARNAME}/stopwords
18dist_stopwords_DATA = \
19	stopwords/stopwords_da.txt \
20	stopwords/stopwords_de.txt \
21	stopwords/stopwords_en.txt \
22	stopwords/stopwords_es.txt \
23	stopwords/stopwords_fi.txt \
24	stopwords/stopwords_fr.txt \
25	stopwords/stopwords_it.txt \
26	stopwords/stopwords_nl.txt \
27	stopwords/stopwords_no.txt \
28	stopwords/stopwords_pt.txt \
29	stopwords/stopwords_ro.txt \
30	stopwords/stopwords_ru.txt \
31	stopwords/stopwords_sv.txt \
32	stopwords/stopwords_tr.txt
33
34BUILT_SOURCES = $(srcdir)/word-boundary-data.c \
35		$(srcdir)/word-break-data.c
36
37EXTRA_DIST = \
38	udhr_fra.txt \
39	PropList.txt \
40	word-properties.pl \
41	WordBreakProperty.txt \
42	word-boundary-data.c \
43	word-break-data.c \
44	stopwords/stopwords_malformed.txt
45
46$(srcdir)/WordBreakProperty.txt:
47	test -f $@ || wget -O $@ https://dovecot.org/res/WordBreakProperty.txt
48$(srcdir)/word-boundary-data.c: $(srcdir)/word-properties.pl $(srcdir)/WordBreakProperty.txt
49	perl $(srcdir)/word-properties.pl boundaries $(srcdir)/WordBreakProperty.txt > $@
50
51$(srcdir)/PropList.txt:
52	test -f $@ || wget -O $@ https://dovecot.org/res/PropList.txt
53$(srcdir)/word-break-data.c: $(srcdir)/word-properties.pl $(srcdir)/PropList.txt
54	perl $(srcdir)/word-properties.pl breaks $(srcdir)/PropList.txt > $@
55
56
57if BUILD_FTS_STEMMER
58STEMMER_LIBS = -lstemmer
59endif
60
61if BUILD_FTS_EXTTEXTCAT
62TEXTCAT_LIBS = $(LIBEXTTEXTCAT_LIBS)
63else
64if BUILD_FTS_TEXTCAT
65TEXTCAT_LIBS = -ltextcat
66endif
67endif
68
69if BUILD_LIBICU
70ICU_SOURCES = fts-icu.c
71NORMALIZER_LIBS = $(LIBICU_LIBS)
72ICU_TESTS = test-fts-icu
73endif
74
75libfts_la_LIBADD = \
76	$(STEMMER_LIBS) \
77	$(TEXTCAT_LIBS) \
78	$(NORMALIZER_LIBS)
79
80libfts_la_SOURCES = \
81	fts-filter.c \
82	fts-filter-contractions.c \
83	fts-filter-common.c \
84	fts-filter-english-possessive.c \
85	fts-filter-lowercase.c \
86	fts-filter-normalizer-icu.c \
87	fts-filter-stopwords.c \
88	fts-filter-stemmer-snowball.c \
89	fts-language.c \
90	fts-library.c \
91	fts-tokenizer.c \
92	fts-tokenizer-address.c \
93	fts-tokenizer-common.c \
94	fts-tokenizer-generic.c \
95	$(ICU_SOURCES)
96
97headers = \
98	fts-common.h \
99	fts-filter.h \
100	fts-filter-common.h \
101	fts-filter-private.h \
102	fts-icu.h \
103	fts-language.h \
104	fts-library.h \
105	fts-tokenizer.h \
106	fts-tokenizer-common.h \
107	fts-tokenizer-private.h \
108	fts-tokenizer-generic-private.h
109
110pkginc_libdir=$(pkgincludedir)
111pkginc_lib_HEADERS = $(headers)
112
113deps=../lib-dovecot/libdovecot.la
114
115pkglib_LTLIBRARIES = libdovecot-fts.la
116libdovecot_fts_la_SOURCES =
117libdovecot_fts_la_LIBADD = libfts.la $(deps)
118libdovecot_fts_la_DEPENDENCIES = libfts.la $(deps)
119libdovecot_fts_la_LDFLAGS = -export-dynamic
120
121test_programs = \
122	$(ICU_TESTS) \
123	$(TEST_FTS_LANGUAGE) \
124	test-fts-filter \
125	test-fts-tokenizer
126
127noinst_PROGRAMS = $(test_programs)
128
129test_libs = \
130	../lib-test/libtest.la \
131	../lib/liblib.la
132test_deps = $(noinst_LTLIBRARIES) $(test_libs)
133
134test_fts_icu_SOURCES = test-fts-icu.c
135test_fts_icu_LDADD = fts-icu.lo $(LIBICU_LIBS) $(test_libs)
136test_fts_icu_DEPENDENCIES = fts-icu.lo $(test_deps)
137
138test_fts_filter_SOURCES = test-fts-filter.c
139test_fts_filter_LDADD = libfts.la $(test_libs)
140test_fts_filter_DEPENDENCIES = libfts.la $(test_deps)
141
142if BUILD_FTS_EXTTEXTCAT
143TEST_FTS_LANGUAGE = test-fts-language
144test_fts_language_SOURCES = test-fts-language.c
145test_fts_language_LDADD = fts-language.lo $(test_libs) $(TEXTCAT_LIBS)
146test_fts_language_DEPENDENCIES = $(test_deps)
147endif
148
149test_fts_tokenizer_SOURCES = test-fts-tokenizer.c
150test_fts_tokenizer_LDADD = fts-tokenizer.lo fts-tokenizer-generic.lo fts-tokenizer-address.lo fts-tokenizer-common.lo ../lib-mail/libmail.la $(test_libs)
151test_fts_tokenizer_DEPENDENCIES = ../lib-mail/libmail.la $(test_deps)
152
153check-local:
154	for bin in $(test_programs); do \
155	  if ! $(RUN_TEST) ./$$bin; then exit 1; fi; \
156	done
157