From 1fda64670868ca7585b2ecb5c47d0785c21eb4b8 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 12 Jul 2017 14:30:55 +0200 Subject: [PATCH] Always build ctpp2c for the host and static. We are using `ctpp2c` when building kiwix-lib to compile embedded resources. As `ctpp2c` will be used in the host machine, it always need to be compiled for the host (native). But we still want tho ctpp2 library compiled for the target platform. As we don't want handle the conflict between two dynamic lib with the same name but for two different platforms, we build ctpp2c statically. --- dependencies.py | 26 +++++++++++++++++++++-- patches/ctpp2_compile_ctpp2c_static.patch | 13 ++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 patches/ctpp2_compile_ctpp2c_static.patch diff --git a/dependencies.py b/dependencies.py index b22ce2e..606bd75 100644 --- a/dependencies.py +++ b/dependencies.py @@ -143,12 +143,34 @@ class CTPP2(Dependency): "ctpp2_mingw32.patch", "ctpp2_dll_export_VMExecutable.patch", "ctpp2_win_install_lib_in_lib_dir.patch", - "ctpp2_iconv_support.patch"] + "ctpp2_iconv_support.patch", + "ctpp2_compile_ctpp2c_static.patch", + ] class Builder(CMakeBuilder): configure_option = "-DMD5_SUPPORT=OFF" +class CTPP2C(CTPP2): + name = "ctpp2c" + force_native_build = True + + class Builder(CTPP2.Builder): + make_target = "ctpp2c" + + @property + def build_path(self): + return super().build_path+"_native" + + def _install(self, context): + context.try_skip(self.build_path) + command = "cp {ctpp2c}* {install_dir}".format( + ctpp2c=pj(self.build_path, 'ctpp2c'), + install_dir=pj(self.buildEnv.install_dir, 'bin') + ) + self.buildEnv.run_command(command, self.build_path, context) + + class Pugixml(Dependency): name = "pugixml" version = "1.2" @@ -272,7 +294,7 @@ class Kiwixlib(Dependency): def dependencies(self): base_dependencies = ["pugixml", "libzim", "zlib", "lzma"] if self.buildEnv.platform_info.build != 'android': - base_dependencies += ['ctpp2'] + base_dependencies += ['ctpp2', 'ctpp2c'] if self.buildEnv.platform_info.build != 'native': return base_dependencies + ["icu4c_cross-compile"] else: diff --git a/patches/ctpp2_compile_ctpp2c_static.patch b/patches/ctpp2_compile_ctpp2c_static.patch new file mode 100644 index 0000000..398d306 --- /dev/null +++ b/patches/ctpp2_compile_ctpp2c_static.patch @@ -0,0 +1,13 @@ +diff -u ctpp2-2.8.3/CMakeLists.txt ctpp2-2.8.3-static/CMakeLists.txt +--- ctpp2-2.8.3/CMakeLists.txt 2017-07-12 11:53:28.656535071 +0200 ++++ ctpp2-2.8.3-static/CMakeLists.txt 2017-07-12 11:52:15.358692988 +0200 +@@ -464,7 +464,8 @@ + + # CTPP Compiler + ADD_EXECUTABLE(ctpp2c tests/CTPP2Compiler.cpp) +-TARGET_LINK_LIBRARIES(ctpp2c ctpp2) ++TARGET_LINK_LIBRARIES(ctpp2c ctpp2-static) ++TARGET_LINK_LIBRARIES(ctpp2c "-static") + + # CTPP2 Interpreter + ADD_EXECUTABLE(ctpp2i tests/CTPP2Interpreter.cpp)