From a3bef76083bbc03bd353f8187555ae78dc7133a8 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Thu, 6 Aug 2020 19:23:11 +0400 Subject: [PATCH 1/6] example.zim is copied only if gtest is available --- test/meson.build | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/meson.build b/test/meson.build index ed17316cc..c45afa3c8 100644 --- a/test/meson.build +++ b/test/meson.build @@ -1,7 +1,3 @@ -configure_file(input : 'data/example.zim', - output : 'example.zim', - copy: true ) - tests = [ 'parseUrl', 'library', @@ -26,6 +22,10 @@ gtest_dep = dependency('gtest', required:false) if gtest_dep.found() and not meson.is_cross_build() + configure_file(input : 'data/example.zim', + output : 'example.zim', + copy: true ) + configure_file(input : 'data/wikipedia_en_ray_charles_mini_2020-03.zim', output : 'zimfile.zim', copy: true ) From 5f0bcd2bfafe9389856c2cc946e3f1e7dc3b0f7d Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Thu, 6 Aug 2020 19:24:45 +0400 Subject: [PATCH 2/6] Renamed wikipedia_en_ray_charles_mini_2020-03.zim --- ..._en_ray_charles_mini_2020-03.zim => zimfile.zim} | Bin test/meson.build | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename test/data/{wikipedia_en_ray_charles_mini_2020-03.zim => zimfile.zim} (100%) diff --git a/test/data/wikipedia_en_ray_charles_mini_2020-03.zim b/test/data/zimfile.zim similarity index 100% rename from test/data/wikipedia_en_ray_charles_mini_2020-03.zim rename to test/data/zimfile.zim diff --git a/test/meson.build b/test/meson.build index c45afa3c8..1e53c2c50 100644 --- a/test/meson.build +++ b/test/meson.build @@ -26,7 +26,7 @@ if gtest_dep.found() and not meson.is_cross_build() output : 'example.zim', copy: true ) - configure_file(input : 'data/wikipedia_en_ray_charles_mini_2020-03.zim', + configure_file(input : 'data/zimfile.zim', output : 'zimfile.zim', copy: true ) configure_file(input : 'data/corner_cases.zim', From e8cc6e4205cb47f8b97509fc3ac2a2c0c522f072 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Thu, 6 Aug 2020 19:27:21 +0400 Subject: [PATCH 3/6] Copying data files via a loop --- test/meson.build | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/meson.build b/test/meson.build index 1e53c2c50..10f01c4e3 100644 --- a/test/meson.build +++ b/test/meson.build @@ -22,16 +22,16 @@ gtest_dep = dependency('gtest', required:false) if gtest_dep.found() and not meson.is_cross_build() - configure_file(input : 'data/example.zim', - output : 'example.zim', - copy: true ) - - configure_file(input : 'data/zimfile.zim', - output : 'zimfile.zim', - copy: true ) - configure_file(input : 'data/corner_cases.zim', - output : 'corner_cases.zim', - copy: true ) + data_files = [ + 'example.zim', + 'zimfile.zim', + 'corner_cases.zim' + ] + foreach file : data_files + configure_file(input : 'data/' + file, + output : file, + copy: true ) + endforeach foreach test_name : tests # XXX: implicit_include_directories must be set to false, otherwise From 18e46969b74e0ef6d86ccd81effdb22056fe1b18 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Thu, 6 Aug 2020 19:30:19 +0400 Subject: [PATCH 4/6] Workaround for configure_file(copy:true) The `copy` keyword argument of `configure_file()` first appears in meson 0.47. Now performing file copy via python. --- test/meson.build | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test/meson.build b/test/meson.build index 10f01c4e3..e203bc74d 100644 --- a/test/meson.build +++ b/test/meson.build @@ -28,9 +28,25 @@ if gtest_dep.found() and not meson.is_cross_build() 'corner_cases.zim' ] foreach file : data_files + # configure_file(input : 'data/' + file, + # output : file, + # copy: true ) + # + # Above (commented) command doesn't work with Meson versions below 0.47 + # (in which the 'copy' keyword was first introduced). We want to keep + # compatibility with Ubuntu 18.04 Bionic (which has Meson version 0.45) + # until its EOL. + # + # Below is a python based workaround. configure_file(input : 'data/' + file, output : file, - copy: true ) + command: [ + find_program('python3'), + '-c', + 'import sys; import shutil; shutil.copy(sys.argv[1], sys.argv[2])', + '@INPUT@', + '@OUTPUT@' + ]) endforeach foreach test_name : tests From c4e6313c906a485e52ee9f1f5b35bba1d239e9a1 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Thu, 6 Aug 2020 19:33:03 +0400 Subject: [PATCH 5/6] x in a --> a.contains(x) in meson.build files --- meson.build | 8 ++++---- src/meson.build | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 9649992ce..c205ca7d7 100644 --- a/meson.build +++ b/meson.build @@ -7,19 +7,19 @@ compiler = meson.get_compiler('cpp') wrapper = get_option('wrapper') -static_deps = 'android' in wrapper or 'java' in wrapper or get_option('default_library') == 'static' -if 'android' in wrapper +static_deps = wrapper.contains('android') or wrapper.contains('java') or get_option('default_library') == 'static' +if wrapper.contains('android') extra_libs = ['-llog'] else extra_libs = [] endif -if 'java' in wrapper +if wrapper.contains('java') add_languages('java') endif # See https://github.com/kiwix/kiwix-lib/issues/371 -if target_machine.cpu_family() in ['arm', 'mips', 'm68k', 'ppc', 'sh4'] +if ['arm', 'mips', 'm68k', 'ppc', 'sh4'].contains(target_machine.cpu_family()) extra_libs += '-latomic' endif diff --git a/src/meson.build b/src/meson.build index e3b678acb..fb2ab4595 100644 --- a/src/meson.build +++ b/src/meson.build @@ -34,13 +34,13 @@ else kiwix_sources += 'subprocess_unix.cpp' endif -if 'android' in wrapper +if wrapper.contains('android') install_dir = 'kiwix-lib/jniLibs/' + meson.get_cross_property('android_abi') else install_dir = get_option('libdir') endif -if 'android' in wrapper or 'java' in wrapper +if wrapper.contains('android') or wrapper.contains('java') subdir('wrapper/java') endif From 56e46c43f8364209ddff02fd1ee110151f7167f4 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Thu, 6 Aug 2020 19:45:53 +0400 Subject: [PATCH 6/6] Upped meson version in the README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5332c64e4..f3616417e 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Environment ------------- The Kiwix library builds using [Meson](https://mesonbuild.com/) version -0.43 or higher. Meson relies itself on Ninja, pkg-config and few other +0.45 or higher. Meson relies itself on Ninja, pkg-config and few other compilation tools. Install first the few common compilation tools: