[vlc-devel] [PATCH] contrib: Update SRT to 1.3.1

Olivier CrĂȘte olivier.crete at collabora.com
Tue Jul 10 17:48:17 CEST 2018


Skipping 1.3.0 as it was a bad version. Also removed all
custom patches are they don't seem to be required anymore, but
added new ones to make it build with MingW.
---
 ...ubstitute-link-flags-for-package-nam.patch | 33 ------------
 .../srt/0001-api-Don-t-use-inet_ntop.patch    | 43 ++++++++++++++++
 ...MakeLists.txt-let-cmake-find-pthread.patch | 51 -------------------
 ...32-Only-include-inttypes.h-with-MSVC.patch | 27 ++++++++++
 ...all-Windows-header-in-windows-subdir.patch | 25 +++++++++
 ...nstall-windows-headers-in-win-subdir.patch | 39 ++++++++++++++
 contrib/src/srt/SHA512SUMS                    |  3 +-
 .../src/srt/add-implicit-link-libraries.patch | 25 ---------
 contrib/src/srt/rules.mak                     | 18 +++----
 .../src/srt/srt-fix-non-gnu-detection.patch   | 23 ---------
 contrib/src/srt/srt-no-implicit-libs.patch    | 26 ----------
 11 files changed, 142 insertions(+), 171 deletions(-)
 delete mode 100644 contrib/src/srt/0001-CMakeLists.txt-substitute-link-flags-for-package-nam.patch
 create mode 100644 contrib/src/srt/0001-api-Don-t-use-inet_ntop.patch
 delete mode 100644 contrib/src/srt/0002-CMakeLists.txt-let-cmake-find-pthread.patch
 create mode 100644 contrib/src/srt/0002-win32-Only-include-inttypes.h-with-MSVC.patch
 create mode 100644 contrib/src/srt/0003-Only-install-Windows-header-in-windows-subdir.patch
 create mode 100644 contrib/src/srt/0004-cmake-Only-install-windows-headers-in-win-subdir.patch
 delete mode 100644 contrib/src/srt/add-implicit-link-libraries.patch
 delete mode 100644 contrib/src/srt/srt-fix-non-gnu-detection.patch
 delete mode 100644 contrib/src/srt/srt-no-implicit-libs.patch

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
deleted file mode 100644
index 0d3cf7038a..0000000000
--- a/contrib/src/srt/0001-CMakeLists.txt-substitute-link-flags-for-package-nam.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-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/0001-api-Don-t-use-inet_ntop.patch b/contrib/src/srt/0001-api-Don-t-use-inet_ntop.patch
new file mode 100644
index 0000000000..67f5fa7dae
--- /dev/null
+++ b/contrib/src/srt/0001-api-Don-t-use-inet_ntop.patch
@@ -0,0 +1,43 @@
+From e3f250de430d914e46cfcf70fdaa5ecd14b794cb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= <olivier.crete at collabora.com>
+Date: Mon, 9 Jul 2018 17:51:27 -0400
+Subject: [PATCH 1/4] api: Don't use inet_ntop
+
+It's not defined on Windows. Instead use getnameinfo with
+the numeric request.
+---
+ srtcore/api.h | 15 +++++----------
+ 1 file changed, 5 insertions(+), 10 deletions(-)
+
+diff --git a/srtcore/api.h b/srtcore/api.h
+index e6e9d3f..5e3724b 100644
+--- a/srtcore/api.h
++++ b/srtcore/api.h
+@@ -270,19 +270,14 @@ inline std::string SockaddrToString(const sockaddr* sadr)
+ 
+     std::ostringstream output;
+     char hostbuf[1024];
++    int flags = NI_NAMEREQD;
+ 
+-#if ENABLE_GETNAMEINFO
+-    if (!getnameinfo(sadr, sizeof(*sadr), hostbuf, 1024, NULL, 0, NI_NAMEREQD))
+-    {
+-        output << hostbuf;
+-    }
+-    else
++#if !ENABLE_GETNAMEINFO
++    flags |= NI_NUMERICHOST | NI_NUMERICSERV;
+ #endif
++
++    if (!getnameinfo(sadr, sizeof(*sadr), hostbuf, 1024, NULL, 0, flags))
+     {
+-        if (inet_ntop(sadr->sa_family, addr, hostbuf, 1024) == NULL)
+-        {
+-            strcpy(hostbuf, "unknown");
+-        }
+         output << hostbuf;
+     }
+ 
+-- 
+2.17.1
+
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
deleted file mode 100644
index b90a4e5cf3..0000000000
--- a/contrib/src/srt/0002-CMakeLists.txt-let-cmake-find-pthread.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-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/0002-win32-Only-include-inttypes.h-with-MSVC.patch b/contrib/src/srt/0002-win32-Only-include-inttypes.h-with-MSVC.patch
new file mode 100644
index 0000000000..4b14773382
--- /dev/null
+++ b/contrib/src/srt/0002-win32-Only-include-inttypes.h-with-MSVC.patch
@@ -0,0 +1,27 @@
+From d1e17010264e51ed47f373ca755e8b4fce8aca2d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= <olivier.crete at collabora.com>
+Date: Mon, 9 Jul 2018 18:04:44 -0400
+Subject: [PATCH 2/4] win32: Only include inttypes.h with MSVC
+
+---
+ srtcore/platform_sys.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/srtcore/platform_sys.h b/srtcore/platform_sys.h
+index 33c4d9b..ce546d2 100644
+--- a/srtcore/platform_sys.h
++++ b/srtcore/platform_sys.h
+@@ -15,9 +15,9 @@
+    #include <ws2tcpip.h>
+    #include <ws2ipdef.h>
+    #include <windows.h>
+-   #include <inttypes.h>
+    #include <stdint.h>
+    #if defined(_MSC_VER)
++      #include <inttypes.h>
+       #pragma warning(disable:4251)
+    #endif
+ #else
+-- 
+2.17.1
+
diff --git a/contrib/src/srt/0003-Only-install-Windows-header-in-windows-subdir.patch b/contrib/src/srt/0003-Only-install-Windows-header-in-windows-subdir.patch
new file mode 100644
index 0000000000..b6205405fa
--- /dev/null
+++ b/contrib/src/srt/0003-Only-install-Windows-header-in-windows-subdir.patch
@@ -0,0 +1,25 @@
+From 7a5e184ba8328c5455d51e0f5a159cab1a66cac5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= <olivier.crete at collabora.com>
+Date: Mon, 9 Jul 2018 18:16:28 -0400
+Subject: [PATCH 3/4] Only install Windows header in windows subdir
+
+---
+ srtcore/platform_sys.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/srtcore/platform_sys.h b/srtcore/platform_sys.h
+index ce546d2..c0aa287 100644
+--- a/srtcore/platform_sys.h
++++ b/srtcore/platform_sys.h
+@@ -17,7 +17,7 @@
+    #include <windows.h>
+    #include <stdint.h>
+    #if defined(_MSC_VER)
+-      #include <inttypes.h>
++      #include <win/inttypes.h>
+       #pragma warning(disable:4251)
+    #endif
+ #else
+-- 
+2.17.1
+
diff --git a/contrib/src/srt/0004-cmake-Only-install-windows-headers-in-win-subdir.patch b/contrib/src/srt/0004-cmake-Only-install-windows-headers-in-win-subdir.patch
new file mode 100644
index 0000000000..57af8d8eca
--- /dev/null
+++ b/contrib/src/srt/0004-cmake-Only-install-windows-headers-in-win-subdir.patch
@@ -0,0 +1,39 @@
+From 5a7295870dbccc321a460804c6a24f4493692ce4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= <olivier.crete at collabora.com>
+Date: Mon, 9 Jul 2018 18:17:45 -0400
+Subject: [PATCH 4/4] cmake: Only install windows headers in win subdir
+
+---
+ CMakeLists.txt         | 1 -
+ srtcore/platform_sys.h | 2 +-
+ 2 files changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index daec198..b197c19 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -450,7 +450,6 @@ endif()
+ # will now apply to the dependent library.
+ #list(APPEND SOURCES_srt ${SOURCES_haicrypt})
+ set (VIRTUAL_srt $<TARGET_OBJECTS:srt_virtual> $<TARGET_OBJECTS:haicrypt_virtual>)
+-set (HEADERS_srt ${HEADERS_srt} ${HEADERS_srt_win32})
+ 
+ if (srt_libspec_shared)
+ 	add_library(${TARGET_srt}_shared SHARED ${VIRTUAL_srt})
+diff --git a/srtcore/platform_sys.h b/srtcore/platform_sys.h
+index c0aa287..e8e6927 100644
+--- a/srtcore/platform_sys.h
++++ b/srtcore/platform_sys.h
+@@ -15,8 +15,8 @@
+    #include <ws2tcpip.h>
+    #include <ws2ipdef.h>
+    #include <windows.h>
+-   #include <stdint.h>
+    #if defined(_MSC_VER)
++      #include <win/stdint.h>
+       #include <win/inttypes.h>
+       #pragma warning(disable:4251)
+    #endif
+-- 
+2.17.1
+
diff --git a/contrib/src/srt/SHA512SUMS b/contrib/src/srt/SHA512SUMS
index a1abaf6598..e348996427 100644
--- a/contrib/src/srt/SHA512SUMS
+++ b/contrib/src/srt/SHA512SUMS
@@ -1,2 +1 @@
-30bc7750e1a47d637c57fef9dcf0d1be02ac51831f041f75ea3bd2437f1e1bfd06848fbbdcfb5476267b9165b1a035e5bedfa9ea2f3c88ea536ee93c23e3cd46  srt-1.2.3.tar.gz
-
+1f8fdfc0e1d92bc8c477651982c23afeacb65e2293a7225227927e1b6f71a01355a3311600097d77b3df638503e4856acbcb52ed270b650480f20b98c1be5ec2  srt-1.3.1.tar.gz
\ No newline at end of file
diff --git a/contrib/src/srt/add-implicit-link-libraries.patch b/contrib/src/srt/add-implicit-link-libraries.patch
deleted file mode 100644
index c007c1f394..0000000000
--- a/contrib/src/srt/add-implicit-link-libraries.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- srt.old/CMakeLists.txt	2017-12-09 09:10:02.000000000 +0100
-+++ srt/CMakeLists.txt	2017-12-09 09:18:38.000000000 +0100
-@@ -425,13 +425,15 @@
- # This may cause trouble when you want to compile your app with static libstdc++;
- # if your build requires it, you'd probably remove -lstdc++ from the list
- # obtained by `pkg-config --libs`.
--#
--# Some sensible solution for that is desired. Currently turned on only on demand.
--if (ENABLE_C_DEPS)
--if ( LINUX )
--	set (IFNEEDED_SRT_LDFLAGS "${IFNEEDED_SRT_LDFLAGS} -lstdc++ -lm")
--endif()
--endif()
-+
-+message("Adding the following implicit link libraries: ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES}")
-+foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES})
-+    if(IS_ABSOLUTE ${LIB} AND EXISTS ${LIB})
-+	    set(SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE} ${LIB})
-+    else()
-+        set(SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE} "-l${LIB}")
-+    endif()
-+endforeach()
- 
- join_arguments(SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE})
- 
diff --git a/contrib/src/srt/rules.mak b/contrib/src/srt/rules.mak
index 93d6e8c255..93970b8ccd 100644
--- a/contrib/src/srt/rules.mak
+++ b/contrib/src/srt/rules.mak
@@ -1,13 +1,13 @@
 # srt
 
-SRT_VERSION := 1.2.3
+SRT_VERSION := 1.3.1
 SRT_URL := $(GITHUB)/Haivision/srt/archive/v$(SRT_VERSION).tar.gz
 
 ifdef BUILD_NETWORK
 PKGS += srt
 endif
 
-ifeq ($(call need_pkg,"srt >= 1.2.2"),)
+ifeq ($(call need_pkg,"srt >= 1.3.1"),)
 PKGS_FOUND += srt
 endif
 
@@ -30,18 +30,14 @@ $(TARBALLS)/srt-$(SRT_VERSION).tar.gz:
 
 srt: srt-$(SRT_VERSION).tar.gz .sum-srt
 	$(UNPACK)
-	$(APPLY) $(SRC)/srt/add-implicit-link-libraries.patch 
-	$(APPLY) $(SRC)/srt/0001-CMakeLists.txt-substitute-link-flags-for-package-nam.patch
-	$(APPLY) $(SRC)/srt/srt-fix-non-gnu-detection.patch 
-ifdef HAVE_WINSTORE
-	$(APPLY) $(SRC)/srt/0002-CMakeLists.txt-let-cmake-find-pthread.patch
-	$(APPLY) $(SRC)/srt/srt-no-implicit-libs.patch 
-endif
-	$(call pkg_static,"scripts/haisrt.pc.in")
+	$(APPLY) $(SRC)/srt/0001-api-Don-t-use-inet_ntop.patch
+	$(APPLY) $(SRC)/srt/0002-win32-Only-include-inttypes.h-with-MSVC.patch
+	$(APPLY) $(SRC)/srt/0003-Only-install-Windows-header-in-windows-subdir.patch
+	$(APPLY) $(SRC)/srt/0004-cmake-Only-install-windows-headers-in-win-subdir.patch
 	mv srt-$(SRT_VERSION) $@ && touch $@
 
 .srt: srt toolchain.cmake
 	cd $< && $(HOSTVARS_PIC) CFLAGS="$(SRT_CFLAGS)" CXXFLAGS="$(SRT_CXXFLAGS)" $(CMAKE) \
-		-DENABLE_SHARED=OFF -DUSE_GNUTLS=ON -DENABLE_CXX11=OFF
+		-DENABLE_SHARED=OFF -DUSE_GNUTLS=ON -DENABLE_CXX11=OFF -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_BINDIR=bin -DCMAKE_INSTALL_INCLUDEDIR=include
 	cd $< && $(MAKE) install
 	touch $@
diff --git a/contrib/src/srt/srt-fix-non-gnu-detection.patch b/contrib/src/srt/srt-fix-non-gnu-detection.patch
deleted file mode 100644
index f7118afd1c..0000000000
--- a/contrib/src/srt/srt-fix-non-gnu-detection.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- srt/CMakeLists.txt	2018-04-23 13:12:07.138132400 +0200
-+++ srt/CMakeLists.txt.non-gnu	2018-04-23 13:11:11.088341900 +0200
-@@ -115,12 +115,14 @@ message (STATUS "SSL libraries: ${SSL_LI
- 
- # Detect if the compiler is GNU compatable for flags
- set(HAVE_COMPILER_GNU_COMPAT 0)
--foreach (gnid GNU Intel Clang AppleClang)
--	if (${CMAKE_CXX_COMPILER_ID} STREQUAL ${gnid})
--		set(HAVE_COMPILER_GNU_COMPAT 1)
--		break()
--	endif()
--endforeach()
-+if ( CMAKE_CXX_COMPILER_ID )
-+	foreach (gnid GNU Intel Clang AppleClang)
-+		if (${CMAKE_CXX_COMPILER_ID} STREQUAL ${gnid})
-+			set(HAVE_COMPILER_GNU_COMPAT 1)
-+			break()
-+		endif()
-+	endforeach()
-+endif()
- 
- if (DISABLE_CXX11)
- 	set (ENABLE_CXX11 0)
diff --git a/contrib/src/srt/srt-no-implicit-libs.patch b/contrib/src/srt/srt-no-implicit-libs.patch
deleted file mode 100644
index 928e38f6e5..0000000000
--- a/contrib/src/srt/srt-no-implicit-libs.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- srt-1.2.3/CMakeLists.txt	2018-05-16 15:11:24.490534700 +0200
-+++ srt-1.2.3/CMakeLists.txt.no-pthread	2018-05-16 15:12:19.940696200 +0200
-@@ -423,13 +423,20 @@ endif()
- # obtained by `pkg-config --libs`.
- 
- message("Adding the following implicit link libraries: ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES}")
--foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES})
-+foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
-     if(IS_ABSOLUTE ${LIB} AND EXISTS ${LIB})
--	    set(SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE} ${LIB})
-+        list(APPEND PLIBLIST "${LIB}")
-     else()
--        set(SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE} "-l${LIB}")
-+        list(APPEND PLIBLIST "-l${LIB}")
-     endif()
- endforeach()
-+if(PLIBLIST)
-+    # blacklist of libraries that should not be in Libs.private
-+    list(REMOVE_ITEM PLIBLIST "-lc" "-lpthread")
-+    string(REPLACE ";" " " SRT_LIBS_PRIVATE "${PLIBLIST}")
-+else()
-+    set(SRT_LIBS_PRIVATE "")
-+endif(PLIBLIST)
- 
- join_arguments(SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE})
- 
-- 
2.17.1



More information about the vlc-devel mailing list