Kelson has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/330417 )

Change subject: Make zimlib compilable with meson.
......................................................................


Make zimlib compilable with meson.

Also install a correct pkg-config file who correctly declare dependencies
of zimlib.

Change-Id: I86b999e46fac42e8d552cba8a1be1c674bb2c67d
---
M zimlib/.gitignore
A zimlib/include/meson.build
A zimlib/meson.build
A zimlib/meson_options.txt
A zimlib/src/config.h.in
A zimlib/src/meson.build
6 files changed, 168 insertions(+), 1 deletion(-)

Approvals:
  Kelson: Verified; Looks good to me, approved



diff --git a/zimlib/.gitignore b/zimlib/.gitignore
index 550c09a..3563fa8 100644
--- a/zimlib/.gitignore
+++ b/zimlib/.gitignore
@@ -2,7 +2,7 @@
 *#*
 autom4te.cache
 compile
-config.*
+config.h
 configure
 depcomp
 .deps
diff --git a/zimlib/include/meson.build b/zimlib/include/meson.build
new file mode 100644
index 0000000..0caa2e8
--- /dev/null
+++ b/zimlib/include/meson.build
@@ -0,0 +1,34 @@
+install_headers(
+    'zim/article.h',
+    'zim/articlesearch.h',
+    'zim/blob.h',
+    'zim/cache.h',
+    'zim/cluster.h',
+    'zim/dirent.h',
+    'zim/endian.h',
+    'zim/error.h',
+    'zim/file.h',
+    'zim/fileheader.h',
+    'zim/fileimpl.h',
+    'zim/fileiterator.h',
+    'zim/fstream.h',
+    'zim/indexarticle.h',
+    'zim/noncopyable.h',
+    'zim/search.h',
+    'zim/smartptr.h',
+    'zim/refcounted.h',
+    'zim/template.h',
+    'zim/unicode.h',
+    'zim/uuid.h',
+    'zim/zim.h',
+    'zim/zintstream.h',
+    subdir:'zim'
+)
+
+install_headers(
+    'zim/writer/articlesource.h',
+    'zim/writer/dirent.h',
+    'zim/writer/zimcreator.h',
+    subdir:'zim/writer'
+)
+
diff --git a/zimlib/meson.build b/zimlib/meson.build
new file mode 100644
index 0000000..0eed3c4
--- /dev/null
+++ b/zimlib/meson.build
@@ -0,0 +1,44 @@
+project('libzim', ['c', 'cpp'],
+  version : '1.4',
+  license : 'GPL2')
+
+abi_current=2
+abi_revision=0
+abi_age=0
+  
+conf = configuration_data()
+conf.set('VERSION', '"@0@"'.format(meson.project_version()))
+conf.set('DIRENT_CACHE_SIZE', get_option('DIRENT_CACHE_SIZE'))
+conf.set('CLUSTER_CACHE_SIZE', get_option('CLUSTER_CACHE_SIZE'))
+conf.set('LZMA_MEMORY_SIZE', get_option('LZMA_MEMORY_SIZE'))
+
+zlib_dep = dependency('zlib', required:false)
+conf.set('ENABLE_ZLIB', zlib_dep.found())
+lzma_dep = dependency('liblzma', required:false)
+conf.set('ENABLE_LZMA', lzma_dep.found())
+bzip2_dep = dependency('bzip2', required:false)
+conf.set('ENABLE_BZIP2', bzip2_dep.found())
+
+pkg_requires = []
+if zlib_dep.found()
+    pkg_requires += ['zlib']
+endif
+if lzma_dep.found()
+    pkg_requires += ['liblzma']
+endif
+if bzip2_dep.found()
+    pkg_requires += ['bzip2']
+endif
+
+inc = include_directories('include')
+
+subdir('include')
+subdir('src')
+
+pkg_mod = import('pkgconfig')
+pkg_mod.generate(libraries : libzim,
+                 version : meson.project_version(),
+                 name : 'libzim',
+                 filebase : 'libzim',
+                 description : 'A Library to zim.',
+                 requires : pkg_requires)
diff --git a/zimlib/meson_options.txt b/zimlib/meson_options.txt
new file mode 100644
index 0000000..108edf9
--- /dev/null
+++ b/zimlib/meson_options.txt
@@ -0,0 +1,6 @@
+option('CLUSTER_CACHE_SIZE', type : 'string', value : '16',
+  description : 'set cluster cache size to number (default:16)')
+option('DIRENT_CACHE_SIZE', type : 'string', value : '512',
+  description : 'set dirent cache size to number (default:512)')
+option('LZMA_MEMORY_SIZE', type : 'string', value : '128',
+  description : 'set lzma uncompress memory in MB (default:128)')
\ No newline at end of file
diff --git a/zimlib/src/config.h.in b/zimlib/src/config.h.in
new file mode 100644
index 0000000..d9e4b7d
--- /dev/null
+++ b/zimlib/src/config.h.in
@@ -0,0 +1,14 @@
+
+#mesondefine VERSION
+
+#mesondefine DIRENT_CACHE_SIZE
+
+#mesondefine CLUSTER_CACHE_SIZE
+
+#mesondefine LZMA_MEMORY_SIZE
+
+#mesondefine ENABLE_ZLIB
+
+#mesondefine ENABLE_LZMA
+
+#mesondefine ENABLE_BZIP2
diff --git a/zimlib/src/meson.build b/zimlib/src/meson.build
new file mode 100644
index 0000000..ec550f4
--- /dev/null
+++ b/zimlib/src/meson.build
@@ -0,0 +1,69 @@
+
+configure_file(output : 'config.h',
+               configuration : conf,
+               input : 'config.h.in')
+
+common_sources = [
+#    'config.h',
+    'article.cpp',
+    'articlesearch.cpp',
+    'articlesource.cpp',
+    'cluster.cpp',
+    'dirent.cpp',
+    'envvalue.cpp',
+    'file.cpp',
+    'fileheader.cpp',
+    'fileimpl.cpp',
+    'fstream.cpp',
+    'indexarticle.cpp',
+    'md5.c',
+    'md5stream.cpp',
+    'ptrstream.cpp',
+    'search.cpp',
+    'tee.cpp',
+    'template.cpp',
+    'unicode.cpp',
+    'uuid.cpp',
+    'zimcreator.cpp',
+    'zintstream.cpp'
+]
+
+zlib_sources = [
+    'deflatestream.cpp',
+    'inflatestream.cpp'
+]
+
+bzip2_sources = [
+    'bunzip2stream.cpp',
+    'bzip2.cpp',
+    'bzip2stream.cpp'
+]
+
+lzma_sources = [
+    'lzmastream.cpp',
+    'unlzmastream.cpp'
+]
+
+sources = common_sources
+deps = []
+
+if zlib_dep.found()
+    sources += zlib_sources
+    deps += [zlib_dep]
+endif
+
+if bzip2_dep.found()
+    sources += bzip2_sources
+    deps += [bzip2_dep]
+endif
+
+if lzma_dep.found()
+    sources += lzma_sources
+    deps += [lzma_dep]
+endif
+
+libzim = library('zim',
+                 sources,
+                 include_directories : inc,
+                 dependencies : deps,
+                 install : true)

-- 
To view, visit https://gerrit.wikimedia.org/r/330417
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I86b999e46fac42e8d552cba8a1be1c674bb2c67d
Gerrit-PatchSet: 1
Gerrit-Project: openzim
Gerrit-Branch: master
Gerrit-Owner: Mgautierfr <mgaut...@kymeria.fr>
Gerrit-Reviewer: Kelson <kel...@kiwix.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to