]> git.ipfire.org Git - thirdparty/pdns.git/blame - meson.build
Meson: Auth tinyDNS backend
[thirdparty/pdns.git] / meson.build
CommitLineData
5c68e442
FM
1project(
2 'pdns',
3 ['c', 'cpp'],
762296f8
FM
4 # version: 4.7.0, # TODO This should call builder-support/gen-version
5 # license_files: 'LICENse', # TODO Meson 1.1.0
5c68e442
FM
6 meson_version: '>= 0.53',
7 default_options: [
8 'buildtype=debugoptimized',
762296f8 9 'warning_level=2', # TODO Move this to 3 at some point to enable -Wpedantic
5c68e442
FM
10 'cpp_std=c++17',
11 ],
12)
13
9c9daf0d
FM
14summary('Source Dir', meson.current_source_dir(), section: 'Build')
15summary('Build Dir', meson.current_build_dir(), section: 'Build')
16
0cb50745
FM
17# Setup some modules
18fs = import('fs')
19
762296f8 20# Create the configuration object and dependencies list.
5c68e442 21conf = configuration_data()
e79e8538 22deps = []
e79e8538 23
762296f8
FM
24subdir('meson/compiler-setup') # Common compiler setup (cxx is the C++ compiler)
25subdir('meson/summary') # Print a system/project summary
26subdir('meson/timet-size') # Check the size of time_t
27subdir('meson/timet-sign') # Check the sign of time_t
28subdir('meson/flex-bison') # Find flex and bison
29subdir('meson/platform') # Platform detection
30subdir('meson/atomics') # Check atomics support
31subdir('meson/pthread-headers') # Check pthread headers
32subdir('meson/pthread-setname') # Pthread setname madness
33subdir('meson/strerror') # Strerror_r
34subdir('meson/lua') # Lua
35subdir('meson/hardening') # Hardening
36subdir('meson/kiss-rng') # Unsafe KISS RNG
37subdir('meson/net-libs') # Network Libraries
38subdir('meson/tm-gmtoff') # Check for the tm_gmtoff field in struct tm
39subdir('meson/mmap') # Check for mmap
40subdir('meson/libsodium') # Libsodium-based signers
41subdir('meson/libdecaf') # Libdecaf-based signers
42subdir('meson/libcrypto') # OpenSSL-based signers
938ccd43 43subdir('meson/libssl') # OpenSSL libssl
ad588272 44subdir('meson/gnutls') # GnuTLS
520e7564 45subdir('meson/dot') # DNS over TLS
3ab2b4fa 46subdir('meson/ipcipher') # IPCipher
0cb50745 47subdir('meson/ragel') # Find Ragel
7453397d 48subdir('meson/clock-gettime') # Clock_gettime
9e63b827 49subdir('meson/boost') # Boost
b9b35b00 50subdir('meson/unit-tests') # Unit Tests
4a8d6e23 51subdir('meson/reproducible') # Reproducible Builds
938fae07 52subdir('meson/fuzz-targets') # Fuzzing Targets
96a13200 53subdir('meson/python-venv') # Python Venv
11dcbf21 54subdir('meson/from-git') # From Git
a98cd1bf 55subdir('meson/dlopen') # dlopen
ba7748ad 56subdir('meson/verbose-logging') # Verbose Logging
6b6581ea 57subdir('meson/pkcs11') # PKCS11
8aa864cb 58subdir('meson/gss-tsig') # GSS-TSIG
0cb50745 59
3904de9f
FM
60# Find or generate pdns/dnslabeltext.cc
61if not ragel.found() and not fs.exists('pdns/dnslabeltext.cc')
62 error('Ragel is missing and `pdns/dnslabeltext.cc` cannot be found. ' +
63 'Install Ragel or download the sources from www.powerdns.com')
64endif
65
66# Boost Program Options library
67dep_boost_program_options = dependency('boost', modules: ['program_options'], required: true)
b7c65f82
FM
68deps += dep_boost_program_options
69summary('Program Options', dep_boost_program_options.found(), bool_yn: true, section: 'Boost')
3904de9f
FM
70
71# Backend Unit Tests
72opt_backend_unittests = get_option('backend-unit-tests')
73dep_boost_test = dependency('boost', modules: ['unit_test_framework'], required: opt_backend_unittests)
b7c65f82
FM
74deps += dep_boost_test
75conf.set10('BACKEND_UNIT_TESTS', opt_backend_unittests, description: 'Whether backend unit tests are enabled')
76if not opt_unittests
77 summary('Test', dep_boost_test.found(), bool_yn: true, section: 'Boost')
78endif
3904de9f 79
879c7a6f
FM
80# Swagger
81if not fs.exists('pdns/api-swagger.json') and not python_have_venv
82 error('Python3 and/or its venv module is not available and ' +
83 '`pdns/api-swagger.json` cannot be found. ' +
84 'The Authoritative Server cannot be built.')
85endif
86# TODO Generate api-swagger.json
87
007f8b5e
FM
88# Manpages
89if not fs.exists('docs/pdns_server.1') and not python_have_venv
90 warning('Python3 and/or its venv module is not available and ' +
91 '`docs/pdns_server.1` cannot be found. ' +
92 'Documentation will not be built.')
93endif
94# TODO Generate pdns_server.1 manpage
95
81fd95b2
FM
96# Various Functions
97funcs = [
98 'strcasestr',
99 'localtime_r',
100 'gmtime_r',
101 'recvmmsg',
102 'sched_setscheduler',
103 'getrandom',
104 'arc4random',
105]
106foreach func: funcs
107 found = cxx.has_function(func)
108 define = 'HAVE_' + func.to_upper()
109 conf.set10(define, found, description: 'Whether we have ' + func)
110 # summary(func, found, bool_yn: true, section: 'Various Functions')
111endforeach
112
ab8ff2d1
FM
113# Socket Dir
114opt_socket_dir = get_option('socket-dir')
115
7e83417e
FM
116# Modules
117all_modules = [
118 ['gmysql', 'mysql'],
119 ['godbc', 'odbc'],
120 ['gpgsql', 'pgsql'],
121 ['gsqlite3', 'sqlite3'],
3f84c878 122 ['ldap', 'ldap'],
45964631 123 ['remote', 'curl'],
d9682113 124 ['tinydns', 'cdb'],
7e83417e
FM
125]
126selected_modules = []
127foreach module: all_modules
128 name = module[0]
129 dep = module[1]
130 opt = get_option('module-' + name)
131 opt_dyn = get_option('module-' + name + '-dyn')
132
133 if opt or opt_dyn
7e83417e
FM
134 if opt
135 selected_modules += name
136 endif
45964631
FM
137
138 if name == 'remote' and not opt_unittests
139 continue # We only need cURL for unit tests.
140 endif
141
142 subdir('meson' / dep)
143 # TODO Also build the actual backend.
7e83417e
FM
144 endif
145endforeach
146conf.set_quoted('PDNS_MODULES', ' '.join(selected_modules), description: 'Built-in modules')
147
5c68e442
FM
148# Generate config.h ----------------------------------------------------------------------
149config_h = configure_file(configuration: conf, output: 'config.h')
762296f8 150# summary('Defines', conf.keys(), section: 'Build Configuration') # TODO Meson 0.57
5c68e442 151
762296f8 152# TODO: Add source files
5c68e442
FM
153auth = executable('pdns', config_h, dependencies: deps, export_dynamic: true)
154
762296f8
FM
155# TODO Generate bindlexer.c and bindparser.cc.
156# bindlexer_c = generator(flex, ...)
157# bindparser_cc = generator(bison, ...)