From: Tomas Krizek Date: Tue, 5 Feb 2019 17:04:46 +0000 (+0100) Subject: meson: organize dependencies X-Git-Tag: v4.0.0~24^2~179 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3e0abb45f0210e8b94af95474f2d0400d0ee8381;p=thirdparty%2Fknot-resolver.git meson: organize dependencies --- diff --git a/client/meson.build b/client/meson.build index e23628251..bc5b42843 100644 --- a/client/meson.build +++ b/client/meson.build @@ -1,13 +1,16 @@ +# client + kresc_src = [ 'kresc.c', ] -# client dependencies +message('--- kresc 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 +message('--------------------------') # build diff --git a/daemon/lua/meson.build b/daemon/lua/meson.build index a2b2c56e4..59ce08249 100644 --- a/daemon/lua/meson.build +++ b/daemon/lua/meson.build @@ -23,14 +23,16 @@ configure_file( # embed lua to daemon if get_option('daemon') - # dependencies + message('--- required kresd dependencies ---') xxd = find_program('xxd', required: false) if not xxd.found() hexdump = find_program('hexdump') endif + embed_lua = find_program('../../scripts/embed-lua.sh') + message('--------------------------------------') embed_lua = generator( - find_program('../../scripts/embed-lua.sh'), + embed_lua, arguments: ['@INPUT@'], output: '@BASENAME@.inc', capture: true, diff --git a/daemon/meson.build b/daemon/meson.build index 52850d24b..46b6dae1a 100644 --- a/daemon/meson.build +++ b/daemon/meson.build @@ -19,8 +19,6 @@ config_tests += [ ['cache.clear', files('cache.test/clear.test.lua')], ] -subdir('lua') - lib_suffix = '.so' # TODO seek&destroy LIBEXT @@ -32,7 +30,6 @@ luajit_has_setfuncs = run_command( 'pkg-config', ['luajit', '--atleast-version', '2.1.0-beta3'] ).returncode() == 0 ? '1' : '0' - # daemon CFLAGS c_args = [ '-fPIE', # NOTE this triggers warning, but is needed for compatibility with meson 0.47.0 @@ -43,7 +40,6 @@ c_args = [ '-DLUA_HAS_SETFUNCS=@0@'.format(luajit_has_setfuncs), ] - # TODO test build on osx if host_machine.system() == 'darwin' # luajit workaround for OS X https://luajit.org/install.html#embed @@ -51,13 +47,20 @@ if host_machine.system() == 'darwin' endif -if get_option('daemon') - # optional systemd socket activation - libsystemd = dependency('libsystemd', version: '>=227', required: false) - if libsystemd.found() - c_args += ['-DHAS_SYSTEMD'] - endif +# optional systemd socket activation +message('--- optional kresd dependencies ---') +libsystemd = dependency('libsystemd', version: '>=227', required: false) +if libsystemd.found() + c_args += ['-DHAS_SYSTEMD'] + config.set('man_seealso_systemd', '\fIkresd.systemd(7)\fR,') +endif +message('-----------------------------------') + +subdir('lua') + + +if get_option('daemon') # build kresd = executable( 'kresd', diff --git a/doc/meson.build b/doc/meson.build index e6b8d5cd1..1267ac83b 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -1,7 +1,7 @@ # documentation if get_option('doc') # doxygen + html docs - # doc dependencies + message('--- doc dependencies ---') doxygen = find_program('doxygen') sphinx_build = find_program('sphinx-build') @@ -13,6 +13,7 @@ if get_option('doc') # doxygen + html docs error('missing doc dependency: python breathe') endif endif + message('------------------------') # create doxygen in source dir doc_doxyxml = custom_target( diff --git a/meson.build b/meson.build index 29bea2d66..ccac5e41b 100644 --- a/meson.build +++ b/meson.build @@ -8,8 +8,7 @@ project( ) -# Project-wide dependencies - +message('--- required dependencies ---') knot_version = '>=2.7.6' libknot = dependency('libknot', version: knot_version) libdnssec = dependency('libdnssec', version: knot_version) @@ -18,6 +17,7 @@ libuv = dependency('libuv', version: '>=1.7') lmdb = dependency('lmdb') gnutls = dependency('gnutls') luajit = dependency('luajit') +message('------------------------------') # TODO coverage @@ -65,7 +65,7 @@ lua_src = [ # files(module.lua) ] -# List of tests +# Lists of tests # These lists are added to from subdir() and finally used in tests/* unit_tests = [ diff --git a/modules/dnstap/meson.build b/modules/dnstap/meson.build index 78c459f24..2db216c35 100644 --- a/modules/dnstap/meson.build +++ b/modules/dnstap/meson.build @@ -5,15 +5,15 @@ dnstap_src = [ ] ## dnstap dependencies +message('--- dnstap module dependencies ---') libprotobuf_c = dependency('libprotobuf-c', version: '>=1', required: false) libfstrm = dependency('libfstrm', version: '>=0.2', required: false) protoc_c = find_program('protoc-c', required: false) +message('----------------------------------') # build dnstap if deps are found -if not libprotobuf_c.found() or not libfstrm.found() or not protoc_c.found() - message('dnstap module: skipping build') -else +if libprotobuf_c.found() and libfstrm.found() and protoc_c.found() # generate protobuf-c sources using protoc-c dnstap_pb = custom_target( 'dnstap_pb', diff --git a/tests/meson.build b/tests/meson.build index 41035d3b2..a04b54fb8 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,7 +1,16 @@ +# tests + +message('--- unit test dependencies ---') +cmocka = dependency('cmocka', required: false) +if cmocka.found() + subdir('unit') +endif +message('------------------------------') + subdir('config') -subdir('unit') if get_option('extra_tests') + message('--- extra_tests dependencies ---') python3 = find_program('python3') py3_deps = [] @@ -14,5 +23,6 @@ if get_option('extra_tests') error('missing python3 dependency: @0@'.format(py3_dep[1])) endif endforeach + message('--------------------------------') endif diff --git a/tests/unit/meson.build b/tests/unit/meson.build index 609d2dac1..f7c2a3b6e 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -1,42 +1,36 @@ # tests: unit -# dependency -cmocka = dependency('cmocka', required: false) +# mock module for test_module +mock_cmodule_src = [ + 'mock_cmodule.c', +] -if cmocka.found() +mock_cmodule_lib = library( + 'mock_cmodule', + mock_cmodule_src, + name_prefix: '', + dependencies: libkres_dep, +) - # mock module for test_module - mock_cmodule_src = [ - 'mock_cmodule.c', - ] +mock_cmodule_dep = declare_dependency( + link_with: mock_cmodule_lib, +) - mock_cmodule_lib = library( - 'mock_cmodule', - mock_cmodule_src, - name_prefix: '', - dependencies: libkres_dep, +# executables with tests +foreach unit_test : unit_tests + exec_test = executable( + unit_test[0], + unit_test[1], + dependencies: [ + contrib_dep, + libkres_dep, + cmocka, + lmdb, + ], ) - - mock_cmodule_dep = declare_dependency( - link_with: mock_cmodule_lib, + test( + 'unit.' + unit_test[0], + exec_test, + suite: 'unit', ) - - # executables with tests - foreach unit_test : unit_tests - exec_test = executable( - 'unit.' + unit_test[0], - unit_test[1], - dependencies: [ - contrib_dep, - libkres_dep, - cmocka, - lmdb, - ], - ) - test( - unit_test[0], - exec_test, - suite: 'unit', - ) - endforeach -endif +endforeach