]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
meson: organize dependencies
authorTomas Krizek <tomas.krizek@nic.cz>
Tue, 5 Feb 2019 17:04:46 +0000 (18:04 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Tue, 12 Mar 2019 09:43:22 +0000 (10:43 +0100)
client/meson.build
daemon/lua/meson.build
daemon/meson.build
doc/meson.build
meson.build
modules/dnstap/meson.build
tests/meson.build
tests/unit/meson.build

index e236282513a8337474437634b1a7bb43453f961e..bc5b42843b2e65afbe367b8b00c41e79edc795af 100644 (file)
@@ -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
index a2b2c56e461cd74b7bbd3f94ddf430671dfde459..59ce082495d46aff0fae8fd30de04631b3ecdb99 100644 (file)
@@ -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,
index 52850d24b5767af65cadbed09b7a05a36903292d..46b6dae1abad3adb77458ff6dedb1850db69c827 100644 (file)
@@ -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',
index e6b8d5cd1bfbbed5bcf0c0a7b343c13b6061dfb5..1267ac83b00aa2c757d6282544d71c7f0328e7a1 100644 (file)
@@ -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(
index 29bea2d667ff391657551d6dffefbb02b82de6b3..ccac5e41b9d173258cca9a2d1ffdc05e5e526e65 100644 (file)
@@ -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 = [
index 78c459f244cbfcb5c7361608aebf0a14bef5dc28..2db216c355993bd4bddf8ae6a392c9f008978c4f 100644 (file)
@@ -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',
index 41035d3b20e85b9c40ef7853e79affa4ff584c33..a04b54fb8196ee03cae6c664fc96f87f42654d61 100644 (file)
@@ -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
index 609d2dac1d75ddad1aca9e44d00785330d0d7b8c..f7c2a3b6eb7f203bf456e3d011dfc2ad4183aa93 100644 (file)
@@ -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