From: Fred Morcos Date: Wed, 17 Jan 2024 15:33:24 +0000 (+0100) Subject: Meson: Refactor into a single file X-Git-Tag: rec-5.1.0-alpha1~80^2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ff791ec956a81e8c33e5fab46093315b510ffb5;p=thirdparty%2Fpdns.git Meson: Refactor into a single file This file supports both the old (non-flat) project hierarchy and the new flat project hierarchy. --- diff --git a/meson.build b/meson.build index 32ff788de3..ec3ac02694 100644 --- a/meson.build +++ b/meson.build @@ -20,9 +20,6 @@ summary('Build Dir', product_build_dir, section: 'Build') # Create the configuration object and dependencies list. conf = configuration_data() -# Toplevel includes -dep_pdns = declare_dependency(include_directories: include_directories('.', 'pdns')) - # Feature detection and system configuration subdir('meson' / 'config') # Config subdir('meson' / 'version') # Generate version define @@ -91,6 +88,13 @@ subdir('meson' / 'cxx-fs') # C++ stdlib Filesystem Module # endif # TODO Generate pdns_server.1 manpage +common_sources = [] + +fs = import('fs') +src_dir = fs.is_dir('pdns') ? 'pdns' : '' +# Toplevel includes +dep_pdns = declare_dependency(include_directories: include_directories('.', src_dir)) + # Ext subdir('ext' / 'arc4random') subdir('ext' / 'ipcrypt') @@ -102,7 +106,348 @@ if get_option('module-lmdb') != 'disabled' subdir('ext' / 'lmdb-safe') endif +libpdns_bindlexer_source = src_dir / 'bindlexer.l' +libpdns_bindlexer_gen = src_dir / 'bindlexer.c' +if not fs.is_file(libpdns_bindlexer_gen) + flex = find_program('flex', required: true) + + summary('Flex', flex.found(), bool_yn: true, section: 'BIND Parser') + summary('Flex Path', flex.full_path(), section: 'BIND Parser') + summary('Flex Version', flex.version(), section: 'BIND Parser') + + flex_generator = generator( + flex, + output: '@BASENAME@.c', + arguments: ['--case-insensitive', '--outfile=@OUTPUT@', '@INPUT@'], + ) + + libpdns_bindlexer_gen = flex_generator.process(libpdns_bindlexer_source) +endif + +libpdns_bindparser_source = src_dir / 'bindparser.yy' +libpdns_bindparser_gen = src_dir / 'bindparser.cc' +libpdns_bindparser_gen_header = src_dir / 'bindparser.hh' +if not fs.is_file(libpdns_bindparser_gen) and not fs.is_file(libpdns_bindparser_gen_header) + bison = find_program('bison', required: false) + if not bison.found() + bison = find_program('yacc', required: true) + endif + + summary('Bison/YACC', bison.found(), bool_yn: true, section: 'BIND Parser') + summary('Bison/YACC Path', bison.full_path(), section: 'BIND Parser') + summary('Bison/YACC Version', bison.version(), section: 'BIND Parser') + + bison_generator = generator( + bison, + output: ['@BASENAME@.cc', '@BASENAME@.hh', '@BASENAME@.output'], + arguments: ['-d', '--verbose', '--debug', '--output=@OUTPUT0@', '@INPUT@'], + ) + + libpdns_bindparser_gen = bison_generator.process(libpdns_bindparser_source) +endif + +libpdns_dnslabeltext_source = src_dir / 'dnslabeltext.rl' +libpdns_dnslabeltext_gen = src_dir / 'dnslabeltext.cc' +if not fs.is_file(libpdns_dnslabeltext_gen) + ragel = find_program('ragel', required: true) + ragel_generator = generator( + ragel, + output: '@BASENAME@.cc', + arguments: ['@INPUT@', '-o', '@OUTPUT@'], + ) + + summary('Ragel', ragel.found(), bool_yn: ragel.found(), section: 'DNS Labels') + summary('Ragel Path', ragel.full_path(), section: 'DNS Labels') + summary('Ragel Version', ragel.version(), section: 'DNS Labels') + + libpdns_dnslabeltext_gen = ragel_generator.process(libpdns_dnslabeltext_source) +endif +common_sources += libpdns_dnslabeltext_gen + +libpdns_apidocfiles_source = 'docs' / 'http-api' / 'swagger' / 'authoritative-api-swagger.yaml' +libpdns_apidocfiles_gen = src_dir / 'apidocfiles.h' +generate_api_swagger_py = src_dir / 'generate-api-swagger.py' +if not fs.is_file(libpdns_apidocfiles_gen) + 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_apidocfiles_gen = custom_target( + 'pdns-apidocfiles-h', + command: [python, '@INPUT0@', '@INPUT1@'], + input: [generate_api_swagger_py, libpdns_apidocfiles_source], + output: 'apidocfiles.h', + capture: true, + ) +endif +common_sources += libpdns_apidocfiles_gen +libpdns_bind_dnssec_schema_source = src_dir / 'bind-dnssec.schema.sqlite3.sql' +libpdns_bind_dnssec_schema_gen = src_dir / 'bind-dnssec.schema.sqlite3.sql.h' +generate_bind_dnssec_schema_py = src_dir / 'generate-bind-dnssec-schema.py' +if not fs.is_file(libpdns_bind_dnssec_schema_gen) + 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_gen = custom_target( + 'pdns-bind-dnssec-schema', + command: [python, '@INPUT0@', '@INPUT1@'], + input: [generate_bind_dnssec_schema_py, libpdns_bind_dnssec_schema_source], + output: 'bind-dnssec.schema.sqlite3.sql.h', + capture: true, + ) +endif +common_sources += libpdns_bind_dnssec_schema_gen + +conditional_sources = { + 'mplexer-sunos-devpoll': { + 'sources': [ + src_dir / 'devpollmplexer.cc', + src_dir / 'portsmplexer.cc', + ], + 'condition': have_sunos, + }, + 'mplexer-linux-epoll': { + 'sources': [src_dir / 'epollmplexer.cc'], + 'condition': have_linux, + }, + 'mplexer-bsd-kqueue': { + 'sources': [src_dir / 'kqueuemplexer.cc'], + 'condition': have_openbsd or have_freebsd, + }, + 'minicurl': { + 'sources': [ + src_dir / 'minicurl.cc', + src_dir / 'minicurl.hh', + ], + 'condition': dep_lua_records.found() or dep_libcurl.found(), + }, + 'lua-record': { + 'sources': [src_dir / 'lua-record.cc'], + 'condition': dep_lua_records.found(), + }, + 'signers-sodium': { + 'sources': [src_dir / 'sodiumsigners.cc'], + 'condition': dep_libsodium.found(), + }, + 'signers-decaf': { + 'sources': [src_dir / 'decafsigners.cc'], + 'condition': dep_libdecaf.found(), + }, + 'signers-pkcs11': { + 'sources': [ + src_dir / 'pkcs11signers.cc', + src_dir / 'pkcs11signers.hh', + ], + 'condition': dep_pkcs11.found(), + }, + 'standalone-fuzz-target-runner': { + 'sources': [src_dir / 'standalone_fuzz_target_runner.cc'], + 'condition': get_option('fuzz-targets'), + }, +} + +foreach name, info: conditional_sources + if info['condition'] + common_sources += files(info['sources']) + endif +endforeach + +# This needs to be link_whole'd because it's needed by auth backends. +libpdns_ssqlite3 = dependency('', required: false) +if dep_sqlite3.found() + libpdns_ssqlite3 = declare_dependency( + link_whole: static_library( + 'pdns-ssqlite3', + sources: files(src_dir / 'ssqlite3.cc', src_dir / 'ssqlite3.hh'), + dependencies: dep_sqlite3, + ) + ) +endif + +libpdns_gettime = static_library( + 'pdns-gettime', + src_dir / 'gettime.cc', + src_dir / 'gettime.hh', +) + +common_sources += files( + src_dir / 'arguments.cc', + src_dir / 'arguments.hh', + src_dir / 'auth-caches.cc', + src_dir / 'auth-caches.hh', + src_dir / 'auth-carbon.cc', + src_dir / 'auth-catalogzone.cc', + src_dir / 'auth-catalogzone.hh', + src_dir / 'auth-main.hh', + src_dir / 'auth-packetcache.cc', + src_dir / 'auth-packetcache.hh', + src_dir / 'auth-primarycommunicator.cc', + src_dir / 'auth-querycache.cc', + src_dir / 'auth-querycache.hh', + src_dir / 'auth-secondarycommunicator.cc', + src_dir / 'auth-zonecache.cc', + src_dir / 'auth-zonecache.hh', + src_dir / 'axfr-retriever.cc', + src_dir / 'axfr-retriever.hh', + src_dir / 'backends' / 'gsql' / 'gsqlbackend.cc', # TODO Move to a separate module. + src_dir / 'backends' / 'gsql' / 'gsqlbackend.hh', # TODO Move to a separate module. + src_dir / 'backends' / 'gsql' / 'ssql.hh', # TODO Move to a separate module. + src_dir / 'base32.cc', + src_dir / 'base32.hh', + src_dir / 'base64.cc', + src_dir / 'base64.hh', + src_dir / 'bindparserclasses.hh', + src_dir / 'burtle.hh', + src_dir / 'cachecleaner.hh', + src_dir / 'circular_buffer.hh', + src_dir / 'comment.hh', + src_dir / 'communicator.cc', + src_dir / 'communicator.hh', + src_dir / 'coverage.cc', + src_dir / 'coverage.hh', + src_dir / 'credentials.cc', + src_dir / 'credentials.hh', + src_dir / 'dbdnsseckeeper.cc', + src_dir / 'digests.hh', + src_dir / 'distributor.hh', + src_dir / 'dns.cc', + src_dir / 'dns.hh', + src_dir / 'dns_random.hh', + src_dir / 'dnsbackend.cc', + src_dir / 'dnsbackend.hh', + src_dir / 'dnsname.cc', + src_dir / 'dnsname.hh', + src_dir / 'dnspacket.cc', + src_dir / 'dnspacket.hh', + src_dir / 'dnsparser.cc', + src_dir / 'dnsparser.hh', + src_dir / 'dnsproxy.cc', + src_dir / 'dnsproxy.hh', + src_dir / 'dnsrecords.cc', + src_dir / 'dnsrecords.hh', + src_dir / 'dnssecinfra.cc', + src_dir / 'dnssecinfra.hh', + src_dir / 'dnsseckeeper.hh', + src_dir / 'dnssecsigner.cc', + src_dir / 'dnswriter.cc', + src_dir / 'dnswriter.hh', + src_dir / 'dynhandler.cc', + src_dir / 'dynhandler.hh', + src_dir / 'dynlistener.cc', + src_dir / 'dynlistener.hh', + src_dir / 'dynmessenger.cc', + src_dir / 'dynmessenger.hh', + src_dir / 'ednscookies.cc', + src_dir / 'ednscookies.hh', + src_dir / 'ednsoptions.cc', + src_dir / 'ednsoptions.hh', + src_dir / 'ednssubnet.cc', + src_dir / 'ednssubnet.hh', + src_dir / 'gss_context.cc', + src_dir / 'gss_context.hh', + src_dir / 'histogram.hh', + src_dir / 'ipcipher.cc', + src_dir / 'ipcipher.hh', + src_dir / 'iputils.cc', + src_dir / 'iputils.hh', + src_dir / 'ixfr.cc', + src_dir / 'ixfr.hh', + src_dir / 'json.cc', + src_dir / 'json.hh', + src_dir / 'lock.hh', + src_dir / 'logger.cc', + src_dir / 'logger.hh', + src_dir / 'logging.hh', + src_dir / 'lua-auth4.cc', + src_dir / 'lua-auth4.hh', + src_dir / 'lua-base4.cc', + src_dir / 'lua-base4.hh', + src_dir / 'misc.cc', + src_dir / 'misc.hh', + src_dir / 'nameserver.cc', + src_dir / 'nameserver.hh', + src_dir / 'namespaces.hh', + src_dir / 'noinitvector.hh', + src_dir / 'nsecrecords.cc', + src_dir / 'opensslsigners.cc', + src_dir / 'opensslsigners.hh', + src_dir / 'packetcache.hh', + src_dir / 'packethandler.cc', + src_dir / 'packethandler.hh', + src_dir / 'pdnsexception.hh', + src_dir / 'proxy-protocol.cc', + src_dir / 'proxy-protocol.hh', + src_dir / 'qtype.cc', + src_dir / 'qtype.hh', + src_dir / 'query-local-address.cc', + src_dir / 'query-local-address.hh', + src_dir / 'rcpgenerator.cc', + src_dir / 'rcpgenerator.hh', + src_dir / 'resolver.cc', + src_dir / 'resolver.hh', + src_dir / 'responsestats-auth.cc', + src_dir / 'responsestats.cc', + src_dir / 'responsestats.hh', + src_dir / 'rfc2136handler.cc', + src_dir / 'secpoll-auth.cc', + src_dir / 'secpoll-auth.hh', + src_dir / 'secpoll.cc', + src_dir / 'secpoll.hh', + src_dir / 'serialtweaker.cc', + src_dir / 'sha.hh', + src_dir / 'shuffle.cc', + src_dir / 'shuffle.hh', + src_dir / 'signingpipe.cc', + src_dir / 'signingpipe.hh', + src_dir / 'sillyrecords.cc', + src_dir / 'sstuff.hh', + src_dir / 'stat_t.hh', + src_dir / 'statbag.cc', + src_dir / 'statbag.hh', + src_dir / 'stubresolver.cc', + src_dir / 'stubresolver.hh', + src_dir / 'svc-records.cc', + src_dir / 'svc-records.hh', + src_dir / 'tcpreceiver.cc', + src_dir / 'tcpreceiver.hh', + src_dir / 'threadname.cc', + src_dir / 'threadname.hh', + src_dir / 'tkey.cc', + src_dir / 'trusted-notification-proxy.cc', + src_dir / 'trusted-notification-proxy.hh', + src_dir / 'tsigutils.cc', + src_dir / 'tsigutils.hh', + src_dir / 'tsigverifier.cc', + src_dir / 'tsigverifier.hh', + src_dir / 'ueberbackend.cc', + src_dir / 'ueberbackend.hh', + src_dir / 'unix_semaphore.cc', + src_dir / 'unix_utility.cc', + src_dir / 'utility.hh', + src_dir / 'uuid-utils.cc', + src_dir / 'uuid-utils.hh', + src_dir / 'validate.hh', + src_dir / 'version.cc', + src_dir / 'version.hh', + src_dir / 'webserver.cc', + src_dir / 'webserver.hh', + src_dir / 'ws-api.cc', + src_dir / 'ws-api.hh', + src_dir / 'ws-auth.cc', + src_dir / 'ws-auth.hh', + src_dir / 'zonemd.cc', + src_dir / 'zonemd.hh', + src_dir / 'zoneparser-tng.cc', + src_dir / 'zoneparser-tng.hh', +) deps = [ dep_pdns, @@ -145,14 +490,20 @@ deps = [ dep_boost_test, ] -subdir('pdns') +libpdns_bindparser = static_library( + 'pdns-bindparser', + libpdns_bindlexer_gen, + libpdns_bindparser_gen, + cpp_args: '-Wno-redundant-decls', + dependencies: deps, +) libpdns_cdb = dependency('', required: false) if dep_cdb.found() libpdns_cdb = declare_dependency( link_whole: static_library( 'libpdns-cdb', - sources: libpdns_cdb_sources, + sources: files(src_dir / 'cdb.cc', src_dir / 'cdb.hh'), dependencies: deps, ) ) @@ -165,6 +516,7 @@ all_modules = [ 'gmysql', 'godbc', 'gpgsql', + 'gsqlite3', 'ldap', 'lua2', 'remote', @@ -198,96 +550,196 @@ conf.set_quoted('PDNS_DYN_MODULES', ' '.join(selected_dyn_modules), description: # Generate config.h config_h = configure_file(configuration: conf, output: 'config.h') -libpdns_common = static_library( - 'pdns-common', - common_sources, - config_h, - link_with: static_library( - 'pdns-bindparser', - libpdns_bindlexer_sources, - libpdns_bindparser_sources, - cpp_args: '-Wno-redundant-decls', - dependencies: deps, - ), - dependencies: deps, -) +tools = { + 'pdns-auth' : { + 'main': src_dir / 'auth-main.cc', + 'export-dynamic': true, + 'deps-extra': [dep_modules, libpdns_ssqlite3], + 'link-whole-extra': [libpdns_gettime], + }, -pdns_auth = executable( - 'pdns-auth', - pdns_auth_sources, - config_h, - export_dynamic: true, - dependencies: deps + dep_modules, - link_with: libpdns_common, -) - -tools = ['pdns-auth-util', 'pdns-auth-control', 'pdns-zone2sql', 'pdns-zone2json'] + 'pdns-auth-util' : { + 'main': src_dir / 'pdnsutil.cc', + 'deps-extra': libpdns_ssqlite3, + }, + 'pdns-auth-control' : { 'main': src_dir / 'dynloader.cc' }, + 'pdns-zone2sql' : { 'main': src_dir / 'zone2sql.cc' }, + 'pdns-zone2json' : { 'main': src_dir / 'zone2json.cc' }, +} if get_option('module-ldap') != 'disabled' - tools += 'pdns-zone2ldap' + tools += { 'pdns-zone2ldap' : { 'main': src_dir / 'zone2ldap.cc' } } endif if get_option('tools') - tools += [ - 'calidns', - 'dnsdemog', - 'dnsgram', - 'dnspcap2calidns', - 'dnspcap2protobuf', - 'dnsreplay', - 'dnsscan', - 'dnsscope', - 'dnswasher', - 'dumresp', - 'ixplore', - 'kvresp', - 'nproxy', - 'nsec3dig', - 'pdns-auth-notify', - 'saxfr', - 'sdig', - 'stubquery', - ] + tools += { + 'pdns-auth-notify' : { 'main': src_dir / 'notify.cc' }, + 'sdig' : { 'main': src_dir / 'sdig.cc' }, + 'calidns' : { 'main': src_dir / 'calidns.cc' }, + 'dnsdemog' : { 'main': src_dir / 'dnsdemog.cc' }, + 'dnsgram' : { 'main': src_dir / 'dnsgram.cc' }, + 'dnspcap2calidns' : { 'main': src_dir / 'dnspcap2calidns.cc' }, + 'dnspcap2protobuf' : { + 'main': src_dir / 'dnspcap2protobuf.cc', + 'link-with-extra': libpdns_gettime, + }, + 'dnsreplay' : { 'main': src_dir / 'dnsreplay.cc' }, + 'dnsscan' : { 'main': src_dir / 'dnsscan.cc' }, + 'dnsscope' : { 'main': src_dir / 'dnsscope.cc' }, + 'dnswasher' : { 'main': src_dir / 'dnswasher.cc' }, + 'nproxy' : { 'main': src_dir / 'nproxy.cc' }, + 'nsec3dig' : { 'main': src_dir / 'nsec3dig.cc' }, + 'dumresp' : { 'main': src_dir / 'dumresp.cc' }, + 'kvresp' : { 'main': src_dir / 'kvresp.cc' }, + 'stubquery' : { 'main': src_dir / 'stubquery.cc' }, + 'saxfr' : { 'main': src_dir / 'saxfr.cc' }, + 'ixplore' : { 'main': src_dir / 'ixplore.cc' }, + # 'comfun' : { 'main': src_dir / 'comfun.cc' }, # Broken + } + + common_sources += files( + src_dir / 'anadns.hh', + src_dir / 'dnspcap.cc', + src_dir / 'dnspcap.hh', + src_dir / 'dolog.hh', + src_dir / 'ednsextendederror.cc', + src_dir / 'ednsextendederror.hh', + src_dir / 'histog.hh', + src_dir / 'ixfrutils.cc', + src_dir / 'ixfrutils.hh', + src_dir / 'libssl.cc', + src_dir / 'libssl.hh', + src_dir / 'mplexer.hh', + src_dir / 'pollmplexer.cc', + src_dir / 'protozero.cc', + src_dir / 'protozero.hh', + src_dir / 'statnode.cc', + src_dir / 'statnode.hh', + src_dir / 'tcpiohandler.cc', + src_dir / 'tcpiohandler.hh', + ) if have_boost_1_48_0 - tools += [ - 'dnsbulktest', - 'dnstcpbench', - ] + tools += { + 'dnstcpbench': { 'main': src_dir / 'dnstcpbench.cc' }, + 'dnsbulktest': { 'main': src_dir / 'dnsbulktest.cc' }, + } endif endif if get_option('tools-ixfrdist') - tools += ['ixfrdist'] + tools += { + 'ixfrdist': {'main': src_dir / 'ixfrdist.cc' }, + } + + common_sources += files( + src_dir / 'ixfrdist-stats.cc', + src_dir / 'ixfrdist-stats.hh', + src_dir / 'ixfrdist-web.cc', + src_dir / 'ixfrdist-web.hh', + src_dir / 'ixfrutils.cc', + src_dir / 'ixfrutils.hh', + src_dir / 'mplexer.hh', + src_dir / 'pollmplexer.cc', + ) endif if get_option('unit-tests') - # TODO: NOINSTALL speedtest and pdns-auth-testrunner - tools += ['tsig-tests', 'speedtest', 'pdns-auth-testrunner'] + tools += { + # TODO: NOINSTALL speedtest and pdns-auth-testrunner + 'pdns-auth-testrunner': { 'main': src_dir / 'testrunner.cc' }, + 'speedtest' : { 'main': src_dir / 'speedtest.cc' }, + 'tsig-tests' : { 'main': src_dir / 'tsig-tests.cc' }, + } + + common_sources += files( + src_dir / 'channel.cc', + src_dir / 'channel.hh', + src_dir / 'pollmplexer.cc', + src_dir / 'test-arguments_cc.cc', + src_dir / 'test-auth-zonecache_cc.cc', + src_dir / 'test-base32_cc.cc', + src_dir / 'test-base64_cc.cc', + src_dir / 'test-bindparser_cc.cc', + src_dir / 'test-channel.cc', + src_dir / 'test-common.hh', + src_dir / 'test-communicator_hh.cc', + src_dir / 'test-credentials_cc.cc', + src_dir / 'test-digests_hh.cc', + src_dir / 'test-distributor_hh.cc', + src_dir / 'test-dns_random_hh.cc', + src_dir / 'test-dnsname_cc.cc', + src_dir / 'test-dnsparser_cc.cc', + src_dir / 'test-dnsparser_hh.cc', + src_dir / 'test-dnsrecordcontent.cc', + src_dir / 'test-dnsrecords_cc.cc', + src_dir / 'test-dnswriter_cc.cc', + src_dir / 'test-ednscookie_cc.cc', + src_dir / 'test-ipcrypt_cc.cc', + src_dir / 'test-iputils_hh.cc', + src_dir / 'test-ixfr_cc.cc', + src_dir / 'test-lock_hh.cc', + src_dir / 'test-lua_auth4_cc.cc', + src_dir / 'test-luawrapper.cc', + src_dir / 'test-misc_hh.cc', + src_dir / 'test-mplexer.cc', + src_dir / 'test-nameserver_cc.cc', + src_dir / 'test-packetcache_cc.cc', + src_dir / 'test-packetcache_hh.cc', + src_dir / 'test-proxy_protocol_cc.cc', + src_dir / 'test-rcpgenerator_cc.cc', + src_dir / 'test-sha_hh.cc', + src_dir / 'test-signers.cc', + src_dir / 'test-statbag_cc.cc', + src_dir / 'test-svc_records_cc.cc', + src_dir / 'test-trusted-notification-proxy_cc.cc', + src_dir / 'test-tsig.cc', + src_dir / 'test-ueberbackend_cc.cc', + src_dir / 'test-webserver_cc.cc', + src_dir / 'test-zonemd_cc.cc', + src_dir / 'test-zoneparser_tng_cc.cc', + src_dir / 'zoneparser-tng.hh', + ) 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', - ] + tools += { + 'fuzz-target-moadnsparser' : { 'main': src_dir / 'fuzz_moadnsparser.cc' }, + 'fuzz-target-packetcache' : { 'main': src_dir / 'fuzz_packetcache.cc' }, + 'fuzz-target-proxyprotocol' : { 'main': src_dir / 'fuzz_proxyprotocol.cc' }, + 'fuzz-target-dnslabeltext-parseRFC1035CharString' : { 'main': src_dir / 'fuzz_dnslabeltext_parseRFC1035CharString.cc' }, + 'fuzz-target-yahttp' : { 'main': src_dir / 'fuzz_yahttp.cc' }, + 'fuzz-target-zoneparsertng' : { 'main': src_dir / 'fuzz_zoneparsertng.cc' }, + } endif -foreach tool: tools +libpdns_common = static_library( + 'pdns-common', + common_sources, + config_h, + dependencies: deps, + link_with: libpdns_bindparser, +) + +foreach tool, info: tools var_name = tool.underscorify() - sources_var = var_name + '_sources' + main = files(info['main']) + + export_dynamic = 'export-dynamic' in info ? info['export-dynamic'] : false + deps_extra = 'deps-extra' in info ? info['deps-extra'] : [] + link_with_extra = 'link-with-extra' in info ? info['link-with-extra'] : [] + link_whole_extra = 'link-whole-extra' in info ? info['link-whole-extra'] : [] + set_variable( var_name, executable( tool, - get_variable(sources_var), + main, config_h, - dependencies: deps, - link_with: libpdns_common, + export_dynamic: export_dynamic, + dependencies: deps + deps_extra, + link_with: [libpdns_common] + link_with_extra, + link_whole: link_whole_extra, ) ) endforeach diff --git a/modules/bindbackend/meson.build b/modules/bindbackend/meson.build index 26fb97788a..ad0576904e 100644 --- a/modules/bindbackend/meson.build +++ b/modules/bindbackend/meson.build @@ -18,6 +18,7 @@ lib = static_library( sources, dependencies: module_deps, extra_files: extras, + link_with: libpdns_bindparser, ) dep_name = 'dep_' + module_backend_name diff --git a/pdns/meson.build b/pdns/meson.build deleted file mode 100644 index b06080ba55..0000000000 --- a/pdns/meson.build +++ /dev/null @@ -1,494 +0,0 @@ -fs = import('fs') - -libpdns_cdb_sources = files('cdb.cc', 'cdb.hh') - -common_sources = [] - -libpdns_bindlexer_sources = 'bindlexer.c' -if not fs.is_file(libpdns_bindlexer_sources) - flex = find_program('flex', required: true) - - summary('Flex', flex.found(), bool_yn: true, section: 'BIND Parser') - summary('Flex Path', flex.full_path(), section: 'BIND Parser') - summary('Flex Version', flex.version(), section: 'BIND Parser') - - flex_generator = generator( - flex, - output: '@BASENAME@.c', - arguments: ['--case-insensitive', '--outfile=@OUTPUT@', '@INPUT@'], - ) - - libpdns_bindlexer_sources = flex_generator.process('bindlexer.l') -endif - -libpdns_bindparser_sources = 'bindparser.cc' -if not fs.is_file(libpdns_bindparser_sources) and not fs.is_file('bindparser.hh') - bison = find_program('bison', required: false) - if not bison.found() - bison = find_program('yacc', required: true) - endif - - summary('Bison/YACC', bison.found(), bool_yn: true, section: 'BIND Parser') - summary('Bison/YACC Path', bison.full_path(), section: 'BIND Parser') - summary('Bison/YACC Version', bison.version(), section: 'BIND Parser') - - bison_generator = generator( - bison, - output: ['@BASENAME@.cc', '@BASENAME@.hh', '@BASENAME@.output'], - arguments: ['-d', '--verbose', '--debug', '--output=@OUTPUT0@', '@INPUT@'], - ) - - libpdns_bindparser_sources = bison_generator.process('bindparser.yy') -endif - -libpdns_dnslabeltext_sources = 'dnslabeltext.cc' -if not fs.is_file(libpdns_dnslabeltext_sources) - ragel = find_program('ragel', required: true) - ragel_generator = generator( - ragel, - output: '@BASENAME@.cc', - arguments: ['@INPUT@', '-o', '@OUTPUT@'], - ) - - summary('Ragel', ragel.found(), bool_yn: ragel.found(), section: 'DNS Labels') - summary('Ragel Path', ragel.full_path(), section: 'DNS Labels') - summary('Ragel Version', ragel.version(), section: 'DNS Labels') - - libpdns_dnslabeltext_sources = ragel_generator.process('dnslabeltext.rl') -endif -common_sources += libpdns_dnslabeltext_sources - -libpdns_apidocfiles_headers = 'apidocfiles.h' -if not fs.is_file(libpdns_apidocfiles_headers) - 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_apidocfiles_headers = custom_target( - 'pdns-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, - ) -endif -common_sources += libpdns_apidocfiles_headers - -libpdns_bind_dnssec_schema_headers = 'bind-dnssec.schema.sqlite3.sql.h' -if not fs.is_file(libpdns_bind_dnssec_schema_headers) - 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_headers = 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, - ) -endif -common_sources += libpdns_bind_dnssec_schema_headers - -conditional_sources = { - 'mplexer-sunos-devpoll': { - 'sources': ['devpollmplexer.cc', 'portsmplexer.cc'], - 'condition': have_sunos, - }, - 'mplexer-linux-epoll': { - 'sources': ['epollmplexer.cc'], - 'condition': have_linux, - }, - 'mplexer-bsd-kqueue': { - 'sources': ['kqueuemplexer.cc'], - 'condition': have_openbsd or have_freebsd, - }, - 'ssqlite3': { - 'sources': ['ssqlite3.cc', 'ssqlite3.hh'], - 'condition': dep_sqlite3.found(), - }, - 'minicurl': { - 'sources': ['minicurl.cc', 'minicurl.hh'], - 'condition': dep_lua_records.found() or dep_libcurl.found(), - }, - 'lua-record': { - 'sources': ['lua-record.cc'], - 'condition': dep_lua_records.found(), - }, - 'signers-sodium': { - 'sources': ['sodiumsigners.cc'], - 'condition': dep_libsodium.found(), - }, - 'signers-decaf': { - 'sources': ['decafsigners.cc'], - 'condition': dep_libdecaf.found(), - }, - 'signers-pkcs11': { - 'sources': ['pkcs11signers.cc', 'pkcs11signers.hh'], - 'condition': dep_pkcs11.found(), - }, - 'standalone-fuzz-target-runner': { - 'sources': ['standalone_fuzz_target_runner.cc'], - 'condition': get_option('fuzz-targets'), - }, -} - -foreach name, info: conditional_sources - if info['condition'] - common_sources += files(info['sources']) - endif -endforeach - -common_sources += files( - '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-primarycommunicator.cc', - 'auth-querycache.cc', - 'auth-querycache.hh', - 'auth-secondarycommunicator.cc', - 'auth-zonecache.cc', - 'auth-zonecache.hh', - 'axfr-retriever.cc', - 'axfr-retriever.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', - 'base32.hh', - 'base64.cc', - 'base64.hh', - 'bindparserclasses.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', - 'dnsparser.hh', - 'dnsproxy.cc', - 'dnsproxy.hh', - 'dnsrecords.cc', - 'dnsrecords.hh', - 'dnssecinfra.cc', - 'dnssecinfra.hh', - 'dnsseckeeper.hh', - 'dnssecsigner.cc', - 'dnswriter.cc', - 'dnswriter.hh', - 'dynhandler.cc', - 'dynhandler.hh', - 'dynlistener.cc', - 'dynlistener.hh', - 'dynmessenger.cc', - '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', - 'ipcipher.cc', - 'ipcipher.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', - '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', - 'proxy-protocol.cc', - 'proxy-protocol.hh', - 'qtype.cc', - 'qtype.hh', - 'query-local-address.cc', - 'query-local-address.hh', - 'rcpgenerator.cc', - 'rcpgenerator.hh', - 'resolver.cc', - 'resolver.hh', - 'responsestats-auth.cc', - 'responsestats.cc', - 'responsestats.hh', - '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', - 'sstuff.hh', - 'stat_t.hh', - 'statbag.cc', - 'statbag.hh', - 'stubresolver.cc', - 'stubresolver.hh', - 'svc-records.cc', - 'svc-records.hh', - 'tcpreceiver.cc', - 'tcpreceiver.hh', - 'threadname.cc', - 'threadname.hh', - 'tkey.cc', - 'trusted-notification-proxy.cc', - 'trusted-notification-proxy.hh', - 'tsigutils.cc', - 'tsigutils.hh', - 'tsigverifier.cc', - 'tsigverifier.hh', - 'ueberbackend.cc', - 'ueberbackend.hh', - 'unix_semaphore.cc', - 'unix_utility.cc', - 'utility.hh', - 'uuid-utils.cc', - 'uuid-utils.hh', - 'validate.hh', - 'version.cc', - 'version.hh', - 'webserver.cc', - 'webserver.hh', - 'ws-api.cc', - 'ws-api.hh', - 'ws-auth.cc', - 'ws-auth.hh', - 'zonemd.cc', - 'zonemd.hh', - 'zoneparser-tng.cc', - 'zoneparser-tng.hh', -) - -tools = { - 'pdns-auth' : { 'main': 'auth-main.cc' }, - 'pdns-auth-util' : { 'main': 'pdnsutil.cc' }, - 'pdns-auth-control' : { 'main': 'dynloader.cc' }, - 'pdns-zone2sql' : { 'main': 'zone2sql.cc' }, - 'pdns-zone2json' : { 'main': 'zone2json.cc' }, -} - -if get_option('module-ldap') != 'disabled' - tools += { 'pdns-zone2ldap' : { 'main': 'zone2ldap.cc' } } -endif - -if get_option('tools') - tools += { - 'pdns-auth-notify' : { 'main': 'notify.cc' }, - - 'sdig' : {}, - 'calidns' : {}, - 'dnsdemog' : {}, - 'dnsgram' : {}, - 'dnspcap2calidns' : {}, - 'dnspcap2protobuf' : {}, - 'dnsreplay' : {}, - 'dnsscan' : {}, - 'dnsscope' : {}, - 'dnswasher' : {}, - 'nproxy' : {}, - 'nsec3dig' : {}, - 'dumresp' : {}, - 'kvresp' : {}, - 'stubquery' : {}, - 'saxfr' : {}, - 'ixplore' : {}, - # 'comfun' : {}, # Broken - } - - common_sources += files( - 'anadns.hh', - 'dnspcap.cc', - 'dnspcap.hh', - 'dolog.hh', - 'ednsextendederror.cc', - 'ednsextendederror.hh', - 'histog.hh', - 'ixfrutils.cc', - 'ixfrutils.hh', - 'libssl.cc', - 'libssl.hh', - 'mplexer.hh', - 'pollmplexer.cc', - 'protozero.cc', - 'protozero.hh', - 'statnode.cc', - 'statnode.hh', - 'tcpiohandler.cc', - 'tcpiohandler.hh', - ) - - if have_boost_1_48_0 - tools += { - 'dnstcpbench': {}, - 'dnsbulktest': {}, - } - endif -endif - -if get_option('tools-ixfrdist') - tools += { 'ixfrdist': {} } - - common_sources += files( - 'ixfrdist-stats.cc', - 'ixfrdist-stats.hh', - 'ixfrdist-web.cc', - 'ixfrdist-web.hh', - 'ixfrutils.cc', - 'ixfrutils.hh', - 'mplexer.hh', - 'pollmplexer.cc', - ) -endif - -if get_option('unit-tests') - tools += { - 'pdns-auth-testrunner': { 'main': 'testrunner.cc' }, - 'tsig-tests' : { 'main': 'tsig-tests.cc' }, - 'speedtest' : {}, - } - - common_sources += files( - 'channel.cc', - 'channel.hh', - 'pollmplexer.cc', - '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', - 'zoneparser-tng.hh', - ) -endif - -if get_option('fuzz-targets') - tools += { - 'fuzz-target-moadnsparser' : { 'main': 'fuzz_moadnsparser.cc' }, - 'fuzz-target-packetcache' : { 'main': 'fuzz_packetcache.cc' }, - 'fuzz-target-proxyprotocol' : { 'main': 'fuzz_proxyprotocol.cc' }, - 'fuzz-target-dnslabeltext-parseRFC1035CharString' : { 'main': 'fuzz_dnslabeltext_parseRFC1035CharString.cc' }, - 'fuzz-target-yahttp' : { 'main': 'fuzz_yahttp.cc' }, - 'fuzz-target-zoneparsertng' : { 'main': 'fuzz_zoneparsertng.cc' }, - } -endif - -foreach tool, info: tools - tool_name = tool.underscorify() - - if 'main' in info - main = info['main'] - else - main = tool_name + '.cc' - endif - - set_variable(tool_name + '_sources', files(main)) -endforeach