[PATCH 1/2] Fix pkg-config files to avoid overlinking
Ulrich Klauer
ulrich at chirlu.de
Sat Apr 6 11:41:12 PDT 2013
Libraries that are used internally by libFLAC(++) but are not part of
their API should be listed in pkg-config "private" clauses. Otherwise
executables that are linked dynamically against libFLAC(++) will have
unneeded direct dependencies (overlinking).
Based on a patch by Brad Smith from
https://sourceforge.net/p/flac/bugs/397/
that I updated to only include ogg if libFLAC is actually built with
ogg support.
---
configure.ac | 2 ++
src/libFLAC++/flac++.pc.in | 4 ++--
src/libFLAC/flac.pc.in | 4 +++-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index b35e44d..b4094ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -308,9 +308,11 @@ fi
AM_CONDITIONAL(FLaC__HAS_OGG, [test "x$have_ogg" = xyes])
if test "x$have_ogg" = xyes ; then
AC_DEFINE_UNQUOTED([FLAC__HAS_OGG],1,[define if you have the ogg library])
+ OGG_PACKAGE="ogg"
else
AC_DEFINE_UNQUOTED([FLAC__HAS_OGG],0)
fi
+AC_SUBST(OGG_PACKAGE)
dnl check for i18n(internationalization); these are from libiconv/gettext
AM_ICONV
diff --git a/src/libFLAC++/flac++.pc.in b/src/libFLAC++/flac++.pc.in
index 8f55499..242998d 100644
--- a/src/libFLAC++/flac++.pc.in
+++ b/src/libFLAC++/flac++.pc.in
@@ -6,6 +6,6 @@ includedir=@includedir@
Name: FLAC++
Description: Free Lossless Audio Codec Library (C++ API)
Version: @VERSION@
-Requires: flac
-Libs: -L${libdir} -lFLAC++ @OGG_LIBS@ -lm
+Requires.private: flac
+Libs: -L${libdir} -lFLAC++
Cflags: -I${includedir}
diff --git a/src/libFLAC/flac.pc.in b/src/libFLAC/flac.pc.in
index 5f9be59..56e8594 100644
--- a/src/libFLAC/flac.pc.in
+++ b/src/libFLAC/flac.pc.in
@@ -6,5 +6,7 @@ includedir=@includedir@
Name: FLAC
Description: Free Lossless Audio Codec Library
Version: @VERSION@
-Libs: -L${libdir} -lFLAC @OGG_LIBS@ -lm
+Requires.private: @OGG_PACKAGE@
+Libs: -L${libdir} -lFLAC
+Libs.private: -lm
Cflags: -I${includedir}
--
1.7.10.4
--=_zgXxQ3sVxI23LNoRrdaXaA1
Content-Type: text/x-patch; charset=us-ascii;
name=0002-Only-link-against-libogg-and-libm-if-needed.patch
Content-Disposition: attachment;
filename=0002-Only-link-against-libogg-and-libm-if-needed.patch; size=3995
More information about the flac-dev
mailing list