From 5f5e9ff957d03c88c96f7527a6196d89f907904e Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Mon, 20 Mar 2023 18:41:55 +0100 Subject: [PATCH] wget: Update to 1.21.3 * Move to gnutls like Arch/Debian/Fedora * Drop the openssl patch, it no longer applies and we use gnutls now * Drop the taskbar patch, this was added in 2017 an no longer applies. If someone misses it, please report it upstream. * Drop c-ares, for some reason it wasn't used, and no other distro uses it. Please tell if you are missing it. --- mingw-w64-wget/PKGBUILD | 48 ++-- mingw-w64-wget/gettext-reconfigure.patch | 13 - .../openssl-windows-cert-store.patch | 113 --------- mingw-w64-wget/taskbar-progress.patch | 237 ------------------ 4 files changed, 14 insertions(+), 397 deletions(-) delete mode 100644 mingw-w64-wget/gettext-reconfigure.patch delete mode 100644 mingw-w64-wget/openssl-windows-cert-store.patch delete mode 100644 mingw-w64-wget/taskbar-progress.patch diff --git a/mingw-w64-wget/PKGBUILD b/mingw-w64-wget/PKGBUILD index cf603d4d19a1d..a18f8b673ad84 100644 --- a/mingw-w64-wget/PKGBUILD +++ b/mingw-w64-wget/PKGBUILD @@ -4,62 +4,42 @@ _realname=wget pkgbase=mingw-w64-${_realname} pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") -pkgver=1.20.3 -pkgrel=6 +pkgver=1.21.3 +pkgrel=1 pkgdesc='Wget retrieves files using HTTP, HTTPS and FTP (mingw-w64)' arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32') url='https://www.gnu.org/software/wget/' -license=('GPL3') +license=('spdx:GPL-3.0-or-later') depends=("${MINGW_PACKAGE_PREFIX}-pcre2" "${MINGW_PACKAGE_PREFIX}-libidn2" - "${MINGW_PACKAGE_PREFIX}-openssl" - "${MINGW_PACKAGE_PREFIX}-c-ares" - "${MINGW_PACKAGE_PREFIX}-gpgme") + "${MINGW_PACKAGE_PREFIX}-gnutls") makedepends=("${MINGW_PACKAGE_PREFIX}-cc" - "${MINGW_PACKAGE_PREFIX}-autotools") -source=("https://ftp.gnu.org/gnu/${_realname}/${_realname}-${pkgver}.tar.lz"{,.sig} - taskbar-progress.patch - openssl-windows-cert-store.patch - gettext-reconfigure.patch) -sha256sums=('69607ce8216c2d1126b7a872db594b3f21e511e660e07ca1f81be96650932abb' - 'SKIP' - 'd5b662a4ee3f85d1c7d2f6e221c7e45f19189925e6774102114045fbfb2953b7' - '528369e9339eeeec7066632a1badc91a190decc2842810a6bd89a49c62565423' - 'd707a4e223433f6e79dd4f455c26dc162d26de79495d85dc4f2f92b877139325') + "${MINGW_PACKAGE_PREFIX}-autotools" + "autoconf-archive") +source=("https://ftp.gnu.org/gnu/wget/${_realname}-${pkgver}.tar.lz"{,.sig}) +sha256sums=('dbd2fb5e47149d4752d0eaa0dac68cc49cf20d46df4f8e326ffc8f18b2af4ea5' + 'SKIP') validpgpkeys=('7845120B07CBD8D6ECE5FF2B2A1743EDA91A35B6') prepare() { cd ${srcdir}/${_realname}-${pkgver} - rm -f src/tbprogress.c src/tbprogress.h > /dev/null 2>&1 || true - patch -p1 -i ${srcdir}/gettext-reconfigure.patch - #Patch for support of taskbar-progress in windows cmd - patch -p1 -i ${srcdir}/taskbar-progress.patch - #Patch for supporting windows certificate store if openssl cacerts is not found - patch -p1 -i ${srcdir}/openssl-windows-cert-store.patch + autoreconf -fiv } build() { mkdir -p ${srcdir}/build-${MSYSTEM} && cd ${srcdir}/build-${MSYSTEM} - local -a _extra_config - if [ "$CARCH" == "x86_64" ]; then - _extra_config+=("--with-cares") - fi - ../${_realname}-${pkgver}/configure \ --prefix=${MINGW_PREFIX} \ --build=${MINGW_CHOST} \ --host=${MINGW_CHOST} \ --target=${MINGW_CHOST} \ - --with-ssl=openssl \ - --with-libidn=${MINGW_PREFIX} \ - --disable-xattr \ - "${configure_opts[@]}" \ - LIBS="-lole32" + --with-ssl=gnutls \ + LIBS="-lbcrypt" - make GETTEXT_MACRO_VERSION="0.21" + make } check() { @@ -69,7 +49,7 @@ check() { package() { cd ${srcdir}/build-${MSYSTEM} - make DESTDIR="${pkgdir}" GETTEXT_MACRO_VERSION="0.21" install + make DESTDIR="${pkgdir}" install # Licenses install -Dm644 "${srcdir}/${_realname}-${pkgver}/README" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/README" diff --git a/mingw-w64-wget/gettext-reconfigure.patch b/mingw-w64-wget/gettext-reconfigure.patch deleted file mode 100644 index c3726f24e2f75..0000000000000 --- a/mingw-w64-wget/gettext-reconfigure.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/configure.ac b/configure.ac -index 686f040..b704755 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -200,7 +200,7 @@ dnl - dnl Gettext - dnl - AM_GNU_GETTEXT([external],[need-ngettext]) --AM_GNU_GETTEXT_VERSION([0.17]) -+AM_GNU_GETTEXT_VERSION([0.19.8]) - - AC_PROG_RANLIB - \ No newline at end of file diff --git a/mingw-w64-wget/openssl-windows-cert-store.patch b/mingw-w64-wget/openssl-windows-cert-store.patch deleted file mode 100644 index 2eeae0ce79162..0000000000000 --- a/mingw-w64-wget/openssl-windows-cert-store.patch +++ /dev/null @@ -1,113 +0,0 @@ -diff --git a/src/openssl.c b/src/openssl.c -index 0404d2d..f1cae1c 100644 ---- a/src/openssl.c -+++ b/src/openssl.c -@@ -169,6 +169,71 @@ static int ssl_true_initialized = 0; - - Returns true on success, false otherwise. */ - -+/* Start: Windows SSL Cert Changes */ -+#ifdef WINDOWS -+/* Local version of CERT_CONTEXT, to prevent from bringing in a specific -+ version of the Windows SDK */ -+typedef struct _CERT_CONTEXT -+{ -+ unsigned int dwCertEncodingType; -+ unsigned char *pbCertEncoded; -+ unsigned int cbCertEncoded; -+ void* pCertInfo; -+ void* hCertStore; -+} CERT_CONTEXT, *PCERT_CONTEXT;typedef const CERT_CONTEXT *PCCERT_CONTEXT; -+ -+/* Load crypt32.dll manually to prevent bringing it in unless used */ -+HMODULE Local_Crypt32() -+{ -+ static HMODULE ret = NULL; -+ if (!ret) -+ { -+ ret = LoadLibraryA("Crypt32.dll"); -+ } -+ return ret; -+} -+ -+/* Bounce these APIs to our loaded version of crypt32.dll */ -+void* Local_CertOpenSystemStoreA(void* hprov, char* szSubsystemProtocol) -+{ -+ if (Local_Crypt32()) -+ { -+ static FARPROC ret = NULL; -+ if (!ret) -+ { -+ ret = GetProcAddress(Local_Crypt32(), "CertOpenSystemStoreA"); -+ } -+ if (ret) -+ { -+ typedef void* (WINAPI * PFN_Func)(void*, char*); -+ return ((PFN_Func) ret)(hprov, szSubsystemProtocol); -+ } -+ } -+ return NULL; -+} -+ -+void* Local_CertEnumCertificatesInStore(void* hCertStore, void* pPrevCertContext) -+{ -+ if (Local_Crypt32()) -+ { -+ static FARPROC ret = NULL; -+ if (!ret) -+ { -+ ret = GetProcAddress(Local_Crypt32(), "CertEnumCertificatesInStore"); -+ } -+ if (ret) -+ { -+ typedef void* (WINAPI * PFN_Func)(void*, void*); -+ return ((PFN_Func) ret)(hCertStore, pPrevCertContext); -+ } -+ } -+ return NULL; -+} -+ -+#define PKCS_7_ASN_ENCODING 0x00010000 -+#endif -+/* End: Windows SSL Cert Changes */ -+ - bool - ssl_init (void) - { -@@ -272,6 +337,36 @@ ssl_init (void) - SSL_CTX_set_cipher_list (ssl_ctx, "HIGH:MEDIUM:!RC4:!SRP:!PSK:!RSA:!aNULL@STRENGTH"); - - SSL_CTX_set_default_verify_paths (ssl_ctx); -+ -+ /* Start: Windows SSL Cert Changes */ -+#ifdef WINDOWS -+ /* Only attempt to use the Windows store if one is not specified */ -+ if (!opt.ca_cert) -+ { -+ /* Open the default Windows cert store */ -+ void* hStore = Local_CertOpenSystemStoreA(NULL, "ROOT"); -+ if (hStore) -+ { -+ /* And then open the OpenSSL store */ -+ X509_STORE * store = SSL_CTX_get_cert_store(ssl_ctx); -+ CERT_CONTEXT * pCertCtx = NULL; -+ /* Loop through all the certs in the Windows cert store */ -+ for ( pCertCtx = Local_CertEnumCertificatesInStore(hStore, NULL); -+ pCertCtx != NULL; -+ pCertCtx = Local_CertEnumCertificatesInStore(hStore, pCertCtx) ) -+ { -+ if (!((pCertCtx->dwCertEncodingType & PKCS_7_ASN_ENCODING) == PKCS_7_ASN_ENCODING)) -+ { -+ /* Add all certs we find to OpenSSL's store */ -+ X509 *cert = d2i_X509(NULL, (const unsigned char**)&pCertCtx->pbCertEncoded, pCertCtx->cbCertEncoded); -+ X509_STORE_add_cert(store, cert); -+ X509_free(cert); -+ } -+ } -+ } -+ } -+#endif -+ /* End: Windows SSL Cert Changes */ - SSL_CTX_load_verify_locations (ssl_ctx, opt.ca_cert, opt.ca_directory); - - if (opt.crl_file) diff --git a/mingw-w64-wget/taskbar-progress.patch b/mingw-w64-wget/taskbar-progress.patch deleted file mode 100644 index 30f017aad6628..0000000000000 --- a/mingw-w64-wget/taskbar-progress.patch +++ /dev/null @@ -1,237 +0,0 @@ - src/Makefile.am | 5 +- - src/mswindows.c | 3 + - src/tbprogress.c | 164 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - src/tbprogress.h | 6 ++ - 4 files changed, 176 insertions(+), 2 deletions(-) - -diff --git a/src/Makefile.am b/src/Makefile.am -index 28c0be2..356a21e 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -54,13 +54,14 @@ wget_SOURCES = connect.c convert.c cookies.c ftp.c \ - ftp-basic.c ftp-ls.c hash.c host.c hsts.c html-parse.c html-url.c \ - http.c init.c log.c main.c netrc.c progress.c ptimer.c \ - recur.c res.c retr.c spider.c url.c warc.c $(XATTR_OBJ) \ -- utils.c exits.c build_info.c $(IRI_OBJ) $(METALINK_OBJ) \ -+ utils.c exits.c tbprogress.c build_info.c \ -+ $(IRI_OBJ) $(METALINK_OBJ) \ - css-url.h css-tokens.h connect.h convert.h cookies.h \ - ftp.h hash.h host.h hsts.h html-parse.h html-url.h \ - http.h http-ntlm.h init.h log.h mswindows.h netrc.h \ - options.h progress.h ptimer.h recur.h res.h retr.h \ - spider.h ssl.h sysdep.h url.h warc.h utils.h wget.h iri.h \ -- exits.h version.h metalink.h xattr.h -+ exits.h version.h metalink.h tbprogress.h xattr.h - nodist_wget_SOURCES = version.c - EXTRA_wget_SOURCES = iri.c - LDADD = $(LIBOBJS) ../lib/libgnu.a $(GETADDRINFO_LIB) $(HOSTENT_LIB)\ -diff --git a/src/mswindows.c b/src/mswindows.c -index 90e6ec4..f8ed2da 100644 ---- a/src/mswindows.c -+++ b/src/mswindows.c -@@ -43,6 +43,7 @@ as that of the covered work. */ - #include "utils.h" - #include "url.h" - #include "exits.h" -+#include "tbprogress.h" - - #ifndef ES_SYSTEM_REQUIRED - #define ES_SYSTEM_REQUIRED 0x00000001 -@@ -86,6 +87,7 @@ windows_main (char **exec_name) - static void - ws_cleanup (void) - { -+ SetTBProgress(-1); - xfree (exec_name); - WSACleanup (); - } -@@ -399,6 +401,7 @@ ws_percenttitle (double percentage_float) - - sprintf (title_buf, "Wget [%d%%] %s", percentage, curr_url); - SetConsoleTitle (title_buf); -+ SetTBProgress((int)(percentage_float * 10.0)); - } - - /* Returns a pointer to the fully qualified name of the directory that -diff --git a/src/tbprogress.c b/src/tbprogress.c -new file mode 100644 -index 0000000..59645c0 ---- /dev/null -+++ b/src/tbprogress.c -@@ -0,0 +1,164 @@ -+/* -+ * Adapted from: -+ * https://eternallybored.org/misc/wget.old/src/taskbar-progress.patch -+ */ -+ -+#if !defined(__cplusplus) -+ #define CINTERFACE -+ #define COBJMACROS -+#endif -+ -+#include "config.h" -+ -+#ifndef _WIN32_WINNT -+#define _WIN32_WINNT 0x0500 -+#endif -+ -+#include -+#include -+#include -+#include -+ -+#include "tbprogress.h" -+ -+#if !defined(_SHLOBJIDL_H) && !defined(__ITaskbarList3_INTERFACE_DEFINED__) -+#error This file is not for you. Set ENABLE_TASKBAR=0. -+#endif -+ -+const GUID CLSID_TaskbarList = { 0x56FDF344, 0xFD6D, 0x11d0, { 0x95,0x8A,0x00,0x60,0x97,0xC9,0xA0,0x90 } }; -+const GUID IID_ITaskbarList1 = { 0x56FDF342, 0xFD6D, 0x11d0, { 0x95,0x8A,0x00,0x60,0x97,0xC9,0xA0,0x90 } }; -+const GUID IID_ITaskbarList3 = { 0xea1afb91, 0x9e28, 0x4b86, { 0x90,0xe9,0x9e,0x9f,0x8a,0x5e,0xef,0xaf } }; -+ -+#if !defined(__ITaskbarList3_INTERFACE_DEFINED__) -+ typedef enum { -+ TBPF_NOPROGRESS = 0, /* Normal state / no progress bar */ -+ TBPF_INDETERMINATE = 1, /* Marquee style progress bar */ -+ TBPF_NORMAL = 2, /* Standard progress bar */ -+ TBPF_ERROR = 4, /* Red taskbar button to indicate an error occurred */ -+ TBPF_PAUSED = 8 /* Yellow taskbar button to indicate user attention */ -+ } TBPFLAG; -+ -+ typedef void* LPTHUMBBUTTON; /* dummy typedef! */ -+ typedef enum { TBATF_DUMMY } TBATFLAG; -+ -+ #undef INTERFACE -+ #define INTERFACE ITaskbarList3 -+ DECLARE_INTERFACE_(ITaskbarList3,IUnknown) -+ { -+ STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE; -+ STDMETHOD_(ULONG,AddRef)(THIS) PURE; -+ STDMETHOD_(ULONG,Release)(THIS) PURE; -+ -+ /* ITaskbarList(1) */ -+ STDMETHOD(HrInit)(THIS) PURE; -+ STDMETHOD(AddTab)(THIS, HWND hwnd) PURE; -+ STDMETHOD(DeleteTab)(THIS, HWND hwnd) PURE; -+ STDMETHOD(ActivateTab)(THIS, HWND hwnd) PURE; -+ STDMETHOD(SetActiveAlt)(THIS, HWND hwnd) PURE; -+ -+ /* ITaskbarList2 */ -+ STDMETHOD(MarkFullscreenWindow)(THIS, HWND hwnd, BOOL fFullscreen) PURE; -+ -+ /* ITaskbarList3 */ -+ STDMETHOD(SetProgressValue)(THIS, HWND hwnd, ULONGLONG ullCompleted, ULONGLONG ullTotal) PURE; -+ STDMETHOD(SetProgressState)(THIS, HWND hwnd, TBPFLAG tbpFlags) PURE; -+ STDMETHOD(RegisterTab)(THIS, HWND hwndTab, HWND hwndMDI) PURE; -+ STDMETHOD(UnregisterTab)(THIS, HWND hwndTab) PURE; -+ STDMETHOD(SetTabOrder)(THIS, HWND hwndTab,HWND hwndInsertBefore) PURE; -+ STDMETHOD(SetTabActive)(THIS, HWND hwndTab,HWND hwndMDI, TBATFLAG tbatFlags) PURE; -+ STDMETHOD(ThumbBarAddButtons)(THIS, HWND hwnd,UINT cButtons, LPTHUMBBUTTON pButton) PURE; -+ STDMETHOD(ThumbBarUpdateButtons)(THIS, HWND hwnd,UINT cButtons, LPTHUMBBUTTON pButton) PURE; -+ STDMETHOD(ThumbBarSetImageList)(THIS, HWND hwnd, HIMAGELIST himl) PURE; -+ STDMETHOD(SetOverlayIcon)(THIS, HWND hwnd, HICON hIcon, LPCWSTR pszDescription) PURE; -+ STDMETHOD(SetThumbnailTooltip)(THIS, HWND hwnd, LPCWSTR pszTip); -+ STDMETHOD(SetThumbnailClip)(THIS, HWND hwnd, RECT *prcClip); -+ -+ STDMETHOD(QueryContextMenu)(THIS_ HMENU,UINT,UINT,UINT,UINT) PURE; -+ STDMETHOD(InvokeCommand)(THIS_ LPCMINVOKECOMMANDINFO) PURE; -+ STDMETHOD(GetCommandString)(THIS_ UINT,UINT,PUINT,LPSTR,UINT) PURE; -+ STDMETHOD(HandleMenuMsg)(THIS_ UINT,WPARAM,LPARAM) PURE; -+ }; -+ #undef INTERFACE -+#endif /* __ITaskbarList3_INTERFACE_DEFINED__ */ -+ -+static ITaskbarList3 *g_pTL = NULL; -+static HWND g_hwndConsole = NULL; -+static int TB_status = 0; -+ -+/* Use these macros to gets to the methods. -+ */ -+#ifdef __cplusplus -+ #define COCREATEINSTANCE(cls,iunk,ctx,iid,pv) CoCreateInstance (cls,iunk,gtx,iid,pv) -+ #define HRINIT(iface) iface->HrInit() -+ #define RELEASE(iface) iface->Release() -+ #define SETPROGRESSVALUE(iface,hwnd,permille,max) iface->SetProgressValue (hwnd, permille, max) -+ #define SETPROGRESSSTATE(iface,hwnd,state) iface->SetProgressState (hwnd, state) -+#else -+ #define COCREATEINSTANCE(cls,iunk,ctx,iid,pv) CoCreateInstance ((REFCLSID)&(cls),iunk,ctx,(REFCLSID)&(iid),pv) -+ #define HRINIT(iface) ITaskbarList3_HrInit (iface) -+ #define RELEASE(iface) ITaskbarList3_Release (iface) -+ #define SETPROGRESSVALUE(iface,hwnd,permille,max) ITaskbarList3_SetProgressValue (iface,hwnd,permille,max) -+ #define SETPROGRESSSTATE(iface,hwnd,state) ITaskbarList3_SetProgressState (iface,hwnd,state) -+#endif -+ -+ -+void SetTBProgress (int permille) -+{ -+ /* Already stopped; quit */ -+ if (g_pTL == NULL && permille < 0) -+ return; -+ -+ /* Prior attempt failed; quit */ -+ if (TB_status != 0) -+ return; -+ -+ /* Clamp to max 100% */ -+ if (permille > 1000) -+ permille = 1000; -+ -+ /* 1st attempt; init */ -+ if (g_pTL == NULL) { -+ HRESULT hr; -+ -+ g_hwndConsole = GetConsoleWindow(); -+ if (!g_hwndConsole) { -+ TB_status = -1; -+ return; -+ } -+ -+ hr = CoInitializeEx (NULL, COINIT_APARTMENTTHREADED); -+ if (!SUCCEEDED(hr)) { -+ CoUninitialize(); -+ TB_status = -1; -+ return; -+ } -+ COCREATEINSTANCE (CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, -+ IID_ITaskbarList3, (void**)&g_pTL); -+ if (g_pTL == NULL) { -+ CoUninitialize(); -+ TB_status = -1; -+ return; -+ } -+ -+ hr = HRINIT (g_pTL); -+ if (!SUCCEEDED(hr)) { -+ TB_status = -1; -+ RELEASE (g_pTL); -+ g_pTL = NULL; -+ CoUninitialize(); -+ return; -+ } -+ TB_status = 0; -+ } -+ -+ if (permille >= 0) { -+ SETPROGRESSVALUE (g_pTL, g_hwndConsole, permille, 1000); -+ } -+ else { -+ SETPROGRESSSTATE (g_pTL, g_hwndConsole, TBPF_NOPROGRESS); -+ RELEASE (g_pTL); -+ g_pTL = NULL; -+ CoUninitialize(); -+ } -+} -+ -diff --git a/src/tbprogress.h b/src/tbprogress.h -new file mode 100644 -index 0000000..a59ad6d ---- /dev/null -+++ b/src/tbprogress.h -@@ -0,0 +1,6 @@ -+#ifndef tbprogress_h -+#define tbprogress_h -+ -+extern void SetTBProgress(int permille); // 0 - 1000 -+ -+#endif