Skip to content

Commit

Permalink
GH-19: Improved ftruncate fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
negrutiu committed May 21, 2024
1 parent ac12326 commit e71b45d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 8 additions & 0 deletions vcpkg_overlay_ports/curl/nscurl/curl_ftruncate.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1245,3 +1245,3 @@
check_symbol_exists(pipe "${CURL_INCLUDES}" HAVE_PIPE)
-check_symbol_exists(ftruncate "${CURL_INCLUDES}" HAVE_FTRUNCATE)
+# check_symbol_exists(ftruncate "${CURL_INCLUDES}" HAVE_FTRUNCATE) # nscurl: The mingw-x64 implementation of ftruncate() calls FindFirstVolume/FindNextVolume/GetFileSizeEx, unavailable in NT4
check_symbol_exists(fseeko "${CURL_INCLUDES};stdio.h" HAVE_FSEEKO)
5 changes: 1 addition & 4 deletions vcpkg_overlay_ports/curl/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ vcpkg_from_github(
dependencies.patch
cmake-config.patch
"${COMPRESSION_FIX}"
nscurl/curl_ftruncate.patch # nscurl: mingw-x64 implementation of ftruncate() calls FindFirstVolume/FindNextVolume/GetFileSizeEx, unavailable in NT4
nscurl/curl_toolhelp.diff # nscurl: no Tool Help calls (i.e. CreateToolhelp32Snapshot). inexistent in NT4, unneeded by nscurl
nscurl/curl_wspiapi.diff # nscurl: fix linking to Ws2_32!getaddrinfo and Ws2_32!freeaddrinfo when _WIN32_WINNT <= 0x0500
nscurl/curl_xprequirement.diff # nscurl: remove target >= XP restriction
Expand Down Expand Up @@ -57,10 +58,6 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
non-http HTTP_ONLY
)

# nscurl: -D_UNISTD_H counters the effect of curl commit 474a947e (11 Oct 2022) "cmake: enable more detection on Windows". It prevents "unistd.h" from defining ftruncate(). Its mingw-x64 implementation calls FindFirstVolume/FindNextVolume/GetFileSizeEx, unavailable in NT4
set(VCPKG_C_FLAGS "${VCPKG_C_FLAGS} -D_UNISTD_H")
set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS} -D_UNISTD_H")

set(OPTIONS "")

# nscurl: no schannel
Expand Down

0 comments on commit e71b45d

Please sign in to comment.