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: 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 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 ed17316cc..e203bc74d 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,12 +22,32 @@ gtest_dep = dependency('gtest', required:false) if gtest_dep.found() and not meson.is_cross_build() - configure_file(input : 'data/wikipedia_en_ray_charles_mini_2020-03.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 ) + # + # 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, + command: [ + find_program('python3'), + '-c', + 'import sys; import shutil; shutil.copy(sys.argv[1], sys.argv[2])', + '@INPUT@', + '@OUTPUT@' + ]) + endforeach foreach test_name : tests # XXX: implicit_include_directories must be set to false, otherwise