From: Fred Morcos Date: Fri, 17 Nov 2023 11:56:39 +0000 (+0100) Subject: Meson: Build all auth-related tools and tests X-Git-Tag: rec-5.1.0-alpha1~80^2~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1df6c54071cb5d2ce0a7f870d96f8994ffe6833a;p=thirdparty%2Fpdns.git Meson: Build all auth-related tools and tests --- diff --git a/meson.build b/meson.build index 3d55736b05..26cc26c259 100644 --- a/meson.build +++ b/meson.build @@ -224,35 +224,53 @@ pdns_auth = executable( export_dynamic: true, dependencies: [ dep_modules, - libpdns, libpdns_auth, - libpdns_auth_main, - libpdns_auth_ws, - libpdns_lua_records, ], ) -tools = ['util', 'auth-control', 'zone2sql', 'zone2json'] +tools = ['pdns-auth-util', 'pdns-auth-control', 'zone2sql', 'zone2json'] if get_option('module-ldap') != 'disabled' tools += 'zone2ldap' endif if get_option('tools') - tools += ['sdig', 'calidns', 'dumresp', 'kvresp', 'stubquery', 'saxfr'] - + # TODO Broken: comfun + tools += [ + 'sdig', 'calidns', 'dumresp', 'kvresp', 'stubquery', 'saxfr', 'nsec3dig', + 'dnswasher', 'dnsreplay', 'dnsscan', 'nproxy', 'pdns-auth-notify', 'dnsscope', + 'dnsgram', 'dnsdemog', 'dnspcap2calidns', 'dnspcap2protobuf' + ] + + if have_boost_1_48_0 + tools += ['dnstcpbench', 'dnsbulktest'] + endif endif +if get_option('tools-ixfrdist') + tools += ['ixfrdist', 'ixplore'] +endif +if get_option('unit-tests') or get_option('unit-tests-backends') + # TODO: NOINSTALL speedtest and pdns-auth-testrunner + tools += ['tsig_tests', 'speedtest', 'pdns-auth-testrunner'] +endif +if get_option('fuzz-targets') + tools += [ + 'fuzz_target_moadnsparser', + 'fuzz_target_packetcache', + 'fuzz_target_proxyprotocol', + 'fuzz_target_yahttp', + 'fuzz_target_zoneparsertng', + 'fuzz_target_dnslabeltext_parseRFC1035CharString', + ] +endif foreach tool: tools - set_variable( - 'pdns_' + tool.underscorify(), - executable( - 'pdns-' + tool, - sources: [config_h], - dependencies: [get_variable('libpdns_' + tool.underscorify())], - ) + executable( + tool, + sources: [config_h], + dependencies: [get_variable('lib' + tool.underscorify())], ) endforeach diff --git a/pdns/meson.build b/pdns/meson.build index 17ac9176a6..c2a25a8493 100644 --- a/pdns/meson.build +++ b/pdns/meson.build @@ -54,13 +54,6 @@ libpdns_bindparser_cc = declare_dependency(sources: [libpdns_bindparser_cc]) libpdns_bind_parser = declare_dependency( link_whole: static_library( 'pdns-bind-parser', - sources: [ - 'zoneparser-tng.cc', - ], - extra_files: [ - 'bindparserclasses.hh', - 'zoneparser-tng.hh', - ], cpp_args: '-Wno-redundant-decls', dependencies: [ deps, @@ -70,135 +63,6 @@ libpdns_bind_parser = declare_dependency( ) ) -libpdns_lua = dependency('', required: false) -if dep_lua.found() - libpdns_lua = declare_dependency( - link_whole: static_library( - 'pdns-lua', - sources: ['lua-base4.cc'], - extra_files: ['lua-base4.hh'], - dependencies: deps, - ) - ) -endif - -libpdns_minicurl = dependency('', required: false) -if dep_libcurl.found() - libpdns_minicurl = declare_dependency( - link_whole: static_library( - 'pdns-minicurl', - sources: ['minicurl.cc'], - extra_files: ['minicurl.hh'], - dependencies: deps, - ) - ) -endif - -libpdns_lua_records = dependency('', required: false) -if dep_lua_records.found() - libpdns_lua_records = declare_dependency( - link_whole: static_library( - 'pdns-lua-records', - sources: ['lua-record.cc'], - extra_files: [], - dependencies: [ - deps, - libpdns_minicurl, - ], - ) - ) -endif - -libpdns_gss = dependency('', required: false) -libpdns_gss = declare_dependency( - link_whole: static_library( - 'pdns-gss', - sources: ['gss_context.cc'], - extra_files: ['gss_context.hh'], - dependencies: deps, - ) -) - -libpdns_sodium = dependency('', required: false) -if dep_libsodium.found() - libpdns_sodium = declare_dependency( - link_whole: static_library( - 'pdns-sodium', - sources: ['sodiumsigners.cc'], - dependencies: deps, - ) - ) -endif - -libpdns_decaf = dependency('', required: false) -if dep_libdecaf.found() - libpdns_decaf = declare_dependency( - link_whole: static_library( - 'pdns-decaf', - sources: ['decafsigners.cc'], - dependencies: deps, - cpp_args: '-Wno-shadow', - ) - ) -endif - -libpdns_pkcs11 = dependency('', required: false) -if dep_pkcs11.found() - libpdns_pkcs11 = declare_dependency( - link_whole: static_library( - 'pdns-pkcs11', - sources: ['pkcs11signers.cc'], - extra_files: ['pkcs11signers.hh'], - dependencies: deps, - ) - ) -endif - -libpdns_sqlite3 = dependency('', required: false) -if get_variable('dep_sqlite3', dependency('', required: false)).found() - libpdns_sqlite3 = declare_dependency( - link_whole: static_library( - 'pdns-sqlite3', - sources: ['ssqlite3.cc'], - extra_files: ['ssqlite3.hh'], - dependencies: deps, - ) - ) -endif - -libpdns_ws = declare_dependency( - link_whole: static_library( - 'pdns-ws', - 'webserver.cc', - 'ws-api.cc', - extra_files: [ - 'webserver.hh', - 'ws-api.hh', - ], - cpp_args: '-Wno-overloaded-virtual', - dependencies: deps, - ) -) - -libpdns_tsig = dependency('', required: false) -if dep_gss_tsig.found() - libpdns_tsig = declare_dependency( - link_whole: static_library( - 'pdns-tsig', - sources: [ - 'tsigutils.cc', - 'tsigverifier.cc', - ], - extra_files: [ - 'tsigutils.hh', - 'tsigverifier.hh', - ], - dependencies: deps, - cpp_args: '-Wno-redundant-decls', - ) - ) -endif - libpdns_dnslabeltext_cc = 'dnslabeltext.cc' if not fs.is_file(libpdns_dnslabeltext_cc) ragel = find_program('ragel', required: true) @@ -222,412 +86,1753 @@ libpdns_dnslabeltext = declare_dependency( ) ) -libpdns_common = declare_dependency( - link_whole: static_library( - 'pdns-common', - sources: [ - 'arguments.cc', - 'base32.cc', - 'base64.cc', - 'dns.cc', - 'dnsname.cc', - 'dnsparser.cc', - 'dnsrecords.cc', - 'dnswriter.cc', - 'ednsoptions.cc', - 'ednssubnet.cc', - 'iputils.cc', - 'json.cc', - 'logger.cc', - 'misc.cc', - 'nsecrecords.cc', - 'proxy-protocol.cc', - 'qtype.cc', - 'rcpgenerator.cc', - 'sillyrecords.cc', - 'statbag.cc', - 'svc-records.cc', - 'unix_utility.cc', - ], - extra_files: [ - 'arguments.hh', - 'base32.hh', - 'base64.hh', - 'dns.hh', - 'dns_random.hh', - 'dnsname.hh', - 'dnsparser.hh', - 'dnsrecords.hh', - 'dnswriter.hh', - 'ednsoptions.hh', - 'ednssubnet.hh', - 'iputils.hh', - 'json.hh', - 'logger.hh', - 'misc.hh', - 'proxy-protocol.hh', - 'qtype.hh', - 'rcpgenerator.hh', - 'statbag.hh', - 'svc-records.hh', - 'utility.hh', +libpdns_auth_apidocfiles_h = 'apidocfiles.h' +if not fs.is_file(libpdns_auth_apidocfiles_h) + py = import('python') + python = py.find_installation('python3', modules: 'yaml', required: true) + + summary('Python', python.found(), bool_yn: true, section: 'Swagger API') + summary('Path', python.full_path(), section: 'Swagger API') + summary('Version', python.version(), section: 'Swagger API') + + libpdns_auth_apidocfiles_h = custom_target( + 'pdns-auth-apidocfiles-h', + command: [ + python, + '@INPUT0@', + '@INPUT1@', ], - dependencies: [ - deps, - libpdns_dnslabeltext_cc, + input: [ + 'generate-api-swagger.py', + product_source_dir / 'docs' / 'http-api' / 'swagger' / 'authoritative-api-swagger.yaml', ], + output: 'apidocfiles.h', + capture: true, ) -) - -libpdns_dnssecinfra = declare_dependency( +endif +libpdns_auth_apidocfiles = declare_dependency( link_whole: static_library( - 'pdns-dnssecinfra', - sources: [ - 'dnssecinfra.cc', - ], - extra_files: [ - 'dnssecinfra.hh', - ], - dependencies: [ - deps, - libpdns_common, - ], + 'pdns-auth-apidocfiles', + sources: [libpdns_auth_apidocfiles_h], ) ) -libpdns_stubresolver = declare_dependency( - link_whole: static_library( - 'pdns-stubresolver', - sources: [ - 'stubresolver.cc', - ], - extra_files: [ - 'stubresolver.hh', +libpdns_bind_dnssec_schema_h = 'bind-dnssec.schema.sqlite3.sql.h' +if not fs.is_file(libpdns_bind_dnssec_schema_h) + py = import('python') + python = py.find_installation('python3', required: true) + + summary('Python', python.found(), bool_yn: true, section: 'BIND DNSSEC Schema') + summary('Path', python.full_path(), section: 'BIND DNSSEC Schema') + summary('Version', python.version(), section: 'BIND DNSSEC Schema') + + libpdns_bind_dnssec_schema_h = custom_target( + 'pdns-bind-dnssec-schema', + command: [ + python, + '@INPUT0@', + '@INPUT1@', ], - dependencies: [ - deps, - libpdns_common, + input: [ + 'generate-bind-dnssec-schema.py', + 'bind-dnssec.schema.sqlite3.sql', ], + output: 'bind-dnssec.schema.sqlite3.sql.h', + capture: true, + ) +endif +libpdns_bind_dnssec_schema = declare_dependency( + link_whole: static_library( + 'pdns-bind-dnssec-schema', + sources: [libpdns_bind_dnssec_schema_h], ) ) -libpdns_base = declare_dependency( - link_whole: static_library( - 'pdns-base', - sources: [ +tool_libs = { + 'pdns-auth': { + 'main': 'auth-main.cc', + 'sources': [ + 'arguments.cc', + 'arguments.hh', + 'auth-caches.cc', + 'auth-caches.hh', + 'auth-carbon.cc', + 'auth-catalogzone.cc', + 'auth-catalogzone.hh', + 'auth-main.hh', + 'auth-packetcache.cc', + 'auth-packetcache.hh', + 'auth-querycache.cc', + 'auth-querycache.hh', + 'auth-zonecache.cc', + 'auth-zonecache.hh', 'axfr-retriever.cc', - 'backends' / 'gsql' / 'gsqlbackend.cc', # TODO Move to a separate module - 'credentials.cc', - 'dbdnsseckeeper.cc', - 'dnsbackend.cc', - 'dnspacket.cc', - 'dnsproxy.cc', - 'dnssecsigner.cc', - 'dynlistener.cc', - 'ednscookies.cc', - 'gettime.cc', - 'ixfr.cc', - 'opensslsigners.cc', - 'query-local-address.cc', - 'resolver.cc', - 'responsestats.cc', - 'secpoll.cc', - 'serialtweaker.cc', - 'shuffle.cc', - 'signingpipe.cc', - 'threadname.cc', - 'trusted-notification-proxy.cc', - 'ueberbackend.cc', - 'unix_semaphore.cc', - 'uuid-utils.cc', - 'version.cc', - ], - extra_files: [ 'axfr-retriever.hh', - 'backends' / 'gsql' / 'gsqlbackend.hh', # TODO Move to a separate module - 'backends' / 'gsql' / 'ssql.hh', # TODO Move to a separate module + 'backends' / 'gsql' / 'gsqlbackend.cc', # TODO Move to a separate module. + 'backends' / 'gsql' / 'gsqlbackend.hh', # TODO Move to a separate module. + 'backends' / 'gsql' / 'ssql.hh', # TODO Move to a separate module. + 'base32.cc', + 'base32.hh', + 'base64.cc', + 'base64.hh', 'burtle.hh', 'cachecleaner.hh', 'circular_buffer.hh', 'comment.hh', + 'communicator.cc', + 'communicator.hh', + 'coverage.cc', + 'coverage.hh', + 'credentials.cc', 'credentials.hh', + 'dbdnsseckeeper.cc', 'digests.hh', 'distributor.hh', + 'dns.cc', + 'dns.hh', + 'dns_random.hh', + 'dnsbackend.cc', 'dnsbackend.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnspacket.cc', 'dnspacket.hh', + 'dnsparser.cc', + 'dnsproxy.cc', 'dnsproxy.hh', + 'dnsrecords.cc', + 'dnsrecords.hh', + 'dnssecinfra.cc', + 'dnssecinfra.hh', 'dnsseckeeper.hh', + 'dnssecsigner.cc', + 'dnswriter.cc', + 'dynhandler.cc', 'dynhandler.hh', + 'dynlistener.cc', 'dynlistener.hh', 'dynmessenger.hh', + 'ednscookies.cc', 'ednscookies.hh', + 'ednsoptions.cc', + 'ednsoptions.hh', + 'ednssubnet.cc', + 'ednssubnet.hh', + 'gettime.cc', 'gettime.hh', + 'gss_context.cc', + 'gss_context.hh', 'histogram.hh', + 'iputils.cc', + 'iputils.hh', + 'ixfr.cc', 'ixfr.hh', + 'json.cc', + 'json.hh', 'lock.hh', + 'logger.cc', + 'logger.hh', 'logging.hh', + 'lua-auth4.cc', + 'lua-auth4.hh', + 'lua-base4.cc', + 'lua-base4.hh', + 'mastercommunicator.cc', + 'misc.cc', + 'misc.hh', + 'nameserver.cc', + 'nameserver.hh', 'namespaces.hh', 'noinitvector.hh', + 'nsecrecords.cc', + 'opensslsigners.cc', 'opensslsigners.hh', 'packetcache.hh', + 'packethandler.cc', + 'packethandler.hh', 'pdnsexception.hh', - 'query-local-address.hh', - 'resolver.hh', + 'proxy-protocol.cc', + 'proxy-protocol.hh', + 'qtype.cc', + 'qtype.hh', + 'query-local-address.hh', + 'query-local-address.cc', + 'rcpgenerator.cc', + 'resolver.cc', + 'resolver.hh', + 'responsestats.cc', 'responsestats.hh', + 'responsestats-auth.cc', + 'rfc2136handler.cc', + 'secpoll-auth.cc', + 'secpoll-auth.hh', + 'secpoll.cc', 'secpoll.hh', + 'serialtweaker.cc', 'sha.hh', + 'shuffle.cc', 'shuffle.hh', + 'signingpipe.cc', 'signingpipe.hh', + 'sillyrecords.cc', + 'slavecommunicator.cc', 'stat_t.hh', + 'statbag.cc', + 'statbag.hh', + 'stubresolver.cc', + 'stubresolver.hh', + 'svc-records.cc', + 'svc-records.hh', + 'tcpreceiver.cc', + 'tcpreceiver.hh', 'threadname.hh', + 'threadname.cc', + 'tkey.cc', 'trusted-notification-proxy.hh', + 'trusted-notification-proxy.cc', + 'tsigutils.hh', + 'tsigutils.cc', + 'tsigverifier.cc', + 'tsigverifier.hh', + 'ueberbackend.cc', 'ueberbackend.hh', + 'unix_semaphore.cc', + 'unix_utility.cc', + 'utility.hh', 'uuid-utils.hh', + 'uuid-utils.cc', + 'version.cc', 'version.hh', + 'webserver.cc', + 'webserver.hh', + 'ws-api.cc', + 'ws-api.hh', + 'ws-auth.cc', + 'ws-auth.hh', + 'zoneparser-tng.cc', + + 'lua-record.cc', + 'minicurl.cc', + 'minicurl.hh', + 'sodiumsigners.cc', + 'decafsigners.cc', + 'ssqlite3.cc', + 'ssqlite3.hh', + 'pkcs11signers.cc', + 'pkcs11signers.hh', ], - dependencies: [ + 'deps': [ deps, - libpdns_common, - libpdns_dnssecinfra, - libpdns_stubresolver, libpdns_bind_parser, - libpdns_gss, - libpdns_lua, - libpdns_pkcs11, - libpdns_tsig, - libpdns_sodium, - libpdns_decaf, - libpdns_sqlite3, - ], - ) -) + libpdns_bind_dnssec_schema, + libpdns_dnslabeltext, + ] + }, + 'pdns-auth-util': { + 'main': 'pdnsutil.cc', + 'sources': [ + 'arguments.cc', + 'auth-caches.cc', + 'auth-caches.hh', + 'auth-catalogzone.cc', + 'auth-catalogzone.hh', + 'auth-packetcache.cc', + 'auth-packetcache.hh', + 'auth-querycache.cc', + 'auth-querycache.hh', + 'auth-zonecache.cc', + 'auth-zonecache.hh', + 'backends' / 'gsql' / 'gsqlbackend.cc', # TODO Move to a separate module. + 'backends' / 'gsql' / 'gsqlbackend.hh', # TODO Move to a separate module. + 'backends' / 'gsql' / 'ssql.hh', # TODO Move to a separate module. + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'cachecleaner.hh', + 'circular_buffer.hh', + 'credentials.cc', + 'credentials.hh', + 'dbdnsseckeeper.cc', + 'dns.cc', + 'dnsbackend.cc', + 'dnsname.cc', + 'dnsname.hh', + 'dnspacket.cc', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnsrecords.cc', + 'dnssecinfra.cc', + 'dnssecinfra.hh', + 'dnssecsigner.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'dynlistener.cc', + 'ednscookies.cc', + 'ednscookies.hh', + 'ednsoptions.cc', + 'ednsoptions.hh', + 'ednssubnet.cc', + 'gettime.cc', + 'gettime.hh', + 'gss_context.cc', + 'gss_context.hh', + 'ipcipher.cc', + 'ipcipher.hh', + 'iputils.cc', + 'iputils.hh', + 'json.cc', + 'logger.cc', + 'lua-auth4.cc', + 'lua-auth4.hh', + 'lua-base4.cc', + 'lua-base4.hh', + 'misc.cc', + 'misc.hh', + 'nsecrecords.cc', + 'opensslsigners.cc', + 'opensslsigners.hh', + 'qtype.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'serialtweaker.cc', + 'shuffle.cc', + 'shuffle.hh', + 'signingpipe.cc', + 'sillyrecords.cc', + 'sstuff.hh', + 'statbag.cc', + 'stubresolver.cc', + 'stubresolver.hh', + 'svc-records.cc', + 'svc-records.hh', + 'threadname.hh', + 'threadname.cc', + 'tsigutils.hh', + 'tsigutils.cc', + 'ueberbackend.cc', + 'unix_utility.cc', + 'uuid-utils.hh', + 'uuid-utils.cc', + 'validate.hh', + 'zonemd.hh', + 'zonemd.cc', + 'zoneparser-tng.cc', -libpdns = declare_dependency( - link_whole: static_library( - 'pdns', - 'communicator.cc', - 'dynhandler.cc', - 'mastercommunicator.cc', - 'nameserver.cc', - 'packethandler.cc', - 'rfc2136handler.cc', - 'slavecommunicator.cc', - 'tcpreceiver.cc', - 'tkey.cc', - extra_files: [ - 'communicator.hh', - 'dynhandler.hh', - 'nameserver.hh', - 'packethandler.hh', - 'tcpreceiver.hh', + 'sodiumsigners.cc', + 'decafsigners.cc', + 'ssqlite3.cc', + 'ssqlite3.hh', + 'pkcs11signers.cc', + 'pkcs11signers.hh', ], - dependencies: [ + 'deps': [ deps, - libpdns_base, - libpdns_ws, + libpdns_bind_parser, + libpdns_dnslabeltext, ], - ) -) + }, + 'pdns-auth-control': { + 'main': 'dynloader.cc', + 'sources': [ + 'arguments.cc', + 'dnsname.cc', + 'dynmessenger.cc', + 'logger.cc', + 'misc.cc', + 'qtype.cc', + 'statbag.cc', + 'unix_utility.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'zone2sql': { + 'main': 'zone2sql.cc', + 'sources': [ + 'arguments.cc', + 'base32.cc', + 'base64.cc', + 'bindparserclasses.hh', + 'dns.cc', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsrecords.cc', + 'dnswriter.cc', + 'json.cc', + 'json.hh', + 'logger.cc', + 'misc.cc', + 'nsecrecords.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'sillyrecords.cc', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + 'zoneparser-tng.cc', + ], + 'deps': [ + deps, + libpdns_bind_parser, + libpdns_bind_dnssec_schema, + libpdns_dnslabeltext, + ], + }, + 'zone2json': { + 'main': 'zone2json.cc', + 'sources': [ + 'arguments.cc', + 'base32.cc', + 'base64.cc', + 'bindparserclasses.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsrecords.cc', + 'dnswriter.cc', + 'logger.cc', + 'misc.cc', + 'nsecrecords.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'sillyrecords.cc', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + 'zoneparser-tng.cc', + ], + 'deps': [ + deps, + libpdns_bind_parser, + libpdns_bind_dnssec_schema, + libpdns_dnslabeltext, + ], + }, +} -libpdns_auth_apidocfiles_h = 'apidocfiles.h' -if not fs.is_file(libpdns_auth_apidocfiles_h) - py = import('python') - python = py.find_installation('python3', modules: 'yaml', required: true) +if get_option('module-ldap') != 'disabled' + tool_libs += { + 'zone2ldap': { + 'main': 'zone2ldap.cc', + 'sources': [ + 'arguments.cc', + 'base32.cc', + 'base64.cc', + 'bindparserclasses.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsrecords.cc', + 'dnswriter.cc', + 'logger.cc', + 'misc.cc', + 'nsecrecords.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'sillyrecords.cc', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + 'zoneparser-tng.cc', + ], + 'deps': [ + deps, + libpdns_bind_parser, + libpdns_bind_dnssec_schema, + libpdns_dnslabeltext, + ], + }, + } +endif - summary('Python', python.found(), bool_yn: true, section: 'Swagger API') - summary('Path', python.full_path(), section: 'Swagger API') - summary('Version', python.version(), section: 'Swagger API') +if get_option('tools') + tool_libs += { + 'sdig': { + 'main': 'sdig.cc', + 'sources': [ + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'dns.cc', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnsrecords.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'dolog.hh', + 'ednsextendederror.cc', + 'ednsextendederror.hh', + 'ednssubnet.cc', + 'iputils.cc', + 'libssl.cc', + 'libssl.hh', + 'logger.cc', + 'misc.cc', + 'misc.hh', + 'nsecrecords.cc', + 'proxy-protocol.cc', + 'proxy-protocol.hh', + 'qtype.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'sstuff.hh', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'tcpiohandler.cc', + 'tcpiohandler.hh', + 'unix_utility.cc', - libpdns_auth_apidocfiles_h = custom_target( - 'pdns-auth-apidocfiles-h', - command: [ - python, - '@INPUT0@', - '@INPUT1@', - ], - input: [ - 'generate-api-swagger.py', - product_source_dir / 'docs' / 'http-api' / 'swagger' / 'authoritative-api-swagger.yaml', - ], - output: 'apidocfiles.h', - capture: true, - ) + 'minicurl.cc', + 'minicurl.hh', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'calidns': { + 'main': 'calidns.cc', + 'sources': [ + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'dns_random.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnsrecords.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'ednsoptions.cc', + 'ednsoptions.hh', + 'ednssubnet.cc', + 'ednssubnet.hh', + 'iputils.cc', + 'logger.cc', + 'misc.cc', + 'misc.hh', + 'nsecrecords.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'sstuff.hh', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + # TODO: Broken + # 'comfun': { + # 'main': 'comfun.cc', + # 'sources': [ + # 'base32.cc', + # 'base64.cc', + # 'dns.cc', + # 'dnsname.cc', + # 'dnsname.hh', + # 'dnsparser.cc', + # 'dnsrecords.cc', + # 'dnswriter.cc', + # 'logger.cc', + # 'misc.cc', + # 'nsecrecords.cc', + # 'qtype.cc', + # 'rcpgenerator.cc', + # 'sillyrecords.cc', + # 'statbag.cc', + # 'svc-records.cc', + # 'svc-records.hh', + # 'unix_utility.cc', + # 'zoneparser-tng.cc', + # 'zoneparser-tng.hh', + # ], + # 'deps': [ + # deps, + # libpdns_dnslabeltext, + # ], + # }, + 'dnsdemog': { + 'main': 'dnsdemog.cc', + 'sources': [ + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnspcap.cc', + 'dnspcap.hh', + 'dnsrecords.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'logger.cc', + 'misc.cc', + 'nsecrecords.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + 'utility.hh', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'dnsgram': { + 'main': 'dnsgram.cc', + 'sources': [ + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnspcap.cc', + 'dnspcap.hh', + 'dnsrecords.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'logger.cc', + 'misc.cc', + 'nsecrecords.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + 'utility.hh', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'dnspcap2calidns': { + 'main': 'dnspcap2calidns.cc', + 'sources': [ + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnspcap.cc', + 'dnspcap.hh', + 'dnsrecords.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'ednsoptions.cc', + 'ednsoptions.hh', + 'ednssubnet.cc', + 'ednssubnet.hh', + 'iputils.cc', + 'logger.cc', + 'misc.cc', + 'nsecrecords.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + 'utility.hh', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'dnspcap2protobuf': { + 'main': 'dnspcap2protobuf.cc', + 'sources': [ + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnspcap.cc', + 'dnspcap.hh', + 'dnsrecords.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'gettime.cc', + 'gettime.hh', + 'iputils.cc', + 'logger.cc', + 'misc.cc', + 'nsecrecords.cc', + 'protozero.cc', + 'protozero.hh', + 'qtype.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + 'utility.hh', + 'uuid-utils.hh', + 'uuid-utils.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'dnsreplay': { + 'main': 'dnsreplay.cc', + 'sources': [ + 'anadns.hh', + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnspcap.cc', + 'dnspcap.hh', + 'dnsrecords.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'ednsoptions.cc', + 'ednsoptions.hh', + 'ednssubnet.cc', + 'ednssubnet.hh', + 'iputils.cc', + 'logger.cc', + 'misc.cc', + 'nsecrecords.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + 'utility.hh', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'dnsscan': { + 'main': 'dnsscan.cc', + 'sources': [ + 'anadns.hh', + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnspcap.cc', + 'dnspcap.hh', + 'dnsrecords.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'logger.cc', + 'misc.cc', + 'nsecrecords.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + 'utility.hh', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'dnsscope': { + 'main': 'dnsscope.cc', + 'sources': [ + 'arguments.cc', + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'dns.cc', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnspcap.cc', + 'dnspcap.hh', + 'dnsrecords.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'histog.hh', + 'logger.cc', + 'misc.cc', + 'nsecrecords.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'statbag.cc', + 'statnode.cc', + 'statnode.hh', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + 'utility.hh', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'dnswasher': { + 'main': 'dnswasher.cc', + 'sources': [ + 'base64.cc', + 'dnsname.hh', + 'dnsname.cc', + 'dnsparser.hh', + 'dnspcap.cc', + 'dnspcap.hh', + 'dnswriter.hh', + 'ipcipher.cc', + 'ipcipher.hh', + 'logger.cc', + 'misc.cc', + 'qtype.cc', + 'statbag.cc', + 'unix_utility.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'nproxy': { + 'main': 'nproxy.cc', + 'sources': [ + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnsrecords.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'logger.cc', + 'misc.cc', + 'mplexer.hh', + 'nsecrecords.cc', + 'pollmplexer.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'nsec3dig': { + 'main': 'nsec3dig.cc', + 'sources': [ + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnsrecords.cc', + 'dnssecinfra.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'gss_context.cc', + 'gss_context.hh', + 'iputils.cc', + 'logger.cc', + 'misc.cc', + 'misc.hh', + 'nsecrecords.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'sstuff.hh', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + + 'pkcs11signers.cc', + 'pkcs11signers.hh', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'pdns-auth-notify': { + 'main': 'notify.cc', + 'sources': [ + 'arguments.cc', + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'dns.cc', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnsrecords.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'logger.cc', + 'misc.cc', + 'nsecrecords.cc', + 'pollmplexer.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'dumresp': { + 'main': 'dumresp.cc', + 'sources': [ + 'dnsname.cc', + 'dnsname.hh', + 'iputils.cc', + 'iputils.hh', + 'logger.cc', + 'misc.cc', + 'misc.hh', + 'qtype.cc', + 'statbag.cc', + 'unix_utility.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'kvresp': { + 'main': 'kvresp.cc', + 'sources': [ + 'dnsname.cc', + 'dnsname.hh', + 'logger.cc', + 'misc.cc', + 'misc.hh', + 'qtype.cc', + 'statbag.cc', + 'unix_utility.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'stubquery': { + 'main': 'stubquery.cc', + 'sources': [ + 'arguments.cc', + 'arguments.hh', + 'base32.cc', + 'base64.cc', + 'dnsname.cc', + 'dnsparser.cc', + 'dnsrecords.cc', + 'dnswriter.cc', + 'iputils.cc', + 'logger.cc', + 'misc.cc', + 'nsecrecords.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'sillyrecords.cc', + 'statbag.cc', + 'stubresolver.cc', + 'stubresolver.hh', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'saxfr': { + 'main': 'saxfr.cc', + 'sources': [ + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'dns_random.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnsrecords.cc', + 'dnssecinfra.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'gss_context.cc', + 'gss_context.hh', + 'iputils.cc', + 'logger.cc', + 'misc.cc', + 'misc.hh', + 'nsecrecords.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'sstuff.hh', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + + 'pkcs11signers.cc', + 'pkcs11signers.hh', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + } + + if have_boost_1_48_0 + tool_libs += { + 'dnstcpbench': { + 'main': 'dnstcpbench.cc', + 'sources': [ + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnsrecords.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'iputils.cc', + 'logger.cc', + 'misc.cc', + 'misc.hh', + 'nsecrecords.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'sstuff.hh', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'threadname.hh', + 'threadname.cc', + 'unix_utility.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'dnsbulktest': { + 'main': 'dnsbulktest.cc', + 'sources': [ + 'arguments.cc', + 'arguments.hh', + 'base32.cc', + 'base64.cc', + 'dns_random.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsrecords.cc', + 'dnswriter.cc', + 'iputils.cc', + 'iputils.hh', + 'logger.cc', + 'misc.cc', + 'nsecrecords.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'sillyrecords.cc', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + } + endif endif -libpdns_auth_apidocfiles_h = declare_dependency( - sources: [libpdns_auth_apidocfiles_h], -) -libpdns_auth_main = declare_dependency( - link_whole: static_library( - 'pdns-auth-main', - 'auth-main.cc', - extra_files: [ - 'auth-main.hh', - ], - cpp_args: '-Wno-overloaded-virtual', - dependencies: deps, - ) -) +if get_option('tools-ixfrdist') + tool_libs += { + 'ixfrdist': { + 'main': 'ixfrdist.cc', + 'sources': [ + 'arguments.cc', + 'axfr-retriever.cc', + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'credentials.cc', + 'credentials.hh', + 'dns.cc', + 'dns_random.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnsrecords.cc', + 'dnssecinfra.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'gss_context.cc', + 'gss_context.hh', + 'iputils.hh', + 'iputils.cc', + 'ixfr.cc', + 'ixfr.hh', + 'ixfrdist-stats.hh', + 'ixfrdist-stats.cc', + 'ixfrdist-web.hh', + 'ixfrdist-web.cc', + 'ixfrutils.cc', + 'ixfrutils.hh', + 'logger.cc', + 'logger.hh', + 'misc.cc', + 'misc.hh', + 'mplexer.hh', + 'nsecrecords.cc', + 'pollmplexer.cc', + 'qtype.cc', + 'query-local-address.hh', + 'query-local-address.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'resolver.cc', + 'sillyrecords.cc', + 'sstuff.hh', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'threadname.hh', + 'threadname.cc', + 'tsigverifier.cc', + 'tsigverifier.hh', + 'unix_utility.cc', + 'uuid-utils.hh', + 'uuid-utils.cc', + 'webserver.hh', + 'webserver.cc', + 'zoneparser-tng.cc', -libpdns_auth_ws = declare_dependency( - link_whole: static_library( - 'pdns-auth-ws', - 'ws-auth.cc', - extra_files: [ - 'ws-auth.hh', - ], - cpp_args: '-Wno-overloaded-virtual', - dependencies: deps, - ) -) + 'pkcs11signers.cc', + 'pkcs11signers.hh', + 'kqueuemplexer.cc', + 'epollmplexer.cc', + 'devpollmplexer.cc', + 'portsmplexer.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'ixplore': { + 'main': 'ixplore.cc', + 'sources': [ + 'arguments.cc', + 'axfr-retriever.cc', + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'dns.cc', + 'dns_random.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnsrecords.cc', + 'dnssecinfra.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'gss_context.cc', + 'gss_context.hh', + 'iputils.cc', + 'ixfr.cc', + 'ixfr.hh', + 'ixfrutils.cc', + 'ixfrutils.hh', + 'logger.cc', + 'misc.cc', + 'misc.hh', + 'nsecrecords.cc', + 'qtype.cc', + 'query-local-address.hh', + 'query-local-address.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'resolver.cc', + 'sillyrecords.cc', + 'sstuff.hh', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'tsigverifier.cc', + 'tsigverifier.hh', + 'unix_utility.cc', + 'zoneparser-tng.cc', -libpdns_auth_lua = dependency('', required: false) -if dep_lua.found() - libpdns_auth_lua = declare_dependency( - link_whole: static_library( - 'pdns-auth-lua', - 'lua-auth4.cc', - extra_files: [ - 'lua-auth4.hh', + 'pkcs11signers.cc', + 'pkcs11signers.hh', ], - dependencies: deps, - ) - ) + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + } endif -libpdns_auth = declare_dependency( - link_whole: static_library( - 'pdns-auth', - 'auth-caches.cc', - 'auth-carbon.cc', - 'auth-catalogzone.cc', - 'auth-packetcache.cc', - 'auth-querycache.cc', - 'auth-zonecache.cc', - 'responsestats-auth.cc', - 'secpoll-auth.cc', - extra_files: [ - 'auth-caches.hh', - 'auth-catalogzone.hh', - 'auth-packetcache.hh', - 'auth-querycache.hh', - 'auth-zonecache.hh', - 'secpoll-auth.hh', - ], - dependencies: [ - deps, - libpdns_auth_apidocfiles_h, - libpdns_auth_lua, - ], - ) -) +if get_option('unit-tests') or get_option('unit-tests-backends') + tool_libs += { + 'tsig_tests': { + 'main': 'tsig-tests.cc', + 'sources': [ + 'arguments.cc', + 'axfr-retriever.cc', + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'digests.hh', + 'dns.cc', + 'dns_random.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnsrecords.cc', + 'dnssecinfra.cc', + 'dnswriter.cc', + 'dnswriter.hh', + 'gss_context.cc', + 'gss_context.hh', + 'iputils.cc', + 'logger.cc', + 'misc.cc', + 'misc.hh', + 'nsecrecords.cc', + 'qtype.cc', + 'query-local-address.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'resolver.cc', + 'sillyrecords.cc', + 'sstuff.hh', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'tsigverifier.cc', + 'tsigverifier.hh', + 'unix_utility.cc', -libpdns_bind_dnssec_schema_h = 'bind-dnssec.schema.sqlite3.sql.h' -if not fs.is_file(libpdns_bind_dnssec_schema_h) - py = import('python') - python = py.find_installation('python3', required: true) + 'pkcs11signers.cc', + 'pkcs11signers.hh', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'speedtest': { + 'main': 'speedtest.cc', + 'sources': [ + 'arguments.cc', + 'arguments.hh', + 'base32.cc', + 'base64.cc', + 'base64.hh', + 'credentials.cc', + 'credentials.hh', + 'dns_random.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnsrecords.cc', + 'dnssecinfra.cc', + 'dnssecinfra.hh', + 'dnswriter.cc', + 'dnswriter.hh', + 'gss_context.cc', + 'gss_context.hh', + 'iputils.cc', + 'logger.cc', + 'misc.cc', + 'misc.hh', + 'nsecrecords.cc', + 'qtype.cc', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'statbag.cc', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + 'uuid-utils.cc', - summary('Python', python.found(), bool_yn: true, section: 'BIND DNSSEC Schema') - summary('Path', python.full_path(), section: 'BIND DNSSEC Schema') - summary('Version', python.version(), section: 'BIND DNSSEC Schema') + 'pkcs11signers.cc', + 'pkcs11signers.hh', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'pdns-auth-testrunner': { + 'main': 'testrunner.cc', + 'sources': [ + 'arguments.cc', + 'auth-caches.cc', + 'auth-caches.hh', + 'auth-packetcache.cc', + 'auth-packetcache.hh', + 'auth-querycache.cc', + 'auth-querycache.hh', + 'auth-zonecache.cc', + 'auth-zonecache.hh', + 'base32.cc', + 'base64.cc', + 'channel.cc', + 'channel.hh', + 'credentials.cc', + 'credentials.hh', + 'dbdnsseckeeper.cc', + 'dns.cc', + 'dnsbackend.cc', + 'dnsname.cc', + 'dnsname.hh', + 'dnspacket.cc', + 'dnsparser.hh', + 'dnsparser.cc', + 'dnsrecords.cc', + 'dnssecinfra.cc', + 'dnssecsigner.cc', + 'dnswriter.cc', + 'ednscookies.cc', + 'ednscookies.hh', + 'ednsoptions.cc', + 'ednsoptions.hh', + 'ednssubnet.cc', + 'gettime.cc', + 'gettime.hh', + 'gss_context.cc', + 'gss_context.hh', + 'histogram.hh', + 'ipcipher.cc', + 'ipcipher.hh', + 'iputils.cc', + 'ixfr.cc', + 'ixfr.hh', + 'logger.cc', + 'lua-auth4.hh', + 'lua-auth4.cc', + 'lua-base4.hh', + 'lua-base4.cc', + 'misc.cc', + 'nameserver.cc', + 'nsecrecords.cc', + 'opensslsigners.cc', + 'opensslsigners.hh', + 'pollmplexer.cc', + 'proxy-protocol.cc', + 'proxy-protocol.hh', + 'qtype.cc', + 'rcpgenerator.cc', + 'responsestats-auth.cc', + 'responsestats.cc', + 'responsestats.hh', + 'shuffle.cc', + 'shuffle.hh', + 'sillyrecords.cc', + 'stat_t.hh', + 'statbag.cc', + 'stubresolver.hh', + 'stubresolver.cc', + 'svc-records.cc', + 'svc-records.hh', + 'test-arguments_cc.cc', + 'test-auth-zonecache_cc.cc', + 'test-base32_cc.cc', + 'test-base64_cc.cc', + 'test-bindparser_cc.cc', + 'test-channel.cc', + 'test-common.hh', + 'test-communicator_hh.cc', + 'test-credentials_cc.cc', + 'test-digests_hh.cc', + 'test-distributor_hh.cc', + 'test-dns_random_hh.cc', + 'test-dnsname_cc.cc', + 'test-dnsparser_cc.cc', + 'test-dnsparser_hh.cc', + 'test-dnsrecordcontent.cc', + 'test-dnsrecords_cc.cc', + 'test-dnswriter_cc.cc', + 'test-ednscookie_cc.cc', + 'test-ipcrypt_cc.cc', + 'test-iputils_hh.cc', + 'test-ixfr_cc.cc', + 'test-lock_hh.cc', + 'test-lua_auth4_cc.cc', + 'test-luawrapper.cc', + 'test-misc_hh.cc', + 'test-mplexer.cc', + 'test-nameserver_cc.cc', + 'test-packetcache_cc.cc', + 'test-packetcache_hh.cc', + 'test-proxy_protocol_cc.cc', + 'test-rcpgenerator_cc.cc', + 'test-sha_hh.cc', + 'test-signers.cc', + 'test-statbag_cc.cc', + 'test-svc_records_cc.cc', + 'test-trusted-notification-proxy_cc.cc', + 'test-tsig.cc', + 'test-ueberbackend_cc.cc', + 'test-webserver_cc.cc', + 'test-zonemd_cc.cc', + 'test-zoneparser_tng_cc.cc', + 'threadname.hh', + 'threadname.cc', + 'trusted-notification-proxy.cc', + 'tsigverifier.cc', + 'tsigverifier.hh', + 'ueberbackend.cc', + 'ueberbackend.hh', + 'unix_utility.cc', + 'uuid-utils.cc', + 'validate.hh', + 'webserver.cc', + 'zonemd.cc', + 'zonemd.hh', + 'zoneparser-tng.cc', + 'zoneparser-tng.hh', - libpdns_bind_dnssec_schema_h = custom_target( - 'pdns-bind-dnssec-schema', - command: [ - python, - '@INPUT0@', - '@INPUT1@', - ], - input: [ - 'generate-bind-dnssec-schema.py', - 'bind-dnssec.schema.sqlite3.sql', - ], - output: 'bind-dnssec.schema.sqlite3.sql.h', - capture: true, - ) + 'pkcs11signers.cc', + 'pkcs11signers.hh', + 'sodiumsigners.cc', + 'decafsigners.cc', + 'kqueuemplexer.cc', + 'epollmplexer.cc', + 'devpollmplexer.cc', + 'portsmplexer.cc', + ], + 'deps': [ + deps, + libpdns_bind_parser, + libpdns_dnslabeltext, + ], + }, + } endif -libpdns_bind_dnssec_schema = declare_dependency( - sources: [libpdns_bind_dnssec_schema_h], -) -libpdns_ipcipher = dependency('', required: false) -if enable_ipcipher - libpdns_ipcipher = declare_dependency( - link_whole: static_library( - 'pdns-ipcipher', - sources: ['ipcipher.cc'], - dependencies: deps, - ) - ) +if get_option('fuzz-targets') + tool_libs += { + 'fuzz_target_moadnsparser': { + 'main': 'fuzz_moadnsparser.cc', + 'sources': [ + 'base32.cc', + 'base32.hh', + 'base64.cc', + 'base64.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnsrecords.cc', + 'dnsrecords.hh', + 'dnswriter.cc', + 'dnswriter.hh', + 'logger.cc', + 'logger.hh', + 'misc.cc', + 'misc.hh', + 'nsecrecords.cc', + 'qtype.cc', + 'qtype.hh', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'statbag.cc', + 'statbag.hh', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + 'utility.hh', + + 'standalone_fuzz_target_runner.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'fuzz_target_packetcache': { + 'main': 'fuzz_packetcache.cc', + 'sources': [ + 'dnsname.cc', + 'dnsname.hh', + 'ednsoptions.cc', + 'ednsoptions.hh', + 'misc.cc', + 'misc.hh', + 'packetcache.hh', + 'qtype.cc', + 'qtype.hh', + 'statbag.cc', + 'statbag.hh', + 'svc-records.cc', + 'svc-records.hh', + + 'standalone_fuzz_target_runner.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'fuzz_target_proxyprotocol': { + 'main': 'fuzz_proxyprotocol.cc', + 'sources': [ + 'iputils.hh', + 'proxy-protocol.cc', + 'proxy-protocol.hh', + + 'standalone_fuzz_target_runner.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'fuzz_target_dnslabeltext_parseRFC1035CharString': { + 'main': 'fuzz_dnslabeltext_parseRFC1035CharString.cc', + 'sources': [ + 'standalone_fuzz_target_runner.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'fuzz_target_yahttp': { + 'main': 'fuzz_yahttp.cc', + 'sources': [ + 'standalone_fuzz_target_runner.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + 'fuzz_target_zoneparsertng': { + 'main': 'fuzz_zoneparsertng.cc', + 'sources': [ + 'base32.cc', + 'base32.hh', + 'base64.cc', + 'base64.hh', + 'dnsname.cc', + 'dnsname.hh', + 'dnsparser.cc', + 'dnsparser.hh', + 'dnsrecords.cc', + 'dnsrecords.hh', + 'dnswriter.cc', + 'dnswriter.hh', + 'logger.cc', + 'logger.hh', + 'misc.cc', + 'misc.hh', + 'nsecrecords.cc', + 'qtype.cc', + 'qtype.hh', + 'rcpgenerator.cc', + 'rcpgenerator.hh', + 'sillyrecords.cc', + 'statbag.cc', + 'statbag.hh', + 'svc-records.cc', + 'svc-records.hh', + 'unix_utility.cc', + 'utility.hh', + 'zoneparser-tng.cc', + 'zoneparser-tng.hh', + + 'standalone_fuzz_target_runner.cc', + ], + 'deps': [ + deps, + libpdns_dnslabeltext, + ], + }, + } endif -tool_libs = { - 'util': { - 'sources': ['pdnsutil.cc', 'zonemd.cc'], - 'headers': ['zonemd.hh'], - 'deps': [deps, libpdns_base, libpdns_auth, libpdns_bind_dnssec_schema, libpdns_ipcipher], - }, - 'auth-control': { - 'sources': ['dynloader.cc', 'dynmessenger.cc'], - 'headers': ['dynmessenger.hh'], - 'deps': [deps, libpdns_common], - }, - 'zone2sql': { - 'sources': ['zone2sql.cc'], - 'headers': [], - 'deps': [deps, libpdns_common, libpdns_bind_parser], - }, - 'zone2ldap': { - 'sources': ['zone2ldap.cc'], - 'headers': [], - 'deps': [deps, libpdns_common, libpdns_bind_parser, libpdns_bind_dnssec_schema], - }, - 'zone2json': { - 'sources': ['zone2json.cc'], - 'headers': [], - 'deps': [deps, libpdns_common, libpdns_bind_parser, libpdns_bind_dnssec_schema], - }, - 'sdig': { - 'sources': ['ednsextendederror.cc', 'libssl.cc', 'sdig.cc', 'tcpiohandler.cc'], - 'headers': ['dolog.hh', 'ednsextendederror.hh', 'libssl.hh', 'sstuff.hh', 'tcpiohandler.hh'], - 'deps': [deps, libpdns_common, libpdns_minicurl], - }, - 'calidns': { - 'sources': ['calidns.cc'], - 'headers': ['sstuff.hh'], - 'deps': [deps, libpdns_common], - }, - 'dumresp': { - 'sources': ['dumresp.cc'], - 'headers': [], - 'deps': [deps, libpdns_common], - }, - 'kvresp': { - 'sources': ['kvresp.cc'], - 'headers': [], - 'deps': [deps, libpdns_common], - }, - 'stubquery': { - 'sources': ['stubquery.cc'], - 'headers': [], - 'deps': [deps, libpdns_common, libpdns_stubresolver], - }, - 'saxfr': { - 'sources': ['saxfr.cc'], - 'headers': [], - 'deps': [deps, libpdns_common, libpdns_gss, libpdns_pkcs11, libpdns_tsig, libpdns_dnssecinfra], - }, +conditional_sources = { + 'devpollmplexer.cc': get_variable('have_sunos', false), + 'portsmplexer.cc': get_variable('have_sunos', false), + 'epollmplexer.cc': get_variable('have_linux', false), + 'kqueuemplexer.cc': get_variable('have_openbsd', false) or get_variable('have_freebsd', false), + + 'tsigutils.cc': dep_gss_tsig.found(), + 'tsigutils.hh': dep_gss_tsig.found(), + + 'tsigverifier.cc': dep_gss_tsig.found(), + 'tsigverifier.hh': dep_gss_tsig.found(), + + 'ssqlite3.cc': get_variable('dep_sqlite3', dependency('', required: false)).found(), + 'ssqlite3.hh': get_variable('dep_sqlite3', dependency('', required: false)).found(), + + 'minicurl.cc': dep_lua_records.found() or dep_libcurl.found(), + 'minicurl.hh': dep_lua_records.found() or dep_libcurl.found(), + + 'ipcipher.cc': enable_ipcipher, + 'ipcipher.hh': enable_ipcipher, + + 'lua-base4.cc': dep_lua.found(), + 'lua-base4.hh': dep_lua.found(), + + 'lua-record.cc': dep_lua_records.found(), + + 'sodiumsigners.cc': dep_libsodium.found(), + + 'decafsigners.cc': dep_libdecaf.found(), + + 'pkcs11signers.cc': dep_pkcs11.found(), + 'pkcs11signers.hh': dep_pkcs11.found(), + + 'standalone_fuzz_target_runner.cc': get_option('fuzz-targets'), } +source_deps = {} + foreach tool_name, tool_info: tool_libs + tool_deps = tool_info['deps'] + tool_main = tool_info['main'] + all_sources = tool_info['sources'] + + tool_sources = [] + tool_headers = [] + + foreach source: all_sources + if source.endswith('.cc') + # name = source.underscorify().replace('/', '__') + + if source not in source_deps + # Check if the source is conditionally built. + if source not in conditional_sources or (source in conditional_sources and conditional_sources[source]) + # Create a new cached dependency for this source file. + source_deps += { + source: declare_dependency( + link_whole: static_library( + 'pdns-' + source.replace('/', '__'), + sources: [source], + dependencies: deps, + ) + ) + } + elif not conditional_sources[source] + source_deps += { + source: dependency('', required: false) + } + endif + endif + + tool_sources += source_deps[source] + elif source.endswith('.hh') + tool_headers += source + else + error('Unsupported extension for source file ' + source) + endif + endforeach + set_variable( - 'libpdns_' + tool_name.underscorify(), + 'lib' + tool_name.underscorify(), declare_dependency( link_whole: static_library( - 'pdns-' + tool_name, - sources: tool_info['sources'], - extra_files: tool_info['headers'], - dependencies: tool_info['deps'], + tool_name, + sources: [tool_main], + extra_files: tool_headers, + dependencies: tool_deps + tool_sources, ) ) )