[vlc-commits] Contribs: add upnp.

Konstantin Pavlov git at videolan.org
Thu Jul 14 09:46:23 CEST 2011


vlc | branch: master | Konstantin Pavlov <thresh at videolan.org> | Wed Jul 13 22:45:28 2011 +0400| [a1fdfd702c9d08218f02139aeccb75b862f301aa] | committer: Konstantin Pavlov

Contribs: add upnp.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a1fdfd702c9d08218f02139aeccb75b862f301aa
---

 contrib/src/upnp/SHA512SUMS              |    1 +
 contrib/src/upnp/libupnp-configure.patch |   82 ++++++++++++++++++++++++++++++
 contrib/src/upnp/libupnp-win32.patch     |   31 +++++++++++
 contrib/src/upnp/rules.mak               |   27 ++++++++++
 4 files changed, 141 insertions(+), 0 deletions(-)

diff --git a/contrib/src/upnp/SHA512SUMS b/contrib/src/upnp/SHA512SUMS
new file mode 100644
index 0000000..087ffe7
--- /dev/null
+++ b/contrib/src/upnp/SHA512SUMS
@@ -0,0 +1 @@
+b1eca8fd6a61790197a33c14e00b380126b99261a0568061967c5623264982a7e6ab68b39b7c4ed066a0c38ab927dc17d69799ea48701416f5a217c6fffe2ce1  libupnp-1.6.13.tar.bz2
diff --git a/contrib/src/upnp/libupnp-configure.patch b/contrib/src/upnp/libupnp-configure.patch
new file mode 100644
index 0000000..dbc14cc
--- /dev/null
+++ b/contrib/src/upnp/libupnp-configure.patch
@@ -0,0 +1,82 @@
+--- libupnp/configure.ac.orig	2011-02-09 00:55:44.000000000 +0100
++++ libupnp/configure.ac	2011-02-10 23:39:44.154929678 +0100
+@@ -397,7 +397,6 @@
+ AC_PROG_MAKE_SET
+ AC_PROG_EGREP
+ 
+-#
+ # Default compilation flags
+ #
+ echo "--------------------- Default compilation flags -------------------------------"
+@@ -531,39 +530,46 @@
+ # Checks for POSIX Threads
+ #
+ echo "--------------------------- pthread stuff -------------------------------------"
+-ACX_PTHREAD(
+-	[],
+-	[AC_MSG_ERROR([POSIX threads are required to build this program])])
++#ACX_PTHREAD(
++#	[],
++#	[AC_MSG_ERROR([POSIX threads are required to build this program])])
+ #
++PTHREAD_LIBS=" -lpthreadGC2 -lws2_32"
++PTHREAD_CFLAGS=" -DPTW32_STATIC_LIB -DUPNP_STATIC_LIB"
+ # Update environment variables for pthreads
+ #
+-CC="$PTHREAD_CC"
++#CC="$PTHREAD_CC"
+ CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
++
++AC_SUBST(PTHREAD_LIBS)
++AC_SUBST(PTHREAD_CFLAGS)
++AC_SUBST(PTHREAD_CC)
++
+ #
+ # Determine if pthread_rwlock_t is available
+ #
+-echo "----------------------- pthread_rwlock_t stuff --------------------------------"
+-AC_MSG_CHECKING([if pthread_rwlock_t is available])
+-AC_LANG([C])
+-AC_COMPILE_IFELSE(
+-	[AC_LANG_PROGRAM(
+-		[#include <pthread.h>],
+-		[pthread_rwlock_t *x;])],
+-	[AC_DEFINE([UPNP_USE_RWLOCK], [1], [Use pthread_rwlock_t])
+-		AC_MSG_RESULT([yes, supported without any options])],
+-	[AC_COMPILE_IFELSE(
+-		[AC_LANG_PROGRAM(
+-			[#define _GNU_SOURCE
+-			#include <pthread.h>],
+-			[pthread_rwlock_t *x;])],
+-		[AC_DEFINE([UPNP_USE_RWLOCK], [1], [Use pthread_rwlock_t])
+-			CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
+-			AC_MSG_RESULT([yes, definition of _GNU_SOURCE required])],
+-		[AC_DEFINE([UPNP_USE_RWLOCK], [0], [Do not use pthread_rwlock_t])
+-			AC_MSG_RESULT([no, needs to fallback to pthread_mutex])
+-			AC_MSG_ERROR([pthread_rwlock_t not available])])])
+-echo "-------------------------------------------------------------------------------"
++#echo "----------------------- pthread_rwlock_t stuff --------------------------------"
++#AC_MSG_CHECKING([if pthread_rwlock_t is available])
++#AC_LANG([C])
++#AC_COMPILE_IFELSE(
++#	[AC_LANG_PROGRAM(
++#		[#include <pthread.h>],
++#		[pthread_rwlock_t *x;])],
++#	[AC_DEFINE([UPNP_USE_RWLOCK], [1], [Use pthread_rwlock_t])
++#		AC_MSG_RESULT([yes, supported without any options])],
++#	[AC_COMPILE_IFELSE(
++#		[AC_LANG_PROGRAM(
++#			[#define _GNU_SOURCE
++#			#include <pthread.h>],
++#			[pthread_rwlock_t *x;])],
++#		[AC_DEFINE([UPNP_USE_RWLOCK], [1], [Use pthread_rwlock_t])
++#			CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
++#			AC_MSG_RESULT([yes, definition of _GNU_SOURCE required])],
++#		[AC_DEFINE([UPNP_USE_RWLOCK], [0], [Do not use pthread_rwlock_t])
++#			AC_MSG_RESULT([no, needs to fallback to pthread_mutex])
++#			AC_MSG_ERROR([pthread_rwlock_t not available])])])
++#echo "-------------------------------------------------------------------------------"
+ 
+ 
+ AC_CONFIG_FILES([
diff --git a/contrib/src/upnp/libupnp-win32.patch b/contrib/src/upnp/libupnp-win32.patch
new file mode 100644
index 0000000..f26ba5b
--- /dev/null
+++ b/contrib/src/upnp/libupnp-win32.patch
@@ -0,0 +1,31 @@
+--- libupnp/configure.ac.orig	2011-02-10 23:53:25.000000000 +0100
++++ libupnp/configure.ac	2011-02-10 23:54:23.574454501 +0100
+@@ -546,6 +546,7 @@
+ AC_SUBST(PTHREAD_CFLAGS)
+ AC_SUBST(PTHREAD_CC)
+ 
++AC_DEFINE([_WIN32_WINNT], 0x0501, [Define to '0x0500' for Windows 2000 APIs.])
+ #
+ # Determine if pthread_rwlock_t is available
+ #
+--- libupnp/libupnp.pc.in	2010-12-23 21:24:05.000000000 +0100
++++ libupnp.new/libupnp.pc.in	2011-02-13 11:27:23.000000000 +0100
+@@ -6,6 +6,6 @@
+ Name: libupnp
+ Description: Linux SDK for UPnP Devices
+ Version: @VERSION@
+-Libs: @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ -L${libdir} -lupnp -lthreadutil -lixml 
++Libs: @PTHREAD_CFLAGS@ -L${libdir} -lupnp -lthreadutil -lixml -liphlpapi @PTHREAD_LIBS@ 
+ Cflags: @PTHREAD_CFLAGS@ -I${includedir}/upnp
+ 
+--- libupnp/upnp/src/inc/upnputil.h	2010-12-23 21:24:06.000000000 +0100
++++ libupnp.new/upnp/src/inc/upnputil.h	2011-02-13 08:24:24.000000000 +0100
+@@ -125,7 +125,7 @@
+ 		#define strncasecmp		strnicmp
+ 		#define sleep(a)		Sleep((a)*1000)
+ 		#define usleep(a)		Sleep((a)/1000)
+-		#define strerror_r(a,b,c)	(strerror_s((b),(c),(a)))
++		#define strerror_r(a,b,c)       strncpy( b, strerror(a), c)
+ 	#else
+ 		#define max(a, b)   (((a)>(b))? (a):(b))
+ 		#define min(a, b)   (((a)<(b))? (a):(b))
diff --git a/contrib/src/upnp/rules.mak b/contrib/src/upnp/rules.mak
new file mode 100644
index 0000000..d3e2a8a
--- /dev/null
+++ b/contrib/src/upnp/rules.mak
@@ -0,0 +1,27 @@
+# UPNP
+UPNP_VERSION := 1.6.13
+UPNP_URL := $(SF)/pupnp/libupnp-$(UPNP_VERSION).tar.bz2
+
+$(TARBALLS)/libupnp-$(UPNP_VERSION).tar.bz2:
+	$(call download,$(UPNP_URL))
+
+.sum-upnp: libupnp-$(UPNP_VERSION).tar.bz2
+
+ifdef HAVE_WIN32
+	PKGS += .pthreads
+	DEPS_upnp += pthreads $(DEPS_pthreads)
+	LIBUPNP_ECFLAGS = -DPTW32_STATIC_LIB
+endif
+
+upnp: libupnp-$(UPNP_VERSION).tar.bz2 .sum-upnp
+	$(UNPACK)
+ifdef HAVE_WIN32
+	$(APPLY) $(SRC)/upnp/libupnp-configure.patch
+	$(APPLY) $(SRC)/upnp/libupnp-win32.patch
+endif
+	$(MOVE)
+
+.upnp: upnp
+	cd $< && $(HOSTVARS) CFLAGS="$(CFLAGS) -O3 -DUPNP_STATIC_LIB $(LIBUPNP_ECFLAGS)" ./configure --disable-samples --without-documentation --disable-webserver $(HOSTCONF)
+	cd $< && $(MAKE) install
+	touch $@



More information about the vlc-commits mailing list