[V2] curl: support multilib installation

Submitted by changqing.li@windriver.com on July 30, 2018, 2:32 a.m. | Patch ID: 153107

Details

Message ID 1532917949-207205-1-git-send-email-changqing.li@windriver.com
State New
Headers show

Commit Message

changqing.li@windriver.com July 30, 2018, 2:32 a.m.
From: Changqing Li <changqing.li@windriver.com>

curl-config is generated to displays information about
the curl and libcurl installation. So the content is different
for 32bit and 64bit package. eg: maybe for 32bit, use
i686-linux-gnu-gcc, and for 64bit, use x86-64-linux-gnu-gcc.

Use update-alternatives to add base_libdir as suffix to create
seperate curl-config, so user can check both info of 32/64 bit
curl.

Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
 meta/recipes-support/curl/curl_7.61.0.bb | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/meta/recipes-support/curl/curl_7.61.0.bb b/meta/recipes-support/curl/curl_7.61.0.bb
index cc983fd..1841c50 100644
--- a/meta/recipes-support/curl/curl_7.61.0.bb
+++ b/meta/recipes-support/curl/curl_7.61.0.bb
@@ -13,7 +13,7 @@  SRC_URI[md5sum] = "31d0a9f48dc796a7db351898a1e5058a"
 SRC_URI[sha256sum] = "5f6f336921cf5b84de56afbd08dfb70adeef2303751ffb3e570c936c6d656c9c"
 
 CVE_PRODUCT = "libcurl"
-inherit autotools pkgconfig binconfig multilib_header
+inherit autotools pkgconfig binconfig multilib_header update-alternatives
 
 PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} gnutls proxy threaded-resolver verbose zlib"
 PACKAGECONFIG_class-native = "ipv6 proxy ssl threaded-resolver verbose zlib"
@@ -48,6 +48,17 @@  PACKAGECONFIG[threaded-resolver] = "--enable-threaded-resolver,--disable-threade
 PACKAGECONFIG[verbose] = "--enable-verbose,--disable-verbose"
 PACKAGECONFIG[zlib] = "--with-zlib=${STAGING_LIBDIR}/../,--without-zlib,zlib"
 
+MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
+ALTERNATIVE_${PN}-dev = "curl-config"
+ALTERNATIVE_LINK_NAME[curl-config] = "${bindir}/curl-config"
+ALTERNATIVE_TARGET[curl-config] = "${bindir}/curl-config-${MULTILIB_SUFFIX}"
+
+PACKAGE_PREPROCESS_FUNCS += "alternative_rename"
+
+alternative_rename() {
+        mv ${PKGD}${bindir}/curl-config ${PKGD}${bindir}/curl-config-${MULTILIB_SUFFIX}
+}
+
 EXTRA_OECONF = " \
     --disable-libcurl-option \
     --disable-ntlm-wb \

Comments

Richard Purdie July 30, 2018, 10:29 p.m.
On Mon, 2018-07-30 at 10:32 +0800, changqing.li@windriver.com wrote:
> From: Changqing Li <changqing.li@windriver.com>
> 
> curl-config is generated to displays information about
> the curl and libcurl installation. So the content is different
> for 32bit and 64bit package. eg: maybe for 32bit, use
> i686-linux-gnu-gcc, and for 64bit, use x86-64-linux-gnu-gcc.
> 
> Use update-alternatives to add base_libdir as suffix to create
> seperate curl-config, so user can check both info of 32/64 bit
> curl.
> 
> Signed-off-by: Changqing Li <changqing.li@windriver.com>
> ---
>  meta/recipes-support/curl/curl_7.61.0.bb | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-support/curl/curl_7.61.0.bb b/meta/recipes-support/curl/curl_7.61.0.bb
> index cc983fd..1841c50 100644
> --- a/meta/recipes-support/curl/curl_7.61.0.bb
> +++ b/meta/recipes-support/curl/curl_7.61.0.bb
> @@ -13,7 +13,7 @@ SRC_URI[md5sum] = "31d0a9f48dc796a7db351898a1e5058a"
>  SRC_URI[sha256sum] = "5f6f336921cf5b84de56afbd08dfb70adeef2303751ffb3e570c936c6d656c9c"
>  
>  CVE_PRODUCT = "libcurl"
> -inherit autotools pkgconfig binconfig multilib_header
> +inherit autotools pkgconfig binconfig multilib_header update-alternatives
>  
>  PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} gnutls proxy threaded-resolver verbose zlib"
>  PACKAGECONFIG_class-native = "ipv6 proxy ssl threaded-resolver verbose zlib"
> @@ -48,6 +48,17 @@ PACKAGECONFIG[threaded-resolver] = "--enable-threaded-resolver,--disable-threade
>  PACKAGECONFIG[verbose] = "--enable-verbose,--disable-verbose"
>  PACKAGECONFIG[zlib] = "--with-zlib=${STAGING_LIBDIR}/../,--without-zlib,zlib"
>  
> +MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
> +ALTERNATIVE_${PN}-dev = "curl-config"
> +ALTERNATIVE_LINK_NAME[curl-config] = "${bindir}/curl-config"
> +ALTERNATIVE_TARGET[curl-config] = "${bindir}/curl-config-${MULTILIB_SUFFIX}"
> +
> +PACKAGE_PREPROCESS_FUNCS += "alternative_rename"
> +
> +alternative_rename() {
> +        mv ${PKGD}${bindir}/curl-config ${PKGD}${bindir}/curl-config-${MULTILIB_SUFFIX}
> +}
> +
>  EXTRA_OECONF = " \
>      --disable-libcurl-option \
>      --disable-ntlm-wb \

We're going to keep having this problem with other files and I really
don't want to impact non-multilib systems with the problems multilib
causes.

I started writing a reply suggesting we create multilib_script.bbclass
and then realised it would also solve my libtool issue with multilib
and kernel-devsrc.

I've therefore written a patch which I've just sent out which fixes
this kind of issue in libtool. You should be able to use the same
mechanism for curl.

That said, is it not possible to just patch curl-config to use pkg-
config instead and remove the differences between the two multilib
cases, thereby solving this problem in a better way?

Cheers,

Richard
Ross Burton July 30, 2018, 11:05 p.m.
On 30 July 2018 at 23:29,
<openembedded-core-bounces@lists.openembedded.org> wrote:
> That said, is it not possible to just patch curl-config to use pkg-
> config instead and remove the differences between the two multilib
> cases, thereby solving this problem in a better way?

Prior art of this in Fedora:
https://src.fedoraproject.org/rpms/curl/blob/master/f/0101-curl-7.32.0-multilib.patch

Ross
changqing.li@windriver.com July 31, 2018, 2:22 a.m.
On 07/31/2018 06:29 AM, Richard Purdie wrote:
> On Mon, 2018-07-30 at 10:32 +0800, changqing.li@windriver.com wrote:
>> From: Changqing Li <changqing.li@windriver.com>
>>
>> curl-config is generated to displays information about
>> the curl and libcurl installation. So the content is different
>> for 32bit and 64bit package. eg: maybe for 32bit, use
>> i686-linux-gnu-gcc, and for 64bit, use x86-64-linux-gnu-gcc.
>>
>> Use update-alternatives to add base_libdir as suffix to create
>> seperate curl-config, so user can check both info of 32/64 bit
>> curl.
>>
>> Signed-off-by: Changqing Li <changqing.li@windriver.com>
>> ---
>>   meta/recipes-support/curl/curl_7.61.0.bb | 13 ++++++++++++-
>>   1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/meta/recipes-support/curl/curl_7.61.0.bb b/meta/recipes-support/curl/curl_7.61.0.bb
>> index cc983fd..1841c50 100644
>> --- a/meta/recipes-support/curl/curl_7.61.0.bb
>> +++ b/meta/recipes-support/curl/curl_7.61.0.bb
>> @@ -13,7 +13,7 @@ SRC_URI[md5sum] = "31d0a9f48dc796a7db351898a1e5058a"
>>   SRC_URI[sha256sum] = "5f6f336921cf5b84de56afbd08dfb70adeef2303751ffb3e570c936c6d656c9c"
>>   
>>   CVE_PRODUCT = "libcurl"
>> -inherit autotools pkgconfig binconfig multilib_header
>> +inherit autotools pkgconfig binconfig multilib_header update-alternatives
>>   
>>   PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} gnutls proxy threaded-resolver verbose zlib"
>>   PACKAGECONFIG_class-native = "ipv6 proxy ssl threaded-resolver verbose zlib"
>> @@ -48,6 +48,17 @@ PACKAGECONFIG[threaded-resolver] = "--enable-threaded-resolver,--disable-threade
>>   PACKAGECONFIG[verbose] = "--enable-verbose,--disable-verbose"
>>   PACKAGECONFIG[zlib] = "--with-zlib=${STAGING_LIBDIR}/../,--without-zlib,zlib"
>>   
>> +MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
>> +ALTERNATIVE_${PN}-dev = "curl-config"
>> +ALTERNATIVE_LINK_NAME[curl-config] = "${bindir}/curl-config"
>> +ALTERNATIVE_TARGET[curl-config] = "${bindir}/curl-config-${MULTILIB_SUFFIX}"
>> +
>> +PACKAGE_PREPROCESS_FUNCS += "alternative_rename"
>> +
>> +alternative_rename() {
>> +        mv ${PKGD}${bindir}/curl-config ${PKGD}${bindir}/curl-config-${MULTILIB_SUFFIX}
>> +}
>> +
>>   EXTRA_OECONF = " \
>>       --disable-libcurl-option \
>>       --disable-ntlm-wb \
> We're going to keep having this problem with other files and I really
> don't want to impact non-multilib systems with the problems multilib
> causes.
>
> I started writing a reply suggesting we create multilib_script.bbclass
> and then realised it would also solve my libtool issue with multilib
> and kernel-devsrc.
>
> I've therefore written a patch which I've just sent out which fixes
> this kind of issue in libtool. You should be able to use the same
> mechanism for curl.
>
> That said, is it not possible to just patch curl-config to use pkg-
> config instead and remove the differences between the two multilib
> cases, thereby solving this problem in a better way?
>
> Cheers,
>
> Richard

Thanks, I will try with your patch way.

>