]>
Commit | Line | Data |
---|---|---|
5c68e442 FM |
1 | project( |
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 |
14 | summary('Source Dir', meson.current_source_dir(), section: 'Build') |
15 | summary('Build Dir', meson.current_build_dir(), section: 'Build') | |
16 | ||
0cb50745 FM |
17 | # Setup some modules |
18 | fs = import('fs') | |
19 | ||
762296f8 | 20 | # Create the configuration object and dependencies list. |
5c68e442 | 21 | conf = configuration_data() |
e79e8538 | 22 | deps = [] |
e79e8538 | 23 | |
762296f8 FM |
24 | subdir('meson/compiler-setup') # Common compiler setup (cxx is the C++ compiler) |
25 | subdir('meson/summary') # Print a system/project summary | |
26 | subdir('meson/timet-size') # Check the size of time_t | |
27 | subdir('meson/timet-sign') # Check the sign of time_t | |
28 | subdir('meson/flex-bison') # Find flex and bison | |
29 | subdir('meson/platform') # Platform detection | |
30 | subdir('meson/atomics') # Check atomics support | |
31 | subdir('meson/pthread-headers') # Check pthread headers | |
32 | subdir('meson/pthread-setname') # Pthread setname madness | |
33 | subdir('meson/strerror') # Strerror_r | |
34 | subdir('meson/lua') # Lua | |
35 | subdir('meson/hardening') # Hardening | |
36 | subdir('meson/kiss-rng') # Unsafe KISS RNG | |
37 | subdir('meson/net-libs') # Network Libraries | |
38 | subdir('meson/tm-gmtoff') # Check for the tm_gmtoff field in struct tm | |
39 | subdir('meson/mmap') # Check for mmap | |
40 | subdir('meson/libsodium') # Libsodium-based signers | |
41 | subdir('meson/libdecaf') # Libdecaf-based signers | |
42 | subdir('meson/libcrypto') # OpenSSL-based signers | |
938ccd43 | 43 | subdir('meson/libssl') # OpenSSL libssl |
ad588272 | 44 | subdir('meson/gnutls') # GnuTLS |
520e7564 | 45 | subdir('meson/dot') # DNS over TLS |
3ab2b4fa | 46 | subdir('meson/ipcipher') # IPCipher |
0cb50745 | 47 | subdir('meson/ragel') # Find Ragel |
7453397d | 48 | subdir('meson/clock-gettime') # Clock_gettime |
9e63b827 | 49 | subdir('meson/boost') # Boost |
b9b35b00 | 50 | subdir('meson/unit-tests') # Unit Tests |
4a8d6e23 | 51 | subdir('meson/reproducible') # Reproducible Builds |
938fae07 | 52 | subdir('meson/fuzz-targets') # Fuzzing Targets |
96a13200 | 53 | subdir('meson/python-venv') # Python Venv |
11dcbf21 | 54 | subdir('meson/from-git') # From Git |
a98cd1bf | 55 | subdir('meson/dlopen') # dlopen |
ba7748ad | 56 | subdir('meson/verbose-logging') # Verbose Logging |
6b6581ea | 57 | subdir('meson/pkcs11') # PKCS11 |
8aa864cb | 58 | subdir('meson/gss-tsig') # GSS-TSIG |
0cb50745 | 59 | |
3904de9f FM |
60 | # Find or generate pdns/dnslabeltext.cc |
61 | if 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') | |
64 | endif | |
65 | ||
66 | # Boost Program Options library | |
67 | dep_boost_program_options = dependency('boost', modules: ['program_options'], required: true) | |
b7c65f82 FM |
68 | deps += dep_boost_program_options |
69 | summary('Program Options', dep_boost_program_options.found(), bool_yn: true, section: 'Boost') | |
3904de9f FM |
70 | |
71 | # Backend Unit Tests | |
72 | opt_backend_unittests = get_option('backend-unit-tests') | |
73 | dep_boost_test = dependency('boost', modules: ['unit_test_framework'], required: opt_backend_unittests) | |
b7c65f82 FM |
74 | deps += dep_boost_test |
75 | conf.set10('BACKEND_UNIT_TESTS', opt_backend_unittests, description: 'Whether backend unit tests are enabled') | |
76 | if not opt_unittests | |
77 | summary('Test', dep_boost_test.found(), bool_yn: true, section: 'Boost') | |
78 | endif | |
3904de9f | 79 | |
879c7a6f FM |
80 | # Swagger |
81 | if 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.') | |
85 | endif | |
86 | # TODO Generate api-swagger.json | |
87 | ||
007f8b5e FM |
88 | # Manpages |
89 | if 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.') | |
93 | endif | |
94 | # TODO Generate pdns_server.1 manpage | |
95 | ||
81fd95b2 FM |
96 | # Various Functions |
97 | funcs = [ | |
98 | 'strcasestr', | |
99 | 'localtime_r', | |
100 | 'gmtime_r', | |
101 | 'recvmmsg', | |
102 | 'sched_setscheduler', | |
103 | 'getrandom', | |
104 | 'arc4random', | |
105 | ] | |
106 | foreach 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') | |
111 | endforeach | |
112 | ||
ab8ff2d1 FM |
113 | # Socket Dir |
114 | opt_socket_dir = get_option('socket-dir') | |
115 | ||
7e83417e FM |
116 | # Modules |
117 | all_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 | ] |
126 | selected_modules = [] | |
127 | foreach 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 |
145 | endforeach | |
146 | conf.set_quoted('PDNS_MODULES', ' '.join(selected_modules), description: 'Built-in modules') | |
147 | ||
5c68e442 FM |
148 | # Generate config.h ---------------------------------------------------------------------- |
149 | config_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 |
153 | auth = 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, ...) |