Patchwork [01/51] package/cURL: fix static link whith openSSL

login
register
mail settings
Submitter Yann E. MORIN
Date Nov. 28, 2012, 11:54 p.m.
Message ID <1354146890-27380-2-git-send-email-yann.morin.1998@free.fr>
Download mbox | patch
Permalink /patch/202575/
State Accepted
Commit 61d322c3d258072460fddbab0b39c8bf4cc3e0bc
Headers show

Comments

Yann E. MORIN - Nov. 28, 2012, 11:54 p.m.
When openSSL is selected, cURL is configured to use it.

But in this case, the libcurl.pc file /forgets/ to require link
against -ldl.

This can happen, for example, when BR2_PREFER_STATIC_LIB is not set,
but an executable wants to be linked statically (for various reasons
which are irrelevant here).

Fix that by appending a 'Requires: openssl' line to libcurl.pc.in,
but only if openSSL is enabled.

As suggested by Arnout, do it in a post-patch hook, rather as a
post-install hook.

Cc: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 package/libcurl/libcurl.mk |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
Peter Korsgaard - Dec. 3, 2012, 7:21 a.m.
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 Yann> When openSSL is selected, cURL is configured to use it.
 Yann> But in this case, the libcurl.pc file /forgets/ to require link
 Yann> against -ldl.

 Yann> This can happen, for example, when BR2_PREFER_STATIC_LIB is not set,
 Yann> but an executable wants to be linked statically (for various reasons
 Yann> which are irrelevant here).

 Yann> Fix that by appending a 'Requires: openssl' line to libcurl.pc.in,
 Yann> but only if openSSL is enabled.

 Yann> As suggested by Arnout, do it in a post-patch hook, rather as a
 Yann> post-install hook.

Committed, thanks.

Patch

diff --git a/package/libcurl/libcurl.mk b/package/libcurl/libcurl.mk
index 8d8fdb4..888f6d0 100644
--- a/package/libcurl/libcurl.mk
+++ b/package/libcurl/libcurl.mk
@@ -25,17 +25,20 @@  else
 LIBCURL_CONF_OPT += --without-ssl
 endif
 
+define LIBCURL_FIX_DOT_PC
+	printf 'Requires: openssl\n' >>$(@D)/libcurl.pc.in
+endef
+LIBCURL_POST_PATCH_HOOKS += $(if $(BR2_PACKAGE_OPENSSL),LIBCURL_FIX_DOT_PC)
+
 define LIBCURL_TARGET_CLEANUP
 	rm -rf $(TARGET_DIR)/usr/bin/curl-config \
 	       $(if $(BR2_PACKAGE_CURL),,$(TARGET_DIR)/usr/bin/curl)
 endef
-
 LIBCURL_POST_INSTALL_TARGET_HOOKS += LIBCURL_TARGET_CLEANUP
 
 define LIBCURL_STAGING_FIXUP_CURL_CONFIG
 	$(SED) "s,prefix=/usr,prefix=$(STAGING_DIR)/usr," $(STAGING_DIR)/usr/bin/curl-config
 endef
-
 LIBCURL_POST_INSTALL_STAGING_HOOKS += LIBCURL_STAGING_FIXUP_CURL_CONFIG
 
 $(eval $(autotools-package))