Add patches to cross-compile ctpp2 correctly.

This commit is contained in:
Matthieu Gautier 2017-01-17 12:02:21 +01:00 committed by Matthieu Gautier
parent 597fd8dbe1
commit ca53171bdc
4 changed files with 115 additions and 1 deletions

View File

@ -541,7 +541,12 @@ class CTPP2(Dependency, ReleaseDownloadMixin, CMakeMixin):
archive = Remotefile('ctpp2-2.8.3.tar.gz', archive = Remotefile('ctpp2-2.8.3.tar.gz',
'a83ffd07817adb575295ef40fbf759892512e5a63059c520f9062d9ab8fb42fc') 'a83ffd07817adb575295ef40fbf759892512e5a63059c520f9062d9ab8fb42fc')
configure_option = "-DMD5_SUPPORT=OFF" 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): class Pugixml(Dependency, ReleaseDownloadMixin, MesonMixin):

View File

@ -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 <CTPP2VMExecutable.hpp>
@brief CTPP Executable file
*/
-struct VMExecutable
+struct CTPP2DECL VMExecutable
{
/** CTPP magic number */
UCHAR_8 magic[4]; // 'CTPP' xor 0xFFFFFFFF

View File

@ -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 <Windows.h>
+#include <windows.h>
#else
#include <unistd.h>
#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 <stdio.h>
#include <errno.h>
-#ifdef _MSC_VER
- #include <WinSock2.h>
+#if defined(_MSC_VER) || defined(__MINGW32__)
+ #include <winsock2.h>
#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 <Winsock2.h>
+#if defined(_MSC_VER) || defined(__MINGW32__)
+#include <winsock2.h>
#else
#include <unistd.h>
#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 <stdlib.h>
#include <time.h>
-#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));

View File

@ -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})