[vlc-commits] [Git][videolan/vlc][master] contrib: flac: Include -pthread in the pkg-config file when necessary
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue May 6 11:24:02 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
cf3035ee by Martin Storsjö at 2025-05-05T14:06:17+03:00
contrib: flac: Include -pthread in the pkg-config file when necessary
This fixes linking with llvm-mingw (or any mingw distribution that
doesn't default to linking in winpthreads).
This wasn't noticed in the upstream VLC CI, as it builds with
extras/packages/win32/build.sh, which passes in -Wl,-l:libpthread.a
in VLC_LDFLAGS (in order to prefer linking winpthreads statically,
rather than dynamically, for libraries that do use winpthreads).
This patch has been sent upstream in
https://github.com/xiph/flac/pull/832.
- - - - -
2 changed files:
- + contrib/src/flac/0001-cmake-Include-pthread-in-the-pkg-config-file-if-usin.patch
- contrib/src/flac/rules.mak
Changes:
=====================================
contrib/src/flac/0001-cmake-Include-pthread-in-the-pkg-config-file-if-usin.patch
=====================================
@@ -0,0 +1,37 @@
+From 8e74f100fa822852dd567cd0dbaf7245b26c412f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
+Date: Mon, 5 May 2025 13:42:15 +0300
+Subject: [PATCH] cmake: Include "-pthread" in the pkg-config file if using
+ pthreads
+
+This makes sure that users of the library pass the right linker
+flags if linking libflac statically, with a mingw toolchain that
+doesn't automatically link in pthreads.
+---
+ CMakeLists.txt | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9396130d..c8f4e7ff 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -157,7 +157,7 @@ if(MINGW AND (WITH_FORTIFY_SOURCE OR WITH_STACK_PROTECTOR))
+ link_libraries("ssp.a")
+ # static libraries don't carry over other static libraries in mingw
+ # we need to export it in the pkg-config
+- set(FLAC_STATIC_LIBS "-lssp")
++ set(FLAC_STATIC_LIBS "${FLAC_STATIC_LIBS} -lssp")
+ endif()
+ elseif(NOT MSVC)
+ set(HAVE_LIBSSP 1)
+@@ -212,6 +212,7 @@ if(ENABLE_MULTITHREADING)
+ find_package(Threads)
+ if(CMAKE_USE_PTHREADS_INIT)
+ set(HAVE_PTHREAD 1)
++ set(FLAC_STATIC_LIBS "${FLAC_STATIC_LIBS} -pthread")
+ endif()
+ endif()
+
+--
+2.43.0
+
=====================================
contrib/src/flac/rules.mak
=====================================
@@ -15,6 +15,7 @@ $(TARBALLS)/flac-$(FLAC_VERSION).tar.xz:
flac: flac-$(FLAC_VERSION).tar.xz .sum-flac
$(UNPACK)
+ $(APPLY) $(SRC)/flac/0001-cmake-Include-pthread-in-the-pkg-config-file-if-usin.patch
$(call pkg_static,"src/libFLAC/flac.pc.in")
$(MOVE)
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/cf3035ee38537556ed4b55523a3a14318eb60bd0
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/cf3035ee38537556ed4b55523a3a14318eb60bd0
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