[vlc-devel] [PATCH 10/14] contrib: bump libupnp to 1.12.1

Alaric Senat dev.asenat at posteo.net
Fri Mar 19 11:40:05 UTC 2021


Removed contrib patches:
  - libpthread.patch         -> Linker arguments are now in rules.mak
  - missing_win32.patch      -> Fixed upstream by 02bb90c5
  - fix_infinite_loop.patch  -> Fixed upstream by 4367cbfa
  - dont_use_down_intf.patch -> Fixed upstream by 1f2e3b88
  - use-unicode.patch        -> Fixed upstream
  - windows-random.patch     -> Fixed upstream by 44e092a6
  - no-getifinfo.patch       -> Fixed upstream by 0296c3cd

Edited patches (mostly to fit the new sources):
  - miniserver.patch
  - upnp-no-debugfile.patch
  - libupnp-win32.patch (Partially fixed upstream)
  - libupnp-win64.patch (Partially fixed upstream by 421d5d28)
  - windows-version-inet.patch
  - libupnp-win32-exports.patch
  - libupnp-pthread-w32-checks.patch
---
 contrib/src/upnp/SHA512SUMS                   |  2 +-
 contrib/src/upnp/dont_use_down_intf.patch     | 12 ----
 contrib/src/upnp/fix_infinite_loop.patch      | 21 ------
 contrib/src/upnp/libpthread.patch             | 15 -----
 .../src/upnp/libupnp-pthread-w32-checks.patch | 62 +++++++++++------
 contrib/src/upnp/libupnp-win32-exports.patch  | 34 +++++++---
 contrib/src/upnp/libupnp-win32.patch          | 14 ----
 contrib/src/upnp/libupnp-win64.patch          | 67 +++++++++----------
 contrib/src/upnp/miniserver.patch             | 28 ++++++--
 contrib/src/upnp/missing_win32.patch          | 13 ----
 contrib/src/upnp/no-getifinfo.patch           | 18 -----
 contrib/src/upnp/rules.mak                    | 27 +++-----
 contrib/src/upnp/upnp-no-debugfile.patch      | 32 ++++++---
 contrib/src/upnp/use-inet-pton.patch          | 39 +++++++++++
 contrib/src/upnp/use-unicode.patch            | 49 --------------
 contrib/src/upnp/windows-random.patch         | 34 ----------
 contrib/src/upnp/windows-version-inet.patch   | 42 ++++++++----
 extras/package/snap/snapcraft.yaml            |  3 -
 modules/services_discovery/Makefile.am        |  2 +-
 19 files changed, 222 insertions(+), 292 deletions(-)
 delete mode 100644 contrib/src/upnp/dont_use_down_intf.patch
 delete mode 100644 contrib/src/upnp/fix_infinite_loop.patch
 delete mode 100644 contrib/src/upnp/libpthread.patch
 delete mode 100644 contrib/src/upnp/missing_win32.patch
 delete mode 100644 contrib/src/upnp/no-getifinfo.patch
 create mode 100644 contrib/src/upnp/use-inet-pton.patch
 delete mode 100644 contrib/src/upnp/use-unicode.patch
 delete mode 100644 contrib/src/upnp/windows-random.patch

diff --git a/contrib/src/upnp/SHA512SUMS b/contrib/src/upnp/SHA512SUMS
index f30c34e49b..b2a5422f34 100644
--- a/contrib/src/upnp/SHA512SUMS
+++ b/contrib/src/upnp/SHA512SUMS
@@ -1 +1 @@
-97af62a7483cc19cfe80157cbc3383c1b4b7c9c39b848f4ed063784b74df0b9b0527f7b467e01451e0a44dbf9e8a9eab510619146a6ee1e3dce46f3e4af6e661  libupnp-1.6.19.tar.bz2
+f13833118d08fc05273dc65a12596854b937c505b20d82e58eb1c2e1fa35dba0cafd5799475e030f3c698069046cc5256e6ef5afe398680e7ea881df953b95e6  libupnp-1.12.1.tar.bz2
diff --git a/contrib/src/upnp/dont_use_down_intf.patch b/contrib/src/upnp/dont_use_down_intf.patch
deleted file mode 100644
index 6af6a4795e..0000000000
--- a/contrib/src/upnp/dont_use_down_intf.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- upnp_clean/upnp/src/api/upnpapi.c	2015-05-11 18:04:45.054340200 +0200
-+++ libupnp-1.6.19/upnp/src/api/upnpapi.c	2015-05-11 18:11:37.438360600 +0200
-@@ -3258,7 +3258,8 @@
-		ifname_found = 1;
-	}
-	for (adapts_item = adapts; adapts_item != NULL; adapts_item = adapts_item->Next) {
--		if (adapts_item->Flags & IP_ADAPTER_NO_MULTICAST) {
-+		if (adapts_item->Flags & IP_ADAPTER_NO_MULTICAST ||
-+			adapts_item->OperStatus != IfOperStatusUp) {
-			continue;
-        }
-		if (ifname_found == 0) {
diff --git a/contrib/src/upnp/fix_infinite_loop.patch b/contrib/src/upnp/fix_infinite_loop.patch
deleted file mode 100644
index b9e2ab7792..0000000000
--- a/contrib/src/upnp/fix_infinite_loop.patch
+++ /dev/null
@@ -1,21 +0,0 @@
---- upnp_clean/upnp/src/api/upnpapi.c	2015-05-11 17:59:17.892347500 +0200
-+++ upnp/upnp/src/api/upnpapi.c	2015-05-11 18:01:05.000083700 +0200
-@@ -3257,8 +3257,7 @@
- 		strncpy(gIF_NAME, IfName, sizeof(gIF_NAME) - 1);
- 		ifname_found = 1;
- 	}
--	adapts_item = adapts;
--	while (adapts_item != NULL) {
-+	for (adapts_item = adapts; adapts_item != NULL; adapts_item = adapts_item->Next) {
- 		if (adapts_item->Flags & IP_ADAPTER_NO_MULTICAST) {
- 			continue;
- 		}
-@@ -3345,8 +3344,6 @@
- 			gIF_INDEX = adapts_item->IfIndex;
- 			break;
- 		}
--		/* Next adapter. */
--		adapts_item = adapts_item->Next;
- 	}
- 	/* Failed to find a valid interface, or valid address. */
- 	if (ifname_found == 0 || valid_addr_found == 0) {
diff --git a/contrib/src/upnp/libpthread.patch b/contrib/src/upnp/libpthread.patch
deleted file mode 100644
index e3067595e7..0000000000
--- a/contrib/src/upnp/libpthread.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-On GNU/Linux, -pthread does not work properly when linking a static
-library that depends on POSIX threads. -lpthread must be checked first.
-
-diff -Nru upnp.orig/m4/acx_pthread.m4 upnp/m4/acx_pthread.m4
---- upnp.orig/m4/acx_pthread.m4	2016-08-06 11:54:20.990800226 +0300
-+++ upnp/m4/acx_pthread.m4	2016-08-06 11:54:37.909800395 +0300
-@@ -123,7 +123,7 @@
- # which indicates that we try without any flags at all, and "pthread-config"
- # which is a program returning the flags for the Pth emulation library.
- 
--acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
-+acx_pthread_flags="pthreads none -Kthread -kthread lthread -lpthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
- 
- # The ordering *is* (sometimes) important.  Some notes on the
- # individual items follow:
diff --git a/contrib/src/upnp/libupnp-pthread-w32-checks.patch b/contrib/src/upnp/libupnp-pthread-w32-checks.patch
index f1e76ec332..2d24b44976 100644
--- a/contrib/src/upnp/libupnp-pthread-w32-checks.patch
+++ b/contrib/src/upnp/libupnp-pthread-w32-checks.patch
@@ -1,22 +1,47 @@
---- upnp/threadutil/src/ThreadPool.c.pthread-w32	2018-05-17 10:53:48.438587300 +0200
-+++ upnp/threadutil/src/ThreadPool.c	2018-05-17 10:54:03.696907300 +0200
+From 54af55d7ba47726567339db0d8e93806cb03e18c Mon Sep 17 00:00:00 2001
+From: Alaric Senat <dev.asenat at posteo.net>
+Date: Wed, 10 Mar 2021 16:18:39 +0100
+Subject: pthread w32 checks
+
+---
+ upnp/src/api/upnpdebug.c         |  2 +-
+ upnp/src/threadutil/ThreadPool.c | 17 +++++++++++++----
+ 2 files changed, 14 insertions(+), 5 deletions(-)
+
+diff --git a/upnp/src/api/upnpdebug.c b/upnp/src/api/upnpdebug.c
+index 02464bb..dc8f10f 100644
+--- a/upnp/src/api/upnpdebug.c
++++ b/upnp/src/api/upnpdebug.c
+@@ -190,7 +190,7 @@ static void UpnpDisplayFileAndLine(
+ 	strftime(timebuf, 26, "%Y-%m-%d %H:%M:%S", timeinfo);
+ 
+ 	fprintf(fp, "%s UPNP-%s-%s: Thread:0x%lX [%s:%d]: ", timebuf, smod, slev,
+-#ifdef _WIN32
++#if defined(PTW32_LEVEL)
+ 		(unsigned long int)ithread_self().p
+ #else
+ 		(unsigned long int)ithread_self()
+diff --git a/upnp/src/threadutil/ThreadPool.c b/upnp/src/threadutil/ThreadPool.c
+index 3e75916..7189737 100644
+--- a/upnp/src/threadutil/ThreadPool.c
++++ b/upnp/src/threadutil/ThreadPool.c
 @@ -34,7 +34,7 @@
   * \file
   */
  
--#if !defined(WIN32)
+-#if !defined(_WIN32)
 +#if !defined(WIN32) || !defined(_MSC_VER)
  	#include <sys/param.h>
  #endif
  
 @@ -263,8 +263,16 @@ static int SetPolicyType(
- #elif defined(__OSX__) || defined(__APPLE__) || defined(__NetBSD__)
+ #elif defined(__APPLE__) || defined(__NetBSD__)
  	setpriority(PRIO_PROCESS, 0, 0);
  	retVal = 0;
--#elif defined(WIN32)
-+#elif defined(PTW32_LEVEL) 
+-#elif defined(_WIN32)
++#elif defined(PTW32_LEVEL)
  	retVal = sched_setscheduler(0, in);
-+#elif defined(WIN32)
++#elif defined(_WIN32)
 +	struct sched_param current;
 +	int sched_result;
 +
@@ -27,28 +52,21 @@
  #elif defined(_POSIX_PRIORITY_SCHEDULING) && _POSIX_PRIORITY_SCHEDULING > 0
  	struct sched_param current;
  	int sched_result;
-@@ -415,11 +423,11 @@ static void SetSeed(void)
+@@ -415,11 +423,12 @@ static void SetSeed(void)
  	struct timeval t;
    
  	gettimeofday(&t, NULL);
--#if defined(WIN32)
+-#if defined(_WIN32)
 +#if defined(PTW32_LEVEL)
  	srand((unsigned int)t.tv_usec + (unsigned int)ithread_get_current_thread_id().p);
- #elif defined(BSD) || defined(__OSX__) || defined(__APPLE__) || defined(__FreeBSD_kernel__)
+ #elif defined(BSD) || defined(__APPLE__) || defined(__FreeBSD_kernel__)
  	srand((unsigned int)t.tv_usec + (unsigned int)ithread_get_current_thread_id());
 -#elif defined(__linux__) || defined(__sun) || defined(__CYGWIN__) || defined(__GLIBC__)
-+#elif defined(__linux__) || defined(__sun) || defined(__CYGWIN__) || defined(__GLIBC__) || defined(WIN32)
++#elif defined(__linux__) || defined(__sun) || defined(__CYGWIN__) || \
++	defined(__GLIBC__) || defined(_WIN32)
  	srand((unsigned int)t.tv_usec + (unsigned int)ithread_get_current_thread_id());
  #else
  	{
---- upnp/upnp/src/api/upnpdebug.c.pthread-w32	2018-05-17 10:53:05.030173700 +0200
-+++ upnp/upnp/src/api/upnpdebug.c	2018-05-17 10:53:44.686358100 +0200
-@@ -183,7 +183,7 @@ void UpnpDisplayFileAndLine(FILE *fd, co
- 		lines[i] = buf[i];
- 	/* Put the debug lines in the buffer */
- 	sprintf(buf[0], "DEBUG - THREAD ID: 0x%lX",
--#ifdef WIN32
-+#if defined(PTW32_LEVEL)
- 		(unsigned long int)ithread_self().p
- #else
- 		(unsigned long int)ithread_self()
+-- 
+2.29.2
+
diff --git a/contrib/src/upnp/libupnp-win32-exports.patch b/contrib/src/upnp/libupnp-win32-exports.patch
index 9375393f68..7211b5b10b 100644
--- a/contrib/src/upnp/libupnp-win32-exports.patch
+++ b/contrib/src/upnp/libupnp-win32-exports.patch
@@ -1,6 +1,18 @@
---- upnp/configure.ac.win32	2013-11-15 17:18:45.000000000 +0100
-+++ upnp/configure.ac	2018-05-17 11:41:56.647083600 +0200
-@@ -670,6 +670,17 @@ ACX_PTHREAD(
+From 6334d9726e409cec3c095a8764044aee7624032c Mon Sep 17 00:00:00 2001
+From: Alaric Senat <dev.asenat at posteo.net>
+Date: Wed, 10 Mar 2021 16:07:08 +0100
+Subject: win32 exports
+
+---
+ configure.ac  | 11 +++++++++++
+ libupnp.pc.in |  4 ++--
+ 2 files changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 2a73ca1..a92b3dc 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -759,6 +759,17 @@ AX_PTHREAD(
  CC="$PTHREAD_CC"
  CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
  LIBS="$PTHREAD_LIBS $LIBS"
@@ -18,14 +30,20 @@
  #
  # Determine if pthread_rwlock_t is available
  #
---- upnp/libupnp.pc.in.win32	2010-12-23 21:24:05.000000000 +0100
-+++ upnp/libupnp.pc.in	2018-05-17 11:43:06.014745400 +0200
-@@ -6,6 +6,6 @@ includedir=@includedir@
+diff --git a/libupnp.pc.in b/libupnp.pc.in
+index 8c6fc22..fa93393 100644
+--- a/libupnp.pc.in
++++ b/libupnp.pc.in
+@@ -6,7 +6,7 @@ includedir=@includedir@
  Name: libupnp
  Description: Linux SDK for UPnP Devices
  Version: @VERSION@
--Libs: @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ -L${libdir} -lupnp -lthreadutil -lixml 
+-Libs: @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ -L${libdir} -lupnp -lixml
+ Libs.private: @OPENSSL_LIBS@
 -Cflags: @PTHREAD_CFLAGS@ -I${includedir}/upnp
-+Libs: -L${libdir} -lupnp -lthreadutil -lixml @PTHREAD_LIBS@ @WIN32_LIBS@
++Libs: -L${libdir} -lupnp -lixml @PTHREAD_LIBS@ @WIN32_LIBS@
 +Cflags: @PC_CFLAGS@ -I${includedir}/upnp
  
+-- 
+2.29.2
+
diff --git a/contrib/src/upnp/libupnp-win32.patch b/contrib/src/upnp/libupnp-win32.patch
index 80d758423d..7b874f1436 100644
--- a/contrib/src/upnp/libupnp-win32.patch
+++ b/contrib/src/upnp/libupnp-win32.patch
@@ -9,17 +9,3 @@
  	#else
  		#define max(a, b)   (((a)>(b))? (a):(b))
  		#define min(a, b)   (((a)<(b))? (a):(b))
---- upnp/upnp/inc/UpnpInet.h	2011-04-03 04:50:36.000000000 +0200
-+++ upnp.neww/upnp/inc/UpnpInet.h	2011-11-18 01:54:45.418529337 +0100
-@@ -15,11 +15,6 @@
- 
- #ifdef WIN32
- 	#include <stdarg.h>
--	#ifndef UPNP_USE_MSVCPP
--		/* Removed: not required (and cause compilation issues) */
--		#include <winbase.h>
--		#include <windef.h>
--	#endif
- 	#include <winsock2.h>
- 	#include <iphlpapi.h>
- 	#include <ws2tcpip.h>
diff --git a/contrib/src/upnp/libupnp-win64.patch b/contrib/src/upnp/libupnp-win64.patch
index 8064e6d214..c9135f9773 100644
--- a/contrib/src/upnp/libupnp-win64.patch
+++ b/contrib/src/upnp/libupnp-win64.patch
@@ -1,41 +1,36 @@
---- libupnp/threadutil/inc/ThreadPool.h	2011-01-20 07:46:57.000000000 +0100
-+++ libupnp.new/threadutil/inc/ThreadPool.h	2011-09-23 01:36:12.000000000 +0200
-@@ -45,6 +45,7 @@
- #include <errno.h>
+From 9ec9967c55e51c387f7d517e72adb6ed278d153f Mon Sep 17 00:00:00 2001
+From: Alaric Senat <dev.asenat at posteo.net>
+Date: Wed, 10 Mar 2021 15:25:20 +0100
+Subject: win64
 
- #ifdef WIN32
-+	#ifndef _TIMEZONE_DEFINED
- 	#include <time.h>
- 	struct timezone
- 	{
-@@ -52,6 +53,7 @@
- 		int  tz_dsttime;     /* type of dst correction */
- 	};
- 	int gettimeofday(struct timeval *tv, struct timezone *tz);
-+	#endif
- #else /* WIN32 */
- 	#include <sys/param.h>
- 	#include <sys/time.h> /* for gettimeofday() */
---- libupnp-1.6.16/upnp/inc/upnp.h.orig	2012-03-22 00:15:38.000000000 +0100
-+++ libupnp-1.6.16/upnp/inc/upnp.h	2012-03-28 18:58:55.043642000 +0200
-@@ -61,6 +61,20 @@
+---
+ upnp/inc/upnp.h | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/upnp/inc/upnp.h b/upnp/inc/upnp.h
+index 0a51b34..4711e11 100644
+--- a/upnp/inc/upnp.h
++++ b/upnp/inc/upnp.h
+@@ -61,6 +61,19 @@
  	/* Other systems ??? */
  #endif
  
-+#   if defined( __MINGW32__ )
-+#       if !defined( _OFF_T_ )
-+            typedef long long _off_t;
-+            typedef _off_t off_t;
-+#           define _OFF_T_
-+#       else
-+#           ifdef off_t
-+#               undef off_t
-+#           endif
-+#           define off_t long long
-+#       endif
-+#   endif
-+
++#if defined(__MINGW32__)
++	#if !defined(_OFF_T_)
++typedef long long _off_t;
++typedef _off_t off_t;
++		#define _OFF_T_
++	#else
++		#ifdef off_t
++			#undef off_t
++		#endif
++		#define off_t long long
++	#endif
++#endif
 +
- #define LINE_SIZE  (size_t)180
- #define NAME_SIZE  (size_t)256
- #define MNFT_NAME_SIZE  64
+ #ifdef UPNP_ENABLE_OPEN_SSL
+ 	#include <openssl/ssl.h>
+ #endif
+-- 
+2.29.2
+
diff --git a/contrib/src/upnp/miniserver.patch b/contrib/src/upnp/miniserver.patch
index 45ff90c675..ebf3a20884 100644
--- a/contrib/src/upnp/miniserver.patch
+++ b/contrib/src/upnp/miniserver.patch
@@ -1,17 +1,31 @@
---- upnp/upnp/src/api/upnpapi.c.orig	2013-04-08 00:23:46.000000000 +0200
-+++ upnp/upnp/src/api/upnpapi.c	2013-04-08 00:25:49.000000000 +0200
-@@ -358,13 +358,13 @@
+From e238e20db9153d4a066cbcce1fdb5f95ada45fbf Mon Sep 17 00:00:00 2001
+From: Alaric Senat <dev.asenat at posteo.net>
+Date: Wed, 10 Mar 2021 12:01:18 +0100
+Subject: miniserver
+
+---
+ upnp/src/api/upnpapi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/upnp/src/api/upnpapi.c b/upnp/src/api/upnpapi.c
+index 3ad4658..b0ee7db 100644
+--- a/upnp/src/api/upnpapi.c
++++ b/upnp/src/api/upnpapi.c
+@@ -387,13 +387,13 @@ static int UpnpInitPreamble(void)
  		return retVal;
  	}
  
 +#ifdef INTERNAL_WEB_SERVER
  #ifdef INCLUDE_DEVICE_APIS
- #if EXCLUDE_SOAP == 0
+ 	#if EXCLUDE_SOAP == 0
  	SetSoapCallback(soap_device_callback);
- #endif
+ 	#endif
  #endif /* INCLUDE_DEVICE_APIS */
  
 -#ifdef INTERNAL_WEB_SERVER
- #if EXCLUDE_GENA == 0
+ 	#if EXCLUDE_GENA == 0
  	SetGenaCallback(genaCallback);
- #endif
+ 	#endif
+-- 
+2.29.2
+
diff --git a/contrib/src/upnp/missing_win32.patch b/contrib/src/upnp/missing_win32.patch
deleted file mode 100644
index c5f80d0d28..0000000000
--- a/contrib/src/upnp/missing_win32.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- upnp_clean/upnp/inc/upnp.h	2015-04-30 14:37:26.962425889 +0200
-+++ upnp/upnp/inc/upnp.h	2015-04-30 14:41:48.099528162 +0200
-@@ -41,6 +41,10 @@
-  * \file
-  */
- 
-+#ifdef _WIN32
-+# define WIN32
-+#endif
-+
- #include "ixml.h"
- #include "upnpconfig.h"
- #include "UpnpGlobal.h"
diff --git a/contrib/src/upnp/no-getifinfo.patch b/contrib/src/upnp/no-getifinfo.patch
deleted file mode 100644
index 63a101d660..0000000000
--- a/contrib/src/upnp/no-getifinfo.patch
+++ /dev/null
@@ -1,18 +0,0 @@
---- upnp/upnp/src/api/upnpapi.c.orig	2016-05-10 10:39:59.757852761 +0200
-+++ upnp/upnp/src/api/upnpapi.c	2016-05-10 10:40:24.885603353 +0200
-@@ -3205,6 +3205,7 @@
- }
- 
- 
-+#ifdef UPNP_ENABLE_IPV6
- int UpnpGetIfInfo(const char *IfName)
- {
- #ifdef WIN32
-@@ -3587,6 +3588,7 @@
- 
- 	return UPNP_E_SUCCESS;
- }
-+#endif
- 
- 
- /*!
diff --git a/contrib/src/upnp/rules.mak b/contrib/src/upnp/rules.mak
index 7290056904..9e5afb2fd9 100644
--- a/contrib/src/upnp/rules.mak
+++ b/contrib/src/upnp/rules.mak
@@ -1,11 +1,11 @@
 # UPNP
-UPNP_VERSION := 1.6.19
+UPNP_VERSION := 1.12.1
 UPNP_URL := $(SF)/pupnp/libupnp-$(UPNP_VERSION).tar.bz2
 
 ifdef BUILD_NETWORK
 PKGS += upnp
 endif
-ifeq ($(call need_pkg,"libupnp >= 1.6.18"),)
+ifeq ($(call need_pkg,"libupnp >= 1.12.1"),)
 PKGS_FOUND += upnp
 endif
 
@@ -14,18 +14,21 @@ $(TARBALLS)/libupnp-$(UPNP_VERSION).tar.bz2:
 
 .sum-upnp: libupnp-$(UPNP_VERSION).tar.bz2
 
-UPNP_CFLAGS   := $(CFLAGS)   -DUPNP_STATIC_LIB
+UPNP_CFLAGS := $(CFLAGS) -DUPNP_STATIC_LIB
 UPNP_CXXFLAGS := $(CXXFLAGS) -DUPNP_STATIC_LIB
+UPNP_LDFLAGS := $(LDFLAGS)
+CONFIGURE_ARGS := --disable-samples --enable-shared=no --enable-static=yes
+
 ifdef HAVE_WIN32
 DEPS_upnp += pthreads $(DEPS_pthreads)
 endif
 ifdef HAVE_WINSTORE
-CONFIGURE_ARGS=--disable-ipv6 --enable-unspecified_server
+CONFIGURE_ARGS += --disable-ipv6 --enable-unspecified_server
 else
-CONFIGURE_ARGS=--enable-ipv6
+CONFIGURE_ARGS += --enable-ipv6
 endif
 ifndef WITH_OPTIMIZATION
-CONFIGURE_ARGS += --enable-debug
+CONFIGURE_ARGS += --enable-debug 
 endif
 
 upnp: libupnp-$(UPNP_VERSION).tar.bz2 .sum-upnp
@@ -33,27 +36,19 @@ upnp: libupnp-$(UPNP_VERSION).tar.bz2 .sum-upnp
 ifdef HAVE_WIN32
 	$(APPLY) $(SRC)/upnp/libupnp-win32.patch
 	$(APPLY) $(SRC)/upnp/libupnp-win64.patch
-	$(APPLY) $(SRC)/upnp/windows-random.patch
 	$(APPLY) $(SRC)/upnp/windows-version-inet.patch
 	$(APPLY) $(SRC)/upnp/libupnp-win32-exports.patch
 	$(APPLY) $(SRC)/upnp/libupnp-pthread-w32-checks.patch
 	$(APPLY) $(SRC)/upnp/libupnp-pthread-w32-force.patch
-ifdef HAVE_WINSTORE
-	$(APPLY) $(SRC)/upnp/no-getifinfo.patch
-endif
+	$(APPLY) $(SRC)/upnp/use-inet-pton.patch
 endif
-	$(APPLY) $(SRC)/upnp/libpthread.patch
 	$(APPLY) $(SRC)/upnp/miniserver.patch
-	$(APPLY) $(SRC)/upnp/missing_win32.patch
-	$(APPLY) $(SRC)/upnp/fix_infinite_loop.patch
-	$(APPLY) $(SRC)/upnp/dont_use_down_intf.patch
 	$(APPLY) $(SRC)/upnp/upnp-no-debugfile.patch
-	$(APPLY) $(SRC)/upnp/use-unicode.patch
 	$(UPDATE_AUTOCONFIG) && cd $(UNPACK_DIR) && mv config.guess config.sub build-aux/
 	$(MOVE)
 
 .upnp: upnp
 	$(RECONF)
-	cd $< && $(HOSTVARS) CFLAGS="$(UPNP_CFLAGS)" CXXFLAGS="$(UPNP_CXXFLAGS)" ./configure --disable-samples --without-documentation $(CONFIGURE_ARGS) $(HOSTCONF)
+	cd $< && $(HOSTVARS) LDFLAGS="$(UPNP_LDFLAGS)" CFLAGS="$(UPNP_CFLAGS)" CXXFLAGS="$(UPNP_CXXFLAGS)" ./configure $(CONFIGURE_ARGS) $(HOSTCONF)
 	cd $< && $(MAKE) install
 	touch $@
diff --git a/contrib/src/upnp/upnp-no-debugfile.patch b/contrib/src/upnp/upnp-no-debugfile.patch
index 1a0d525631..87cc8c3187 100644
--- a/contrib/src/upnp/upnp-no-debugfile.patch
+++ b/contrib/src/upnp/upnp-no-debugfile.patch
@@ -1,11 +1,25 @@
---- upnp/upnp/src/inc/config.h	2016-05-27 21:10:05.804950200 +0200
-+++ upnp/upnp/src/inc/config.h.debug	2016-05-27 20:59:31.808017700 +0200
-@@ -383,7 +383,7 @@
-  *
-  * @{
+From ef877d8c4991adf4d0615892fee64f6212f850b1 Mon Sep 17 00:00:00 2001
+From: Alaric Senat <dev.asenat at posteo.net>
+Date: Wed, 10 Mar 2021 14:54:00 +0100
+Subject: no-debugfile
+
+---
+ upnp/src/inc/config.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/upnp/src/inc/config.h b/upnp/src/inc/config.h
+index 8dc8cdb..6f2e17f 100644
+--- a/upnp/src/inc/config.h
++++ b/upnp/src/inc/config.h
+@@ -409,7 +409,7 @@
+  * see <upnp/inc/upnpdebug.h>
   */
--#define DEBUG_TARGET		1   
-+#define DEBUG_TARGET		0   
- /* @} */
- 
  
+-#define DEBUG_ALL		1
++#define DEBUG_ALL		0
+ #define DEBUG_SSDP		0
+ #define DEBUG_SOAP		0
+ #define DEBUG_GENA		0
+-- 
+2.29.2
+
diff --git a/contrib/src/upnp/use-inet-pton.patch b/contrib/src/upnp/use-inet-pton.patch
new file mode 100644
index 0000000000..ec6919251f
--- /dev/null
+++ b/contrib/src/upnp/use-inet-pton.patch
@@ -0,0 +1,39 @@
+From 1c0bccfa4440e91b10971d9a9bc9781741a78e09 Mon Sep 17 00:00:00 2001
+From: Alaric Senat <dev.asenat at posteo.net>
+Date: Wed, 17 Mar 2021 16:34:07 +0100
+Subject: use inet pton
+
+---
+ upnp/src/ssdp/ssdp_ctrlpt.c | 2 +-
+ upnp/src/ssdp/ssdp_device.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/upnp/src/ssdp/ssdp_ctrlpt.c b/upnp/src/ssdp/ssdp_ctrlpt.c
+index 8d46bef..8fdb7c0 100644
+--- a/upnp/src/ssdp/ssdp_ctrlpt.c
++++ b/upnp/src/ssdp/ssdp_ctrlpt.c
+@@ -573,7 +573,7 @@ int SearchByTarget(int Hnd, int Mx, char *St, void *Cookie)
+ 	/*ThreadData *ThData; */
+ 	ThreadPoolJob job;
+ 
+-	if (!inet_aton(gIF_IPV4, &addrv4)) {
++	if (!inet_pton(AF_INET, gIF_IPV4, &addrv4)) {
+ 		return UPNP_E_INVALID_PARAM;
+ 	}
+ 
+diff --git a/upnp/src/ssdp/ssdp_device.c b/upnp/src/ssdp/ssdp_device.c
+index 0a90d94..d0e264c 100644
+--- a/upnp/src/ssdp/ssdp_device.c
++++ b/upnp/src/ssdp/ssdp_device.c
+@@ -194,7 +194,7 @@ static int NewRequestHandler(
+ 	char buf_ntop[INET6_ADDRSTRLEN];
+ 	int ret = UPNP_E_SUCCESS;
+ 
+-	if (!inet_aton(gIF_IPV4, &replyAddr)) {
++	if (!inet_pton(AF_INET, gIF_IPV4, &replyAddr)) {
+ 		return UPNP_E_INVALID_PARAM;
+ 	}
+ 
+-- 
+2.29.2
+
diff --git a/contrib/src/upnp/use-unicode.patch b/contrib/src/upnp/use-unicode.patch
deleted file mode 100644
index b67b78009f..0000000000
--- a/contrib/src/upnp/use-unicode.patch
+++ /dev/null
@@ -1,49 +0,0 @@
---- upnp/upnp/src/api/upnpapi.c.orig	2017-03-17 17:21:09.510544751 +0100
-+++ upnp/upnp/src/api/upnpapi.c	2017-03-17 17:21:32.742531559 +0100
-@@ -3264,31 +3264,10 @@
- 		}
- 		if (ifname_found == 0) {
- 			/* We have found a valid interface name. Keep it. */
--#ifdef UPNP_USE_MSVCPP
--			/*
--			 * Partial fix for VC - friendly name is wchar string,
--			 * but currently gIF_NAME is char string. For now try
--			 * to convert it, which will work with many (but not
--			 * all) adapters. A full fix would require a lot of
--			 * big changes (gIF_NAME to wchar string?).
--			 */
- 			wcstombs(gIF_NAME, adapts_item->FriendlyName,
- 				sizeof(gIF_NAME));
--#else
--			memset(gIF_NAME, 0, sizeof(gIF_NAME));
--			strncpy(gIF_NAME, adapts_item->FriendlyName,
--				sizeof(gIF_NAME) - 1);
--#endif
- 			ifname_found = 1;
- 		} else {
--#ifdef UPNP_USE_MSVCPP
--			/*
--			 * Partial fix for VC - friendly name is wchar string,
--			 * but currently gIF_NAME is char string. For now try
--			 * to convert it, which will work with many (but not
--			 * all) adapters. A full fix would require a lot of
--			 * big changes (gIF_NAME to wchar string?).
--			 */
- 			char tmpIfName[LINE_SIZE] = { 0 };
- 			wcstombs(tmpIfName, adapts_item->FriendlyName,
- 				sizeof(tmpIfName));
-@@ -3298,14 +3277,6 @@
- 				/* This is not the interface we're looking for. */
- 				continue;
- 			}
--#else
--			if (strncmp
--			    (gIF_NAME, adapts_item->FriendlyName,
--			     sizeof(gIF_NAME)) != 0) {
--				/* This is not the interface we're looking for. */
--				continue;
--			}
--#endif
- 		}
- 		/* Loop thru this adapter's unicast IP addresses. */
- 		uni_addr = adapts_item->FirstUnicastAddress;
diff --git a/contrib/src/upnp/windows-random.patch b/contrib/src/upnp/windows-random.patch
deleted file mode 100644
index f817886311..0000000000
--- a/contrib/src/upnp/windows-random.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-diff -ruN upnp/upnp/src/uuid/sysdep.c upnp.new/upnp/src/uuid/sysdep.c
---- upnp/upnp/src/uuid/sysdep.c	2011-04-03 04:50:36.000000000 +0200
-+++ upnp.new/upnp/src/uuid/sysdep.c	2016-05-09 19:08:15.225581588 +0200
-@@ -23,6 +23,8 @@
- 
- #include "config.h"
- 
-+#define _CRT_RAND_S
-+
- #include "sysdep.h"
- 
- #include "UpnpInet.h"
-@@ -78,6 +80,7 @@
- 
- void get_random_info(unsigned char seed[16])
- {
-+#if 0
- 	MD5_CTX c;
- 	typedef struct {
- 		MEMORYSTATUS m;
-@@ -108,6 +111,13 @@
- 	MD5Init(&c);
- 	MD5Update(&c, (unsigned char *)(&r), sizeof r);
- 	MD5Final(seed, &c);
-+#endif
-+    for( int i = 0; i < 16; i++ )
-+    {
-+        unsigned int number;
-+        rand_s(&number);
-+        seed[i] = number;
-+    }
- };
- 
- #else /* WIN32 */
diff --git a/contrib/src/upnp/windows-version-inet.patch b/contrib/src/upnp/windows-version-inet.patch
index 989a3d840c..f31c783447 100644
--- a/contrib/src/upnp/windows-version-inet.patch
+++ b/contrib/src/upnp/windows-version-inet.patch
@@ -1,9 +1,20 @@
-diff -urN upnp-orig/upnp/src/inc/inet_pton.h upnp/upnp/src/inc/inet_pton.h
---- upnp-orig/upnp/src/inc/inet_pton.h	2010-12-23 22:24:06.000000000 +0200
-+++ upnp/upnp/src/inc/inet_pton.h	2018-02-24 23:44:22.359676036 +0200
+From a66d4779723f9aef75622157c76f5dc1ed1a33a3 Mon Sep 17 00:00:00 2001
+From: Alaric Senat <dev.asenat at posteo.net>
+Date: Wed, 10 Mar 2021 15:59:43 +0100
+Subject: windows version inet
+
+---
+ upnp/src/inc/inet_pton.h | 6 ++++++
+ upnp/src/inet_pton.c     | 5 +++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/upnp/src/inc/inet_pton.h b/upnp/src/inc/inet_pton.h
+index f3e08a5..e6233b5 100644
+--- a/upnp/src/inc/inet_pton.h
++++ b/upnp/src/inc/inet_pton.h
 @@ -3,6 +3,8 @@
  
- #ifdef WIN32
+ #ifdef _WIN32
  
 +#include "autoconfig.h"
 +
@@ -19,31 +30,36 @@ diff -urN upnp-orig/upnp/src/inc/inet_pton.h upnp/upnp/src/inc/inet_pton.h
  /*!
   * \file
   *
-@@ -45,6 +49,8 @@
+@@ -45,6 +49,8 @@ extern const char *inet_ntop(int af, const void *src, char *dst,
   */
  extern int inet_pton(int af, const char *src, void *dst);
  
 +#endif /* _WIN32_WINNT < 0x600 */
 +
- #endif /* WIN32 */
+ #endif /* _WIN32 */
  
  #endif /* INET_PTON */
-diff -urN upnp-orig/upnp/src/inet_pton.c upnp/upnp/src/inet_pton.c
---- upnp-orig/upnp/src/inet_pton.c	2010-12-23 22:24:06.000000000 +0200
-+++ upnp/upnp/src/inet_pton.c	2018-02-24 23:44:16.771807657 +0200
-@@ -24,6 +24,8 @@
+diff --git a/upnp/src/inet_pton.c b/upnp/src/inet_pton.c
+index e2a243b..73c0a16 100644
+--- a/upnp/src/inet_pton.c
++++ b/upnp/src/inet_pton.c
+@@ -24,6 +24,9 @@
  
- #include "inet_pton.h"
+ 	#include "inet_pton.h"
  
 +#if _WIN32_WINNT < 0x600
++
 +
  /*!
   * \brief format an IPv4 address
   *
-@@ -320,4 +322,6 @@
+@@ -324,4 +327,6 @@ int inet_pton(int af, const char *src, void *dst)
  	/* NOTREACHED */
  }
  
 +#endif /* _WIN32_WINNT < 0x600 */
 +
- #endif /* WIN32 */
+ #endif /* _WIN32 */
+-- 
+2.29.2
+
diff --git a/extras/package/snap/snapcraft.yaml b/extras/package/snap/snapcraft.yaml
index b9adb85b2e..d4ae81584a 100644
--- a/extras/package/snap/snapcraft.yaml
+++ b/extras/package/snap/snapcraft.yaml
@@ -78,7 +78,6 @@ parts:
           --host=$TRIPLET \
           --enable-libdsm \
           --enable-dvdcss \
-          --disable-upnp \
           --disable-chromaprint
       if [ -n "$VLC_PREBUILT_CONTRIBS_URL" ]; then
           make prebuilt PREBUILT_URL="$VLC_PREBUILT_CONTRIBS_URL"
@@ -139,7 +138,6 @@ parts:
       - librsvg2-dev
       - libsecret-1-dev
       - libudev-dev
-      - libupnp-dev
       - libv4l-dev
       - libva-dev
       - libvdpau-dev
@@ -221,7 +219,6 @@ parts:
       - libgtk-3-0
       - liblua5.2-0
       - libmtp9
-      - libupnp6
       - libzvbi0
       - libnotify4
       - libvulkan1
diff --git a/modules/services_discovery/Makefile.am b/modules/services_discovery/Makefile.am
index 9755c2552f..a1105282ff 100644
--- a/modules/services_discovery/Makefile.am
+++ b/modules/services_discovery/Makefile.am
@@ -33,7 +33,7 @@ libupnp_plugin_la_SOURCES = services_discovery/upnp.cpp services_discovery/upnp.
 			    stream_out/dlna/dlna.hpp \
 			    stream_out/dlna/dlna.cpp
 libupnp_plugin_la_CXXFLAGS = $(AM_CXXFLAGS) $(UPNP_CFLAGS)
-libupnp_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(sddir)'
+libupnp_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(sddir)' -lpthread
 libupnp_plugin_la_LIBADD = $(UPNP_LIBS)
 EXTRA_LTLIBRARIES += libupnp_plugin.la
 sd_LTLIBRARIES += $(LTLIBupnp)
-- 
2.29.2



More information about the vlc-devel mailing list