[vlc-commits] Contribs: gnutls: Fix win32, winrt, android, macOS compilation
Jean-Baptiste Kempf
git at videolan.org
Tue Dec 26 17:08:55 CET 2017
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Dec 26 16:29:43 2017 +0100| [909e0065e2bcbcd4cd9a481c31c42dc0f9a5d8e7] | committer: Jean-Baptiste Kempf
Contribs: gnutls: Fix win32, winrt, android, macOS compilation
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=909e0065e2bcbcd4cd9a481c31c42dc0f9a5d8e7
---
contrib/src/gnutls/gnutls-android.patch | 11 -------
contrib/src/gnutls/gnutls-loadlibrary.patch | 17 ++---------
contrib/src/gnutls/gnutls-mingw64.patch | 29 ------------------
contrib/src/gnutls/gnutls-win32.patch | 20 ++++++-------
contrib/src/gnutls/gnutls-winrt.patch | 31 +++++++++----------
contrib/src/gnutls/mac-keychain-lookup.patch | 45 ++++++++++------------------
contrib/src/gnutls/rules.mak | 2 --
contrib/src/gnutls/winrt-topendir.patch | 39 ++++++++++--------------
8 files changed, 60 insertions(+), 134 deletions(-)
diff --git a/contrib/src/gnutls/gnutls-android.patch b/contrib/src/gnutls/gnutls-android.patch
deleted file mode 100644
index d8167684ca..0000000000
--- a/contrib/src/gnutls/gnutls-android.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- gnutls.old/gl/secure_getenv.c 2016-07-13 16:36:42.095099707 +0200
-+++ gnutls/gl/secure_getenv.c 2016-07-13 16:43:29.440899856 +0200
-@@ -24,7 +24,7 @@
- # include <unistd.h>
- # else
- # undef issetugid
--# ifdef _WIN32
-+# if defined (_WIN32) || defined(__ANDROID__)
- # define issetugid() 0
- # else
- # define issetugid() 1
diff --git a/contrib/src/gnutls/gnutls-loadlibrary.patch b/contrib/src/gnutls/gnutls-loadlibrary.patch
index 2d9132b9c5..442aa2e40d 100644
--- a/contrib/src/gnutls/gnutls-loadlibrary.patch
+++ b/contrib/src/gnutls/gnutls-loadlibrary.patch
@@ -1,17 +1,6 @@
---- gnutls/lib/system.c.orig 2016-07-08 14:39:45.104700999 +0200
-+++ gnutls/lib/system.c 2016-07-08 14:40:28.276750643 +0200
-@@ -322,7 +322,7 @@
- #ifdef _WIN32
- #if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) && __MINGW32_MAJOR_VERSION <= 3 && __MINGW32_MINOR_VERSION <= 20
- HMODULE crypto;
-- crypto = LoadLibraryA("Crypt32.dll");
-+ crypto = LoadLibrary(TEXT("Crypt32.dll"));
-
- if (crypto == NULL)
- return GNUTLS_E_CRYPTO_INIT_FAILED;
---- gnutls/lib/system-keys-win.c.orig 2016-07-08 14:39:58.336716261 +0200
-+++ gnutls/lib/system-keys-win.c 2016-07-08 14:40:12.568732630 +0200
-@@ -1059,7 +1059,7 @@
+--- gnutls-3.5.16/lib/system/keys-win.c 2016-11-05 19:12:02.000000000 +0100
++++ gnutls-3.5.16/lib/system/keys-win.c.new 2017-12-26 16:29:00.221119300 +0100
+@@ -1426,7 +1426,7 @@
int ret;
#ifdef DYN_NCRYPT
diff --git a/contrib/src/gnutls/gnutls-mingw64.patch b/contrib/src/gnutls/gnutls-mingw64.patch
deleted file mode 100644
index 9f6bd38b7f..0000000000
--- a/contrib/src/gnutls/gnutls-mingw64.patch
+++ /dev/null
@@ -1,29 +0,0 @@
---- gnutls-3.4.13/lib/system.c.orig 2016-05-27 22:40:06.000000000 +0200
-+++ gnutls-3.4.13/lib/system.c 2016-06-29 15:36:26.645190212 +0200
-@@ -34,7 +34,7 @@
- #ifdef _WIN32
- # include <windows.h>
- # include <wincrypt.h>
--# if defined(__MINGW32__) && !defined(__MINGW64__) && __MINGW32_MAJOR_VERSION <= 3 && __MINGW32_MINOR_VERSION <= 20
-+# if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) && __MINGW32_MAJOR_VERSION <= 3 && __MINGW32_MINOR_VERSION <= 20
- typedef PCCRL_CONTEXT WINAPI(*CertEnumCRLsInStoreFunc) (HCERTSTORE
- hCertStore,
- PCCRL_CONTEXT
-@@ -300,7 +300,7 @@
- int gnutls_system_global_init(void)
- {
- #ifdef _WIN32
--#if defined(__MINGW32__) && !defined(__MINGW64__) && __MINGW32_MAJOR_VERSION <= 3 && __MINGW32_MINOR_VERSION <= 20
-+#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) && __MINGW32_MAJOR_VERSION <= 3 && __MINGW32_MINOR_VERSION <= 20
- HMODULE crypto;
- crypto = LoadLibraryA("Crypt32.dll");
-
-@@ -325,7 +325,7 @@
- void gnutls_system_global_deinit(void)
- {
- #ifdef _WIN32
--#if defined(__MINGW32__) && !defined(__MINGW64__) && __MINGW32_MAJOR_VERSION <= 3 && __MINGW32_MINOR_VERSION <= 20
-+#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) && __MINGW32_MAJOR_VERSION <= 3 && __MINGW32_MINOR_VERSION <= 20
- FreeLibrary(Crypt32_dll);
- #endif
- #endif
diff --git a/contrib/src/gnutls/gnutls-win32.patch b/contrib/src/gnutls/gnutls-win32.patch
index 197476ce83..7c077432e3 100644
--- a/contrib/src/gnutls/gnutls-win32.patch
+++ b/contrib/src/gnutls/gnutls-win32.patch
@@ -1,13 +1,3 @@
---- gnutls-3.3.22/lib/gnutls.pc.in.orig 2016-03-10 16:17:25.955785469 +0100
-+++ gnutls-3.3.22/lib/gnutls.pc.in 2016-03-10 16:20:49.979795202 +0100
-@@ -19,6 +19,6 @@
- URL: http://www.gnutls.org/
- Version: @VERSION@
- Libs: -L${libdir} -lgnutls
--Libs.private: @LIBZ@ @LIBINTL@ @LIBSOCKET@ @LIBPTHREAD@ @LIBICONV@ @P11_KIT_LIBS@ @LIB_SELECT@ @TSS_LIBS@ @GMP_LIBS@ @NETTLE_LIBS@ @LIBIDN_LIBS@ @HOGWEED_LIBS@
-+Libs.private: @LIBZ@ @LIBINTL@ @LIBSOCKET@ -lcrypt32 @LIBPTHREAD@ @LIBICONV@ @P11_KIT_LIBS@ @LIB_SELECT@ @TSS_LIBS@ @GMP_LIBS@ @NETTLE_LIBS@ @LIBIDN_LIBS@ @HOGWEED_LIBS@
- @GNUTLS_REQUIRES_PRIVATE@
- Cflags: -I${includedir}
--- gnutls.old/lib/includes/gnutls/gnutls.h.in 2016-07-01 22:44:49.319398504 +0200
+++ gnutls/lib/includes/gnutls/gnutls.h.in 2016-07-01 22:48:00.515407625 +0200
@@ -68,7 +68,7 @@
@@ -19,3 +9,13 @@
#else
# define _SYM_EXPORT
#endif
+--- gnutls-3.5.16/lib/gnutls.pc.in.orig 2017-12-26 16:20:40.969104489 +0100
++++ gnutls-3.5.16/lib/gnutls.pc.in 2017-12-26 16:22:53.817108430 +0100
+@@ -19,6 +19,6 @@
+ URL: http://www.gnutls.org/
+ Version: @VERSION@
+ Libs: -L${libdir} -lgnutls
+-Libs.private: @LIBZ@ @LIBINTL@ @LIBSOCKET@ @LIBNSL@ @LIBPTHREAD@ @LIB_SELECT@ @TSS_LIBS@ @GMP_LIBS@ @LIBUNISTRING@ @LIBIDN2_LIBS@ @LIBIDN_LIBS@ @HOGWEED_LIBS@ @NETTLE_LIBS@
++Libs.private: @LIBZ@ @LIBINTL@ @LIBSOCKET@ @LIBNSL@ -lcrypt32 @LIBPTHREAD@ @LIB_SELECT@ @TSS_LIBS@ @GMP_LIBS@ @LIBUNISTRING@ @LIBIDN2_LIBS@ @LIBIDN_LIBS@ @HOGWEED_LIBS@ @NETTLE_LIBS@
+ @GNUTLS_REQUIRES_PRIVATE@
+ Cflags: -I${includedir}
diff --git a/contrib/src/gnutls/gnutls-winrt.patch b/contrib/src/gnutls/gnutls-winrt.patch
index 02cdfc66b4..174105c526 100644
--- a/contrib/src/gnutls/gnutls-winrt.patch
+++ b/contrib/src/gnutls/gnutls-winrt.patch
@@ -1,20 +1,21 @@
---- gnutls/lib/system.c 2016-05-18 09:28:09.902830600 +0200
-+++ gnutls/lib/system.c.winstore 2016-05-18 13:06:32.408396400 +0200
-@@ -34,6 +34,17 @@
- #ifdef _WIN32
- # include <windows.h>
- # include <wincrypt.h>
-+# include <winapifamily.h>
-+# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
-+# if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0A00 /* Univeral Winstore */
-+# undef CertOpenSystemStore
+--- gnutls-3.5.16/lib/system/keys-win.c 2017-12-26 16:29:00.221119300 +0100
++++ gnutls-3.5.16/lib/system/keys-win.c.new 2017-12-26 16:33:02.501126487 +0100
+@@ -44,6 +44,18 @@
+ #include <wincrypt.h>
+ #include <winbase.h>
+
++#include <winapifamily.h>
++#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
++# if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0A00 /* Univeral Winstore */
++# undef CertOpenSystemStore
+HCERTSTORE CertOpenSystemStore( HCRYPTPROV_LEGACY hprov, LPCSTR szSubsystemProtocol )
+{
+ return CertOpenStore( CERT_STORE_PROV_SYSTEM_A, X509_ASN_ENCODING, 0,
+ CERT_SYSTEM_STORE_CURRENT_USER, szSubsystemProtocol );
+}
-+# endif /* _WIN32_WINNT */
-+# endif /* WINAPI_FAMILY */
- # if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) && __MINGW32_MAJOR_VERSION <= 3 && __MINGW32_MINOR_VERSION <= 20
- typedef PCCRL_CONTEXT WINAPI(*Type_CertEnumCRLsInStore) (HCERTSTORE
- hCertStore,
++# endif /* _WIN32_WINNT */
++#endif /* WINAPI_FAMILY */
++
+ #define DYN_NCRYPT
+
+ #ifdef __MINGW32__
diff --git a/contrib/src/gnutls/mac-keychain-lookup.patch b/contrib/src/gnutls/mac-keychain-lookup.patch
index 81e21c215b..2c18260754 100644
--- a/contrib/src/gnutls/mac-keychain-lookup.patch
+++ b/contrib/src/gnutls/mac-keychain-lookup.patch
@@ -1,42 +1,30 @@
-diff -ru gnutls-old/lib/Makefile.am gnutls/lib/Makefile.am
---- gnutls-old/lib/Makefile.am 2013-06-02 19:33:57.000000000 +0200
-+++ gnutls/lib/Makefile.am 2013-11-10 13:28:18.000000000 +0100
-@@ -152,6 +152,10 @@
- DISTCLEANFILES += $(defexec_DATA)
+--- gnutls-old/lib/Makefile.am
++++ gnutls/lib/Makefile.am
+@@ -206,6 +206,10 @@
+ thirdparty_libadd += -lcrypt32
endif
+if MACOSX
+libgnutls_la_LDFLAGS += -Wl,-framework,Security,-framework,CoreFoundation
+endif
+
- if WINDOWS
- thirdparty_libadd += -lcrypt32
- endif
-diff -ru gnutls-old/lib/system.c gnutls/lib/system.c
---- gnutls-old/lib/system.c 2013-04-10 22:25:51.000000000 +0200
-+++ gnutls/lib/system.c 2013-11-10 13:30:31.000000000 +0100
-@@ -57,6 +57,15 @@
- #undef send
- #undef select
+ libgnutls_la_LIBADD += $(thirdparty_libadd)
-+#ifdef __APPLE__
+ # C++ library
+--- gnutls-old/lib/system/certs.c
++++ gnutls/lib/system/certs.c
+@@ -270,6 +270,43 @@
+
+ return r;
+ }
++
++#elif defined(__APPLE__) && TARGET_OS_MAC
++
+#include "TargetConditionals.h"
-+#ifdef TARGET_OS_MAC
+#define _UINT64
+#include <Security/Security.h>
+#include <Security/SecCertificate.h>
-+#endif
-+#endif
+
- /* System specific function wrappers.
- */
-
-@@ -550,6 +559,40 @@
-
- return r;
- }
-+#elif defined(__APPLE__)
-+#if TARGET_OS_MAC
+static
+int add_system_trust(gnutls_x509_trust_list_t list, unsigned int tl_flags, unsigned int tl_vflags)
+{
@@ -66,9 +54,6 @@ diff -ru gnutls-old/lib/system.c gnutls/lib/system.c
+ return ret;
+}
+
-+#else
-+#define add_system_trust(x,y,z) GNUTLS_E_UNIMPLEMENTED_FEATURE
-+#endif
#else
#define add_system_trust(x,y,z) GNUTLS_E_UNIMPLEMENTED_FEATURE
diff --git a/contrib/src/gnutls/rules.mak b/contrib/src/gnutls/rules.mak
index b6d8d1c1a2..26b1d1ba03 100644
--- a/contrib/src/gnutls/rules.mak
+++ b/contrib/src/gnutls/rules.mak
@@ -22,7 +22,6 @@ gnutls: gnutls-$(GNUTLS_VERSION).tar.xz .sum-gnutls
$(APPLY) $(SRC)/gnutls/gnutls-pkgconfig-static.patch
ifdef HAVE_WIN32
$(APPLY) $(SRC)/gnutls/gnutls-win32.patch
- $(APPLY) $(SRC)/gnutls/gnutls-mingw64.patch
$(APPLY) $(SRC)/gnutls/gnutls-loadlibrary.patch
ifdef HAVE_WINSTORE
$(APPLY) $(SRC)/gnutls/gnutls-winrt.patch
@@ -31,7 +30,6 @@ endif
endif
ifdef HAVE_ANDROID
$(APPLY) $(SRC)/gnutls/no-create-time-h.patch
- $(APPLY) $(SRC)/gnutls/gnutls-android.patch
endif
$(APPLY) $(SRC)/gnutls/read-file-limits.h.patch
ifdef HAVE_MACOSX
diff --git a/contrib/src/gnutls/winrt-topendir.patch b/contrib/src/gnutls/winrt-topendir.patch
index cd09c7e859..6051cd0f01 100644
--- a/contrib/src/gnutls/winrt-topendir.patch
+++ b/contrib/src/gnutls/winrt-topendir.patch
@@ -1,17 +1,16 @@
---- gnutls/lib/x509/verify-high2.c.orig 2016-05-11 21:28:25.584504325 +0200
-+++ gnutls/lib/x509/verify-high2.c 2016-05-11 21:32:00.596348074 +0200
-@@ -37,6 +37,10 @@
-
- #include <dirent.h>
+--- gnutls-3.5.16/lib/x509/verify-high2.c.orig 2016-12-19 15:10:59.000000000 +0100
++++ gnutls-3.5.16/lib/x509/verify-high2.c 2017-12-26 16:39:02.565137168 +0100
+@@ -43,6 +43,9 @@
+ # endif
+ #endif
+#include <windows.h>
+#include <tchar.h>
+
-+
- #ifndef _DIRENT_HAVE_D_TYPE
- # ifdef DT_UNKNOWN
- # define _DIRENT_HAVE_D_TYPE
-@@ -366,14 +370,40 @@
+ /* Convenience functions for verify-high functionality
+ */
+
+@@ -368,29 +371,59 @@
return ret;
}
@@ -54,35 +53,29 @@
int ret;
int r = 0;
char path[GNUTLS_PATH_MAX];
-@@ -381,11 +411,13 @@
- struct dirent e;
- #endif
- dirp = opendir(dirname);
-+ TCHAR* dirnameW = ToWide(dirname);
++ TCHAR* dirnameW = ToWide(dirname);
+ dirp = _topendir(dirnameW);
-+ free(dirnameW);
++ free(dirnameW);
if (dirp != NULL) {
do {
- #ifdef _WIN32
- d = readdir(dirp);
+ d = _treaddir(dirp);
- if (d != NULL) {
- #else
- ret = readdir_r(dirp, &e, &d);
-@@ -395,8 +427,10 @@
+ if (d != NULL
+ #ifdef _DIRENT_HAVE_D_TYPE
+ && (d->d_type == DT_REG || d->d_type == DT_LNK || d->d_type == DT_UNKNOWN)
#endif
) {
- #endif
+ char* d_name = FromWide(d->d_name);
snprintf(path, sizeof(path), "%s/%s",
- dirname, d->d_name);
+ dirname, d_name);
-+ free(d_name);
++ free(d_name);
if (crl != 0) {
ret =
-@@ -414,7 +448,7 @@
+@@ -408,7 +441,7 @@
}
}
while (d != NULL);
More information about the vlc-commits
mailing list