qemu-e2k/crypto/meson.build
Daniel P. Berrangé 46859d9398 crypto: fix build with gcrypt enabled
If nettle is disabled and gcrypt enabled, the compiler and linker flags
needed for gcrypt are not passed.

Gnutls was also not added as a dependancy when gcrypt is enabled.

Attempting to add the library dependencies at the same time as the
source dependencies is error prone, as there are alot of different
rules for picking which sources to use, and some of the source files
use code level conditionals intead. It is thus clearer to add the
library dependencies separately.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200901133050.381844-2-berrange@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2020-09-07 12:34:17 +02:00

84 lines
2.2 KiB
Meson

crypto_ss = ss.source_set()
crypto_ss.add(genh)
crypto_ss.add(files(
'afsplit.c',
'block-luks.c',
'block-qcow.c',
'block.c',
'cipher.c',
'desrfb.c',
'hash.c',
'hmac.c',
'ivgen-essiv.c',
'ivgen-plain.c',
'ivgen-plain64.c',
'ivgen.c',
'pbkdf.c',
'secret_common.c',
'secret.c',
'tlscreds.c',
'tlscredsanon.c',
'tlscredspsk.c',
'tlscredsx509.c',
'tlssession.c',
))
if 'CONFIG_NETTLE' in config_host
crypto_ss.add(files('hash-nettle.c', 'hmac-nettle.c', 'pbkdf-nettle.c'))
elif 'CONFIG_GCRYPT' in config_host
crypto_ss.add(files('hash-gcrypt.c', 'pbkdf-gcrypt.c'))
if 'CONFIG_GCRYPT_HMAC' in config_host
crypto_ss.add(files('hmac-gcrypt.c'))
else
crypto_ss.add(files('hmac-glib.c'))
endif
else
crypto_ss.add(files('hash-glib.c', 'hmac-glib.c', 'pbkdf-stub.c'))
endif
crypto_ss.add(when: 'CONFIG_SECRET_KEYRING', if_true: files('secret_keyring.c'))
crypto_ss.add(when: 'CONFIG_QEMU_PRIVATE_XTS', if_true: files('xts.c'))
crypto_ss.add(when: 'CONFIG_AF_ALG', if_true: files('afalg.c', 'cipher-afalg.c', 'hash-afalg.c'))
crypto_ss.add(when: 'CONFIG_GNUTLS', if_true: files('tls-cipher-suites.c'))
if 'CONFIG_NETTLE' in config_host
crypto_ss.add(nettle)
elif 'CONFIG_GCRYPT' in config_host
crypto_ss.add(gcrypt)
endif
if 'CONFIG_GNUTLS' in config_host
crypto_ss.add(gnutls)
endif
crypto_ss = crypto_ss.apply(config_host, strict: false)
libcrypto = static_library('crypto', crypto_ss.sources() + genh,
dependencies: [crypto_ss.dependencies()],
name_suffix: 'fa',
build_by_default: false)
crypto = declare_dependency(link_whole: libcrypto,
dependencies: [authz, qom])
util_ss.add(files('aes.c'))
util_ss.add(files('init.c'))
if 'CONFIG_GCRYPT' in config_host
util_ss.add(files('random-gcrypt.c'))
elif 'CONFIG_GNUTLS' in config_host
util_ss.add(files('random-gnutls.c'))
elif 'CONFIG_RNG_NONE' in config_host
util_ss.add(files('random-none.c'))
else
util_ss.add(files('random-platform.c'))
endif
if 'CONFIG_GCRYPT' in config_host
util_ss.add(gcrypt)
endif
if 'CONFIG_GNUTLS' in config_host
util_ss.add(gnutls)
endif