diff mbox

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

Message ID 1351113973-17237-2-git-send-email-yann.morin.1998@free.fr
State Changes Requested
Headers show

Commit Message

Yann E. MORIN Oct. 24, 2012, 9:25 p.m. UTC
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 the installed
libcurl.pc, if openSSL is enabled.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
 package/libcurl/libcurl.mk |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

Comments

Arnout Vandecappelle Oct. 25, 2012, 9:36 p.m. UTC | #1
On 24/10/12 23:25, Yann E. MORIN wrote:
> 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 the installed
> libcurl.pc, if openSSL is enabled.
>
> Signed-off-by: "Yann E. MORIN"<yann.morin.1998@free.fr>
> ---
>   package/libcurl/libcurl.mk |   10 ++++++++--
>   1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/package/libcurl/libcurl.mk b/package/libcurl/libcurl.mk
> index 8d8fdb4..80e2922 100644
> --- a/package/libcurl/libcurl.mk
> +++ b/package/libcurl/libcurl.mk
> @@ -29,14 +29,20 @@ define LIBCURL_TARGET_CLEANUP
>   	rm -rf $(TARGET_DIR)/usr/bin/curl-config \
>   	       $(if $(BR2_PACKAGE_CURL),,$(TARGET_DIR)/usr/bin/curl)
>   endef
> -
> +define LIBCURL_FIX_TARGET_PC
> +	printf 'Requires: openssl\n'>>$(TARGET_DIR)/usr/lib/pkgconfig/libcurl.pc
> +endef
>   LIBCURL_POST_INSTALL_TARGET_HOOKS += LIBCURL_TARGET_CLEANUP
> +LIBCURL_POST_INSTALL_TARGET_HOOKS += $(if $(BR2_PACKAGE_OPENSSL),LIBCURL_FIX_TARGET_PC)
>
>   define LIBCURL_STAGING_FIXUP_CURL_CONFIG
>   	$(SED) "s,prefix=/usr,prefix=$(STAGING_DIR)/usr," $(STAGING_DIR)/usr/bin/curl-config
>   endef
> -
> +define LIBCURL_FIX_STAGING_PC
> +	printf 'Requires: openssl\n'>>$(STAGING_DIR)/usr/lib/pkgconfig/libcurl.pc
> +endef
>   LIBCURL_POST_INSTALL_STAGING_HOOKS += LIBCURL_STAGING_FIXUP_CURL_CONFIG
> +LIBCURL_POST_INSTALL_STAGING_HOOKS += $(if $(BR2_PACKAGE_OPENSSL),LIBCURL_FIX_STAGING_PC)

  Why not add it to $(@D)/libcurl.pc.in in a post-patch hook?  Then it only has
to be done once, and I also feel it's a better place to patch things.

  Regards,
  Arnout
Yann E. MORIN Oct. 26, 2012, 5:25 p.m. UTC | #2
Arnout, All,

On Thursday 25 October 2012 Arnout Vandecappelle wrote:
> On 24/10/12 23:25, Yann E. MORIN wrote:
> > 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 the installed
> > libcurl.pc, if openSSL is enabled.
[--SNIP--]
> > +define LIBCURL_FIX_STAGING_PC
> > +	printf 'Requires: openssl\n'>>$(STAGING_DIR)/usr/lib/pkgconfig/libcurl.pc
> > +endef
> >   LIBCURL_POST_INSTALL_STAGING_HOOKS += LIBCURL_STAGING_FIXUP_CURL_CONFIG
> > +LIBCURL_POST_INSTALL_STAGING_HOOKS += $(if $(BR2_PACKAGE_OPENSSL),LIBCURL_FIX_STAGING_PC)
> 
>   Why not add it to $(@D)/libcurl.pc.in in a post-patch hook?  Then it only has
> to be done once, and I also feel it's a better place to patch things.

Yep, good idea! Thanks!

Regards,
Yann E. MORIN.
Yann E. MORIN Oct. 26, 2012, 8:39 p.m. UTC | #3
Johan, All,

[Please keep the list in CC, don't reply only to me]

On Friday 26 October 2012 Sagaert Johan wrote:
> Is this fixing the problem I had 6 months ago where the curl binary just
> said :segmentation fault when it was build with openssl support ?

No idea; probably not. This fixes a build-time issue.

Regards,
Yann E. MORIN.
diff mbox

Patch

diff --git a/package/libcurl/libcurl.mk b/package/libcurl/libcurl.mk
index 8d8fdb4..80e2922 100644
--- a/package/libcurl/libcurl.mk
+++ b/package/libcurl/libcurl.mk
@@ -29,14 +29,20 @@  define LIBCURL_TARGET_CLEANUP
 	rm -rf $(TARGET_DIR)/usr/bin/curl-config \
 	       $(if $(BR2_PACKAGE_CURL),,$(TARGET_DIR)/usr/bin/curl)
 endef
-
+define LIBCURL_FIX_TARGET_PC
+	printf 'Requires: openssl\n' >>$(TARGET_DIR)/usr/lib/pkgconfig/libcurl.pc
+endef
 LIBCURL_POST_INSTALL_TARGET_HOOKS += LIBCURL_TARGET_CLEANUP
+LIBCURL_POST_INSTALL_TARGET_HOOKS += $(if $(BR2_PACKAGE_OPENSSL),LIBCURL_FIX_TARGET_PC)
 
 define LIBCURL_STAGING_FIXUP_CURL_CONFIG
 	$(SED) "s,prefix=/usr,prefix=$(STAGING_DIR)/usr," $(STAGING_DIR)/usr/bin/curl-config
 endef
-
+define LIBCURL_FIX_STAGING_PC
+	printf 'Requires: openssl\n' >>$(STAGING_DIR)/usr/lib/pkgconfig/libcurl.pc
+endef
 LIBCURL_POST_INSTALL_STAGING_HOOKS += LIBCURL_STAGING_FIXUP_CURL_CONFIG
+LIBCURL_POST_INSTALL_STAGING_HOOKS += $(if $(BR2_PACKAGE_OPENSSL),LIBCURL_FIX_STAGING_PC)
 
 $(eval $(autotools-package))