diff mbox series

[v3,1/3] buildsys: Move nettle cflags/libs to per object

Message ID 20170906074418.10903-2-famz@redhat.com
State New
Headers show
Series [v3,1/3] buildsys: Move nettle cflags/libs to per object | expand

Commit Message

Fam Zheng Sept. 6, 2017, 7:44 a.m. UTC
Signed-off-by: Fam Zheng <famz@redhat.com>
---
 configure            | 5 ++---
 crypto/Makefile.objs | 6 ++++++
 2 files changed, 8 insertions(+), 3 deletions(-)

Comments

Daniel P. Berrangé Sept. 6, 2017, 8:55 a.m. UTC | #1
On Wed, Sep 06, 2017 at 03:44:16PM +0800, Fam Zheng wrote:
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  configure            | 5 ++---
>  crypto/Makefile.objs | 6 ++++++
>  2 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/configure b/configure
> index fb7e34a901..6a4cb3832b 100755
> --- a/configure
> +++ b/configure
> @@ -2616,9 +2616,6 @@ if test "$nettle" != "no"; then
>          nettle_cflags=$($pkg_config --cflags nettle)
>          nettle_libs=$($pkg_config --libs nettle)
>          nettle_version=$($pkg_config --modversion nettle)
> -        libs_softmmu="$nettle_libs $libs_softmmu"
> -        libs_tools="$nettle_libs $libs_tools"
> -        QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
>          nettle="yes"
>  
>          cat > $TMPC << EOF
> @@ -5732,6 +5729,8 @@ if test "$nettle" = "yes" ; then
>    if test "$nettle_kdf" = "yes" ; then
>      echo "CONFIG_NETTLE_KDF=y" >> $config_host_mak
>    fi
> +  echo "NETTLE_CFLAGS=$nettle_cflags" >> $config_host_mak
> +  echo "NETTLE_LIBS=$nettle_libs" >> $config_host_mak
>  fi
>  if test "$tasn1" = "yes" ; then
>    echo "CONFIG_TASN1=y" >> $config_host_mak
> diff --git a/crypto/Makefile.objs b/crypto/Makefile.objs
> index 2b99e08062..a936957d03 100644
> --- a/crypto/Makefile.objs
> +++ b/crypto/Makefile.objs
> @@ -34,6 +34,12 @@ crypto-obj-y += block.o
>  crypto-obj-y += block-qcow.o
>  crypto-obj-y += block-luks.o
>  
> +$(if $(CONFIG_NETTLE), \
> +	$(foreach x, cipher hash-nettle hmac-nettle pbkdf-nettle, \
> +		$(eval $x.o-cflags := $(NETTLE_CFLAGS)) \
> +		$(eval $x.o-libs := $(NETTLE_LIBS))) \
> +)

This is a bit ugly, but i don't see any obvious alternative that
would work

> +
>  # Let the userspace emulators avoid linking gnutls/etc
>  crypto-aes-obj-y = aes.o

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>

Regards,
Daniel
Fam Zheng Sept. 6, 2017, 9:30 a.m. UTC | #2
On Wed, 09/06 09:55, Daniel P. Berrange wrote:
> On Wed, Sep 06, 2017 at 03:44:16PM +0800, Fam Zheng wrote:
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> >  configure            | 5 ++---
> >  crypto/Makefile.objs | 6 ++++++
> >  2 files changed, 8 insertions(+), 3 deletions(-)
> > 
> > diff --git a/configure b/configure
> > index fb7e34a901..6a4cb3832b 100755
> > --- a/configure
> > +++ b/configure
> > @@ -2616,9 +2616,6 @@ if test "$nettle" != "no"; then
> >          nettle_cflags=$($pkg_config --cflags nettle)
> >          nettle_libs=$($pkg_config --libs nettle)
> >          nettle_version=$($pkg_config --modversion nettle)
> > -        libs_softmmu="$nettle_libs $libs_softmmu"
> > -        libs_tools="$nettle_libs $libs_tools"
> > -        QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
> >          nettle="yes"
> >  
> >          cat > $TMPC << EOF
> > @@ -5732,6 +5729,8 @@ if test "$nettle" = "yes" ; then
> >    if test "$nettle_kdf" = "yes" ; then
> >      echo "CONFIG_NETTLE_KDF=y" >> $config_host_mak
> >    fi
> > +  echo "NETTLE_CFLAGS=$nettle_cflags" >> $config_host_mak
> > +  echo "NETTLE_LIBS=$nettle_libs" >> $config_host_mak
> >  fi
> >  if test "$tasn1" = "yes" ; then
> >    echo "CONFIG_TASN1=y" >> $config_host_mak
> > diff --git a/crypto/Makefile.objs b/crypto/Makefile.objs
> > index 2b99e08062..a936957d03 100644
> > --- a/crypto/Makefile.objs
> > +++ b/crypto/Makefile.objs
> > @@ -34,6 +34,12 @@ crypto-obj-y += block.o
> >  crypto-obj-y += block-qcow.o
> >  crypto-obj-y += block-luks.o
> >  
> > +$(if $(CONFIG_NETTLE), \
> > +	$(foreach x, cipher hash-nettle hmac-nettle pbkdf-nettle, \
> > +		$(eval $x.o-cflags := $(NETTLE_CFLAGS)) \
> > +		$(eval $x.o-libs := $(NETTLE_LIBS))) \
> > +)
> 
> This is a bit ugly, but i don't see any obvious alternative that
> would work

Since I screwed up the gcrypt patch, v4 is needed, I'll try to make it less
ugly (no foreach and eval).

Fam

> 
> > +
> >  # Let the userspace emulators avoid linking gnutls/etc
> >  crypto-aes-obj-y = aes.o
> 
> Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
> 
> Regards,
> Daniel
> -- 
> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
>
diff mbox series

Patch

diff --git a/configure b/configure
index fb7e34a901..6a4cb3832b 100755
--- a/configure
+++ b/configure
@@ -2616,9 +2616,6 @@  if test "$nettle" != "no"; then
         nettle_cflags=$($pkg_config --cflags nettle)
         nettle_libs=$($pkg_config --libs nettle)
         nettle_version=$($pkg_config --modversion nettle)
-        libs_softmmu="$nettle_libs $libs_softmmu"
-        libs_tools="$nettle_libs $libs_tools"
-        QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags"
         nettle="yes"
 
         cat > $TMPC << EOF
@@ -5732,6 +5729,8 @@  if test "$nettle" = "yes" ; then
   if test "$nettle_kdf" = "yes" ; then
     echo "CONFIG_NETTLE_KDF=y" >> $config_host_mak
   fi
+  echo "NETTLE_CFLAGS=$nettle_cflags" >> $config_host_mak
+  echo "NETTLE_LIBS=$nettle_libs" >> $config_host_mak
 fi
 if test "$tasn1" = "yes" ; then
   echo "CONFIG_TASN1=y" >> $config_host_mak
diff --git a/crypto/Makefile.objs b/crypto/Makefile.objs
index 2b99e08062..a936957d03 100644
--- a/crypto/Makefile.objs
+++ b/crypto/Makefile.objs
@@ -34,6 +34,12 @@  crypto-obj-y += block.o
 crypto-obj-y += block-qcow.o
 crypto-obj-y += block-luks.o
 
+$(if $(CONFIG_NETTLE), \
+	$(foreach x, cipher hash-nettle hmac-nettle pbkdf-nettle, \
+		$(eval $x.o-cflags := $(NETTLE_CFLAGS)) \
+		$(eval $x.o-libs := $(NETTLE_LIBS))) \
+)
+
 # Let the userspace emulators avoid linking gnutls/etc
 crypto-aes-obj-y = aes.o