From 00679b66e3d9fd49afd19a88418426fb50c39b08 Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Wed, 11 Jan 2017 10:59:45 -0800 Subject: added support for building uwp versions --- ports/curl/0002_fix_uwp.patch | 92 +++++++++++++++++++++++++++++++++++++++++++ ports/curl/portfile.cmake | 46 +++++++++++++++++----- 2 files changed, 128 insertions(+), 10 deletions(-) create mode 100644 ports/curl/0002_fix_uwp.patch diff --git a/ports/curl/0002_fix_uwp.patch b/ports/curl/0002_fix_uwp.patch new file mode 100644 index 000000000..a96f67838 --- /dev/null +++ b/ports/curl/0002_fix_uwp.patch @@ -0,0 +1,92 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ed3f38a..d6480b7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1010,7 +1010,9 @@ include(CMake/OtherTests.cmake) + add_definitions(-DHAVE_CONFIG_H) + + # For windows, do not allow the compiler to use default target (Vista). +-if(WIN32) ++if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") ++ add_definitions(-D_WIN32_WINNT=0x0A00 -DHAVE_STRUCT_POLLFD -D_WINSOCK_DEPRECATED_NO_WARNINGS) ++elseif(WIN32) + add_definitions(-D_WIN32_WINNT=0x0501) + endif(WIN32) + +diff --git a/lib/curl_gethostname.c b/lib/curl_gethostname.c +index 2591fd8..4380b7c 100644 +--- a/lib/curl_gethostname.c ++++ b/lib/curl_gethostname.c +@@ -21,6 +21,7 @@ + ***************************************************************************/ + + #include "curl_setup.h" ++#include "curl/curl.h" + + #include "curl_gethostname.h" + +@@ -64,7 +65,7 @@ int Curl_gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen) { + #ifdef DEBUGBUILD + + /* Override host name when environment variable CURL_GETHOSTNAME is set */ +- const char *force_hostname = getenv("CURL_GETHOSTNAME"); ++ const char *force_hostname = curl_getenv("CURL_GETHOSTNAME"); + if(force_hostname) { + strncpy(name, force_hostname, namelen); + err = 0; +diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c +index 812a073..3c322ed 100644 +--- a/lib/curl_ntlm_core.c ++++ b/lib/curl_ntlm_core.c +@@ -696,7 +696,7 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash, + + /* Calculate the timestamp */ + #ifdef DEBUGBUILD +- char *force_timestamp = getenv("CURL_FORCETIME"); ++ char *force_timestamp = curl_getenv("CURL_FORCETIME"); + if(force_timestamp) + tw = CURL_OFF_T_C(11644473600) * 10000000; + else +diff --git a/lib/ftp.c b/lib/ftp.c +index b231731..d50779f 100644 +--- a/lib/ftp.c ++++ b/lib/ftp.c +@@ -3250,7 +3250,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status, + ssize_t nread; + int ftpcode; + CURLcode result = CURLE_OK; +- char *path; ++ char *path = NULL; + const char *path_to_use = data->state.path; + + if(!ftp) +diff --git a/lib/smb.c b/lib/smb.c +index 7cb0c96..2f43d3c 100644 +--- a/lib/smb.c ++++ b/lib/smb.c +@@ -32,8 +32,12 @@ + + #ifdef HAVE_PROCESS_H + #include ++#if defined(CURL_WINDOWS_APP) ++#define getpid GetCurrentProcessId ++#else + #define getpid _getpid + #endif ++#endif + + #include "smb.h" + #include "urldata.h" +diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c +index 56a8823..4032e7e 100644 +--- a/lib/vtls/vtls.c ++++ b/lib/vtls/vtls.c +@@ -197,7 +197,7 @@ unsigned int Curl_rand(struct Curl_easy *data) + static bool seeded = FALSE; + + #ifdef CURLDEBUG +- char *force_entropy = getenv("CURL_ENTROPY"); ++ char *force_entropy = curl_getenv("CURL_ENTROPY"); + if(force_entropy) { + if(!seeded) { + size_t elen = strlen(force_entropy); diff --git a/ports/curl/portfile.cmake b/ports/curl/portfile.cmake index 01c76718b..e8fc658c0 100644 --- a/ports/curl/portfile.cmake +++ b/ports/curl/portfile.cmake @@ -13,22 +13,48 @@ vcpkg_apply_patches( ${CMAKE_CURRENT_LIST_DIR}/0001_cmake.patch ) +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/0002_fix_uwp.patch +) +endif() + if (VCPKG_CRT_LINKAGE STREQUAL dynamic) SET(CURL_STATICLIB OFF) else() SET(CURL_STATICLIB ON) endif() -vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - OPTIONS - -DBUILD_TESTING=OFF - -DBUILD_CURL_EXE=OFF - -DENABLE_MANUAL=OFF - -DCURL_STATICLIB=${CURL_STATICLIB} - OPTIONS_DEBUG - -DENABLE_DEBUG=ON -) +if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DBUILD_TESTING=OFF + -DBUILD_CURL_EXE=OFF + -DENABLE_MANUAL=OFF + -DUSE_WIN32_LDAP=OFF + -DCURL_DISABLE_TELNET=ON + -DENABLE_IPV6=OFF + -DENABLE_UNIX_SOCKETS=OFF + -DCMAKE_USE_OPENSSL=ON + -DCURL_STATICLIB=${CURL_STATICLIB} + OPTIONS_DEBUG + -DENABLE_DEBUG=ON + ) +else() + vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DBUILD_TESTING=OFF + -DBUILD_CURL_EXE=OFF + -DENABLE_MANUAL=OFF + -DCURL_STATICLIB=${CURL_STATICLIB} + OPTIONS_DEBUG + -DENABLE_DEBUG=ON + ) +endif() vcpkg_install_cmake() -- cgit v1.2.3 From 30429e68db721f542abf153293b49822c107870e Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Thu, 12 Jan 2017 12:35:24 -0800 Subject: apply uwp patch to all builds --- ports/curl/portfile.cmake | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ports/curl/portfile.cmake b/ports/curl/portfile.cmake index e8fc658c0..35bfbd592 100644 --- a/ports/curl/portfile.cmake +++ b/ports/curl/portfile.cmake @@ -11,16 +11,9 @@ vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001_cmake.patch + ${CMAKE_CURRENT_LIST_DIR}/0002_fix_uwp.patch ) -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") - vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/0002_fix_uwp.patch -) -endif() - if (VCPKG_CRT_LINKAGE STREQUAL dynamic) SET(CURL_STATICLIB OFF) else() -- cgit v1.2.3 From 678721b9a8efc550aee9e5293f1c39a4522428fa Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Thu, 12 Jan 2017 21:25:10 -0800 Subject: added missing free calls after curl_getenv --- ports/curl/0002_fix_uwp.patch | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/ports/curl/0002_fix_uwp.patch b/ports/curl/0002_fix_uwp.patch index a96f67838..5cd0678cf 100644 --- a/ports/curl/0002_fix_uwp.patch +++ b/ports/curl/0002_fix_uwp.patch @@ -14,7 +14,7 @@ index ed3f38a..d6480b7 100644 endif(WIN32) diff --git a/lib/curl_gethostname.c b/lib/curl_gethostname.c -index 2591fd8..4380b7c 100644 +index 2591fd8..cef38ac 100644 --- a/lib/curl_gethostname.c +++ b/lib/curl_gethostname.c @@ -21,6 +21,7 @@ @@ -25,28 +25,37 @@ index 2591fd8..4380b7c 100644 #include "curl_gethostname.h" -@@ -64,7 +65,7 @@ int Curl_gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen) { +@@ -64,9 +65,10 @@ int Curl_gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen) { #ifdef DEBUGBUILD /* Override host name when environment variable CURL_GETHOSTNAME is set */ - const char *force_hostname = getenv("CURL_GETHOSTNAME"); -+ const char *force_hostname = curl_getenv("CURL_GETHOSTNAME"); ++ char *force_hostname = curl_getenv("CURL_GETHOSTNAME"); if(force_hostname) { strncpy(name, force_hostname, namelen); ++ free(force_hostname); err = 0; + } + else { diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c -index 812a073..3c322ed 100644 +index 812a073..02c8416 100644 --- a/lib/curl_ntlm_core.c +++ b/lib/curl_ntlm_core.c -@@ -696,7 +696,7 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash, +@@ -696,9 +696,12 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash, /* Calculate the timestamp */ #ifdef DEBUGBUILD - char *force_timestamp = getenv("CURL_FORCETIME"); +- if(force_timestamp) + char *force_timestamp = curl_getenv("CURL_FORCETIME"); - if(force_timestamp) ++ if (force_timestamp) ++ { tw = CURL_OFF_T_C(11644473600) * 10000000; ++ free(force_timestamp); ++ } else + #endif + tw = ((curl_off_t)time(NULL) + CURL_OFF_T_C(11644473600)) * 10000000; diff --git a/lib/ftp.c b/lib/ftp.c index b231731..d50779f 100644 --- a/lib/ftp.c @@ -78,7 +87,7 @@ index 7cb0c96..2f43d3c 100644 #include "smb.h" #include "urldata.h" diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c -index 56a8823..4032e7e 100644 +index 56a8823..5a895ed 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -197,7 +197,7 @@ unsigned int Curl_rand(struct Curl_easy *data) @@ -90,3 +99,11 @@ index 56a8823..4032e7e 100644 if(force_entropy) { if(!seeded) { size_t elen = strlen(force_entropy); +@@ -208,6 +208,7 @@ unsigned int Curl_rand(struct Curl_easy *data) + } + else + randseed++; ++ free(force_entropy); + return randseed; + } + #endif -- cgit v1.2.3 From 278e6b9ad1443673ef47a104cb5aa73ff4350866 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Fri, 13 Jan 2017 15:38:14 -0800 Subject: [curl] Bump version to correspond with source code change for uwp support. --- ports/curl/CONTROL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/curl/CONTROL b/ports/curl/CONTROL index e18ea2f67..9ae7e7e52 100644 --- a/ports/curl/CONTROL +++ b/ports/curl/CONTROL @@ -1,4 +1,4 @@ Source: curl -Version: 7.51.0-2 +Version: 7.51.0-3 Build-Depends: zlib, openssl, libssh2 Description: A library for transferring data with URLs -- cgit v1.2.3