]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
build: fix when knot-dns headers are on non-standard location
authorVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 7 Oct 2021 11:58:01 +0000 (13:58 +0200)
committerTomas Krizek <tomas.krizek@nic.cz>
Mon, 11 Oct 2021 11:54:40 +0000 (13:54 +0200)
NEWS
daemon/lua/meson.build
modules/bogus_log/meson.build
modules/dnstap/meson.build
modules/edns_keepalive/meson.build
modules/hints/meson.build
modules/nsid/meson.build
modules/refuse_nord/meson.build
modules/stats/meson.build
tests/unit/meson.build

diff --git a/NEWS b/NEWS
index d1a080ea52860a8ec652245084a05c722d09fa57..e2b63fd9261d8e73d28818c81a2e99642279f4a7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Improvements
 Bugfixes
 --------
 - lua: log() output is visible with default log level again (!1208)
+- build: fix when knot-dns headers are on non-standard location (!1210)
 
 
 Knot Resolver 5.4.1 (2021-08-19)
index 476d107ea25eba3d541fefe0e92aede001626f98..e8fc3be468c4e8e94c38a4eaac89db082f35e31d 100644 (file)
@@ -59,24 +59,32 @@ run_target(  # run manually to re-generate kres-gen.lua
 # but this basic sanity check could be ran always, except for cross compilation,
 # as we *run* luajit to find out the real sizes.
 if get_option('kres_gen_test') and not meson.is_cross_build()
-  types_to_check = {
-    'time_t' : '#include <sys/time.h>',
-    'struct timeval' : '#include <sys/time.h>',
-    'zs_scanner_t' : '#include <libzscanner/scanner.h>',
-    'knot_pkt_t' : '#include <libknot/packet/pkt.h>',
-  }
+  types_to_check = [
+    { 'tname': 'time_t', 'incl': '#include <sys/time.h>' },
+    { 'tname': 'struct timeval', 'incl' : '#include <sys/time.h>' },
+    { 'tname': 'zs_scanner_t', 'incl': '#include <libzscanner/scanner.h>', 'dep': libzscanner },
+    { 'tname': 'knot_pkt_t', 'incl' : '#include <libknot/packet/pkt.h>', 'dep': libknot },
+  ]
   # Construct the lua tester as a meson string.
   kres_gen_test_luastr = '''
     dofile('@0@')
     local ffi = require('ffi')
   '''.format(meson.current_source_dir() / kres_gen_fname)
-  foreach tname, tinclude: types_to_check
+  foreach ttc: types_to_check
+    # We're careful with adding just includes; otherwise it's more fragile (e.g. linking flags).
+    if 'dep' in ttc
+      dep = ttc.get('dep').partial_dependency(includes: true, compile_args: true)
+    else
+      dep = []
+    endif
+    tsize = meson.get_compiler('c').sizeof(ttc.get('tname'), prefix: ttc.get('incl'),
+                                           dependencies: dep)
     kres_gen_test_luastr += '''
       assert(ffi.sizeof(ffi.typeof('@0@')) == @1@,
         'Lua binding for C type ' .. '@0@' .. ' has incorrect size: '
         .. ffi.sizeof(ffi.typeof('@0@'))
       )
-    '''.format(tname, meson.get_compiler('c').sizeof(tname, prefix : tinclude))
+    '''.format(ttc.get('tname'), tsize)
   endforeach
   # Now feed it directly into luajit.
   kres_gen_test = run_command(find_program('luajit'), '-e', kres_gen_test_luastr)
index 44ff07461afbac3a67638aa91bc9ff88a6408c6b..2dcf87f46dd30116881857b376afab468d5c8b3e 100644 (file)
@@ -9,6 +9,7 @@ c_src_lint += bogus_log_src
 bogus_log_mod = shared_module(
   'bogus_log',
   bogus_log_src,
+  dependencies: libknot,
   include_directories: mod_inc_dir,
   name_prefix: '',
   install: true,
index 7bf73b7c89e6ee0defbea6269ccd567727d3ff51..e8a94bf116bb29e17a35a19cc44b440fa51aa8bc 100644 (file)
@@ -47,6 +47,7 @@ if build_dnstap
       declare_dependency(sources: dnstap_pb),
       libfstrm,
       libprotobuf_c,
+      libknot,
     ],
     include_directories: mod_inc_dir,
     name_prefix: '',
index 50d6f2f5f5af4fba166646a94141d8090d5a3408..979452ff134d0630b65072cc37c3a7554d99cb73 100644 (file)
@@ -9,6 +9,7 @@ c_src_lint += edns_keepalive_src
 edns_keepalive_mod = shared_module(
   'edns_keepalive',
   edns_keepalive_src,
+  dependencies: libknot,
   include_directories: mod_inc_dir,
   name_prefix: '',
   install: true,
index 3085d8901efed85630b66ca3a34a824a5f7a5d20..0a0945cf5b7041e45cef299f6e0d4ba4c14583c1 100644 (file)
@@ -10,6 +10,7 @@ hints_mod = shared_module(
   'hints',
   hints_src,
   dependencies: [
+    libknot,
     luajit_inc,
   ],
   include_directories: mod_inc_dir,
index 00570c141af413591c2cbe326deb48fc076e8e11..b0fcd9e24fd1a0172f9f01b2da6324690f84f1d0 100644 (file)
@@ -10,6 +10,7 @@ nsid_mod = shared_module(
   'nsid',
   nsid_src,
   dependencies: [
+    libknot,
     luajit_inc,
   ],
   include_directories: mod_inc_dir,
index fcc4e838bf037ebd329708ff51015376e2cab14d..1bcdbd72c302440c18112078c03b1e6b6f61b121 100644 (file)
@@ -13,6 +13,7 @@ c_src_lint += refuse_nord_src
 refuse_nord_mod = shared_module(
   'refuse_nord',
   refuse_nord_src,
+  dependencies: libknot,
   include_directories: mod_inc_dir,
   name_prefix: '',
   install: true,
index 68dd4111c60f81054471a32076dc03749f265c9f..4f2d41e8fd9a38c4fbc6f209177b1382357dee70 100644 (file)
@@ -15,6 +15,7 @@ stats_mod = shared_module(
   'stats',
   stats_src,
   dependencies: [
+    libknot,
     luajit_inc,
   ],
   include_directories: mod_inc_dir,
index a65317b309addf7b7008c608b2d432a464aa565e..a133e618031d26232a356669f5f0248779de2bbd 100644 (file)
@@ -10,6 +10,7 @@ mock_cmodule_mod = shared_module(
   'mock_cmodule',
   mock_cmodule_src,
   name_prefix: '',
+  dependencies: libknot,
   include_directories: include_directories('../../'),
 )
 
@@ -21,6 +22,7 @@ foreach unit_test : unit_tests
     dependencies: [
       contrib_dep,
       libkres_dep,
+      libknot,
       cmocka,
       lmdb,
     ],