From: Fred Morcos Date: Tue, 15 Aug 2023 12:59:20 +0000 (+0200) Subject: Meson: Cleanup pkcs11 module X-Git-Tag: rec-5.1.0-alpha1~80^2~251 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99a7297760a30b0ada8daf0b78c014fafef82e61;p=thirdparty%2Fpdns.git Meson: Cleanup pkcs11 module --- diff --git a/meson/pkcs11/meson.build b/meson/pkcs11/meson.build index 8f899b262c..49015b9a43 100644 --- a/meson/pkcs11/meson.build +++ b/meson/pkcs11/meson.build @@ -1,28 +1,12 @@ -# PKCS11 -# Inputs: conf deps +opt = get_option('experimental-pkcs11') -prog = ''' -#include +dep_pkcs11 = dependency('p11-kit-1', required: opt) +conf.set('HAVE_P11KIT1', dep_pkcs11.found(), description: 'Have p11-kit-1') -int main() { - void *foo = p11_kit_module_for_name(0, 0); - return 0; -} -''' +prog = fs.read('p11_kit_module_for_name.cc') +have = cxx.links(prog, dependencies: dep_pkcs11, name: 'we can link to p11kit1') +conf.set('HAVE_P11KIT1_V2', have, description: 'Have p11-kit-1 0.20 or newer') -opt_pkcs11 = get_option('pkcs11') -conf.set10('PKCS11', opt_pkcs11, description: 'Whether to enable PKCS11 support (experimental)') - -if opt_pkcs11 - dep_pkcs11 = dependency('p11-kit-1', required: opt_pkcs11) - conf.set10('HAVE_P11KIT1', dep_pkcs11.found(), description: 'Whether we have p11-kit-1') - - has = cxx.links(prog, dependencies: dep_pkcs11, name: 'we can link to p11kit1') - conf.set10('HAVE_P11KIT1_V2', has, description: 'Whether we have p11-kit-1 0.20 or newer') - - if not has - warning('Could not find p11-kit-1') - endif - - deps += dep_pkcs11 +if not have + warning('Could not find p11-kit-1') endif diff --git a/meson/pkcs11/p11_kit_module_for_name.cc b/meson/pkcs11/p11_kit_module_for_name.cc new file mode 100644 index 0000000000..2bae1d3643 --- /dev/null +++ b/meson/pkcs11/p11_kit_module_for_name.cc @@ -0,0 +1,6 @@ +#include + +int main() { + void *foo = p11_kit_module_for_name(0, 0); + return 0; +} diff --git a/meson_options.txt b/meson_options.txt index 24d462a718..5e364d55dd 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -14,8 +14,8 @@ option('unit-tests-backends', type: 'boolean', value: false, description: 'Build option('reproducible', type: 'boolean', value: false, description: 'Create reproducible builds (for distribution maintainers, makes debugging more difficult)') option('fuzz-targets', type: 'boolean', value: false, description: 'Enable fuzzing targets') option('verbose-logging', type: 'boolean', value: false, description: 'Enable verbose logging') -option('pkcs11', type: 'boolean', value: false, description: 'Enable PKCS11 support (experimental)') option('gss-tsig', type: 'boolean', value: false, description: 'Enable GSS-TSIG support (experimental)') +option('experimental-pkcs11', type: 'feature', value: 'disabled', description: 'PKCS11 support') option('socket-dir', type: 'string', value: '/var/run', description: 'Where the control socket lives') option('module-bind', type: 'boolean', value: true, description: 'Bind backend') option('module-bind-dyn', type: 'boolean', value: false, description: 'Bind backend (dynamically loadable)') diff --git a/pdns/meson.build b/pdns/meson.build index 1be2b8d943..c16790e0c0 100644 --- a/pdns/meson.build +++ b/pdns/meson.build @@ -57,6 +57,21 @@ if dep_gss_tsig.found() ) endif +libpdns_pkcs11 = dependency('', required: false) +if dep_pkcs11.found() + libpdns_pkcs11 = static_library( + 'libpdns-pkcs11', + 'pkcs11signers.cc', + 'pkcs11signers.hh', + include_directories: toplevel_includes, + dependencies: dep_pkcs11, + ) + + libpdns_pkcs11 = declare_dependency( + link_with: libpdns_pkcs11, + ) +endif + libpdns_ws = declare_dependency( link_with: static_library( 'libpdns-ws', @@ -208,7 +223,6 @@ libpdns = static_library( ragel_generator.process('dnslabeltext.rl'), include_directories: toplevel_includes, dependencies: [ - dep_pkcs11, dep_gss_tsig, dep_json11, dep_yahttp, @@ -216,6 +230,7 @@ libpdns = static_library( libpdns_lua, libpdns_lua_records, libpdns_tsig, + libpdns_pkcs11, libpdns_ws, ], )