Skip to content

Commit

Permalink
Patch ports to fix MinGW failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
teo-tsirpanis committed Jul 5, 2024
1 parent b0502be commit a6d9d66
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ports/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ For ease of review when patching existing ports, you are recommended to make one

| Port | Reason |
|---------------|------------------------------------------------------------------|
| `aws-c-io` | Patching to fix MinGW build failures. |
| `aws-sdk-cpp` | Patching to fix MinGW build failures. |
| `libmagic` | Updating to the upstream port deferred due to failures. |
| `openssl` | Pinning to OpenSSL 1.1 until we can move to 3.0 in January 2024. |
| `libfaketime` | Port does not yet exist upstream |
22 changes: 22 additions & 0 deletions ports/aws-c-io/fix-pointer-mismatch.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/source/windows/secure_channel_tls_handler.c b/source/windows/secure_channel_tls_handler.c
index b62b1a0..48f4556 100644
--- a/source/windows/secure_channel_tls_handler.c
+++ b/source/windows/secure_channel_tls_handler.c
@@ -53,7 +53,7 @@ struct secure_channel_ctx {
struct aws_tls_ctx ctx;
struct aws_string *alpn_list;
SCHANNEL_CRED credentials;
- PCERT_CONTEXT pcerts;
+ PCCERT_CONTEXT pcerts;
HCERTSTORE cert_store;
HCERTSTORE custom_trust_store;
HCRYPTPROV crypto_provider;
@@ -188,7 +188,7 @@ static int s_manually_verify_peer_cert(struct aws_channel_handler *handler) {
int result = AWS_OP_ERR;
CERT_CONTEXT *peer_certificate = NULL;
HCERTCHAINENGINE engine = NULL;
- CERT_CHAIN_CONTEXT *cert_chain_ctx = NULL;
+ PCCERT_CHAIN_CONTEXT cert_chain_ctx = NULL;

/* get the peer's certificate so we can validate it.*/
SECURITY_STATUS status =
2 changes: 2 additions & 0 deletions ports/aws-c-io/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ vcpkg_from_github(
REF "v${VERSION}"
SHA512 b5dc81635ce775c3783df2d4f6ccf0890b1e1669bddb1c10f6d200203684e84504ca87099cb88874010df28f98f658da5a4eacb9e4df0408d40d845f3d394f48
HEAD_REF master
PATCHES
"fix-pointer-mismatch.patch"
)

vcpkg_cmake_configure(
Expand Down
12 changes: 12 additions & 0 deletions ports/aws-sdk-cpp/fix-winsock-headers.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/src/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp b/src/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp
index b8ab519..7cd91e9 100644
--- a/src/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp
+++ b/src/aws-cpp-sdk-core/source/http/windows/WinHttpSyncHttpClient.cpp
@@ -19,6 +19,7 @@

#include <Windows.h>
#include <winhttp.h>
+#include <WinSock2.h>
#include <mstcpip.h> // for tcp_keepalive
#include <sstream>
#include <iostream>
1 change: 1 addition & 0 deletions ports/aws-sdk-cpp/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ vcpkg_from_github(
lock-curl-http-and-tls-settings.patch
fix_find_curl.patch
find-dependency.patch
fix-winsock-headers.patch # In MinGW, mstcpip.h references types from headers it does not include itself.
)

string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" FORCE_SHARED_CRT)
Expand Down
16 changes: 16 additions & 0 deletions ports/libmagic/0016-Remove-timespec-aliases.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/src/cdf.h b/src/cdf.h
index 0505666..9645114 100644
--- a/src/cdf.h
+++ b/src/cdf.h
@@ -35,11 +35,6 @@
#ifndef _H_CDF_
#define _H_CDF_

-#ifdef WIN32
-#include <winsock2.h>
-#define timespec timeval
-#define tv_nsec tv_usec
-#endif
#ifdef __DJGPP__
#define timespec timeval
#define tv_nsec tv_usec
1 change: 1 addition & 0 deletions ports/libmagic/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ if(VCPKG_TARGET_IS_WINDOWS)
"0011-Remove-pipe-related-functions-in-funcs.c.patch"
"0014-Define-POSIX-macros-if-missing.patch"
"0015-MSYS2-Remove-ioctl-call.patch"
"0016-Remove-timespec-aliases.patch"
)
endif()

Expand Down

0 comments on commit a6d9d66

Please sign in to comment.