summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Sun2018-10-31 17:23:37 -0400
committerAndrew Sun2018-10-31 17:23:37 -0400
commit12c3858bb8b622702db0e9f56d2f938a056a7868 (patch)
tree1f25ab957d3013f2753f558ce8aa031f84dd491c
parentcb88d08cc2af7c0a873ea556707b737087669b88 (diff)
downloadaur-12c3858bb8b622702db0e9f56d2f938a056a7868.tar.gz
mingw-w64-curl: update to 7.62.0
-rw-r--r--.SRCINFO13
-rw-r--r--0001-Make-cURL-relocatable.patch757
-rw-r--r--0002-nghttp2-static.patch20
-rw-r--r--0003-libpsl-static-libs.patch41
-rw-r--r--PKGBUILD25
5 files changed, 849 insertions, 7 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 53ddd7e88c28..4593dbb9b8d1 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = mingw-w64-curl
pkgdesc = An URL retrival utility and library (mingw-w64)
- pkgver = 7.61.1
+ pkgver = 7.62.0
pkgrel = 1
url = http://curl.haxx.se
arch = any
@@ -9,14 +9,21 @@ pkgbase = mingw-w64-curl
depends = mingw-w64-crt
depends = mingw-w64-gnutls
depends = mingw-w64-libidn2
+ depends = mingw-w64-libpsl
depends = mingw-w64-libssh2
depends = mingw-w64-openssl
depends = mingw-w64-zlib
options = staticlibs
options = !strip
options = !buildflags
- source = http://curl.haxx.se/download/curl-7.61.1.tar.bz2
- sha256sums = a308377dbc9a16b2e994abd55455e5f9edca4e31666f8f8fcfe7a1a4aea419b9
+ source = http://curl.haxx.se/download/curl-7.62.0.tar.bz2
+ source = 0001-Make-cURL-relocatable.patch
+ source = 0002-nghttp2-static.patch
+ source = 0003-libpsl-static-libs.patch
+ sha256sums = 7802c54076500be500b171fde786258579d60547a3a35b8c5a23d8c88e8f9620
+ sha256sums = 5d29129b312500c94c4e94cbcdee2fb54148b5788837761534aabb698484f4d4
+ sha256sums = 963368c3fdc16f37eef6b1f5b8afa99d7c945b7ae06cc636d3d6277e330c93fb
+ sha256sums = 5d6563e29e85c7fadd129308e9927450c59fe5d429d9b27aafd3460bfc40defb
pkgname = mingw-w64-curl
diff --git a/0001-Make-cURL-relocatable.patch b/0001-Make-cURL-relocatable.patch
new file mode 100644
index 000000000000..a236de4b7e61
--- /dev/null
+++ b/0001-Make-cURL-relocatable.patch
@@ -0,0 +1,757 @@
+From 5176fc67557291c1774c363640c72f80ad409563 Mon Sep 17 00:00:00 2001
+From: Ray Donnelly <mingw.android@gmail.com>
+Date: Wed, 22 Feb 2017 11:03:04 +0100
+Subject: [PATCH] Make cURL relocatable
+
+This adds the ability to specify CA_BUNDLE paths that are relative to
+the MSYS2 pseudo-root directory.
+
+To make it truly relocatable, we use the path to the *cURL library*
+instead of the path to the current .exe to determine the location of the
+pseudo-root directory (allowing the .exe file to live completely outside
+of the MSYS2 system, e.g. in $HOME/bin). This requires Win32 API
+available in Windows XP & 2003 and later, well within the Windows
+versions supported by Cygwin (and therefore MSYS2).
+
+We also need to be extra careful to extend that path logic to the
+ca-bundle.crt used to validate HTTPS *proxies*, not only HTTPS servers.
+
+Original-patch-by: Ray Donnelly <mingw.android@gmail.com>
+Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
+---
+ configure.ac | 1 +
+ lib/Makefile.inc | 5 +-
+ lib/curl_config.h.in | 3 +
+ lib/pathtools.c | 533 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ lib/pathtools.h | 53 +++++
+ lib/url.c | 26 ++-
+ 6 files changed, 618 insertions(+), 3 deletions(-)
+ create mode 100644 lib/pathtools.c
+ create mode 100644 lib/pathtools.h
+
+diff --git a/configure.ac b/configure.ac
+index 798fa5f1e..2ed766c0d 100755
+--- a/configure.ac
++++ b/configure.ac
+@@ -3474,6 +3474,7 @@ if test "xyes" = "x$longlong"; then
+ ])
+ fi
+
++AC_DEFINE_UNQUOTED(CURL_BINDIR, "${prefix}/bin", [bindir])
+
+ # check for ssize_t
+ AC_CHECK_TYPE(ssize_t, ,
+diff --git a/lib/Makefile.inc b/lib/Makefile.inc
+index 69f9b403d..44e2dc039 100644
+--- a/lib/Makefile.inc
++++ b/lib/Makefile.inc
+@@ -54,7 +54,7 @@ LIB_CFILES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
+ curl_multibyte.c hostcheck.c conncache.c pipeline.c dotdot.c \
+ x509asn1.c http2.c smb.c curl_endian.c curl_des.c system_win32.c \
+ mime.c sha256.c setopt.c curl_path.c curl_ctype.c curl_range.c psl.c \
+- doh.c urlapi.c
++ doh.c urlapi.c pathtools.c
+
+ LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \
+ formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h if2ip.h \
+@@ -74,7 +75,7 @@ LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \
+ curl_setup_once.h multihandle.h setup-vms.h pipeline.h dotdot.h \
+ x509asn1.h http2.h sigpipe.h smb.h curl_endian.h curl_des.h \
+ curl_printf.h system_win32.h rand.h mime.h curl_sha256.h setopt.h \
+- curl_path.h curl_ctype.h curl_range.h psl.h doh.h urlapi-int.h
++ curl_path.h curl_ctype.h curl_range.h psl.h doh.h urlapi-int.h pathtools.h
+
+ LIB_RCFILES = libcurl.rc
+
+diff --git a/lib/curl_config.h.in b/lib/curl_config.h.in
+index 0f2a80403..9bad51f8d 100644
+--- a/lib/curl_config.h.in
++++ b/lib/curl_config.h.in
+@@ -12,6 +12,9 @@
+ /* Default SSL backend */
+ #undef CURL_DEFAULT_SSL_BACKEND
+
++/* Location of executable */
++#undef CURL_BINDIR
++
+ /* to disable cookies support */
+ #undef CURL_DISABLE_COOKIES
+
+diff --git a/lib/pathtools.c b/lib/pathtools.c
+new file mode 100644
+index 000000000..c66df924b
+--- /dev/null
++++ b/lib/pathtools.c
+@@ -0,0 +1,533 @@
++/*
++ .Some useful path tools.
++ .ASCII only for now.
++ .Written by Ray Donnelly in 2014.
++ .Licensed under CC0 (and anything.
++ .else you need to license it under).
++ .No warranties whatsoever.
++ .email: <mingw.android@gmail.com>.
++ */
++
++#if defined(__APPLE__)
++#include <stdlib.h>
++#else
++#include <malloc.h>
++#endif
++#include <limits.h>
++#include <stdio.h>
++#include <string.h>
++#if defined(__linux__) || defined(__CYGWIN__) || defined(__MSYS__)
++#include <alloca.h>
++#endif
++#include <unistd.h>
++
++/* If you don't define this, then get_executable_path()
++ can only use argv[0] which will often not work well */
++#define IMPLEMENT_SYS_GET_EXECUTABLE_PATH
++
++#if defined(IMPLEMENT_SYS_GET_EXECUTABLE_PATH)
++#if defined(__linux__)
++/* Nothing needed, unistd.h is enough. */
++#elif defined(__APPLE__)
++#include <mach-o/dyld.h>
++#elif defined(_WIN32)
++#define WIN32_MEAN_AND_LEAN
++#include <windows.h>
++#include <psapi.h>
++#endif
++#endif /* defined(IMPLEMENT_SYS_GET_EXECUTABLE_PATH) */
++
++#include "pathtools.h"
++
++char *
++malloc_copy_string(char const * original)
++{
++ char * result = (char *) malloc (sizeof (char*) * strlen (original)+1);
++ if (result != NULL)
++ {
++ strcpy (result, original);
++ }
++ return result;
++}
++
++void
++sanitise_path(char * path)
++{
++ size_t path_size = strlen (path);
++
++ /* Replace any '\' with '/' */
++ char * path_p = path;
++ while ((path_p = strchr (path_p, '\\')) != NULL)
++ {
++ *path_p = '/';
++ }
++ /* Replace any '//' with '/' */
++ path_p = path;
++ while ((path_p = strstr (path_p, "//")) != NULL)
++ {
++ memmove (path_p, path_p + 1, path_size--);
++ }
++ return;
++}
++
++char *
++get_relative_path(char const * from_in, char const * to_in)
++{
++ size_t from_size = (from_in == NULL) ? 0 : strlen (from_in);
++ size_t to_size = (to_in == NULL) ? 0 : strlen (to_in);
++ size_t max_size = (from_size + to_size) * 2 + 4;
++ char * scratch_space = (char *) alloca (from_size + 1 + to_size + 1 + max_size + max_size);
++ char * from;
++ char * to;
++ char * common_part;
++ char * result;
++ size_t count;
++
++ /* No to, return "./" */
++ if (to_in == NULL)
++ {
++ return malloc_copy_string ("./");
++ }
++
++ /* If alloca failed or no from was given return a copy of to */
++ if ( from_in == NULL
++ || scratch_space == NULL )
++ {
++ return malloc_copy_string (to_in);
++ }
++
++ from = scratch_space;
++ strcpy (from, from_in);
++ to = from + from_size + 1;
++ strcpy (to, to_in);
++ common_part = to + to_size + 1;
++ result = common_part + max_size;
++ simplify_path (from);
++ simplify_path (to);
++
++ result[0] = '\0';
++
++ size_t match_size_dirsep = 0; /* The match size up to the last /. Always wind back to this - 1 */
++ size_t match_size = 0; /* The running (and final) match size. */
++ size_t largest_size = (from_size > to_size) ? from_size : to_size;
++ int to_final_is_slash = (to[to_size-1] == '/') ? 1 : 0;
++ char from_c;
++ char to_c;
++ for (match_size = 0; match_size < largest_size; ++match_size)
++ {
++ /* To simplify the logic, always pretend the strings end with '/' */
++ from_c = (match_size < from_size) ? from[match_size] : '/';
++ to_c = (match_size < to_size) ? to[match_size] : '/';
++
++ if (from_c != to_c)
++ {
++ if (from_c != '\0' || to_c != '\0')
++ {
++ match_size = match_size_dirsep;
++ }
++ break;
++ }
++ else if (from_c == '/')
++ {
++ match_size_dirsep = match_size;
++ }
++ }
++ strncpy (common_part, from, match_size);
++ common_part[match_size] = '\0';
++ from += match_size;
++ to += match_size;
++ size_t ndotdots = 0;
++ char const* from_last = from + strlen(from) - 1;
++ while ((from = strchr (from, '/')) && from != from_last)
++ {
++ ++ndotdots;
++ ++from;
++ }
++ for (count = 0; count < ndotdots; ++count)
++ {
++ strcat(result, "../");
++ }
++ if (strlen(to) > 0)
++ {
++ strcat(result, to+1);
++ }
++ /* Make sure that if to ends with '/' result does the same, and
++ vice-versa. */
++ size_t size_result = strlen(result);
++ if ((to_final_is_slash == 1)
++ && (!size_result || result[size_result-1] != '/'))
++ {
++ strcat (result, "/");
++ }
++ else if (!to_final_is_slash
++ && size_result && result[size_result-1] == '/')
++ {
++ result[size_result-1] = '\0';
++ }
++
++ return malloc_copy_string (result);
++}
++
++void
++simplify_path(char * path)
++{
++ ssize_t n_toks = 1; /* in-case we need an empty initial token. */
++ ssize_t i, j;
++ size_t tok_size;
++ size_t in_size = strlen (path);
++ int it_ended_with_a_slash = (path[in_size - 1] == '/') ? 1 : 0;
++ char * result = path;
++ sanitise_path(result);
++ char * result_p = result;
++
++ do
++ {
++ ++n_toks;
++ ++result_p;
++ } while ((result_p = strchr (result_p, '/')) != NULL);
++
++ result_p = result;
++ char const ** toks = (char const **) alloca (sizeof (char const*) * n_toks);
++ n_toks = 0;
++ do
++ {
++ if (result_p > result)
++ {
++ *result_p++ = '\0';
++ }
++ else if (*result_p == '/')
++ {
++ /* A leading / creates an empty initial token. */
++ toks[n_toks++] = result_p;
++ *result_p++ = '\0';
++ }
++ toks[n_toks++] = result_p;
++ } while ((result_p = strchr (result_p, '/')) != NULL);
++
++ /* Remove all non-leading '.' and any '..' we can match
++ with an earlier forward path (i.e. neither '.' nor '..') */
++ for (i = 1; i < n_toks; ++i)
++ {
++ int removals[2] = { -1, -1 };
++ if ( strcmp (toks[i], "." ) == 0)
++ {
++ removals[0] = i;
++ }
++ else if ( strcmp (toks[i], ".." ) == 0)
++ {
++ /* Search backwards for a forward path to collapse.
++ If none are found then the .. also stays. */
++ for (j = i - 1; j > -1; --j)
++ {
++ if ( strcmp (toks[j], "." )
++ && strcmp (toks[j], ".." ) )
++ {
++ removals[0] = j;
++ removals[1] = i;
++ break;
++ }
++ }
++ }
++ for (j = 0; j < 2; ++j)
++ {
++ if (removals[j] >= 0) /* Can become -2 */
++ {
++ --n_toks;
++ memmove (&toks[removals[j]], &toks[removals[j]+1], (n_toks - removals[j])*sizeof (char*));
++ --i;
++ if (!j)
++ {
++ --removals[1];
++ }
++ }
++ }
++ }
++ result_p = result;
++ for (i = 0; i < n_toks; ++i)
++ {
++ tok_size = strlen(toks[i]);
++ memcpy (result_p, toks[i], tok_size);
++ result_p += tok_size;
++ if ((!i || tok_size) && ((i < n_toks - 1) || it_ended_with_a_slash == 1))
++ {
++ *result_p = '/';
++ ++result_p;
++ }
++ }
++ *result_p = '\0';
++}
++
++/* Returns actual_to by calculating the relative path from -> to and
++ applying that to actual_from. An assumption that actual_from is a
++ dir is made, and it may or may not end with a '/' */
++char const *
++get_relocated_path (char const * from, char const * to, char const * actual_from)
++{
++ char const * relative_from_to = get_relative_path (from, to);
++ char * actual_to = (char *) malloc (strlen(actual_from) + 2 + strlen(relative_from_to));
++ return actual_to;
++}
++
++int
++get_executable_path(char const * argv0, char * result, ssize_t max_size)
++{
++ char * system_result = (char *) alloca (max_size);
++ ssize_t system_result_size = -1;
++ ssize_t result_size = -1;
++
++ if (system_result != NULL)
++ {
++#if defined(IMPLEMENT_SYS_GET_EXECUTABLE_PATH)
++#if defined(__linux__) || defined(__CYGWIN__) || defined(__MSYS__)
++ system_result_size = readlink("/proc/self/exe", system_result, max_size);
++#elif defined(__APPLE__)
++ uint32_t bufsize = (uint32_t)max_size;
++ if (_NSGetExecutablePath(system_result, &bufsize) == 0)
++ {
++ system_result_size = (ssize_t)bufsize;
++ }
++#elif defined(_WIN32)
++ unsigned long bufsize = (unsigned long)max_size;
++ system_result_size = GetModuleFileNameA(NULL, system_result, bufsize);
++ if (system_result_size == 0 || system_result_size == (ssize_t)bufsize)
++ {
++ /* Error, possibly not enough space. */
++ system_result_size = -1;
++ }
++ else
++ {
++ /* Early conversion to unix slashes instead of more changes
++ everywhere else .. */
++ char * winslash;
++ system_result[system_result_size] = '\0';
++ while ((winslash = strchr (system_result, '\\')) != NULL)
++ {
++ *winslash = '/';
++ }
++ }
++#else
++#warning "Don't know how to get executable path on this system"
++#endif
++#endif /* defined(IMPLEMENT_SYS_GET_EXECUTABLE_PATH) */
++ }
++ /* Use argv0 as a default in-case of failure */
++ if (system_result_size != -1)
++ {
++ strncpy (result, system_result, system_result_size);
++ result[system_result_size] = '\0';
++ }
++ else
++ {
++ if (argv0 != NULL)
++ {
++ strncpy (result, argv0, max_size);
++ result[max_size-1] = '\0';
++ }
++ else
++ {
++ result[0] = '\0';
++ }
++ }
++ result_size = strlen (result);
++ return result_size;
++}
++
++#if defined(_WIN32)
++int
++get_dll_path(char * result, unsigned long max_size)
++{
++ HMODULE handle;
++ char * p;
++ int ret;
++
++ if (!GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
++ GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
++ (LPCSTR) &get_dll_path, &handle))
++ {
++ return -1;
++ }
++
++ ret = GetModuleFileNameA(handle, result, max_size);
++ if (ret == 0 || ret == (int)max_size)
++ {
++ return -1;
++ }
++
++ /* Early conversion to unix slashes instead of more changes
++ everywhere else .. */
++ result[ret] = '\0';
++ p = result - 1;
++ while ((p = strchr (p + 1, '\\')) != NULL)
++ {
++ *p = '/';
++ }
++
++ return ret;
++}
++#endif
++
++char const *
++strip_n_prefix_folders(char const * path, size_t n)
++{
++ if (path == NULL)
++ {
++ return NULL;
++ }
++
++ if (path[0] != '/')
++ {
++ return path;
++ }
++
++ char const * last = path;
++ while (n-- && path != NULL)
++ {
++ last = path;
++ path = strchr (path + 1, '/');
++ }
++ return (path == NULL) ? last : path;
++}
++
++void
++strip_n_suffix_folders(char * path, size_t n)
++{
++ if (path == NULL)
++ {
++ return;
++ }
++ while (n--)
++ {
++ if (strrchr (path + 1, '/'))
++ {
++ *strrchr (path + 1, '/') = '\0';
++ }
++ else
++ {
++ return;
++ }
++ }
++ return;
++}
++
++size_t
++split_path_list(char const * path_list, char split_char, char *** arr)
++{
++ size_t path_count;
++ size_t path_list_size;
++ char const * path_list_p;
++
++ path_list_p = path_list;
++ if (path_list == NULL || path_list[0] == '\0')
++ {
++ return 0;
++ }
++ path_list_size = strlen (path_list);
++
++ path_count = 0;
++ do
++ {
++ ++path_count;
++ ++path_list_p;
++ }
++ while ((path_list_p = strchr (path_list_p, split_char)) != NULL);
++
++ /* allocate everything in one go. */
++ char * all_memory = (char *) malloc (sizeof (char *) * path_count + strlen(path_list) + 1);
++ if (all_memory == NULL)
++ return 0;
++ *arr = (char **)all_memory;
++ all_memory += sizeof (char *) * path_count;
++
++ path_count = 0;
++ path_list_p = path_list;
++ char const * next_path_list_p = 0;
++ do
++ {
++ next_path_list_p = strchr (path_list_p, split_char);
++ if (next_path_list_p != NULL)
++ {
++ ++next_path_list_p;
++ }
++ size_t this_size = (next_path_list_p != NULL)
++ ? next_path_list_p - path_list_p - 1
++ : &path_list[path_list_size] - path_list_p;
++ memcpy (all_memory, path_list_p, this_size);
++ all_memory[this_size] = '\0';
++ (*arr)[path_count++] = all_memory;
++ all_memory += this_size + 1;
++ } while ((path_list_p = next_path_list_p) != NULL);
++
++ return path_count;
++}
++
++char *
++get_relocated_path_list(char const * from, char const * to_path_list)
++{
++ char exe_path[MAX_PATH];
++ char * temp;
++ get_executable_path (NULL, &exe_path[0], sizeof (exe_path) / sizeof (exe_path[0]));
++ if ((temp = strrchr (exe_path, '/')) != NULL)
++ {
++ temp[1] = '\0';
++ }
++
++ char **arr = NULL;
++ /* Ask Alexey why he added this. Are we not 100% sure
++ that we're dealing with unix paths here? */
++ char split_char = ':';
++ if (strchr (to_path_list, ';'))
++ {
++ split_char = ';';
++ }
++ size_t count = split_path_list (to_path_list, split_char, &arr);
++ int result_size = 1 + (count - 1); /* count - 1 is for ; delim. */
++ size_t exe_path_size = strlen (exe_path);
++ size_t i;
++ /* Space required is:
++ count * (exe_path_size + strlen (rel_to_datadir))
++ rel_to_datadir upper bound is:
++ (count * strlen (from)) + (3 * num_slashes (from))
++ + strlen(arr[i]) + 1.
++ .. pathalogically num_slashes (from) is strlen (from)
++ (from = ////////) */
++ size_t space_required = (count * (exe_path_size + 4 * strlen (from))) + count - 1;
++ for (i = 0; i < count; ++i)
++ {
++ space_required += strlen (arr[i]);
++ }
++ char * scratch = (char *) alloca (space_required);
++ if (scratch == NULL)
++ return NULL;
++ for (i = 0; i < count; ++i)
++ {
++ char * rel_to_datadir = get_relative_path (from, arr[i]);
++ scratch[0] = '\0';
++ arr[i] = scratch;
++ strcat (scratch, exe_path);
++ strcat (scratch, rel_to_datadir);
++ simplify_path (arr[i]);
++ size_t arr_i_size = strlen (arr[i]);
++ result_size += arr_i_size;
++ scratch = arr[i] + arr_i_size + 1;
++ }
++ char * result = (char *) malloc (result_size);
++ if (result == NULL)
++ {
++ return NULL;
++ }
++ result[0] = '\0';
++ for (i = 0; i < count; ++i)
++ {
++ strcat (result, arr[i]);
++ if (i != count-1)
++ {
++#if defined(_WIN32)
++ strcat (result, ";");
++#else
++ strcat (result, ":");
++#endif
++ }
++ }
++ free ((void*)arr);
++ return result;
++}
+diff --git a/lib/pathtools.h b/lib/pathtools.h
+new file mode 100644
+index 000000000..d4ff40f8a
+--- /dev/null
++++ b/lib/pathtools.h
+@@ -0,0 +1,53 @@
++/*
++ .Some useful path tools.
++ .ASCII only for now.
++ .Written by Ray Donnelly in 2014.
++ .Licensed under CC0 (and anything.
++ .else you need to license it under).
++ .No warranties whatsoever.
++ .email: <mingw.android@gmail.com>.
++ */
++
++#ifndef PATHTOOLS_H
++#define PATHTOOLS_H
++
++#include <unistd.h>
++#if defined(__APPLE__)
++#include <stdlib.h>
++#else
++#include <malloc.h>
++#endif
++#include <stdio.h>
++
++char * malloc_copy_string(char const * original);
++
++/* In-place replaces any '\' with '/' and any '//' with '/' */
++void sanitise_path(char * path);
++
++/* Uses a host OS specific function to determine the path of the executable,
++ if IMPLEMENT_SYS_GET_EXECUTABLE_PATH is defined, otherwise uses argv0. */
++int get_executable_path(char const * argv0, char * result, ssize_t max_size);
++
++#if defined(_WIN32)
++int get_dll_path(char * result, unsigned long max_size);
++#endif
++
++/* Where possible, in-place removes occourances of '.' and 'path/..' */
++void simplify_path(char * path);
++
++/* Allocates (via malloc) and returns the path to get from from to to. */
++char * get_relative_path(char const * from, char const * to);
++
++size_t split_path_list(char const * path_list, char split_char, char *** arr);
++
++/* Advances path along by the amount that removes n prefix folders. */
++char const *
++strip_n_prefix_folders(char const * path, size_t n);
++
++/* NULL terminates path to remove n suffix folders. */
++void
++strip_n_suffix_folders(char * path, size_t n);
++
++char * get_relocated_path_list(char const * from, char const * to_path_list);
++
++#endif /* PATHTOOLS_H */
+diff --git a/lib/url.c b/lib/url.c
+index 945d4e327..981e60d26 100644
+--- a/lib/url.c
++++ b/lib/url.c
+@@ -119,6 +119,9 @@ bool curl_win32_idn_to_ascii(const char *in, char **out);
+ #include "dotdot.h"
+ #include "strdup.h"
+ #include "setopt.h"
++#if defined(__MINGW32__)
++#include "pathtools.h"
++#endif
+
+ /* The last 3 #include files should be in this order */
+ #include "curl_printf.h"
+@@ -490,21 +493,60 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
+ */
+ if(Curl_ssl_backend() != CURLSSLBACKEND_SCHANNEL) {
+ #if defined(CURL_CA_BUNDLE)
++#if defined(__MINGW32__)
++ const size_t path_max = PATH_MAX;
++ char relocated_bundle[path_max];
++ get_dll_path(relocated_bundle, path_max);
++ strip_n_suffix_folders(relocated_bundle, 1);
++ strncat(relocated_bundle, "/", path_max);
++ char *relative = get_relative_path(CURL_BINDIR, CURL_CA_BUNDLE);
++ strncat(relocated_bundle, relative, path_max);
++ simplify_path(relocated_bundle);
++ result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_ORIG], relocated_bundle);
++#else
+ result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_ORIG], CURL_CA_BUNDLE);
+- if(result)
++#endif /* defined(__MINGW32__) */
++ if(result) {
++#if defined(__MINGW32__)
++ free((void*)relative);
++#endif /* defined(__MINGW32__) */
+ return result;
++ }
+
++#if defined(__MINGW32__)
++ result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_PROXY], relocated_bundle);
++ free((void*)relative);
++#else
+ result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_PROXY],
+ CURL_CA_BUNDLE);
++#endif
+ if(result)
+ return result;
+ #endif
+ #if defined(CURL_CA_PATH)
++#if defined(__MINGW32__)
++ const size_t path_max = PATH_MAX;
++ char relocated_ca_path[path_max];
++ get_dll_path(relocated_ca_path, path_max);
++ strip_n_suffix_folders(relocated_ca_path, 1);
++ strncat(relocated_ca_path, "/", path_max);
++ char *relative = get_relative_path(CURL_BINDIR, CURL_CA_BUNDLE);
++ strncat(relocated_ca_path, relative, path_max);
++ simplify_path(relocated_ca_path);
++ result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_ORIG], relocated_ca_path);
++#else
+ result = Curl_setstropt(&set->str[STRING_SSL_CAPATH_ORIG], CURL_CA_PATH);
+- if(result)
++#endif /* defined(__MINGW32__) */
++ if(result) {
+ return result;
++ }
+
++#if defined(__MINGW32__)
++ result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_PROXY], relocated_ca_path);
++ free((void*)relative);
++#else
+ result = Curl_setstropt(&set->str[STRING_SSL_CAPATH_PROXY], CURL_CA_PATH);
++#endif
+ if(result)
+ return result;
+ #endif
+--
+2.16.1.windows.4
+
diff --git a/0002-nghttp2-static.patch b/0002-nghttp2-static.patch
new file mode 100644
index 000000000000..f2b067583e56
--- /dev/null
+++ b/0002-nghttp2-static.patch
@@ -0,0 +1,20 @@
+--- curl-7.61.0/lib/Makefile.am.orig 2018-07-26 11:45:27.548145800 +0300
++++ curl-7.61.0/lib/Makefile.am 2018-07-26 11:49:05.823729200 +0300
+@@ -111,7 +111,7 @@
+ endif
+
+ if USE_CPPFLAG_CURL_STATICLIB
+-libcurl_la_CPPFLAGS_EXTRA += -DCURL_STATICLIB
++libcurl_la_CPPFLAGS_EXTRA += -DCURL_STATICLIB -DNGHTTP2_STATIC
+ endif
+
+ if DOING_CURL_SYMBOL_HIDING
+@@ -123,7 +123,7 @@
+ libcurl_la_LDFLAGS = $(AM_LDFLAGS) $(libcurl_la_LDFLAGS_EXTRA) $(LDFLAGS) $(LIBCURL_LIBS)
+ libcurl_la_CFLAGS = $(AM_CFLAGS) $(libcurl_la_CFLAGS_EXTRA)
+
+-libcurlu_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_STATICLIB -DUNITTESTS
++libcurlu_la_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_STATICLIB -DNGHTTP2_STATIC -DUNITTESTS
+ libcurlu_la_LDFLAGS = $(AM_LDFLAGS) -static $(LIBCURL_LIBS)
+ libcurlu_la_CFLAGS = $(AM_CFLAGS)
+
diff --git a/0003-libpsl-static-libs.patch b/0003-libpsl-static-libs.patch
new file mode 100644
index 000000000000..98420512260a
--- /dev/null
+++ b/0003-libpsl-static-libs.patch
@@ -0,0 +1,41 @@
+--- curl-7.58.0/configure.ac.orig 2018-02-12 11:45:28.253147200 +0300
++++ curl-7.58.0/configure.ac 2018-02-12 11:51:12.894795500 +0300
+@@ -2618,14 +2618,30 @@
+ with_libpsl=$withval,
+ with_libpsl=yes)
+ if test $with_libpsl != "no"; then
+- AC_SEARCH_LIBS(psl_builtin, psl,
+- [curl_psl_msg="yes";
+- AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled])
+- ],
+- [curl_psl_msg="no (libpsl not found)";
+- AC_MSG_WARN([libpsl was not found])
+- ]
+- )
++ CURL_CHECK_PKGCONFIG(libpsl)
++ if test "$PKGCONFIG" != "no" ; then
++ LIB_PSL=`$PKGCONFIG --libs-only-l libpsl`
++ LD_PSL=`$PKGCONFIG --libs-only-L libpsl`
++ CPP_PSL=`$PKGCONFIG --cflags-only-I libpsl`
++ version=`$PKGCONFIG --modversion libpsl`
++ DIR_PSL=`echo $LD_PSL | $SED -e 's/-L//'`
++
++ AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled])
++ LDFLAGS="$LDFLAGS $LD_PSL"
++ CPPFLAGS="$CPPFLAGS $CPP_PSL"
++ LIBS="$LIB_PSL $LIBS"
++ else
++ dnl no nghttp2 pkg-config found, deal with it
++ AC_SEARCH_LIBS(psl_builtin, psl,
++ [curl_psl_msg="yes";
++ AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled])
++ ],
++ [curl_psl_msg="no (libpsl not found)";
++ AC_MSG_WARN([libpsl was not found])
++ ]
++ )
++ fi
++
+ fi
+ AM_CONDITIONAL([USE_LIBPSL], [test "$curl_psl_msg" = "yes"])
+
diff --git a/PKGBUILD b/PKGBUILD
index 3d9ff46f53f6..ee8d460e739c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,8 @@
+# Maintainer: Andrew Sun <adsun701@gmail.com>
# Contributor: ant32 <antreimer@gmail.com>
pkgname=mingw-w64-curl
-pkgver=7.61.1
+pkgver=7.62.0
pkgrel=1
pkgdesc="An URL retrival utility and library (mingw-w64)"
arch=('any')
@@ -10,20 +11,36 @@ license=("MIT")
depends=('mingw-w64-crt'
'mingw-w64-gnutls'
'mingw-w64-libidn2'
+ 'mingw-w64-libpsl'
'mingw-w64-libssh2'
'mingw-w64-openssl'
'mingw-w64-zlib')
makedepends=('mingw-w64-configure')
options=('staticlibs' '!strip' '!buildflags')
-source=("$url/download/curl-$pkgver.tar.bz2")
-sha256sums=('a308377dbc9a16b2e994abd55455e5f9edca4e31666f8f8fcfe7a1a4aea419b9')
+source=("$url/download/curl-$pkgver.tar.bz2"
+ "0001-Make-cURL-relocatable.patch"
+ "0002-nghttp2-static.patch"
+ "0003-libpsl-static-libs.patch")
+sha256sums=('7802c54076500be500b171fde786258579d60547a3a35b8c5a23d8c88e8f9620'
+ '5d29129b312500c94c4e94cbcdee2fb54148b5788837761534aabb698484f4d4'
+ '963368c3fdc16f37eef6b1f5b8afa99d7c945b7ae06cc636d3d6277e330c93fb'
+ '5d6563e29e85c7fadd129308e9927450c59fe5d429d9b27aafd3460bfc40defb')
_architectures="i686-w64-mingw32 x86_64-w64-mingw32"
+prepare() {
+ cd "${srcdir}"/${pkgname#mingw-w64-}-${pkgver}
+ rm -f lib/pathtools.h lib/pathtools.c > /dev/null 2>&1 || true
+ patch -Np1 -i "${srcdir}/0001-Make-cURL-relocatable.patch"
+ patch -Np1 -i "${srcdir}/0002-nghttp2-static.patch"
+ patch -Np1 -i "${srcdir}/0003-libpsl-static-libs.patch"
+ autoreconf -vfi
+}
+
build() {
cd "${srcdir}"/${pkgname#mingw-w64-}-${pkgver}
for _arch in ${_architectures}; do
- configure_args="--with-ssl --enable-ipv6 --with-libidn2 --with-libssh2 --without-ca-bundle --without-random"
+ configure_args="--with-ssl --enable-ipv6 --with-libidn2 --with-libssh2 --without-ca-bundle --without-random --with-libpsl"
mkdir -p build-${_arch}-static && pushd build-${_arch}-static
${_arch}-configure $configure_args \
--enable-static --disable-shared ..