buildsys: Move crypto libraries to per object variables
v3 cover buildsys: Move crypto libraries to per object variables
v3: Remove one more line that was missed in v2.
Not all targets need the flags and libs of gcrypt/nettle/gnutls, so move them out from global variables, as done with other libraries.
There are still other libraries in ./configure that can be converted this way, which will be sent separatedly.
Fam Zheng (3):
buildsys: Move nettle cflags/libs to per object
buildsys: Move gnutls cflags/libs to per object
buildsys: Move gcrypt cflags/libs to per object
configure | 15 ++++++--------- crypto/Makefile.objs | 20 ++++++++++++++++++++ tests/Makefile.include | 10 +++++----- 3 files changed, 31 insertions(+), 14 deletions(-)
Signature · 1 line
2.13.5
PATCH v3 1/3 buildsys: Move nettle cflags/libs to per object
--- configure | 5 ++--- crypto/Makefile.objs | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-)
configure +2 -3
@@ -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
crypto/Makefile.objs +6 -0
@@ -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
Signature · 1 line
2.13.5
Re: [Qemu-devel] [PATCH v3 1/3] buildsys: Move nettle cflags/libs to per object
Quoted 34 lines · Fam Zheng
Signed-off-by Fam Zheng <[email protected]>--- configure | 5 ++--- crypto/Makefile.objs | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-)configure +2
-3@@ -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_makcrypto/Makefile.objs +0
-0
crypto/Makefile.objs crypto-obj-y += block.o · line 41
Quoted 8 lines
crypto/Makefile.objs +5
-0@@ -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
crypto/Makefile.objs crypto-obj-y += block.o · line 44
Quoted 3 lines
crypto/Makefile.objs +1
-0+ # Let the userspace emulators avoid linking gnutls/etc crypto-aes-obj-y = aes.o
Regards,
Daniel
Signature · 3 lines
|: 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 :|
Re: [Qemu-devel] [PATCH v3 1/3] buildsys: Move nettle cflags/libs to per object
Quoted 38 lines · Daniel P. Berrange
Quoted 37 lines · Fam Zheng
Signed-off-by Fam Zheng <[email protected]>--- configure | 5 ++--- crypto/Makefile.objs | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-)configure +2
-3@@ -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_makcrypto/Makefile.objs +0
-0@@ -34,6 +34,12 @@ crypto-obj-y += block.o crypto-obj-y += block-qcow.o crypto-obj-y += block-luks.o
Quoted 8 lines
crypto/Makefile.objs crypto-obj-y += block.o · line 41
Quoted 5 lines
crypto/Makefile.objs +5
-0+$(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
Quoted 14 lines
crypto/Makefile.objs crypto-obj-y += block.o · line 44
Quoted 4 lines
crypto/Makefile.objs +1
-0+ # Let the userspace emulators avoid linking gnutls/etc crypto-aes-obj-y = aes.oReviewed-by Daniel P. Berrange <[email protected]>Regards,
DanielSignature · 3 lines
|: 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 :|
PATCH v3 2/3 buildsys: Move gnutls cflags/libs to per object
In reply to Fam Zheng--- configure | 5 ++--- crypto/Makefile.objs | 7 +++++++ tests/Makefile.include | 10 +++++----- 3 files changed, 14 insertions(+), 8 deletions(-)
configure +2 -3
@@ -2472,9 +2472,6 @@ if test "$gnutls" != "no"; then if gnutls_works; then gnutls_cflags=$($pkg_config --cflags gnutls) gnutls_libs=$($pkg_config --libs gnutls) - libs_softmmu="$gnutls_libs $libs_softmmu" - libs_tools="$gnutls_libs $libs_tools" - QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags" gnutls="yes" # gnutls_rnd requires >= 2.11.0
@@ -5710,6 +5707,8 @@ fi echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak if test "$gnutls" = "yes" ; then echo "CONFIG_GNUTLS=y" >> $config_host_mak + echo "GNUTLS_CFLAGS=$gnutls_cflags" >> $config_host_mak + echo "GNUTLS_LIBS=$gnutls_libs" >> $config_host_mak fi if test "$gnutls_rnd" = "yes" ; then echo "CONFIG_GNUTLS_RND=y" >> $config_host_mak
crypto/Makefile.objs +7 -0
@@ -40,6 +40,13 @@ $(if $(CONFIG_NETTLE), \ $(eval $x.o-libs := $(NETTLE_LIBS))) \ ) +$(if $(CONFIG_GNUTLS), \ + $(foreach x, init random-gnutls tlscreds tlscredsanon \ + tlscredsx509 tlssession, \ + $(eval $x.o-cflags := $(GNUTLS_CFLAGS)) \ + $(eval $x.o-libs := $(GNUTLS_LIBS))) \ +) + # Let the userspace emulators avoid linking gnutls/etc crypto-aes-obj-y = aes.o
tests/Makefile.include +5 -5
@@ -677,15 +677,15 @@ tests/benchmark-crypto-cipher$(EXESUF): tests/benchmark-crypto-cipher.o $(test-c tests/test-crypto-secret$(EXESUF): tests/test-crypto-secret.o $(test-crypto-obj-y) tests/test-crypto-xts$(EXESUF): tests/test-crypto-xts.o $(test-crypto-obj-y) -tests/crypto-tls-x509-helpers.o-cflags := $(TASN1_CFLAGS) -tests/crypto-tls-x509-helpers.o-libs := $(TASN1_LIBS) -tests/pkix_asn1_tab.o-cflags := $(TASN1_CFLAGS) +tests/crypto-tls-x509-helpers.o-cflags := $(TASN1_CFLAGS) $(GNUTLS_CFLAGS) +tests/crypto-tls-x509-helpers.o-libs := $(TASN1_LIBS) $(GNUTLS_LIBS) +tests/pkix_asn1_tab.o-cflags := $(TASN1_CFLAGS) $(GNUTLS_LIBS) -tests/test-crypto-tlscredsx509.o-cflags := $(TASN1_CFLAGS) +tests/test-crypto-tlscredsx509.o-cflags := $(TASN1_CFLAGS) $(GNUTLS_CFLAGS) tests/test-crypto-tlscredsx509$(EXESUF): tests/test-crypto-tlscredsx509.o \ tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o $(test-crypto-obj-y) -tests/test-crypto-tlssession.o-cflags := $(TASN1_CFLAGS) +tests/test-crypto-tlssession.o-cflags := $(TASN1_CFLAGS) $(GNUTLS_CFLAGS) tests/test-crypto-tlssession$(EXESUF): tests/test-crypto-tlssession.o \ tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o $(test-crypto-obj-y) tests/test-io-task$(EXESUF): tests/test-io-task.o $(test-io-obj-y)
Signature · 1 line
2.13.5
Re: [Qemu-devel] [PATCH v3 2/3] buildsys: Move gnutls cflags/libs to per object
Quoted 63 lines · Fam Zheng
Signed-off-by Fam Zheng <[email protected]>--- configure | 5 ++--- crypto/Makefile.objs | 7 +++++++ tests/Makefile.include | 10 +++++----- 3 files changed, 14 insertions(+), 8 deletions(-)configure +2
-3@@ -2472,9 +2472,6 @@ if test "$gnutls" != "no"; then if gnutls_works; then gnutls_cflags=$($pkg_config --cflags gnutls) gnutls_libs=$($pkg_config --libs gnutls) - libs_softmmu="$gnutls_libs $libs_softmmu" - libs_tools="$gnutls_libs $libs_tools" - QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags" gnutls="yes" # gnutls_rnd requires >= 2.11.0@@ -5710,6 +5707,8 @@ fi echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak if test "$gnutls" = "yes" ; then echo "CONFIG_GNUTLS=y" >> $config_host_mak + echo "GNUTLS_CFLAGS=$gnutls_cflags" >> $config_host_mak + echo "GNUTLS_LIBS=$gnutls_libs" >> $config_host_mak fi if test "$gnutls_rnd" = "yes" ; then echo "CONFIG_GNUTLS_RND=y" >> $config_host_makcrypto/Makefile.objs +7
-0@@ -40,6 +40,13 @@ $(if $(CONFIG_NETTLE), \ $(eval $x.o-libs := $(NETTLE_LIBS))) \ ) +$(if $(CONFIG_GNUTLS), \ + $(foreach x, init random-gnutls tlscreds tlscredsanon \ + tlscredsx509 tlssession, \ + $(eval $x.o-cflags := $(GNUTLS_CFLAGS)) \ + $(eval $x.o-libs := $(GNUTLS_LIBS))) \ +) + # Let the userspace emulators avoid linking gnutls/etc crypto-aes-obj-y = aes.otests/Makefile.include +3
-3@@ -677,15 +677,15 @@ tests/benchmark-crypto-cipher$(EXESUF): tests/benchmark-crypto-cipher.o $(test-c tests/test-crypto-secret$(EXESUF): tests/test-crypto-secret.o $(test-crypto-obj-y) tests/test-crypto-xts$(EXESUF): tests/test-crypto-xts.o $(test-crypto-obj-y) -tests/crypto-tls-x509-helpers.o-cflags := $(TASN1_CFLAGS) -tests/crypto-tls-x509-helpers.o-libs := $(TASN1_LIBS) -tests/pkix_asn1_tab.o-cflags := $(TASN1_CFLAGS) +tests/crypto-tls-x509-helpers.o-cflags := $(TASN1_CFLAGS) $(GNUTLS_CFLAGS) +tests/crypto-tls-x509-helpers.o-libs := $(TASN1_LIBS) $(GNUTLS_LIBS) +tests/pkix_asn1_tab.o-cflags := $(TASN1_CFLAGS) $(GNUTLS_LIBS)
tests/Makefile.include tests/benchmark-crypto-cipher$(EXESUF): tests/benchmark-crypto-cipher.o $(test-c · line 691
Quoted 10 lines
tests/Makefile.include +2
-2-tests/test-crypto-tlscredsx509.o-cflags := $(TASN1_CFLAGS) +tests/test-crypto-tlscredsx509.o-cflags := $(TASN1_CFLAGS) $(GNUTLS_CFLAGS) tests/test-crypto-tlscredsx509$(EXESUF): tests/test-crypto-tlscredsx509.o \ tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o $(test-crypto-obj-y) -tests/test-crypto-tlssession.o-cflags := $(TASN1_CFLAGS) +tests/test-crypto-tlssession.o-cflags := $(TASN1_CFLAGS) $(GNUTLS_CFLAGS) tests/test-crypto-tlssession$(EXESUF): tests/test-crypto-tlssession.o \ tests/crypto-tls-x509-helpers.o tests/pkix_asn1_tab.o $(test-crypto-obj-y) tests/test-io-task$(EXESUF): tests/test-io-task.o $(test-io-obj-y)
Regards,
Daniel
Signature · 3 lines
|: 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 :|
PATCH v3 3/3 buildsys: Move gcrypt cflags/libs to per object
In reply to Fam Zheng--- configure | 5 ++--- crypto/Makefile.objs | 7 +++++++ 2 files changed, 9 insertions(+), 3 deletions(-)
configure +2 -3
@@ -2565,9 +2565,6 @@ if test "$gcrypt" != "no"; then then gcrypt_libs="$gcrypt_libs -lgpg-error" fi - libs_softmmu="$gcrypt_libs $libs_softmmu" - libs_tools="$gcrypt_libs $libs_tools" - QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags" gcrypt="yes" if test -z "$nettle"; then nettle="no"
@@ -5715,6 +5712,8 @@ if test "$gnutls_rnd" = "yes" ; then fi if test "$gcrypt" = "yes" ; then echo "CONFIG_GCRYPT=y" >> $config_host_mak + echo "GCRYPT_CFLAGS=$gcrypt_cflags" >> $config_host_mak + echo "GCRYPT_LIBS=$gcrypt_libs" >> $config_host_mak if test "$gcrypt_hmac" = "yes" ; then echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak fi
crypto/Makefile.objs +7 -0
@@ -34,6 +34,13 @@ crypto-obj-y += block.o crypto-obj-y += block-qcow.o crypto-obj-y += block-luks.o +$(if $(CONFIG_GCRYPT), \ + $(foreach x, init cipher hash-gcrypt hmac-gcrypt random-gcrypt \ + pbkdf-gcrypt, \ + $(eval $x.o-cflags := $(NETTLE_CFLAGS)) \ + $(eval $x.o-libs := $(NETTLE_LIBS))) \ +) + $(if $(CONFIG_NETTLE), \ $(foreach x, cipher hash-nettle hmac-nettle pbkdf-nettle, \ $(eval $x.o-cflags := $(NETTLE_CFLAGS)) \
Signature · 1 line
2.13.5
Re: [Qemu-devel] [PATCH v3 3/3] buildsys: Move gcrypt cflags/libs to per object
Quoted 37 lines · Fam Zheng
Signed-off-by Fam Zheng <[email protected]>--- configure | 5 ++--- crypto/Makefile.objs | 7 +++++++ 2 files changed, 9 insertions(+), 3 deletions(-)configure +2
-3@@ -2565,9 +2565,6 @@ if test "$gcrypt" != "no"; then then gcrypt_libs="$gcrypt_libs -lgpg-error" fi - libs_softmmu="$gcrypt_libs $libs_softmmu" - libs_tools="$gcrypt_libs $libs_tools" - QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags" gcrypt="yes" if test -z "$nettle"; then nettle="no"@@ -5715,6 +5712,8 @@ if test "$gnutls_rnd" = "yes" ; then fi if test "$gcrypt" = "yes" ; then echo "CONFIG_GCRYPT=y" >> $config_host_mak + echo "GCRYPT_CFLAGS=$gcrypt_cflags" >> $config_host_mak + echo "GCRYPT_LIBS=$gcrypt_libs" >> $config_host_mak if test "$gcrypt_hmac" = "yes" ; then echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak ficrypto/Makefile.objs +0
-0@@ -34,6 +34,13 @@ crypto-obj-y += block.o crypto-obj-y += block-qcow.o crypto-obj-y += block-luks.o
crypto/Makefile.objs crypto-obj-y += block.o · line 46
Quoted 10 lines
crypto/Makefile.objs +7
-0+$(if $(CONFIG_GCRYPT), \ + $(foreach x, init cipher hash-gcrypt hmac-gcrypt random-gcrypt \ + pbkdf-gcrypt, \ + $(eval $x.o-cflags := $(NETTLE_CFLAGS)) \ + $(eval $x.o-libs := $(NETTLE_LIBS))) \ +) + $(if $(CONFIG_NETTLE), \ $(foreach x, cipher hash-nettle hmac-nettle pbkdf-nettle, \ $(eval $x.o-cflags := $(NETTLE_CFLAGS)) \
Regards,
Daniel
Signature · 3 lines
|: 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 :|
Re: [Qemu-devel] [PATCH v3 3/3] buildsys: Move gcrypt cflags/libs to per object
Quoted 38 lines · Daniel P. Berrange
Quoted 37 lines · Fam Zheng
Signed-off-by Fam Zheng <[email protected]>--- configure | 5 ++--- crypto/Makefile.objs | 7 +++++++ 2 files changed, 9 insertions(+), 3 deletions(-)configure +2
-3@@ -2565,9 +2565,6 @@ if test "$gcrypt" != "no"; then then gcrypt_libs="$gcrypt_libs -lgpg-error" fi - libs_softmmu="$gcrypt_libs $libs_softmmu" - libs_tools="$gcrypt_libs $libs_tools" - QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags" gcrypt="yes" if test -z "$nettle"; then nettle="no"@@ -5715,6 +5712,8 @@ if test "$gnutls_rnd" = "yes" ; then fi if test "$gcrypt" = "yes" ; then echo "CONFIG_GCRYPT=y" >> $config_host_mak + echo "GCRYPT_CFLAGS=$gcrypt_cflags" >> $config_host_mak + echo "GCRYPT_LIBS=$gcrypt_libs" >> $config_host_mak if test "$gcrypt_hmac" = "yes" ; then echo "CONFIG_GCRYPT_HMAC=y" >> $config_host_mak ficrypto/Makefile.objs +0
-0@@ -34,6 +34,13 @@ crypto-obj-y += block.o crypto-obj-y += block-qcow.o crypto-obj-y += block-luks.o
Quoted 5 lines
crypto/Makefile.objs crypto-obj-y += block.o · line 41
Quoted 5 lines
crypto/Makefile.objs +5
-0+$(if $(CONFIG_GCRYPT), \ + $(foreach x, init cipher hash-gcrypt hmac-gcrypt random-gcrypt \ + pbkdf-gcrypt, \ + $(eval $x.o-cflags := $(NETTLE_CFLAGS)) \ + $(eval $x.o-libs := $(NETTLE_LIBS))) \
Sorry, these should be GCRYPT_* :(
Fam
Quoted 15 lines
crypto/Makefile.objs crypto-obj-y += block.o · line 46
Quoted 5 lines
crypto/Makefile.objs +2
-0+) + $(if $(CONFIG_NETTLE), \ $(foreach x, cipher hash-nettle hmac-nettle pbkdf-nettle, \ $(eval $x.o-cflags := $(NETTLE_CFLAGS)) \Reviewed-by Daniel P. Berrange <[email protected]>Regards,
DanielSignature · 3 lines
|: 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 :|