2 version: run_command('./src/git_tag.sh', check: true).stdout().strip(),
3 license: 'GPL-2.0-or-later',
4 meson_version: '>=0.51',
8 'buildtype=debugoptimized',
12 dir_run_state = get_option('runstatedir')
13 opt_crypto = get_option('crypto')
14 opt_curses = get_option('curses')
15 opt_docs = get_option('docs')
16 opt_harden = get_option('hardening')
17 opt_jumbograms = get_option('jumbograms')
18 opt_lz4 = get_option('lz4')
19 opt_lzo = get_option('lzo')
20 opt_miniupnpc = get_option('miniupnpc')
21 opt_readline = get_option('readline')
22 opt_static = get_option('static')
23 opt_systemd = get_option('systemd')
24 opt_tests = get_option('tests')
25 opt_tunemu = get_option('tunemu')
26 opt_uml = get_option('uml')
27 opt_vde = get_option('vde')
28 opt_zlib = get_option('zlib')
30 meson_version = meson.version()
32 cc = meson.get_compiler('c')
33 os_name = host_machine.system()
36 cc_defs = ['-D_GNU_SOURCE']
38 cc_defs += '-D__EXTENSIONS__'
45 static = os_name == 'windows'
47 static = opt_static.enabled()
56 '-D_FORTIFY_SOURCE=2',
58 '-fno-strict-overflow',
60 '-Wold-style-definition',
61 '-Wmissing-declarations',
62 '-Wmissing-prototypes',
63 '-Wstrict-prototypes',
65 '-Wbad-function-cast',
67 '-fdiagnostics-show-option',
72 cc_flags += '-Qunused-arguments'
74 ld_flags += ['-Wl,-z,relro', '-Wl,-z,now']
75 if os_name == 'windows'
76 ld_flags += ['-Wl,--dynamicbase', '-Wl,--nxcompat']
80 cc_flags = cc.get_supported_arguments(cc_flags)
81 ld_flags = cc.get_supported_link_arguments(ld_flags)
83 add_project_arguments(cc_flags, language: 'c')
84 add_project_link_arguments(ld_flags, language: 'c')
86 build_root = meson.current_build_dir()
87 src_root = meson.current_source_dir()
89 prefix = get_option('prefix')
90 dir_bin = prefix / get_option('bindir')
91 dir_data = prefix / get_option('datadir')
92 dir_info = prefix / get_option('infodir')
93 dir_lib = prefix / get_option('libdir')
94 dir_local_state = prefix / get_option('localstatedir')
95 dir_locale = prefix / get_option('localedir')
96 dir_man = prefix / get_option('mandir')
97 dir_sbin = prefix / get_option('sbindir')
98 dir_sysconf = prefix / get_option('sysconfdir')
100 if dir_run_state == ''
101 dir_run_state = dir_local_state / 'run'
104 if not opt_docs.disabled()
110 if not opt_tests.disabled()
114 subdir('bash_completion.d')
116 if os_name == 'linux' and not opt_systemd.disabled()
120 prog_reformat = find_program('astyle', native: true, required: false)
121 if prog_reformat.found()
122 run_target('reformat', command: [
124 '--options=@SOURCE_ROOT@/.astylerc',
125 '@SOURCE_ROOT@/*.c', '@SOURCE_ROOT@/*.h',