[vlc-commits] [Git][videolan/vlc][master] 2 commits: contrib: upnp: build with cmake

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Dec 3 21:02:44 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
e77c2381 by Alaric Senat at 2022-12-03T18:37:40+00:00
contrib: upnp: build with cmake

pupnp maintainers are actively switching to CMake as their main
build-system.

Co-authored-by: Steve Lhomme <robux4 at ycbcr.xyz>

- - - - -
3d7b30a7 by Alaric Senat at 2022-12-03T18:37:40+00:00
contrib: upnp: update to 1.14.15

This pupnp release address some win32 issues reported after we bumped to
1.14.

Removed patches:
- 0001-ThreadPool-[...].patch -> Fixed upstream by d4cfec4674c6877bad350
- win32-remove-wro[...].patch -> Fixed upstream by d86f4159e13d00a9eb59a

This release also fixes an XML descriptor parsing error:
<https://github.com/pupnp/pupnp/issues/412>

- - - - -


7 changed files:

- − contrib/src/upnp/0001-ThreadPool-Fix-non-UCRT-builds.patch
- contrib/src/upnp/SHA512SUMS
- + contrib/src/upnp/libtool-nostdlib-workaround.patch
- − contrib/src/upnp/libupnp-pthread-force.patch
- − contrib/src/upnp/libupnp-win32-exports.patch
- contrib/src/upnp/rules.mak
- − contrib/src/upnp/win32-remove-wrong-safe-wrappers.patch


Changes:

=====================================
contrib/src/upnp/0001-ThreadPool-Fix-non-UCRT-builds.patch deleted
=====================================
@@ -1,32 +0,0 @@
-From 3560d8d3f1a5b7e88b9d6282c09b2caf37beedc8 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo at beauzee.fr>
-Date: Thu, 4 Aug 2022 15:55:55 +0200
-Subject: [PATCH] ThreadPool: Fix non UCRT builds
-
----
- upnp/src/threadutil/ThreadPool.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/upnp/src/threadutil/ThreadPool.c b/upnp/src/threadutil/ThreadPool.c
-index 49fa8486..e5883d31 100644
---- a/upnp/src/threadutil/ThreadPool.c
-+++ b/upnp/src/threadutil/ThreadPool.c
-@@ -1297,10 +1297,15 @@ int gettimeofday(struct timeval *tv, struct timezone *tz)
- 			_tzset();
- 			tzflag++;
- 		}
-+#ifdef _UCRT
- 		long itz = 0;
- 		_get_timezone(&itz);
- 		tz->tz_minuteswest = (int)(itz / 60);
- 		_get_daylight(&tz->tz_dsttime);
-+#else
-+		tz->tz_minuteswest = _timezone / 60;
-+		tz->tz_dsttime = _daylight;
-+#endif
- 	}
- 
- 	return 0;
--- 
-2.35.1
-


=====================================
contrib/src/upnp/SHA512SUMS
=====================================
@@ -1 +1 @@
-ae6ae72a5e784a0f9508af94c4070627e791660fa37966e9825643fd0f88b171826bda9a2ec872d4961bf3454e5a9cd716127f0bdf6e63c789c4e22aab0b7e71  pupnp-release-1.14.13.tar.gz
+dde2563eaacdd288066012f001b819ec25ab51bc36aef23db71d2eb67eef778b6b2b10b35a2f6b3041ecef20167e873e1c54e17fc4a26e8d1d9f408e2050279d  pupnp-release-1.14.15.tar.gz


=====================================
contrib/src/upnp/libtool-nostdlib-workaround.patch
=====================================
@@ -0,0 +1,50 @@
+From 10278966327553b32d6799fb228be7506757778e Mon Sep 17 00:00:00 2001
+From: Alaric Senat <dev.asenat at posteo.net>
+Date: Tue, 29 Nov 2022 14:00:02 +0100
+Subject: [PATCH] libtool-nostdlib-workaround
+
+Works around a libtool linking with `-no-stdlib` which discards
+`-lpthread`.
+Also forces win32 networking libs which are probably missing for the
+same reasons.
+---
+ CMakeLists.txt | 9 +++++++++
+ libupnp.pc.in  | 2 +-
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index de7f4525..6fd04bf4 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -301,6 +301,15 @@ if (UPNP_ENABLE_OPEN_SSL)
+ 	set (OPENSSL_LIBS "-lssl")
+ endif()
+ 
++if (WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
++    set (VLC_FORCED_LIBS "-pthread -lpthread")
++
++    # Force network libs.
++    if (WIN32)
++        set (VLC_FORCED_LIBS "${VLC_FORCED_LIBS} -liphlpapi -lws2_32")
++    endif()
++endif()
++
+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/libupnp.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libupnp.pc @ONLY)
+ 
+ install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libupnp.pc
+diff --git a/libupnp.pc.in b/libupnp.pc.in
+index 8c6fc22f..4c8b9f79 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 -lixml
++Libs: @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ -L${libdir} -lupnp -lixml @VLC_FORCED_LIBS@
+ Libs.private: @OPENSSL_LIBS@
+ Cflags: @PTHREAD_CFLAGS@ -I${includedir}/upnp
+ 
+-- 
+2.38.1
+


=====================================
contrib/src/upnp/libupnp-pthread-force.patch deleted
=====================================
@@ -1,10 +0,0 @@
---- upnp/configure.ac.pthread-w32      2018-05-17 11:51:47.115502500 +0200
-+++ upnp/configure.ac  2018-05-17 12:49:30.371786100 +0200
-@@ -667,6 +667,7 @@ ACX_PTHREAD(
- #
- # Update environment variables for pthreads
- #
-+PTHREAD_LIBS="-lpthread -pthread"
- CC="$PTHREAD_CC"
- CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
- LIBS="$PTHREAD_LIBS $LIBS"


=====================================
contrib/src/upnp/libupnp-win32-exports.patch deleted
=====================================
@@ -1,35 +0,0 @@
----
- configure.ac  | 7 +++++++
- libupnp.pc.in | 2 +-
- 2 files changed, 8 insertions(+), 1 deletion(-)
-
-diff --git a/configure.ac b/configure.ac
-index 35c060cc..76f48486 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -509,6 +509,13 @@ AX_PTHREAD(
- CC="$PTHREAD_CC"
- CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
- LIBS="$PTHREAD_LIBS $LIBS"
-+
-+# WIN32 specific
-+if test "$ac_cv_win32" = "yes"; then
-+WIN32_LIBS="-liphlpapi -lws2_32"
-+fi
-+AC_SUBST(WIN32_LIBS)
-+
- #
- # Determine if pthread_rwlock_t is available
- #
-diff --git a/libupnp.pc.in b/libupnp.pc.in
-index 8c6fc22f..ccdaf871 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 -lixml
-+Libs: -L${libdir} -lupnp -lixml @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ @WIN32_LIBS@
- Libs.private: @OPENSSL_LIBS@
- Cflags: @PTHREAD_CFLAGS@ -I${includedir}/upnp


=====================================
contrib/src/upnp/rules.mak
=====================================
@@ -1,5 +1,5 @@
 # UPNP
-UPNP_VERSION := 1.14.13
+UPNP_VERSION := 1.14.15
 UPNP_URL := $(GITHUB)/pupnp/pupnp/archive/refs/tags/release-$(UPNP_VERSION).tar.gz
 
 ifdef BUILD_NETWORK
@@ -14,52 +14,43 @@ $(TARBALLS)/pupnp-release-$(UPNP_VERSION).tar.gz:
 
 .sum-upnp: pupnp-release-$(UPNP_VERSION).tar.gz
 
-UPNP_CONF := --disable-samples
-UPNP_CONF += CFLAGS="$(CFLAGS) -DUPNP_STATIC_LIB"
-UPNP_CONF += CXXFLAGS="$(CXXFLAGS) -DUPNP_STATIC_LIB"
-
 ifdef HAVE_WIN32
 DEPS_upnp += winpthreads $(DEPS_winpthreads)
 endif
+
+UPNP_CONF := -DUPNP_BUILD_SHARED=OFF \
+	-DBUILD_TESTING=OFF \
+	-DUPNP_BUILD_SAMPLES=OFF
+
 ifdef HAVE_WINSTORE
-UPNP_CONF += --disable-ipv6 --enable-unspecified_server
+UPNP_CONF += -DUPNP_ENABLE_IPV6=OFF -DUPNP_ENABLE_UNSPECIFIED_SERVER=ON
 else
 ifdef HAVE_IOS
-UPNP_CONF += --disable-ipv6 --enable-unspecified_server
+UPNP_CONF += -DUPNP_ENABLE_IPV6=OFF -DUPNP_ENABLE_UNSPECIFIED_SERVER=ON
 else
-UPNP_CONF += --enable-ipv6
-endif
+UPNP_CONF += -DUPNP_ENABLE_IPV6=ON
 endif
-ifndef WITH_OPTIMIZATION
-UPNP_CONF += --enable-debug
 endif
 
 upnp: pupnp-release-$(UPNP_VERSION).tar.gz .sum-upnp
 	$(UNPACK)
 ifdef HAVE_WIN32
-	$(APPLY) $(SRC)/upnp/libupnp-pthread-force.patch
-	$(APPLY) $(SRC)/upnp/libupnp-win32-exports.patch
 	$(APPLY) $(SRC)/upnp/libupnp-win32.patch
 	$(APPLY) $(SRC)/upnp/windows-version-inet.patch
-	$(APPLY) $(SRC)/upnp/0001-ThreadPool-Fix-non-UCRT-builds.patch
-	$(APPLY) $(SRC)/upnp/win32-remove-wrong-safe-wrappers.patch
-endif
-ifdef HAVE_LINUX
-ifndef HAVE_ANDROID
-	$(APPLY) $(SRC)/upnp/libupnp-pthread-force.patch
-endif
 endif
 ifdef HAVE_ANDROID
 	$(APPLY) $(SRC)/upnp/revert-ifaddrs.patch
+else
+	# Avoid forcing `-lpthread` on android as it does not provide it and
+	# identifies as 'Linux' in CMake.
+	$(APPLY) $(SRC)/upnp/libtool-nostdlib-workaround.patch
 endif
 	$(APPLY) $(SRC)/upnp/miniserver.patch
-	$(UPDATE_AUTOCONFIG)
 	$(MOVE)
 
-.upnp: upnp
-	$(RECONF)
-	$(MAKEBUILDDIR)
-	$(MAKECONFIGURE) $(UPNP_CONF)
-	+$(MAKEBUILD)
-	+$(MAKEBUILD) install
+.upnp: upnp toolchain.cmake
+	$(CMAKECLEAN)
+	$(HOSTVARS) $(CMAKE) $(UPNP_CONF)
+	+$(CMAKEBUILD)
+	+$(CMAKEINSTALL)
 	touch $@


=====================================
contrib/src/upnp/win32-remove-wrong-safe-wrappers.patch deleted
=====================================
@@ -1,35 +0,0 @@
-From 90dee7da8ed96ea6e2ade2dd0f085bfb575449b3 Mon Sep 17 00:00:00 2001
-From: Alaric Senat <dev.asenat at posteo.net>
-Date: Tue, 13 Sep 2022 19:48:09 +0200
-Subject: [PATCH] win32: remove wrong safe wrappers
-
-Theses wrapper were too naively written and are causing a lot of
-regressions on windows.
-
-This has been addressed upstream [1]. And is simply reverted for now,
-waiting for a new release.
-
-[1] https://github.com/pupnp/pupnp/issues/411
----
- ixml/inc/posix_overwrites.h | 6 ------
- 1 file changed, 6 deletions(-)
-
-diff --git a/ixml/inc/posix_overwrites.h b/ixml/inc/posix_overwrites.h
-index a9c49e3f..7e37a355 100644
---- a/ixml/inc/posix_overwrites.h
-+++ b/ixml/inc/posix_overwrites.h
-@@ -11,11 +11,5 @@
- 	#define strncasecmp strnicmp
- 	#define strnicmp _strnicmp
- 
--	/* Secure versions of functions */
--	#define strcat(arg1, arg2) strcat_s(arg1, sizeof(arg1), arg2)
--	#define strcpy(arg1, arg2) strcpy_s(arg1, _countof(arg1), arg2)
--	#define strncpy(arg1, arg2, arg3) strncpy_s(arg1, arg3, arg2, arg3)
--	#define sprintf(arg1, ...) sprintf_s(arg1, sizeof(arg1), __VA_ARGS__)
--
- #endif /* _WIN32 */
- #endif /* POSIX_OVERWRTIES_H */
--- 
-2.35.1
-



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2a5b058dcead7b9d55a3ddaee93055af3b9bfc63...3d7b30a7a1b57a64d50055b7e60e33d6088ea1be

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2a5b058dcead7b9d55a3ddaee93055af3b9bfc63...3d7b30a7a1b57a64d50055b7e60e33d6088ea1be
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list