gnunet

Main GNUnet Logic
Log | Files | Refs | Submodules | README | LICENSE

commit 3199037e97f0a773626e7621d17fc596de216dce
parent 83a608c546f6751d0847c5b9965c9813cbd96522
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date:   Sun, 24 Sep 2023 08:10:08 +0200

BUILD: Meson - add readme, add build options

Diffstat:
AREADME.meson.md | 37+++++++++++++++++++++++++++++++++++++
Mmeson.build | 47+++++++++++++++++++++++++++++++++++++++++++++--
Mmeson.options | 1+
3 files changed, 83 insertions(+), 2 deletions(-)

diff --git a/README.meson.md b/README.meson.md @@ -0,0 +1,37 @@ +# Meson build system + +DISCLAIMER: This is a work in progress. The meson build system will be maintained for a brief period alongside autotools. + +## Motivation + + - We want to build a single, monolithic library libgnunet that is easier to use in, for example, mobile apps. + - Autotools is complex and difficult to use. It also causes stale builds. Meson has a better developer experience. + - Meson supports dynamic pkg-config generation. + - Meson does out-of-tree builds + - Meson makes it (almost) impossible to create dist tarballs that miss files/do not compile. + + +## Reasons to drop it again + + - Meson does not seem to support (automatic) dependency version detection without pkg-config. + + +## TODOs + + - Migrate tests + - Portability defines set implicitly in configure.ac need to be identified and ported to meson. + - Some (experimental) subsystems not yet ported. + - 1:1 match of installed files must be verified. + - Documentation must be updated. + +## Use + + +``` +$ meson setup $builddir +$ cd $builddir +$ meson configure -Dprefix=$string -Dexperimental=$bool -Dmonolith=$bool +$ meson compile +$ meson install +$ meson dist +``` diff --git a/meson.build b/meson.build @@ -28,6 +28,21 @@ cdata.set('enable_experimental', get_option('experimental')) if get_option('experimental') add_project_arguments('-DHAVE_EXPERIMENTAL', language: 'c') endif +logging_opt = get_option('logging') +if get_option('logging') == 'yes' + add_project_arguments('-DGNUNET_EXTRA_LOGGING=0', language: 'c') +endif +if get_option('logging') == 'yes' + add_project_arguments('-DGNUNET_EXTRA_LOGGING=0', language: 'c') + add_project_arguments('-DGNUNET_CULL_LOGGING=1', language: 'c') +endif +if get_option('logging') == 'verbose' + add_project_arguments('-DGNUNET_EXTRA_LOGGING=1', language: 'c') +endif +if get_option('logging') == 'veryverbose' + add_project_arguments('-DGNUNET_EXTRA_LOGGING=2', language: 'c') +endif + # FIXME cdata.set('extractor', 0) @@ -40,8 +55,9 @@ endif if cc.has_member ('struct sockaddr_un', 'sun_len', prefix : ['#include <sys/types.h>', '#include <sys/socket.h>', '#include <sys/un.h>']) add_project_arguments('-DHAVE_SOCKADDR_UN_SUN_LEN', language: 'c') endif - -message('Building on ' + host_machine.system()) +if cc.has_member ('struct tm', 'tm_gmtoff', prefix : ['#include <time.h>']) + add_project_arguments('-DHAVE_TM_GMTOFF', language: 'c') +endif # TODO: # - Go through configure.ac and convert all defines/detections @@ -78,11 +94,13 @@ cdata.set('START_ON_DEMAND', 'YES') cdata.set_quoted('build_target', host_machine.system()) if host_machine.system() == 'linux' + add_project_arguments('-DLINUX', language : 'c') add_project_link_arguments(['-Wl,--unresolved-symbols=report-all'], language : 'c') cdata.set_quoted('GNUNET_DEFAULT_INTERFACE', 'eth0') endif if host_machine.system() == 'darwin' cdata.set_quoted('GNUNET_DEFAULT_INTERFACE', 'en0') + add_project_arguments('-DDARWIN', language : 'c') add_project_arguments('-D_APPLE_C_SOURCE', language : 'c') add_project_arguments('-D__APPLE_USE_RFC_3542', language : 'c') add_project_arguments('-fno-common', language : 'c') @@ -261,6 +279,31 @@ if cc.check_header('sys/param.h') add_project_arguments('-DHAVE_SYS_PARAM_H', language : 'c') endif +# TUN +if cc.check_header('if_tun.h') + if cc.has_header_symbol('if_tun.h', 'struct in6_ifreq') + add_project_arguments('-DIF_TUN_HDR="if_tun.h"', language : 'c') + endif +endif +if cc.check_header('linux/if_tun.h') + if cc.has_header_symbol('linux/if_tun.h', 'struct in6_ifreq') + add_project_arguments('-DIF_TUN_HDR="linux/if_tun.h"', language : 'c') + endif +endif +if cc.check_header('net/if_tun.h') + if cc.has_header_symbol('net/if_tun.h', 'struct in6_ifreq') + add_project_arguments('-DIF_TUN_HDR="net/if_tun.h"', language : 'c') + endif +endif +if cc.check_header('net/tun/if_tun.h') + if cc.has_header_symbol('net/tun/if_tun.h', 'struct in6_ifreq') + add_project_arguments('-DIF_TUN_HDR="net/tun/if_tun.h"', language : 'c') + endif +endif + + + + # NSS if cc.check_header('nss.h') add_project_arguments('-DHAVE_GLIBCNSS', language : 'c') diff --git a/meson.options b/meson.options @@ -1,4 +1,5 @@ # Build options option('monolith', type : 'boolean', value : false, description: 'Build a single, monolithic libgnunet shlib') option('experimental', type : 'boolean', value : false, description: 'Build experimental components') +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)')