diff --git a/kiwix-build.py b/kiwix-build.py index 320a182..b8fb0b6 100755 --- a/kiwix-build.py +++ b/kiwix-build.py @@ -541,7 +541,12 @@ class CTPP2(Dependency, ReleaseDownloadMixin, CMakeMixin): archive = Remotefile('ctpp2-2.8.3.tar.gz', 'a83ffd07817adb575295ef40fbf759892512e5a63059c520f9062d9ab8fb42fc') configure_option = "-DMD5_SUPPORT=OFF" - patches = ["ctpp2_include.patch", "ctpp2_no_src_modification.patch", "ctpp2_fix-static-libname.patch"] + patches = ["ctpp2_include.patch", + "ctpp2_no_src_modification.patch", + "ctpp2_fix-static-libname.patch", + "ctpp2_mingw32.patch", + "ctpp2_dll_export_VMExecutable.patch", + "ctpp2_win_install_lib_in_lib_dir.patch"] class Pugixml(Dependency, ReleaseDownloadMixin, MesonMixin): diff --git a/patches/ctpp2_dll_export_VMExecutable.patch b/patches/ctpp2_dll_export_VMExecutable.patch new file mode 100644 index 0000000..e3a941e --- /dev/null +++ b/patches/ctpp2_dll_export_VMExecutable.patch @@ -0,0 +1,12 @@ +diff -ur ctpp2-2.8.3/include/CTPP2VMExecutable.hpp ctpp2-2.8.3.patched/include/CTPP2VMExecutable.hpp +--- ctpp2-2.8.3/include/CTPP2VMExecutable.hpp 2012-08-02 09:22:44.000000000 +0200 ++++ ctpp2-2.8.3.patched/include/CTPP2VMExecutable.hpp 2017-01-17 11:47:08.332691919 +0100 +@@ -52,7 +52,7 @@ + @struct VMExecutable CTPP2VMExecutable.hpp + @brief CTPP Executable file + */ +-struct VMExecutable ++struct CTPP2DECL VMExecutable + { + /** CTPP magic number */ + UCHAR_8 magic[4]; // 'CTPP' xor 0xFFFFFFFF diff --git a/patches/ctpp2_mingw32.patch b/patches/ctpp2_mingw32.patch new file mode 100644 index 0000000..ca62dd5 --- /dev/null +++ b/patches/ctpp2_mingw32.patch @@ -0,0 +1,85 @@ +diff -ur ctpp2-2.8.3/include/CTPP2SourceLoader.hpp ctpp2-2.8.3.patched/include/CTPP2SourceLoader.hpp +--- ctpp2-2.8.3/include/CTPP2SourceLoader.hpp 2017-01-09 17:00:57.542353340 +0100 ++++ ctpp2-2.8.3.patched/include/CTPP2SourceLoader.hpp 2017-01-09 16:54:04.467316656 +0100 +@@ -33,7 +33,7 @@ + #define _CTPP2_SOURCE_LOADER_HPP__ 1 + + #ifdef _WIN32 +-#include ++#include + #else + #include + #endif +diff -ur ctpp2-2.8.3/src/CTPP2DTOA.cpp ctpp2-2.8.3.patched/src/CTPP2DTOA.cpp +--- ctpp2-2.8.3/src/CTPP2DTOA.cpp 2012-11-11 00:50:01.000000000 +0100 ++++ ctpp2-2.8.3.patched/src/CTPP2DTOA.cpp 2017-01-09 16:53:13.184181977 +0100 +@@ -158,8 +158,8 @@ + #include + #include + +-#ifdef _MSC_VER +- #include ++#if defined(_MSC_VER) || defined(__MINGW32__) ++ #include + #ifndef BIG_ENDIAN + #define BIG_ENDIAN BIGENDIAN + #endif +diff -ur ctpp2-2.8.3/src/CTPP2StringIconvOutputCollector.cpp ctpp2-2.8.3.patched/src/CTPP2StringIconvOutputCollector.cpp +--- ctpp2-2.8.3/src/CTPP2StringIconvOutputCollector.cpp 2012-08-02 09:22:44.000000000 +0200 ++++ ctpp2-2.8.3.patched/src/CTPP2StringIconvOutputCollector.cpp 2017-01-09 16:56:11.162179732 +0100 +@@ -85,7 +85,7 @@ + size_t iDstLength = CTPP_ESCAPE_BUFFER_LEN; + + char aDstData[CTPP_ESCAPE_BUFFER_LEN]; +-#if defined(linux) || defined(__APPLE__) ++#if defined(linux) || defined(__APPLE__) || defined(__MINGW32__) + char * aSrcData = (char *)vData; + #else + const char * aSrcData = (const char *)vData; +diff -ur ctpp2-2.8.3/src/functions/FnHostname.cpp ctpp2-2.8.3.patched/src/functions/FnHostname.cpp +--- ctpp2-2.8.3/src/functions/FnHostname.cpp 2012-11-10 21:40:36.000000000 +0100 ++++ ctpp2-2.8.3.patched/src/functions/FnHostname.cpp 2017-01-09 16:58:53.987435623 +0100 +@@ -34,8 +34,8 @@ + #include "CTPP2Logger.hpp" + #include "FnHostname.hpp" + +-#ifdef _MSC_VER +-#include ++#if defined(_MSC_VER) || defined(__MINGW32__) ++#include + #else + #include + #endif +diff -ur ctpp2-2.8.3/src/functions/FnIconv.cpp ctpp2-2.8.3.patched/src/functions/FnIconv.cpp +--- ctpp2-2.8.3/src/functions/FnIconv.cpp 2012-08-02 09:22:44.000000000 +0200 ++++ ctpp2-2.8.3.patched/src/functions/FnIconv.cpp 2017-01-09 16:58:28.948857601 +0100 +@@ -173,7 +173,7 @@ + size_t iDstLength = CTPP_ESCAPE_BUFFER_LEN; + + char aDstData[CTPP_ESCAPE_BUFFER_LEN]; +-#if defined(linux) || defined(__APPLE__) ++#if defined(linux) || defined(__APPLE__) || defined(__MINGW32__) + char * aSrcData = (char *)sWhat.data(); + #else + const char * aSrcData = (const char *)sWhat.data(); +diff -ur ctpp2-2.8.3/src/functions/FnRandom.cpp ctpp2-2.8.3.patched/src/functions/FnRandom.cpp +--- ctpp2-2.8.3/src/functions/FnRandom.cpp 2012-11-10 21:36:30.000000000 +0100 ++++ ctpp2-2.8.3.patched/src/functions/FnRandom.cpp 2017-01-09 16:59:59.879325141 +0100 +@@ -37,7 +37,7 @@ + #include + #include + +-#ifdef _MSC_VER ++#if defined(_MSC_VER) || defined(__MINGW32__) + #define random() rand() + #define INT_64(x) (INT_64)(x) + #define srandomdev() srand( (unsigned)time(NULL) ); +@@ -51,7 +51,7 @@ + // + FnRandom::FnRandom() + { +-#if defined(__FreeBSD__) || defined(_MSC_VER) ++#if defined(__FreeBSD__) || defined(_MSC_VER) || defined(__MINGW32__) + srandomdev(); + #else + srandom(time(NULL)); diff --git a/patches/ctpp2_win_install_lib_in_lib_dir.patch b/patches/ctpp2_win_install_lib_in_lib_dir.patch new file mode 100644 index 0000000..611eaf1 --- /dev/null +++ b/patches/ctpp2_win_install_lib_in_lib_dir.patch @@ -0,0 +1,12 @@ +diff -ur ctpp2-2.8.3/CMakeLists.txt ctpp2-2.8.3.patched/CMakeLists.txt +--- ctpp2-2.8.3/CMakeLists.txt 2017-01-17 10:09:06.259494234 +0100 ++++ ctpp2-2.8.3.patched/CMakeLists.txt 2017-01-17 11:48:18.427522886 +0100 +@@ -785,7 +785,7 @@ + + INSTALL(TARGETS ctpp2-static DESTINATION lib${LIB_SUFFIX}) + +- INSTALL(TARGETS ctpp2 DESTINATION .) ++ INSTALL(TARGETS ctpp2 DESTINATION lib${LIB_SUFFIX}) + + FILE(WRITE ctpp2-config.cmd ${CTPP_COMPILER_HELPER}) +