changeset 160:d3e7c86c3a4e

added patch to build using mingw
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 23 Jun 2024 10:53:40 +0200
parents 99c14487f96b
children f7654d481226
files Aws/AwsStaticConfiguration.cmake Aws/aws-c-io-0.14.9.patch Aws/aws-sdk-cpp-1.11.178.patch
diffstat 3 files changed, 202 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Aws/AwsStaticConfiguration.cmake	Sun Jun 23 10:30:48 2024 +0200
+++ b/Aws/AwsStaticConfiguration.cmake	Sun Jun 23 10:53:40 2024 +0200
@@ -79,10 +79,29 @@
 SET(AWS_C_HTTP_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/aws/aws-c-http-${AWS_C_HTTP_VERSION}.tar.gz")
 DownloadPackage(${AWS_C_HTTP_MD5} ${AWS_C_HTTP_URL} "${AWS_C_HTTP_SOURCES_DIR}")
 
+
 SET(AWS_C_IO_SOURCES_DIR ${CMAKE_BINARY_DIR}/aws-c-io-${AWS_C_IO_VERSION})
 SET(AWS_C_IO_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/aws/aws-c-io-${AWS_C_IO_VERSION}.tar.gz")
+
+if (IS_DIRECTORY "${AWS_C_IO_SOURCES_DIR}")
+  set(FirstRun OFF)
+else()
+  set(FirstRun ON)
+endif()
+
 DownloadPackage(${AWS_C_IO_MD5} ${AWS_C_IO_URL} "${AWS_C_IO_SOURCES_DIR}")
 
+if (FirstRun)
+  # This is a patch for MinGW
+  execute_process(
+    COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
+    ${CMAKE_CURRENT_LIST_DIR}/aws-c-io-${AWS_C_IO_VERSION}.patch
+    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+    RESULT_VARIABLE Failure
+    )
+endif()
+
+
 SET(AWS_C_MQTT_SOURCES_DIR ${CMAKE_BINARY_DIR}/aws-c-mqtt-${AWS_C_MQTT_VERSION})
 SET(AWS_C_MQTT_URL "https://orthanc.uclouvain.be/downloads/third-party-downloads/aws/aws-c-mqtt-${AWS_C_MQTT_VERSION}.tar.gz")
 DownloadPackage(${AWS_C_MQTT_MD5} ${AWS_C_MQTT_URL} "${AWS_C_MQTT_SOURCES_DIR}")
@@ -108,7 +127,7 @@
 DownloadPackage(${AWS_SDK_CPP_MD5} ${AWS_SDK_CPP_URL} "${AWS_SDK_CPP_SOURCES_DIR}")
 
 if (FirstRun)
-  # This is a patch for Microsoft Visual Studio 2015
+  # This is a patch for Microsoft Visual Studio 2015 and MinGW
   execute_process(
     COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
     ${CMAKE_CURRENT_LIST_DIR}/aws-sdk-cpp-${AWS_SDK_CPP_VERSION}.patch
@@ -289,9 +308,11 @@
   if (MINGW)
     list(REMOVE_ITEM AWS_SOURCES
       ${AWS_C_COMMON_SOURCES_DIR}/source/windows//system_info.c
+      ${AWS_SDK_CPP_SOURCES_DIR}/src/aws-cpp-sdk-core/source/platform/windows//Environment.cpp
       )
     list(APPEND AWS_SOURCES
       ${AWS_C_COMMON_SOURCES_DIR}/source/posix/system_info.c
+      ${AWS_SDK_CPP_SOURCES_DIR}/src/aws-cpp-sdk-core/source/platform/linux-shared/Environment.cpp
       )
   endif()
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Aws/aws-c-io-0.14.9.patch	Sun Jun 23 10:53:40 2024 +0200
@@ -0,0 +1,92 @@
+diff -urEb aws-c-io-0.14.9.orig/include/aws/io/private/pki_utils.h aws-c-io-0.14.9/include/aws/io/private/pki_utils.h
+--- aws-c-io-0.14.9.orig/include/aws/io/private/pki_utils.h	2024-06-04 18:27:58.000000000 +0200
++++ aws-c-io-0.14.9/include/aws/io/private/pki_utils.h	2024-06-23 10:39:15.047978000 +0200
+@@ -9,7 +9,7 @@
+ #ifdef _WIN32
+ /* It's ok to include external headers because this is a PRIVATE header file
+  * (it is usually a crime to include windows.h from header file) */
+-#    include <Windows.h>
++#    include <windows.h>
+ #endif /* _WIN32 */
+ 
+ #ifdef AWS_OS_APPLE
+diff -urEb aws-c-io-0.14.9.orig/source/windows/iocp/iocp_event_loop.c aws-c-io-0.14.9/source/windows/iocp/iocp_event_loop.c
+--- aws-c-io-0.14.9.orig/source/windows/iocp/iocp_event_loop.c	2024-06-04 18:27:58.000000000 +0200
++++ aws-c-io-0.14.9/source/windows/iocp/iocp_event_loop.c	2024-06-23 10:39:15.047978000 +0200
+@@ -12,7 +12,7 @@
+ 
+ #include <aws/io/logging.h>
+ 
+-#include <Windows.h>
++#include <windows.h>
+ 
+ /* The next set of struct definitions are taken directly from the
+     windows documentation. We can't include the header files directly
+diff -urEb aws-c-io-0.14.9.orig/source/windows/iocp/pipe.c aws-c-io-0.14.9/source/windows/iocp/pipe.c
+--- aws-c-io-0.14.9.orig/source/windows/iocp/pipe.c	2024-06-04 18:27:58.000000000 +0200
++++ aws-c-io-0.14.9/source/windows/iocp/pipe.c	2024-06-23 10:39:15.047978000 +0200
+@@ -11,7 +11,7 @@
+ #include <stdbool.h>
+ #include <stdio.h>
+ 
+-#include <Windows.h>
++#include <windows.h>
+ 
+ enum read_end_state {
+     /* Pipe is open. */
+diff -urEb aws-c-io-0.14.9.orig/source/windows/iocp/socket.c aws-c-io-0.14.9/source/windows/iocp/socket.c
+--- aws-c-io-0.14.9.orig/source/windows/iocp/socket.c	2024-06-04 18:27:58.000000000 +0200
++++ aws-c-io-0.14.9/source/windows/iocp/socket.c	2024-06-23 10:39:15.047978000 +0200
+@@ -9,9 +9,9 @@
+ below, clang-format doesn't work (at least on my version) with the c-style comments.*/
+ 
+ // clang-format off
+-#include <WS2tcpip.h>
+-#include <MSWSock.h>
+-#include <Mstcpip.h>
++#include <ws2tcpip.h>
++#include <mswsock.h>
++#include <mstcpip.h>
+ // clang-format on
+ 
+ #include <aws/io/socket.h>
+diff -urEb aws-c-io-0.14.9.orig/source/windows/shared_library.c aws-c-io-0.14.9/source/windows/shared_library.c
+--- aws-c-io-0.14.9.orig/source/windows/shared_library.c	2024-06-04 18:27:58.000000000 +0200
++++ aws-c-io-0.14.9/source/windows/shared_library.c	2024-06-23 10:39:15.047978000 +0200
+@@ -4,7 +4,7 @@
+  */
+ 
+ // clang-format off
+-#include <Windows.h>
++#include <windows.h>
+ #include <libloaderapi.h>
+ // clang-format on
+ 
+diff -urEb aws-c-io-0.14.9.orig/source/windows/windows_pki_utils.c aws-c-io-0.14.9/source/windows/windows_pki_utils.c
+--- aws-c-io-0.14.9.orig/source/windows/windows_pki_utils.c	2024-06-04 18:27:58.000000000 +0200
++++ aws-c-io-0.14.9/source/windows/windows_pki_utils.c	2024-06-23 10:39:15.047978000 +0200
+@@ -10,7 +10,7 @@
+ 
+ #include <aws/io/logging.h>
+ 
+-#include <Windows.h>
++#include <windows.h>
+ #include <stdio.h>
+ #include <string.h>
+ 
+diff -urEb aws-c-io-0.14.9.orig/source/windows/winsock_init.c aws-c-io-0.14.9/source/windows/winsock_init.c
+--- aws-c-io-0.14.9.orig/source/windows/winsock_init.c	2024-06-04 18:27:58.000000000 +0200
++++ aws-c-io-0.14.9/source/windows/winsock_init.c	2024-06-23 10:39:15.047978000 +0200
+@@ -8,9 +8,9 @@
+ below, clang-format doesn't work (at least on my version) with the c-style comments. */
+ 
+ // clang-format off
+-#include <WinSock2.h>
+-#include <WS2tcpip.h>
+-#include <MSWSock.h>
++#include <winsock2.h>
++#include <ws2tcpip.h>
++#include <mswsock.h>
+ // clang-format on
+ 
+ #include <aws/io/logging.h>
--- a/Aws/aws-sdk-cpp-1.11.178.patch	Sun Jun 23 10:30:48 2024 +0200
+++ b/Aws/aws-sdk-cpp-1.11.178.patch	Sun Jun 23 10:53:40 2024 +0200
@@ -1,6 +1,68 @@
+Only in aws-sdk-cpp-1.11.178/src/aws-cpp-sdk-core/include/aws/core: SDKConfig.h
+diff -urEb aws-sdk-cpp-1.11.178.orig/src/aws-cpp-sdk-core/include/aws/core/utils/Array.h aws-sdk-cpp-1.11.178/src/aws-cpp-sdk-core/include/aws/core/utils/Array.h
+--- aws-sdk-cpp-1.11.178.orig/src/aws-cpp-sdk-core/include/aws/core/utils/Array.h	2023-10-06 20:16:49.000000000 +0200
++++ aws-sdk-cpp-1.11.178/src/aws-cpp-sdk-core/include/aws/core/utils/Array.h	2024-06-23 10:47:33.294537700 +0200
+@@ -14,7 +14,7 @@
+ #include <cstring>
+ #include <algorithm>
+ 
+-#ifdef _WIN32
++#ifdef _MSC_VER
+ 
+ #include <iterator>
+ 
+@@ -54,7 +54,7 @@
+                 {
+                     m_data.reset(Aws::NewArray<T>(m_size, ARRAY_ALLOCATION_TAG));
+ 
+-#ifdef _WIN32
++#ifdef _MSC_VER
+                     std::copy(arrayToCopy, arrayToCopy + arraySize, stdext::checked_array_iterator< T * >(m_data.get(), m_size));
+ #else
+                     std::copy(arrayToCopy, arrayToCopy + arraySize, m_data.get());
+@@ -82,7 +82,7 @@
+                     if(arr->m_size > 0 && arr->m_data)
+                     {
+                         size_t arraySize = arr->m_size;
+-#ifdef _WIN32
++#ifdef _MSC_VER
+                         std::copy(arr->m_data.get(), arr->m_data.get() + arraySize, stdext::checked_array_iterator< T * >(m_data.get() + location, m_size));
+ #else
+                         std::copy(arr->m_data.get(), arr->m_data.get() + arraySize, m_data.get() + location);
+@@ -101,7 +101,7 @@
+                 {
+                     m_data.reset(Aws::NewArray<T>(m_size, ARRAY_ALLOCATION_TAG));
+ 
+-#ifdef _WIN32
++#ifdef _MSC_VER
+                     std::copy(other.m_data.get(), other.m_data.get() + other.m_size, stdext::checked_array_iterator< T * >(m_data.get(), m_size));
+ #else
+                     std::copy(other.m_data.get(), other.m_data.get() + other.m_size, m_data.get());
+@@ -134,7 +134,7 @@
+                 {
+                     m_data.reset(Aws::NewArray<T>(m_size, ARRAY_ALLOCATION_TAG));
+ 
+-#ifdef _WIN32
++#ifdef _MSC_VER
+                     std::copy(other.m_data.get(), other.m_data.get() + other.m_size, stdext::checked_array_iterator< T * >(m_data.get(), m_size));
+ #else
+                     std::copy(other.m_data.get(), other.m_data.get() + other.m_size, m_data.get());
+Only in aws-sdk-cpp-1.11.178/src/aws-cpp-sdk-core/include/aws/core/utils: Array.h~
+diff -urEb aws-sdk-cpp-1.11.178.orig/src/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp aws-sdk-cpp-1.11.178/src/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp
+--- aws-sdk-cpp-1.11.178.orig/src/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp	2023-10-06 20:16:49.000000000 +0200
++++ aws-sdk-cpp-1.11.178/src/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp	2024-06-22 19:00:43.200750034 +0200
+@@ -10,7 +10,7 @@
+ #include <aws/core/utils/memory/stl/AWSVector.h>
+ #include <cassert>
+ #include <iostream>
+-#include <Userenv.h>
++#include <userenv.h>
+ 
+ #pragma warning( disable : 4996)
+ 
 diff -urEb aws-sdk-cpp-1.11.178.orig/src/aws-cpp-sdk-core/source/utils/crypto/openssl/CryptoImpl.cpp aws-sdk-cpp-1.11.178/src/aws-cpp-sdk-core/source/utils/crypto/openssl/CryptoImpl.cpp
---- aws-sdk-cpp-1.11.178.orig/src/aws-cpp-sdk-core/source/utils/crypto/openssl/CryptoImpl.cpp	2024-06-20 17:16:09.512162194 +0200
-+++ aws-sdk-cpp-1.11.178/src/aws-cpp-sdk-core/source/utils/crypto/openssl/CryptoImpl.cpp	2024-06-20 17:16:33.863888288 +0200
+--- aws-sdk-cpp-1.11.178.orig/src/aws-cpp-sdk-core/source/utils/crypto/openssl/CryptoImpl.cpp	2023-10-06 20:16:49.000000000 +0200
++++ aws-sdk-cpp-1.11.178/src/aws-cpp-sdk-core/source/utils/crypto/openssl/CryptoImpl.cpp	2024-06-22 18:38:51.196880348 +0200
 @@ -221,7 +221,7 @@
                  EVP_DigestInit_ex(ctx, EVP_md5(), nullptr);
  
@@ -28,3 +90,27 @@
                  {
                      currentPos = 0;
                      stream.clear();
+diff -urEb aws-sdk-cpp-1.11.178.orig/src/aws-cpp-sdk-core/source/utils/StringUtils.cpp aws-sdk-cpp-1.11.178/src/aws-cpp-sdk-core/source/utils/StringUtils.cpp
+--- aws-sdk-cpp-1.11.178.orig/src/aws-cpp-sdk-core/source/utils/StringUtils.cpp	2023-10-06 20:16:49.000000000 +0200
++++ aws-sdk-cpp-1.11.178/src/aws-cpp-sdk-core/source/utils/StringUtils.cpp	2024-06-22 18:55:21.912052713 +0200
+@@ -14,7 +14,7 @@
+ #include <functional>
+ 
+ #ifdef _WIN32
+-#include <Windows.h>
++#include <windows.h>
+ #endif
+ 
+ using namespace Aws::Utils;
+diff -urEb aws-sdk-cpp-1.11.178.orig/src/aws-cpp-sdk-text-to-speech/include/aws/text-to-speech/windows/WaveOutPCMOutputDriver.h aws-sdk-cpp-1.11.178/src/aws-cpp-sdk-text-to-speech/include/aws/text-to-speech/windows/WaveOutPCMOutputDriver.h
+--- aws-sdk-cpp-1.11.178.orig/src/aws-cpp-sdk-text-to-speech/include/aws/text-to-speech/windows/WaveOutPCMOutputDriver.h	2023-10-06 20:16:49.000000000 +0200
++++ aws-sdk-cpp-1.11.178/src/aws-cpp-sdk-text-to-speech/include/aws/text-to-speech/windows/WaveOutPCMOutputDriver.h	2024-06-22 18:57:00.963064735 +0200
+@@ -10,7 +10,7 @@
+ 
+ #include <mutex>
+ 
+-#include <Windows.h>
++#include <windows.h>
+ 
+ namespace Aws
+ {