mirror of https://github.com/kiwix/libkiwix.git
Switch build system to mesonbuild.
There is no more integrated build of dependencies in the build system. Dependencies are discovered using pkg-config except for ctpp2 where there is no pkg-config file.
This commit is contained in:
parent
1c68cf87b9
commit
8ce1fb0ba8
|
@ -37,7 +37,7 @@
|
|||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
#include <stringTools.h>
|
||||
#include "stringTools.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include <pathTools.h>
|
||||
#include "pathTools.h"
|
||||
|
||||
namespace kiwix {
|
||||
|
|
@ -20,12 +20,12 @@
|
|||
#ifndef _CTPP2_VM_STRING_LOADER_HPP__
|
||||
#define _CTPP2_VM_STRING_LOADER_HPP__ 1
|
||||
|
||||
#include "ctpp2/CTPP2VMLoader.hpp"
|
||||
#include "ctpp2/CTPP2Util.hpp"
|
||||
#include "ctpp2/CTPP2Exception.hpp"
|
||||
#include "ctpp2/CTPP2VMExecutable.hpp"
|
||||
#include "ctpp2/CTPP2VMInstruction.hpp"
|
||||
#include "ctpp2/CTPP2VMMemoryCore.hpp"
|
||||
#include <ctpp2/CTPP2VMLoader.hpp>
|
||||
#include <ctpp2/CTPP2Util.hpp>
|
||||
#include <ctpp2/CTPP2Exception.hpp>
|
||||
#include <ctpp2/CTPP2VMExecutable.hpp>
|
||||
#include <ctpp2/CTPP2VMInstruction.hpp>
|
||||
#include <ctpp2/CTPP2VMMemoryCore.hpp>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -34,7 +34,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <resourceTools.h>
|
||||
// #include <common/resourceTools.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
|
@ -29,9 +29,9 @@
|
|||
#include <sstream>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stringTools.h>
|
||||
#include <otherTools.h>
|
||||
#include <resourceTools.h>
|
||||
#include "common/stringTools.h"
|
||||
#include "common/otherTools.h"
|
||||
#include "common/resourceTools.h"
|
||||
#include <zim/file.h>
|
||||
#include <zim/article.h>
|
||||
#include <zim/fileiterator.h>
|
|
@ -17,28 +17,10 @@
|
|||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef KIWIX_COMPONENTTOOLS_H
|
||||
#define KIWIX_COMPONENTTOOLS_H
|
||||
#ifndef KIWIX_H
|
||||
#define KIWIX_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <mozilla/Char16.h>
|
||||
#endif
|
||||
#include "library.h"
|
||||
|
||||
#include<string>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsEmbedString.h"
|
||||
|
||||
const char *nsStringToCString(const nsAString &str);
|
||||
std::string nsStringToString(const nsEmbedString &str);
|
||||
const char *nsStringToUTF8(const nsAString &str);
|
||||
|
||||
#endif
|
|
@ -27,8 +27,8 @@
|
|||
#include <vector>
|
||||
#include <stack>
|
||||
|
||||
#include <stringTools.h>
|
||||
#include <regexTools.h>
|
||||
#include "common/stringTools.h"
|
||||
#include "common/regexTools.h"
|
||||
|
||||
#define KIWIX_LIBRARY_VERSION "20110515"
|
||||
|
|
@ -26,11 +26,11 @@
|
|||
|
||||
#include <pugixml.hpp>
|
||||
|
||||
#include "../base64.h"
|
||||
#include "../regexTools.h"
|
||||
#include "../pathTools.h"
|
||||
#include <kiwix/library.h>
|
||||
#include <kiwix/reader.h>
|
||||
#include "common/base64.h"
|
||||
#include "common/regexTools.h"
|
||||
#include "common/pathTools.h"
|
||||
#include "library.h"
|
||||
#include "reader.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
headers = [
|
||||
'indexer.h',
|
||||
'library.h',
|
||||
'manager.h',
|
||||
'reader.h',
|
||||
'searcher.h'
|
||||
]
|
||||
|
||||
if xapian_dep.found()
|
||||
headers += ['xapianIndexer.h', 'xapianSearcher.h']
|
||||
endif
|
||||
|
||||
install_headers(headers, subdir:'kiwix')
|
||||
|
||||
install_headers(
|
||||
'common/base64.h',
|
||||
'common/networkTools.h',
|
||||
'common/otherTools.h',
|
||||
'common/pathTools.h',
|
||||
'common/regexTools.h',
|
||||
'common/resourceTools.h',
|
||||
'common/stringTools.h',
|
||||
'common/tree.h',
|
||||
subdir:'kiwix/common'
|
||||
)
|
||||
|
||||
|
||||
install_headers(
|
||||
'ctpp2/CTPP2VMStringLoader.hpp',
|
||||
subdir:'kiwix/ctpp2'
|
||||
)
|
|
@ -29,9 +29,8 @@
|
|||
#include <exception>
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
#include "time.h"
|
||||
#include <pathTools.h>
|
||||
#include <stringTools.h>
|
||||
#include "common/pathTools.h"
|
||||
#include "common/stringTools.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
@ -28,16 +28,16 @@
|
|||
#include <locale>
|
||||
#include <cctype>
|
||||
#include <vector>
|
||||
#include <resourceTools.h>
|
||||
#include <pathTools.h>
|
||||
#include <stringTools.h>
|
||||
#include "unicode/putil.h"
|
||||
#include "common/resourceTools.h"
|
||||
#include "common/pathTools.h"
|
||||
#include "common/stringTools.h"
|
||||
#include <unicode/putil.h>
|
||||
|
||||
#ifndef __ANDROID__
|
||||
#include <ctpp2/CDT.hpp>
|
||||
#include <ctpp2/CTPP2FileLogger.hpp>
|
||||
#include <ctpp2/CTPP2SimpleVM.hpp>
|
||||
#include "kiwix/ctpp2/CTPP2VMStringLoader.hpp"
|
||||
#include "ctpp2/CTPP2VMStringLoader.hpp"
|
||||
|
||||
using namespace CTPP;
|
||||
#endif
|
|
@ -0,0 +1,61 @@
|
|||
project('kiwixlib', 'cpp',
|
||||
version : '1.0.0',
|
||||
license : 'GPL')
|
||||
|
||||
compiler = meson.get_compiler('cpp')
|
||||
|
||||
thread_dep = dependency('threads')
|
||||
zlib_dep = dependency('zlib')
|
||||
bzip_dep = dependency('bzip2')
|
||||
libicu_dep = dependency('icu-i18n')
|
||||
lzma_dep = dependency('liblzma')
|
||||
libzim_dep = dependency('zimlib')
|
||||
pugixml_dep = dependency('pugixml')
|
||||
aria2_dep = find_program('aria2c')
|
||||
|
||||
ctpp2_prefix_install = get_option('ctpp2-install-prefix')
|
||||
if get_option('default_library') == 'static'
|
||||
libname = 'ctpp2-st'
|
||||
else
|
||||
libname = 'ctpp2'
|
||||
endif
|
||||
if ctpp2_prefix_install == ''
|
||||
if not compiler.has_header('ctpp2/CTPP2Logger.hpp')
|
||||
error('ctpp2/CTPP2Logger.hppnot found')
|
||||
endif
|
||||
ctpp2_lib = compiler.find_library(libname)
|
||||
ctpp2_dep = declare_dependency(dependencies:[ctpp2_lib])
|
||||
else
|
||||
ctpp2_include_path = ctpp2_prefix_install + '/include'
|
||||
ctpp2_include_args = ['-I'+ctpp2_include_path]
|
||||
if not compiler.has_header('ctpp2/CTPP2Logger.hpp', args:ctpp2_include_args)
|
||||
error('ctpp2/CTPP2Logger.hppnot found')
|
||||
endif
|
||||
ctpp2_include_path = include_directories(ctpp2_include_path, is_system:true)
|
||||
ctpp2_lib_path = ctpp2_prefix_install+'/lib'
|
||||
ctpp2_lib = compiler.find_library(libname, dirs:ctpp2_lib_path)
|
||||
ctpp2_dep = declare_dependency(include_directories:ctpp2_include_path, dependencies:[ctpp2_lib])
|
||||
endif
|
||||
|
||||
xapian_dep = dependency('xapian-core', required:false)
|
||||
if xapian_dep.found()
|
||||
message('xapian_dep found')
|
||||
else
|
||||
message('xapian_dep not found')
|
||||
endif
|
||||
|
||||
all_deps = [thread_dep, zlib_dep, libicu_dep, lzma_dep, libzim_dep, ctpp2_dep, xapian_dep, pugixml_dep, bzip_dep]
|
||||
|
||||
inc = include_directories('include')
|
||||
|
||||
subdir('include')
|
||||
subdir('src')
|
||||
|
||||
pkg_mod = import('pkgconfig')
|
||||
pkg_mod.generate(libraries : kiwixlib,
|
||||
version : '1.0',
|
||||
name : 'libkiwix',
|
||||
filebase : 'kiwix',
|
||||
description : 'A library that contains a lot of things used by used by other kiwix programs',
|
||||
requires: ['zimlib', 'zlib', 'xapian-core', 'icu-i18n', 'liblzma', 'bzip2', 'pugixml'])
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
option('ctpp2-install-prefix', type : 'string', value : '',
|
||||
description : 'Prefix where ctpp libs has been installed')
|
|
@ -24,7 +24,7 @@
|
|||
René Nyffenegger rene.nyffenegger@adp-gmbh.ch
|
||||
*/
|
||||
|
||||
#include "base64.h"
|
||||
#include <common/base64.h>
|
||||
#include <iostream>
|
||||
|
||||
static const std::string base64_chars =
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* Copyright 2011 Emmanuel Engelhart <kelson@kiwix.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "componentTools.h"
|
||||
|
||||
const char *nsStringToCString(const nsAString &str) {
|
||||
const char *cStr;
|
||||
nsCString tmpStr;
|
||||
|
||||
#ifdef _WIN32
|
||||
LossyCopyUTF16toASCII(str, tmpStr);
|
||||
#else
|
||||
CopyUTF16toUTF8(str, tmpStr);
|
||||
#endif
|
||||
|
||||
NS_CStringGetData(tmpStr, &cStr);
|
||||
|
||||
#ifdef _WIN32
|
||||
return _strdup(cStr);
|
||||
#else
|
||||
return strdup(cStr);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string nsStringToString(const nsEmbedString &str) {
|
||||
#ifdef _WIN32
|
||||
PRUnichar *start = (PRUnichar *)str.get();
|
||||
PRUnichar *end = start + str.Length();
|
||||
wchar_t wca[4096];
|
||||
wchar_t *wstart = wca;
|
||||
wchar_t *wpr = wstart;
|
||||
|
||||
for(; start < end; ++start)
|
||||
{
|
||||
*wstart = (wchar_t) *start;
|
||||
++wstart;
|
||||
}
|
||||
*wstart = 0;
|
||||
|
||||
std::string ptr;
|
||||
ptr.resize(4096);
|
||||
size_t size = wcstombs((char*)ptr.data(), wpr, 4096);
|
||||
ptr.resize(size);
|
||||
|
||||
return ptr;
|
||||
#else
|
||||
const char *cStr;
|
||||
nsCString tmpStr;
|
||||
|
||||
CopyUTF16toUTF8(str, tmpStr);
|
||||
NS_CStringGetData(tmpStr, &cStr);
|
||||
return std::string(cStr);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
const char *nsStringToUTF8(const nsAString &str) {
|
||||
const char *cStr;
|
||||
nsCString tmpStr;
|
||||
CopyUTF16toUTF8(str, tmpStr);
|
||||
NS_CStringGetData(tmpStr, &cStr);
|
||||
|
||||
#ifdef _WIN32
|
||||
return _strdup(cStr);
|
||||
#else
|
||||
return strdup(cStr);
|
||||
#endif
|
||||
}
|
|
@ -17,7 +17,7 @@
|
|||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "networkTools.h"
|
||||
#include <common/networkTools.h>
|
||||
|
||||
std::map<std::string, std::string> kiwix::getNetworkInterfaces() {
|
||||
std::map<std::string, std::string> interfaces;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "otherTools.h"
|
||||
#include <common/otherTools.h>
|
||||
|
||||
void kiwix::sleep(unsigned int milliseconds) {
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "pathTools.h"
|
||||
#include <common/pathTools.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <mach-o/dyld.h>
|
||||
|
@ -41,6 +41,8 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 1024
|
||||
#endif
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "regexTools.h"
|
||||
#include <common/regexTools.h>
|
||||
|
||||
std::map<std::string, RegexMatcher*> regexCache;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <resourceTools.h>
|
||||
#include <common/resourceTools.h>
|
||||
#include <iostream>
|
||||
|
||||
std::string getResourceAsString(const std::string &name) {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "stringTools.h"
|
||||
#include <common/stringTools.h>
|
||||
|
||||
/* tell ICU where to find its dat file (tables) */
|
||||
void kiwix::loadICUExternalTables() {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "CTPP2VMStringLoader.hpp"
|
||||
#include <ctpp2/CTPP2VMStringLoader.hpp>
|
||||
|
||||
namespace CTPP // C++ Template Engine
|
||||
{
|
|
@ -0,0 +1,27 @@
|
|||
kiwix_sources = [
|
||||
'library.cpp',
|
||||
'manager.cpp',
|
||||
'reader.cpp',
|
||||
'searcher.cpp',
|
||||
'indexer.cpp',
|
||||
'common/base64.cpp',
|
||||
'common/pathTools.cpp',
|
||||
'common/regexTools.cpp',
|
||||
'common/stringTools.cpp',
|
||||
'common/resourceTools.cpp',
|
||||
'common/networkTools.cpp',
|
||||
'common/otherTools.cpp',
|
||||
'ctpp2/CTPP2VMStringLoader.cpp',
|
||||
'xapian/htmlparse.cc',
|
||||
'xapian/myhtmlparse.cc'
|
||||
]
|
||||
|
||||
if xapian_dep.found()
|
||||
kiwix_sources += ['xapianIndexer.cpp', 'xapianSearcher.cpp']
|
||||
endif
|
||||
|
||||
kiwixlib = library('kiwix',
|
||||
kiwix_sources,
|
||||
include_directories : inc,
|
||||
dependencies : all_deps,
|
||||
install : true)
|
Loading…
Reference in New Issue