[vlc-commits] contrib: srt: enable for Win32 and update to 1.2.3

Justin Kim git at videolan.org
Sun Apr 22 21:33:34 CEST 2018


vlc/vlc-3.0 | branch: master | Justin Kim <justin.kim at collabora.com> | Wed Mar 28 19:29:46 2018 +0900| [2b3e1aec4dad4f0b9b9b4770d43c5479ed041864] | committer: Jean-Baptiste Kempf

contrib: srt: enable for Win32 and update to 1.2.3

(cherry picked from commit 53102c1a2f70bfd32a7d6a61c66da7ec87ba6a27)
(cherry picked from commit 0fed86b7fcb9287ddc370b74db7b6905b92699f8)

Signed-off-by: Justin Kim <justin.kim at collabora.com>
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 ...txt-substitute-link-flags-for-package-nam.patch | 33 ++++++++++++++
 ...002-CMakeLists.txt-let-cmake-find-pthread.patch | 51 ++++++++++++++++++++++
 contrib/src/srt/SHA512SUMS                         |  3 +-
 contrib/src/srt/fix-pc.patch                       | 41 -----------------
 contrib/src/srt/rules.mak                          | 14 +++---
 5 files changed, 95 insertions(+), 47 deletions(-)

diff --git a/contrib/src/srt/0001-CMakeLists.txt-substitute-link-flags-for-package-nam.patch b/contrib/src/srt/0001-CMakeLists.txt-substitute-link-flags-for-package-nam.patch
new file mode 100644
index 0000000000..0d3cf7038a
--- /dev/null
+++ b/contrib/src/srt/0001-CMakeLists.txt-substitute-link-flags-for-package-nam.patch
@@ -0,0 +1,33 @@
+From 671f9bc81168438d7cbc86f5946f2dbb720fa60e Mon Sep 17 00:00:00 2001
+From: Justin Kim <justin.kim at collabora.com>
+Date: Thu, 19 Apr 2018 20:12:21 +0900
+Subject: [PATCH 1/2] CMakeLists.txt: substitute link flags for package names
+
+Signed-off-by: Justin Kim <justin.kim at collabora.com>
+---
+ CMakeLists.txt | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 85eb9c5..77fbfb0 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -90,6 +90,7 @@ if ( USE_GNUTLS )
+ 	endif()
+  
+ 	pkg_check_modules (SSL REQUIRED ${SSL_REQUIRED_MODULES})
++	set (SRT_LIBS_PRIVATE ${SSL_LDFLAGS})
+ 
+ 	add_definitions(
+ 		-DUSE_GNUTLS=1
+@@ -103,6 +104,7 @@ else()
+ 	find_package(OpenSSL REQUIRED)
+ 	set (SSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
+ 	set (SSL_LIBRARIES ${OPENSSL_LIBRARIES})
++	set (SRT_LIBS_PRIVATE ${SSL_LIBRARIES})
+ 
+ 	add_definitions(
+ 		-DHAICRYPT_USE_OPENSSL_EVP=1
+-- 
+2.17.0
+
diff --git a/contrib/src/srt/0002-CMakeLists.txt-let-cmake-find-pthread.patch b/contrib/src/srt/0002-CMakeLists.txt-let-cmake-find-pthread.patch
new file mode 100644
index 0000000000..b90a4e5cf3
--- /dev/null
+++ b/contrib/src/srt/0002-CMakeLists.txt-let-cmake-find-pthread.patch
@@ -0,0 +1,51 @@
+From 6446d6c9294b63b3b1d363a4e92213a3bb5d4101 Mon Sep 17 00:00:00 2001
+From: Justin Kim <justin.kim at collabora.com>
+Date: Fri, 23 Mar 2018 13:05:29 +0900
+Subject: [PATCH 2/2] CMakeLists.txt: let cmake find pthread
+
+---
+ CMakeLists.txt | 24 ++++++------------------
+ 1 file changed, 6 insertions(+), 18 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 77fbfb0..52d6bcd 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -213,28 +213,16 @@ if (${ENABLE_PROFILE} AND HAVE_COMPILER_GNU_COMPAT)
+ endif()
+ 
+ 
+-if (NOT MINGW)
+ # find pthread
+-find_path(PTHREAD_INCLUDE_DIR pthread.h HINTS C:/pthread-win32/include)
+-if (PTHREAD_INCLUDE_DIR)
+-	message(STATUS "Pthread include dir: ${PTHREAD_INCLUDE_DIR}")
+-else()
+-	message(FATAL_ERROR "Failed to find pthread.h. Specify PTHREAD_INCLUDE_DIR.")
+-endif()
+-
+-find_library(PTHREAD_LIBRARY NAMES pthread pthread_dll pthread_lib HINTS C:/pthread-win32/lib)
+-if (PTHREAD_LIBRARY)
+-	message(STATUS "Pthread library: ${PTHREAD_LIBRARY}")
++set (THREADS_PTHREAD_ARG "2" CACHE STRING "Forcibly set by CMakeLists.txt." FORCE)
++set (THREADS_PREFER_PTHREAD_FLAG ON)
++find_package (Threads REQUIRED)
++if (WIN32)
++	set (SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE} -lpthreadGC2)
+ else()
+-	message(FATAL_ERROR "Failed to find pthread library. Specify PTHREAD_LIBRARY.")
++	set (SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE} ${CMAKE_THREAD_LIBS_INIT})
+ endif()
+ 
+-elseif(THREADS_FOUND)
+-	set(PTHREAD_LIBRARY ${CMAKE_THREAD_LIBS_INIT})
+-else()
+-	find_library(PTHREAD_LIBRARY NAMES pthread pthreadGC2 pthreadGC)
+-endif() # if (NOT MINGW)
+-
+ # This is required in some projects that add some other sources
+ # to the SRT library to be compiled together (aka "virtual library").
+ if (DEFINED SRT_EXTRA_LIB_INC)
+-- 
+2.17.0
+
diff --git a/contrib/src/srt/SHA512SUMS b/contrib/src/srt/SHA512SUMS
index 6e7338cdd7..a1abaf6598 100644
--- a/contrib/src/srt/SHA512SUMS
+++ b/contrib/src/srt/SHA512SUMS
@@ -1 +1,2 @@
-cb897c97d5fd93b333c8de0805c78c940650a2daf8d821e09e3fb01c7e4b56bd7513cf28545f7ac422fba9fa8420b745f397359a4b9e81cff496c776820ea90a  srt-1.2.2.tar.gz
+30bc7750e1a47d637c57fef9dcf0d1be02ac51831f041f75ea3bd2437f1e1bfd06848fbbdcfb5476267b9165b1a035e5bedfa9ea2f3c88ea536ee93c23e3cd46  srt-1.2.3.tar.gz
+
diff --git a/contrib/src/srt/fix-pc.patch b/contrib/src/srt/fix-pc.patch
deleted file mode 100644
index 8f666fa6f6..0000000000
--- a/contrib/src/srt/fix-pc.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 2f96045d17b2fc912d8bece54adf1cbe774166dd Mon Sep 17 00:00:00 2001
-From: Justin Kim <justin.kim at collabora.com>
-Date: Fri, 8 Dec 2017 20:43:54 +0900
-Subject: [PATCH] CMakeLists.txt: substitute link flags for package names
-
-Signed-off-by: Justin Kim <justin.kim at collabora.com>
----
- CMakeLists.txt | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 8e02b58..d9a8a1b 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -90,6 +90,7 @@ set_if(LINUX ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
- # find OpenSSL
- if ( USE_GNUTLS )
- 	pkg_check_modules (SSL REQUIRED gnutls nettle)
-+	set (SRT_LIBS_PRIVATE ${SSL_LDFLAGS})
- 
- 	add_definitions(
- 		-DUSE_GNUTLS=1
-@@ -102,6 +103,7 @@ else()
- 	find_package(OpenSSL REQUIRED)
- 	set (SSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
- 	set (SSL_LIBRARIES ${OPENSSL_LIBRARIES})
-+	set (SRT_LIBS_PRIVATE ${SSL_LIBRARIES})
- 
- 	add_definitions(
- 		-DHAICRYPT_USE_OPENSSL_EVP=1
-@@ -358,7 +360,6 @@ target_include_directories(${TARGET_haicrypt}
- 
- set_target_properties (${TARGET_haicrypt} PROPERTIES VERSION ${SRT_VERSION} SOVERSION ${SRT_VERSION_MAJOR})
- target_link_libraries(${TARGET_haicrypt} PRIVATE ${SSL_LIBRARIES})
--set (SRT_LIBS_PRIVATE ${SSL_LIBRARIES})
- if (WIN32)
- 	target_link_libraries(${TARGET_haicrypt} PRIVATE ws2_32.lib)
- 	set (SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE} ws2_32.lib)
--- 
-2.15.1
-
diff --git a/contrib/src/srt/rules.mak b/contrib/src/srt/rules.mak
index 3ffdfb4d55..68233c8f01 100644
--- a/contrib/src/srt/rules.mak
+++ b/contrib/src/srt/rules.mak
@@ -1,13 +1,12 @@
 # srt
 
-SRT_VERSION := 1.2.2
+SRT_VERSION := 1.2.3
 SRT_URL := $(GITHUB)/Haivision/srt/archive/v$(SRT_VERSION).tar.gz
 
-ifndef HAVE_WIN32
 ifdef BUILD_NETWORK
 PKGS += srt
 endif
-endif
+
 ifeq ($(call need_pkg,"srt >= 1.2.2"),)
 PKGS_FOUND += srt
 endif
@@ -16,6 +15,10 @@ ifdef HAVE_DARWIN_OS
 SRT_DARWIN=CFLAGS="$(CFLAGS) -Wno-error=partial-availability" CXXFLAGS="$(CXXFLAGS) -Wno-error=partial-availability"
 endif
 
+ifdef HAVE_WIN32
+DEPS_srt += pthreads $(DEPS_pthreads)
+endif
+
 $(TARBALLS)/srt-$(SRT_VERSION).tar.gz:
 	$(call download_pkg,$(SRT_URL),srt)
 
@@ -23,8 +26,9 @@ $(TARBALLS)/srt-$(SRT_VERSION).tar.gz:
 
 srt: srt-$(SRT_VERSION).tar.gz .sum-srt
 	$(UNPACK)
-	$(APPLY) $(SRC)/srt/fix-pc.patch
-	$(APPLY) $(SRC)/srt/add-implicit-link-libraries.patch
+	$(APPLY) $(SRC)/srt/add-implicit-link-libraries.patch 
+	$(APPLY) $(SRC)/srt/0001-CMakeLists.txt-substitute-link-flags-for-package-nam.patch
+	$(APPLY) $(SRC)/srt/0002-CMakeLists.txt-let-cmake-find-pthread.patch
 	$(call pkg_static,"scripts/haisrt.pc.in")
 	mv srt-$(SRT_VERSION) $@ && touch $@
 



More information about the vlc-commits mailing list