[PATCH] libalpm.pc: migrate to Requires.private

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] libalpm.pc: migrate to Requires.private

Eli Schwartz-2
pkg-config has built-in dependency handling, but we currently insert the
raw $LIBS into libalpm's own linker flags and fail to handle Cflags at
all.

For dependencies which support pkg-config, simply use that instead.

Signed-off-by: Eli Schwartz <[hidden email]>
---

I've been working on getting pacman-static to build, and it is now in
the AUR. I happened to notice this in the process.

 configure.ac              | 6 ++++++
 lib/libalpm/libalpm.pc.in | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index a8c526e3..4d2f7d34 100644
--- a/configure.ac
+++ b/configure.ac
@@ -223,12 +223,14 @@ PKG_CHECK_MODULES(LIBARCHIVE, [libarchive >= 3.0.0], ,
 have_openssl=no
 have_nettle=no
 if test "x$with_crypto" = "xnettle"; then
+ AC_SUBST(pc_crypto, [nettle])
  PKG_CHECK_MODULES(NETTLE, [nettle],
  [AC_DEFINE(HAVE_LIBNETTLE, 1, [Define whether to use nettle]) have_nettle=yes], have_nettle=no)
  if test "x$have_nettle" = xno -a "x$with_crypto" = xnettle; then
  AC_MSG_ERROR([*** nettle support requested but libraries not found])
  fi
 else if test "x$with_crypto" = "xopenssl"; then
+ AC_SUBST(pc_crypto, [libcrypto])
  PKG_CHECK_MODULES(LIBSSL, [libcrypto],
  [AC_DEFINE(HAVE_LIBSSL, 1, [Define if libcrypto is available]) have_openssl=yes], have_openssl=no)
  if test "x$have_openssl" = xno; then
@@ -251,6 +253,10 @@ if test "x$with_libcurl" != "xno"; then
  fi
 fi
 AM_CONDITIONAL(HAVE_LIBCURL, [test "$have_libcurl" = "yes"])
+# used to generate libalpm.pc
+if test "x$have_libcurl" = xyes; then
+ AC_SUBST(pc_libcurl, [libcurl])
+fi
 
 # Check for gpgme
 AC_MSG_CHECKING(whether to link with libgpgme)
diff --git a/lib/libalpm/libalpm.pc.in b/lib/libalpm/libalpm.pc.in
index e1d74ef9..6b905747 100644
--- a/lib/libalpm/libalpm.pc.in
+++ b/lib/libalpm/libalpm.pc.in
@@ -7,6 +7,7 @@ Name: libalpm
 Description: Arch Linux package management library
 URL: http://www.archlinux.org/pacman/
 Version: @LIB_VERSION@
+Requires.private: libarchive @pc_crypto@ @pc_libcurl@
 Cflags: -I${includedir} @LFS_CFLAGS@
 Libs: -L${libdir} -lalpm
-Libs.private: @LIBS@ @LIBARCHIVE_LIBS@ @LIBSSL_LIBS@ @NETTLE_LIBS@ @LIBCURL_LIBS@ @GPGME_LIBS@
+Libs.private: @LIBS@ @GPGME_LIBS@
--
2.17.0