summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Heidelberg <david@ixit.cz>2017-07-16 23:52:54 +0200
committerDavid Heidelberg <david@ixit.cz>2017-07-18 21:25:12 +0200
commitc45d376cf4b28a5967067f58750159f74bfadda9 (patch)
tree5e836267953dd44a4648a50dc593da56dc7f0550
parent89bb617847f1942aa4b34f527ef87421b99f1d5b (diff)
downloadiputils-meson.tar.gz
meson: add experimental meson buildsystem supportmeson
Usage: meson builddir/ cd builddir ninja Signed-off-by: David Heidelberg <david@ixit.cz>
-rw-r--r--builddir/.placeholder0
-rw-r--r--meson.build70
-rw-r--r--meson_options.txt15
3 files changed, 85 insertions, 0 deletions
diff --git a/builddir/.placeholder b/builddir/.placeholder
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/builddir/.placeholder
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..a8a9f49
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,70 @@
+project('iputils', 'c',
+ version : '20170717') # version hardcoded
+
+global_cflags = ['-D_GNU_SOURCE', '-O3', '-g', '-fno-strict-aliasing', '-Wstrict-prototypes', '-Wall']
+add_project_arguments(global_cflags, language: 'c')
+
+message('meson build is EXPERIMENTAL, please DO NOT USE for production!\n')
+
+cc = meson.get_compiler('c')
+m_dep = cc.find_library('m')
+resolv_dep = cc.find_library('resolv')
+rt_dep = cc.find_library('rt')
+
+opt = get_option('USE_CAP')
+if opt == true
+ cap_dep = cc.find_library('cap')
+ add_project_arguments('-DCAPABILITIES', language : 'c')
+else
+ cap_dep = []
+endif
+
+opt = get_option('USE_IDN')
+if opt == '1'
+ idn_dep = cc.find_library('idn')
+ add_project_arguments('-DUSE_IDN', language : 'c')
+elif opt == '2'
+ idn_dep = cc.find_library('idn2', required : false)
+ message('libidn2 is unsupported at this moment.\n')
+ idn_dep = []
+else
+ idn_dep = []
+endif
+
+opt = get_option('USE_CRYPTO')
+if opt == 'nettle'
+ crypto_dep = dependency('nettle')
+ add_project_arguments('-DUSE_NETTLE', language : 'c')
+elif opt == 'gcrypt'
+ crypto_dep = cc.find_library('gcrypt')
+ add_project_arguments('-DUSE_GCRYPT', language : 'c')
+elif opt == 'openssl'
+ crypto_dep = dependency('openssl')
+ add_project_arguments('-DUSE_OPENSSL', language : 'c')
+elif opt == 'none'
+ crypto_dep = []
+endif
+
+ping_src = ['ping.c', 'ping_common.c', 'ping6_common.c']
+p = executable('ping', ping_src,
+ dependencies : [m_dep, cap_dep, idn_dep, crypto_dep, resolv_dep])
+
+executable('tracepath', 'tracepath.c',
+ dependencies : idn_dep)
+
+executable('traceroute6', 'traceroute6.c',
+ dependencies : [cap_dep, idn_dep])
+
+executable('clockdiff', 'clockdiff.c',
+ dependencies : [cap_dep])
+
+executable('rdisc', 'rdisc.c')
+
+executable('arping', 'arping.c',
+ dependencies : [rt_dep, cap_dep, idn_dep])
+
+executable('tftpd', ['tftpd.c', 'tftpsubs.c'])
+
+executable('rarpd', 'rarpd.c')
+
+#test('ping to 127.0.0.1', p, args : ['-p 1', '127.0.0.1'])
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..daee6b6
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,15 @@
+option('USE_CAP', type : 'boolean', value : true,
+ description : 'Capatiblity support (with libcap)')
+option('USE_IDN', type : 'combo', choices : ['0', '1', '2'], value : '1',
+ description : 'IDN support')
+option('USE_CRYPTO', type : 'combo', choices : ['none', 'nettle', 'gcrypt','openssl'], value : 'nettle',
+ description: 'Crypto library support for ping 6. You can choose between none, Nettle, GCrypt or openssl/libressl')
+
+#option('ARPING_DEFAULT_DEVICE', type : 'string', value : '',
+# description : 'default device for arping')
+
+#option('someoption', type : 'string', value : 'optval', description : 'An option')
+#option('other_one', type : 'boolean', value : false)
+#option('combo_opt', type : 'combo', choices : ['one', 'two', 'three'], value : 'three')
+
+