From: Tomas Krizek Date: Fri, 25 Jan 2019 10:57:37 +0000 (+0100) Subject: meson: use build options for client/daemon builds X-Git-Tag: v4.0.0~24^2~242 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7eb6590331746872d5a13f3ef50bda09dae53e35;p=thirdparty%2Fknot-resolver.git meson: use build options for client/daemon builds --- diff --git a/client/meson.build b/client/meson.build index 5a6d848e4..c9068fede 100644 --- a/client/meson.build +++ b/client/meson.build @@ -2,25 +2,17 @@ kresc_src = [ 'kresc.c', ] +if get_option('client') -# client dependencies -skip_client = false - -libedit = dependency('libedit', required: false) -if not libedit.found() - # TODO why call find_library? osx workaround? - libedit = meson.get_compiler('c').find_library('edit', required: false) + # client dependencies + libedit = dependency('libedit', required: false) if not libedit.found() - skip_client = true - message('kresc client: libedit not found') + # TODO why call find_library? osx workaround? + libedit = meson.get_compiler('c').find_library('edit') endif -endif -# build -if skip_client - warning('kresc client: skipping build') -else + # build kresc = executable( 'kresc', kresc_src, diff --git a/daemon/lua/meson.build b/daemon/lua/meson.build index 19beee952..5256c7e03 100644 --- a/daemon/lua/meson.build +++ b/daemon/lua/meson.build @@ -5,15 +5,24 @@ lua_modules_daemon = [ 'zonefile', ] -embed_lua = generator( - find_program('../../scripts/embed-lua.sh'), - arguments: ['@INPUT@'], - output: '@BASENAME@.inc', - capture: true, -) -kresd_lua = embed_lua.process( - 'sandbox.lua', - 'config.lua', - preserve_path_from: meson.source_root(), -) +if get_option('daemon') + # dependencies for embedding lua + xxd = find_program('xxd', required: false) + if not xxd.found() + hexdump = find_program('hexdump') + endif + + embed_lua = generator( + find_program('../../scripts/embed-lua.sh'), + arguments: ['@INPUT@'], + output: '@BASENAME@.inc', + capture: true, + ) + + kresd_lua = embed_lua.process( + 'sandbox.lua', + 'config.lua', + preserve_path_from: meson.source_root(), + ) +endif diff --git a/daemon/meson.build b/daemon/meson.build index c58c5c865..37db785b5 100644 --- a/daemon/meson.build +++ b/daemon/meson.build @@ -14,6 +14,9 @@ kresd_sources = [ ] +subdir('lua') + + lib_suffix = '.so' # TODO seek&destroy LIBEXT if host_machine.system() == 'darwin' @@ -42,41 +45,18 @@ if host_machine.system() == 'darwin' endif -# daemon dependencies -skip_daemon = false +if get_option('daemon') + # daemon dependencies + luajit = dependency('luajit') -luajit = dependency('luajit', required: false) -if not luajit.found() - skip_daemon = true - message('kresd daemon: luajit not found') -endif - -xxd = find_program('xxd', required: false) -if not xxd.found() - hexdump = find_program('hexdump', required: false) - if not hexdump.found() - skip_daemon = true - message('kresd daemon: neither xxd nor hexdump found') + # optional dependencies + ## systemd socket activation + libsystemd = dependency('libsystemd', version: '>=227', required: false) + if libsystemd.found() + c_args += ['-DHAS_SYSTEMD'] endif -endif - - -# optional dependencies - -## systemd socket activation -libsystemd = dependency('libsystemd', version: '>=227', required: false) -if libsystemd.found() - c_args += ['-DHAS_SYSTEMD'] -endif - - -subdir('lua') - -# build -if skip_daemon - warning('kresd daemon: skipping build') -else + # build kresd = executable( 'kresd', kresd_sources, kresd_lua, diff --git a/meson.build b/meson.build index 963944445..204b72678 100644 --- a/meson.build +++ b/meson.build @@ -122,18 +122,18 @@ subdir('daemon') # name_prefix: '', #) -library( - 'stats', - ['modules/stats/stats.c'], - dependencies: [ - contrib_dep, - libkres_dep, - luajit, - ], - install: true, - install_dir: modules_dir, - name_prefix: '', -) +#library( +# 'stats', +# ['modules/stats/stats.c'], +# dependencies: [ +# contrib_dep, +# libkres_dep, +# luajit, +# ], +# install: true, +# install_dir: modules_dir, +# name_prefix: '', +#) # TODO: dnstap diff --git a/meson_options.txt b/meson_options.txt index 533900b54..750fdeac2 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1 +1,3 @@ option('cookies', type: 'boolean', value: false, description: 'Support for DNS Cookies.') +option('client', type : 'boolean', value : true, description: 'kresc client binary') +option('daemon', type: 'boolean', value: true, description: 'kresd daemon binary')