From 16e12ad4635ddca4400c6c4d709d908487276656 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 13 Dec 2017 16:43:08 +0100 Subject: [PATCH 1/3] Stop workaround xapian-core.pc `xapian-core.pc` is now correct stop workaround it adding extra link args. The workaround is broken with meson 0.44.0 and static compilation. However, libmicrohttpd is using `librt` if present but doesn't declare it in its `libmicrohttpd.pc` file so we must add it manually if we found it. --- meson.build | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/meson.build b/meson.build index 9ffb714..bc697e2 100644 --- a/meson.build +++ b/meson.build @@ -15,22 +15,14 @@ kiwixlib_dep = dependency('kiwix', version:'>=1.0.0', static:static_linkage) microhttpd_dep = dependency('libmicrohttpd', static:static_linkage) z_dep = dependency('zlib', static:static_linkage) -# This is a temporary workaround until xapian fix it's xapian-core.pc -# For a correct dependency checking we should test if uuid is really installed -# but for a workaround, we assume that in xapian is installed, uuid also. -if meson.is_cross_build() and host_machine.system() == 'windows' - # xapian doesn't use uuid on windows. - uuid_dep = declare_dependency() -else - xapian_dep = dependency('xapian-core', required : false) - if xapian_dep.found() - uuid_dep = declare_dependency(link_args:['-luuid', '-lrt']) - else - uuid_dep = declare_dependency() - endif -endif +all_deps = [thread_dep, kiwixlib_dep, microhttpd_dep, z_dep] -all_deps = [thread_dep, kiwixlib_dep, microhttpd_dep, z_dep, uuid_dep] +if static_linkage + librt = compiler.find_library('rt', required:false) + if librt.found() + all_deps += librt + endif +endif #subdir('include') subdir('static') From 05c63536dea943df5cb0e9dd756a5ae0f2a94806 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 13 Dec 2017 16:43:42 +0100 Subject: [PATCH 2/3] Force usage of meson 0.43.0. Static compilation is broken with meson 0.44.0. --- travis/install_deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis/install_deps.sh b/travis/install_deps.sh index cdf166b..1ed9d0c 100755 --- a/travis/install_deps.sh +++ b/travis/install_deps.sh @@ -29,7 +29,7 @@ esac sudo apt-get update -qq sudo apt-get install -qq python3-pip ${PACKAGES} -sudo pip3 install meson +sudo pip3 install meson==0.43.0 # Ninja cd $HOME From f3fb5d61ccbd70cd76877ed7956ee2339deb225e Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 13 Dec 2017 17:10:14 +0100 Subject: [PATCH 3/3] Use correct option to compile a static binary in travis. We must use custom option `static-linkage` instead of meson's `default-library`. --- travis/compile.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/travis/compile.sh b/travis/compile.sh index 798ece2..b35431f 100755 --- a/travis/compile.sh +++ b/travis/compile.sh @@ -8,24 +8,17 @@ INSTALL_DIR=${BUILD_DIR}/INSTALL case ${PLATFORM} in "native_static") - MESON_OPTION="--default-library=static" + MESON_OPTION="-Dstatic-linkage=true" ;; "native_dyn") - MESON_OPTION="--default-library=shared" + MESON_OPTION="" ;; "win32_static") - MESON_OPTION="--default-library=static --cross-file ${BUILD_DIR}/meson_cross_file.txt" + MESON_OPTION="-Dstatic-linkage=true --cross-file ${BUILD_DIR}/meson_cross_file.txt" ;; "win32_dyn") - MESON_OPTION="--default-library=shared --cross-file ${BUILD_DIR}/meson_cross_file.txt" + MESON_OPTION="--cross-file ${BUILD_DIR}/meson_cross_file.txt" ;; - "android_arm") - MESON_OPTION="-Dandroid=true --default-library=shared --cross-file ${BUILD_DIR}/meson_cross_file.txt" - ;; - "android_arm64") - MESON_OPTION="-Dandroid=true --default-library=shared --cross-file ${BUILD_DIR}/meson_cross_file.txt" - ;; - esac cd ${TRAVIS_BUILD_DIR}