diff options
-rw-r--r-- | README.meson.md | 37 | ||||
-rw-r--r-- | meson.build | 47 | ||||
-rw-r--r-- | meson.options | 1 |
3 files changed, 83 insertions, 2 deletions
diff --git a/README.meson.md b/README.meson.md new file mode 100644 index 000000000..fc639385c --- /dev/null +++ b/README.meson.md | |||
@@ -0,0 +1,37 @@ | |||
1 | # Meson build system | ||
2 | |||
3 | DISCLAIMER: This is a work in progress. The meson build system will be maintained for a brief period alongside autotools. | ||
4 | |||
5 | ## Motivation | ||
6 | |||
7 | - We want to build a single, monolithic library libgnunet that is easier to use in, for example, mobile apps. | ||
8 | - Autotools is complex and difficult to use. It also causes stale builds. Meson has a better developer experience. | ||
9 | - Meson supports dynamic pkg-config generation. | ||
10 | - Meson does out-of-tree builds | ||
11 | - Meson makes it (almost) impossible to create dist tarballs that miss files/do not compile. | ||
12 | |||
13 | |||
14 | ## Reasons to drop it again | ||
15 | |||
16 | - Meson does not seem to support (automatic) dependency version detection without pkg-config. | ||
17 | |||
18 | |||
19 | ## TODOs | ||
20 | |||
21 | - Migrate tests | ||
22 | - Portability defines set implicitly in configure.ac need to be identified and ported to meson. | ||
23 | - Some (experimental) subsystems not yet ported. | ||
24 | - 1:1 match of installed files must be verified. | ||
25 | - Documentation must be updated. | ||
26 | |||
27 | ## Use | ||
28 | |||
29 | |||
30 | ``` | ||
31 | $ meson setup $builddir | ||
32 | $ cd $builddir | ||
33 | $ meson configure -Dprefix=$string -Dexperimental=$bool -Dmonolith=$bool | ||
34 | $ meson compile | ||
35 | $ meson install | ||
36 | $ meson dist | ||
37 | ``` | ||
diff --git a/meson.build b/meson.build index 17ce5cea1..c60a5c610 100644 --- a/meson.build +++ b/meson.build | |||
@@ -28,6 +28,21 @@ cdata.set('enable_experimental', get_option('experimental')) | |||
28 | if get_option('experimental') | 28 | if get_option('experimental') |
29 | add_project_arguments('-DHAVE_EXPERIMENTAL', language: 'c') | 29 | add_project_arguments('-DHAVE_EXPERIMENTAL', language: 'c') |
30 | endif | 30 | endif |
31 | logging_opt = get_option('logging') | ||
32 | if get_option('logging') == 'yes' | ||
33 | add_project_arguments('-DGNUNET_EXTRA_LOGGING=0', language: 'c') | ||
34 | endif | ||
35 | if get_option('logging') == 'yes' | ||
36 | add_project_arguments('-DGNUNET_EXTRA_LOGGING=0', language: 'c') | ||
37 | add_project_arguments('-DGNUNET_CULL_LOGGING=1', language: 'c') | ||
38 | endif | ||
39 | if get_option('logging') == 'verbose' | ||
40 | add_project_arguments('-DGNUNET_EXTRA_LOGGING=1', language: 'c') | ||
41 | endif | ||
42 | if get_option('logging') == 'veryverbose' | ||
43 | add_project_arguments('-DGNUNET_EXTRA_LOGGING=2', language: 'c') | ||
44 | endif | ||
45 | |||
31 | 46 | ||
32 | # FIXME | 47 | # FIXME |
33 | cdata.set('extractor', 0) | 48 | cdata.set('extractor', 0) |
@@ -40,8 +55,9 @@ endif | |||
40 | if cc.has_member ('struct sockaddr_un', 'sun_len', prefix : ['#include <sys/types.h>', '#include <sys/socket.h>', '#include <sys/un.h>']) | 55 | if cc.has_member ('struct sockaddr_un', 'sun_len', prefix : ['#include <sys/types.h>', '#include <sys/socket.h>', '#include <sys/un.h>']) |
41 | add_project_arguments('-DHAVE_SOCKADDR_UN_SUN_LEN', language: 'c') | 56 | add_project_arguments('-DHAVE_SOCKADDR_UN_SUN_LEN', language: 'c') |
42 | endif | 57 | endif |
43 | 58 | if cc.has_member ('struct tm', 'tm_gmtoff', prefix : ['#include <time.h>']) | |
44 | message('Building on ' + host_machine.system()) | 59 | add_project_arguments('-DHAVE_TM_GMTOFF', language: 'c') |
60 | endif | ||
45 | 61 | ||
46 | # TODO: | 62 | # TODO: |
47 | # - Go through configure.ac and convert all defines/detections | 63 | # - Go through configure.ac and convert all defines/detections |
@@ -78,11 +94,13 @@ cdata.set('START_ON_DEMAND', 'YES') | |||
78 | 94 | ||
79 | cdata.set_quoted('build_target', host_machine.system()) | 95 | cdata.set_quoted('build_target', host_machine.system()) |
80 | if host_machine.system() == 'linux' | 96 | if host_machine.system() == 'linux' |
97 | add_project_arguments('-DLINUX', language : 'c') | ||
81 | add_project_link_arguments(['-Wl,--unresolved-symbols=report-all'], language : 'c') | 98 | add_project_link_arguments(['-Wl,--unresolved-symbols=report-all'], language : 'c') |
82 | cdata.set_quoted('GNUNET_DEFAULT_INTERFACE', 'eth0') | 99 | cdata.set_quoted('GNUNET_DEFAULT_INTERFACE', 'eth0') |
83 | endif | 100 | endif |
84 | if host_machine.system() == 'darwin' | 101 | if host_machine.system() == 'darwin' |
85 | cdata.set_quoted('GNUNET_DEFAULT_INTERFACE', 'en0') | 102 | cdata.set_quoted('GNUNET_DEFAULT_INTERFACE', 'en0') |
103 | add_project_arguments('-DDARWIN', language : 'c') | ||
86 | add_project_arguments('-D_APPLE_C_SOURCE', language : 'c') | 104 | add_project_arguments('-D_APPLE_C_SOURCE', language : 'c') |
87 | add_project_arguments('-D__APPLE_USE_RFC_3542', language : 'c') | 105 | add_project_arguments('-D__APPLE_USE_RFC_3542', language : 'c') |
88 | add_project_arguments('-fno-common', language : 'c') | 106 | add_project_arguments('-fno-common', language : 'c') |
@@ -261,6 +279,31 @@ if cc.check_header('sys/param.h') | |||
261 | add_project_arguments('-DHAVE_SYS_PARAM_H', language : 'c') | 279 | add_project_arguments('-DHAVE_SYS_PARAM_H', language : 'c') |
262 | endif | 280 | endif |
263 | 281 | ||
282 | # TUN | ||
283 | if cc.check_header('if_tun.h') | ||
284 | if cc.has_header_symbol('if_tun.h', 'struct in6_ifreq') | ||
285 | add_project_arguments('-DIF_TUN_HDR="if_tun.h"', language : 'c') | ||
286 | endif | ||
287 | endif | ||
288 | if cc.check_header('linux/if_tun.h') | ||
289 | if cc.has_header_symbol('linux/if_tun.h', 'struct in6_ifreq') | ||
290 | add_project_arguments('-DIF_TUN_HDR="linux/if_tun.h"', language : 'c') | ||
291 | endif | ||
292 | endif | ||
293 | if cc.check_header('net/if_tun.h') | ||
294 | if cc.has_header_symbol('net/if_tun.h', 'struct in6_ifreq') | ||
295 | add_project_arguments('-DIF_TUN_HDR="net/if_tun.h"', language : 'c') | ||
296 | endif | ||
297 | endif | ||
298 | if cc.check_header('net/tun/if_tun.h') | ||
299 | if cc.has_header_symbol('net/tun/if_tun.h', 'struct in6_ifreq') | ||
300 | add_project_arguments('-DIF_TUN_HDR="net/tun/if_tun.h"', language : 'c') | ||
301 | endif | ||
302 | endif | ||
303 | |||
304 | |||
305 | |||
306 | |||
264 | # NSS | 307 | # NSS |
265 | if cc.check_header('nss.h') | 308 | if cc.check_header('nss.h') |
266 | add_project_arguments('-DHAVE_GLIBCNSS', language : 'c') | 309 | add_project_arguments('-DHAVE_GLIBCNSS', language : 'c') |
diff --git a/meson.options b/meson.options index 0fc435ec5..0d5b7e325 100644 --- a/meson.options +++ b/meson.options | |||
@@ -1,4 +1,5 @@ | |||
1 | # Build options | 1 | # Build options |
2 | option('monolith', type : 'boolean', value : false, description: 'Build a single, monolithic libgnunet shlib') | 2 | option('monolith', type : 'boolean', value : false, description: 'Build a single, monolithic libgnunet shlib') |
3 | option('experimental', type : 'boolean', value : false, description: 'Build experimental components') | 3 | option('experimental', type : 'boolean', value : false, description: 'Build experimental components') |
4 | option('logging', type : 'string', value: 'yes', description: 'Log setting. Can be set to "yes" (logging, default), "no" (no logging), "verbose" (extra loggin"), veryverbose (even more logging)') | ||
4 | 5 | ||