[vlc-devel] [PATCH] contribs: srt: Fix pkgconfig file generation

Olivier CrĂȘte olivier.crete at collabora.com
Fri Jul 20 00:46:21 CEST 2018


Hi,

Can you double check that it fixes it for you? I can send an updated
version with the bug number.

Olivier

On Thu, 2018-07-19 at 17:46 -0400, Sean McGovern wrote:
> Hi Olivier,
> 
> Does this fix Trac #20832? If so can you note it in the patch title?
> 
> Sean McG.
> 
>   Original Message  
> From: olivier.crete at collabora.com
> Sent: July 19, 2018 5:39 PM
> To: vlc-devel at videolan.org
> Reply-to: vlc-devel at videolan.org
> Subject: [vlc-devel] [PATCH] contribs: srt: Fix pkgconfig file
> generation
> 
> VLC doesn't use pkg-config --static but hacks the .pc files, so do
> the same here. Also fix srt to produce valid pc files.
> ---
> ...thread-for-now-because-clang-and-VLC.patch | 26 ++++++++++++
> ...make-Don-t-confuse-libs-and-requires.patch | 42
> +++++++++++++++++++
> contrib/src/srt/rules.mak                     |  3 ++
> 3 files changed, 71 insertions(+)
> create mode 100644 contrib/src/srt/0005-cmake-Prefer-lpthread-for-
> now-because-clang-and-VLC.patch
> create mode 100644 contrib/src/srt/0006-cmake-Don-t-confuse-libs-and-
> requires.patch
> 
> diff --git a/contrib/src/srt/0005-cmake-Prefer-lpthread-for-now-
> because-clang-and-VLC.patch b/contrib/src/srt/0005-cmake-Prefer-
> lpthread-for-now-because-clang-and-VLC.patch
> new file mode 100644
> index 0000000000..22cc1e66fb
> --- /dev/null
> +++ b/contrib/src/srt/0005-cmake-Prefer-lpthread-for-now-because-
> clang-and-VLC.patch
> @@ -0,0 +1,26 @@
> +From 60af57d2e045ba80174aa0bb0a89807040be6d3f Mon Sep 17 00:00:00
> 2001
> +From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= <olivier.crete at collabora.com>
> +Date: Tue, 17 Jul 2018 11:24:39 -0400
> +Subject: [PATCH 5/5] cmake: Prefer -lpthread for now because clang++
> and VLC
> +
> +It seems that clang doesn't support -pthread at the linking stage,
> but
> +only at the compilation, so putting it into the .pc file causes
> issues.
> +---
> + CMakeLists.txt | 1 -
> + 1 file changed, 1 deletion(-)
> +
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index 34c8c87..74edd20 100644
> +--- a/CMakeLists.txt
> ++++ b/CMakeLists.txt
> +@@ -358,7 +358,6 @@ elseif (WIN32)
> + message(FATAL_ERROR "Failed to find pthread library. Specify
> PTHREAD_LIBRARY.")
> + endif()
> + else ()
> +- set(THREADS_PREFER_PTHREAD_FLAG ON)
> + find_package(Threads REQUIRED)
> + set(PTHREAD_LIBRARY ${CMAKE_THREAD_LIBS_INIT})
> + endif()
> +-- 
> +2.17.1
> +
> diff --git a/contrib/src/srt/0006-cmake-Don-t-confuse-libs-and-
> requires.patch b/contrib/src/srt/0006-cmake-Don-t-confuse-libs-and-
> requires.patch
> new file mode 100644
> index 0000000000..5b9b7aa99e
> --- /dev/null
> +++ b/contrib/src/srt/0006-cmake-Don-t-confuse-libs-and-
> requires.patch
> @@ -0,0 +1,42 @@
> +From bd7beffef507a2162d22d2735f5aec2d67f81e27 Mon Sep 17 00:00:00
> 2001
> +From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= <olivier.crete at collabora.com>
> +Date: Tue, 17 Jul 2018 17:07:46 -0400
> +Subject: [PATCH 6/6] cmake: Don't confuse libs and requires
> +
> +---
> + CMakeLists.txt | 9 +++++++--
> + 1 file changed, 7 insertions(+), 2 deletions(-)
> +
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index 74edd20..9cfc475 100644
> +--- a/CMakeLists.txt
> ++++ b/CMakeLists.txt
> +@@ -165,10 +165,12 @@ if ( USE_GNUTLS )
> + )
> + message(STATUS "SSL Dependency: using GNUTLS with Nettle, as
> requested")
> + else()
> +- set (SSL_REQUIRED_MODULES "openssl libcrypto zlib")
> + 
> + if (USE_OPENSSL_PC)
> + 
> ++         # Only use the .pc files if we actually try to find them
> ++         set (SSL_REQUIRED_MODULES "openssl libcrypto zlib")
> ++
> + pkg_check_modules(SSL REQUIRED ${SSL_REQUIRED_MODULES})
> + 
> + # We have some cases when pkg-config is improperly configured
> +@@ -492,7 +494,10 @@ endif()
> + 
> + target_include_directories(haicrypt_virtual PRIVATE 
> ${SSL_INCLUDE_DIRS})
> + 
> +-set (SRT_LIBS_PRIVATE ${SSL_LIBRARIES})
> ++# Only set the libraries directly if they're in the
> Requires.private
> ++if (NOT SSL_REQUIRED_MODULES)
> ++  set (SRT_LIBS_PRIVATE ${SSL_LIBRARIES})
> ++endif()
> + 
> + if (MICROSOFT)
> + set (SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE} ws2_32.lib)
> +-- 
> +2.17.1
> +
> diff --git a/contrib/src/srt/rules.mak b/contrib/src/srt/rules.mak
> index 635a2dd1c9..3706118f74 100644
> --- a/contrib/src/srt/rules.mak
> +++ b/contrib/src/srt/rules.mak
> @@ -34,6 +34,9 @@ srt: srt-$(SRT_VERSION).tar.gz .sum-srt
> $(APPLY) $(SRC)/srt/0002-win32-Only-include-inttypes.h-with-
> MSVC.patch
> $(APPLY) $(SRC)/srt/0003-cmake-Only-install-Windows-headers-in-win-
> subdir.patch
> $(APPLY) $(SRC)/srt/0004-cmake-pthread-win32.patch
> + $(APPLY) $(SRC)/srt/0005-cmake-Prefer-lpthread-for-now-because-
> clang-and-VLC.patch
> + $(APPLY) $(SRC)/srt/0006-cmake-Don-t-confuse-libs-and-
> requires.patch
> + $(call pkg_static,"scripts/srt.pc.in")
> mv srt-$(SRT_VERSION) $@ && touch $@
> 
> .srt: srt toolchain.cmake
-- 
Olivier CrĂȘte
olivier.crete at collabora.com


More information about the vlc-devel mailing list