Merge pull request #81 from kiwix/no_ctpp2

Allow kiwix-lib to compile without ctpp2c.
This commit is contained in:
Matthieu Gautier 2017-08-14 11:19:43 -04:00 committed by GitHub
commit ebd3f622ff
5 changed files with 20 additions and 11 deletions

View File

@ -93,7 +93,6 @@ class Searcher
std::string searchPattern; std::string searchPattern;
std::string protocolPrefix; std::string protocolPrefix;
std::string searchProtocolPrefix; std::string searchProtocolPrefix;
std::string template_ct2;
unsigned int resultCountPerPage; unsigned int resultCountPerPage;
unsigned int estimatedResultCount; unsigned int estimatedResultCount;
unsigned int resultStart; unsigned int resultStart;

View File

@ -85,7 +85,6 @@ Searcher::Searcher(const string& xapianDirectoryPath,
resultStart(0), resultStart(0),
resultEnd(0) resultEnd(0)
{ {
template_ct2 = RESOURCE::results_ct2;
loadICUExternalTables(); loadICUExternalTables();
if (!reader || !reader->hasFulltextIndex()) { if (!reader || !reader->hasFulltextIndex()) {
internal->_xapianSearcher = new XapianSearcher(xapianDirectoryPath, reader); internal->_xapianSearcher = new XapianSearcher(xapianDirectoryPath, reader);
@ -104,7 +103,6 @@ Searcher::Searcher()
resultStart(0), resultStart(0),
resultEnd(0) resultEnd(0)
{ {
template_ct2 = RESOURCE::results_ct2;
loadICUExternalTables(); loadICUExternalTables();
} }
@ -375,6 +373,7 @@ string Searcher::getHtml()
oData["searchProtocolPrefix"] = this->searchProtocolPrefix; oData["searchProtocolPrefix"] = this->searchProtocolPrefix;
oData["contentId"] = this->contentHumanReadableId; oData["contentId"] = this->contentHumanReadableId;
std::string template_ct2 = RESOURCE::results_ct2;
VMStringLoader oLoader(template_ct2.c_str(), template_ct2.size()); VMStringLoader oLoader(template_ct2.c_str(), template_ct2.size());
FileLogger oLogger(stderr); FileLogger oLogger(stderr);

View File

@ -1,19 +1,27 @@
ctpp2c = find_program('ctpp2c') ctpp2c = find_program('ctpp2c', required:false)
if ctpp2c.found()
search_result_template = custom_target('result_template', search_result_template = custom_target('result_template',
input: 'results.tmpl', input: 'results.tmpl',
output: 'results.ct2', output: 'results.ct2',
command: [intermediate_ctpp2c, ctpp2c, '@INPUT@', '@OUTPUT@'] command: [intermediate_ctpp2c, ctpp2c, '@INPUT@', '@OUTPUT@']
) )
resources_list = 'resources_list_ctpp2.txt'
resources_depends = [search_result_template]
else
resources_list = 'resources_list_noctpp2.txt'
resources_depends = []
endif
lib_resources = custom_target('resources', lib_resources = custom_target('resources',
input: 'resources_list.txt', input: resources_list,
output: ['kiwixlib-resources.cpp', 'kiwixlib-resources.h'], output: ['kiwixlib-resources.cpp', 'kiwixlib-resources.h'],
command:[res_compiler, command:[res_compiler,
'--cxxfile', '@OUTPUT0@', '--cxxfile', '@OUTPUT0@',
'--hfile', '@OUTPUT1@', '--hfile', '@OUTPUT1@',
'--source_dir', '@OUTDIR@', '--source_dir', '@OUTDIR@',
'@INPUT@'], '@INPUT@'],
depends: [search_result_template] depends: resources_depends
) )

View File

@ -0,0 +1,3 @@
stopwords/en
stopwords/he
stopwords/fra