Skip to content
Snippets Groups Projects
Verified Commit 3d70003e authored by Tomas Krizek's avatar Tomas Krizek
Browse files

meson: cleanup

parent e36aa67d
Branches
Tags
1 merge request!771meson build system
Showing
with 132 additions and 89 deletions
......@@ -2,26 +2,23 @@ kresc_src = [
'kresc.c',
]
if get_option('client')
# client dependencies
libedit = dependency('libedit', required: false)
if not libedit.found()
# TODO why call find_library? osx workaround?
libedit = meson.get_compiler('c').find_library('edit')
endif
# client dependencies
libedit = dependency('libedit', required: false)
if not libedit.found()
# TODO why call find_library? osx workaround?
libedit = meson.get_compiler('c').find_library('edit')
endif
# build
kresc = executable(
'kresc',
kresc_src,
dependencies: [
contrib_dep,
libkres_dep,
libedit,
],
install: true,
install_dir: get_option('sbindir'),
)
endif
# build
kresc = executable(
'kresc',
kresc_src,
dependencies: [
contrib_dep,
libkres_dep,
libedit,
],
install: true,
install_dir: get_option('sbindir'),
)
# contrib
contrib_src = [
'ccan/asprintf/asprintf.c',
'ccan/ilog/ilog.c',
......@@ -15,7 +17,7 @@ contrib_lib = static_library(
'contrib',
contrib_src,
include_directories: contrib_inc,
dependencies: libknot, # errcode.h
dependencies: libknot,
)
contrib_dep = declare_dependency(
......
lua_src_daemon = [
'kres.lua',
'kres-gen.lua',
# daemon: lua modules + embed
lua_src += [
files('kres.lua'),
files('kres-gen.lua'),
# trust_anchors.lua.in handled separately
'zonefile.lua',
files('zonefile.lua'),
]
config_tests += [
['ta_bootstrap', files('trust_anchors.test/bootstrap.test.lua')],
]
# install lua modules
foreach mod : lua_src_daemon
install_data(
mod,
install_dir: modules_dir,
)
endforeach
# trust_anchors lua module
configure_file(
input: 'trust_anchors.lua.in',
output: 'trust_anchors.lua',
......
# daemon
kresd_src = [
'bindings.c',
'engine.c',
......@@ -13,12 +15,10 @@ kresd_src = [
'zimport.c',
]
config_tests += [
['cache.clear', files('cache.test/clear.test.lua')],
]
subdir('lua')
......@@ -35,7 +35,7 @@ luajit_has_setfuncs = run_command(
# daemon CFLAGS
c_args = [
'-fPIE', # TODO pie=true since 0.49.0
'-fPIE', # NOTE this triggers warning, but is needed for compatibility with meson 0.47.0
'-DROOTHINTS="@0@/root.hints"'.format(config.get('etc_dir')),
'-DLIBEXT="@0@"'.format(lib_suffix),
'-Dlibzscanner_SONAME="@0@"'.format(libzscanner.get_pkgconfig_variable('soname')),
......@@ -43,13 +43,8 @@ c_args = [
'-DLUA_HAS_SETFUNCS=@0@'.format(luajit_has_setfuncs),
]
# TODO are these LDFLAGS needed?
#link_args = [
# '-ldl',
# '-lm',
#]
# TODO test build on osx
if host_machine.system() == 'darwin'
# luajit workaround for OS X https://luajit.org/install.html#embed
c_args += ['-pagezero_size', '10000', '-image_base', '100000000']
......@@ -57,8 +52,7 @@ endif
if get_option('daemon')
# optional dependencies
## systemd socket activation
# optional systemd socket activation
libsystemd = dependency('libsystemd', version: '>=227', required: false)
if libsystemd.found()
c_args += ['-DHAS_SYSTEMD']
......@@ -85,7 +79,6 @@ if get_option('daemon')
install_dir: get_option('sbindir'),
)
kresd_install_path = join_paths(
kresd_install_path = join_paths( # path used in tests
get_option('prefix'), get_option('sbindir'))
message(kresd_install_path)
endif
if get_option('doc')
# documentation
if get_option('doc') # doxygen + html docs
# doc dependencies
doxygen = find_program('doxygen')
sphinx_build = find_program('sphinx-build')
......
# etc
example_configs = [
'config.cluster',
'config.docker',
......
# libkres
libkres_src = [
'cache/api.c',
'cache/cdb_lmdb.c',
......
......@@ -3,7 +3,7 @@ project(
['c', 'cpp'],
license: 'GPLv3+',
version: '3.2.1', # TODO dev version from git
default_options: ['c_std=c99'], # TODO why not c11?
default_options: ['c_std=c99'],
meson_version: '>=0.47.0',
)
......@@ -20,11 +20,9 @@ gnutls = dependency('gnutls')
luajit = dependency('luajit')
# Optional dependencies
## coverage
lcov = find_program('lcov', required: false)
luacov = find_program('luacov', required: false)
# TODO coverage
#lcov = find_program('lcov', required: false)
#luacov = find_program('luacov', required: false)
# Variables
......@@ -37,7 +35,6 @@ if get_option('modules_dir') == ''
else
modules_dir = get_option('modules_dir')
endif
message('modules_dir: ' + modules_dir)
data_dir = join_paths(get_option('prefix'), get_option('datadir'), 'knot-resolver')
doc_dir = join_paths(get_option('prefix'), get_option('datadir'), 'doc', 'knot-resolver')
......@@ -63,6 +60,10 @@ add_global_arguments(
language: 'c',
)
# List of lua modules to be installed to modules_dir
lua_src = [
# files(module.lua)
]
# List of tests
# These lists are added to from subdir() and finally used in tests/*
......@@ -81,19 +82,28 @@ integr_tests = [
]
# NOTE order of subdir includes is significant
# compile
subdir('contrib')
subdir('lib')
subdir('client')
subdir('daemon')
subdir('modules')
if get_option('client')
subdir('client')
endif
# tests
subdir('tests')
# documentation, install, tests
# documentation, examples
# TODO install man
subdir('doc')
subdir('etc')
# TODO message summary?
message('modules_dir: ' + modules_dir)
message(kresd_install_path)
# C module: bogus_log
bogus_log_src = [
'bogus_log.c',
]
......
# LUA module: daf
lua_src += [
files('daf.lua'),
]
# install daf.js
install_data(
'daf.js',
......
# C module: dnstap
dnstap_src = [
'dnstap.c',
]
......
# C module: edns_keepalive
edns_keepalive_src = [
'edns_keepalive.c',
]
......
# C module: hints
hints_src = [
'hints.c',
]
......
# LUA module: http
lua_src += [
files('http.lua'),
files('http_trace.lua'),
files('prometheus.lua'),
]
config_tests += [
['http', files('http.test.lua')],
['http.tls', files('test_tls/tls.test.lua')],
]
......
lua_src = [
'daf/daf.lua',
'detect_time_jump/detect_time_jump.lua',
'detect_time_skew/detect_time_skew.lua',
'dns64/dns64.lua',
'etcd/etcd.lua',
'experimental_dot_auth/experimental_dot_auth.lua',
'experimental_dot_auth/basexx.lua',
'graphite/graphite.lua',
'http/http.lua',
'http/http_trace.lua',
'http/prometheus.lua',
'policy/policy.lua',
'predict/predict.lua',
'prefill/prefill.lua',
'priming/priming.lua',
'rebinding/rebinding.lua',
'renumber/renumber.lua',
'serve_stale/serve_stale.lua',
'ta_sentinel/ta_sentinel.lua',
'ta_signal_query/ta_signal_query.lua',
'view/view.lua',
'workarounds/workarounds.lua',
# modules
lua_src += [ # add lua modules without separate meson.build
files('detect_time_jump/detect_time_jump.lua'),
files('detect_time_skew/detect_time_skew.lua'),
files('dns64/dns64.lua'),
files('etcd/etcd.lua'),
files('experimental_dot_auth/experimental_dot_auth.lua'),
files('experimental_dot_auth/basexx.lua'),
files('graphite/graphite.lua'),
files('predict/predict.lua'),
files('prefill/prefill.lua'),
files('priming/priming.lua'),
files('rebinding/rebinding.lua'),
files('renumber/renumber.lua'),
files('serve_stale/serve_stale.lua'),
files('ta_sentinel/ta_sentinel.lua'),
files('ta_signal_query/ta_signal_query.lua'),
files('workarounds/workarounds.lua'),
]
config_tests += [
['predict', files('predict/predict.test.lua')],
['http', files('http/http.test.lua')], # TODO organize
['http.tls', files('http/test_tls/tls.test.lua')],
['policy', files('policy/policy.test.lua')],
['hints', files('hints/tests/hints.test.lua')],
['nsid', files('nsid/nsid.test.lua')],
['dns64', files('dns64/dns64.test.lua')],
]
# TODO cleanup modules (lua_src)
# handle more complex C/LUA modules separately
subdir('bogus_log')
# cookies module is not currently used
subdir('daf')
......
# C module: nsid
nsid_src = [
'nsid.c',
]
......
# lua-aho-corasick build
# LUA module: policy
lua_src += [
files('policy.lua'),
]
config_tests += [
['policy', files('policy.test.lua')],
]
integr_tests += [
['policy.noipv6', join_paths(meson.current_source_dir(), 'noipv6.test.integr')],
['policy.noipvx', join_paths(meson.current_source_dir(), 'noipvx.test.integr')],
]
# compile bundled lua-aho-corasick lib
lua_ac_src = [
'lua-aho-corasick/ac_fast.cxx',
'lua-aho-corasick/ac_lua.cxx',
......@@ -19,8 +35,3 @@ lua_ac_lib = library(
install: true,
install_dir: modules_dir,
)
integr_tests += [
['policy.noipv6', join_paths(meson.current_source_dir(), 'noipv6.test.integr')],
['policy.noipvx', join_paths(meson.current_source_dir(), 'noipvx.test.integr')],
]
# C module: stats
stats_src = [
'stats.c',
]
......
# LUA module: view
lua_src += [
files('view.lua'),
]
integr_tests += [
['view.tsig', join_paths(meson.current_source_dir(), 'tsig.test.integr')],
['view.addr', join_paths(meson.current_source_dir(), 'addr.test.integr')],
......
# tests: integration (using deckard)
# deckard dependencies
cmake = find_program('cmake') # for libswrapper
git = find_program('git')
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment