]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Meson: Cleanup pkcs11 module
authorFred Morcos <fred.morcos@open-xchange.com>
Tue, 15 Aug 2023 12:59:20 +0000 (14:59 +0200)
committerFred Morcos <fred.morcos@open-xchange.com>
Wed, 20 Mar 2024 12:28:37 +0000 (13:28 +0100)
meson/pkcs11/meson.build
meson/pkcs11/p11_kit_module_for_name.cc [new file with mode: 0644]
meson_options.txt
pdns/meson.build

index 8f899b262c4c7b43fdee76f42b61b9a81e05841f..49015b9a4370d1bbe3b6080e02ad613d8b41c199 100644 (file)
@@ -1,28 +1,12 @@
-# PKCS11
-# Inputs: conf deps
+opt = get_option('experimental-pkcs11')
 
-prog = '''
-#include <p11-kit/p11-kit.h>
+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 (file)
index 0000000..2bae1d3
--- /dev/null
@@ -0,0 +1,6 @@
+#include <p11-kit/p11-kit.h>
+
+int main() {
+    void *foo = p11_kit_module_for_name(0, 0);
+    return 0;
+}
index 24d462a7185b51cdab98434e299549683191994d..5e364d55dd2e266374446c6c11aac54218d9a505 100644 (file)
@@ -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)')
index 1be2b8d9434d904dd3df0ee9b538650b3073ebdf..c16790e0c04eb4efc755eff1ad94c2e39e0d6f88 100644 (file)
@@ -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,
   ],
 )