1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# SPDX-License-Identifier: GPL-2.0
project('minecproxy',
'c',
version: '0.1.0',
license: 'GPL2',
default_options : [
'c_std=gnu18',
'sysconfdir=/etc',
'sharedstatedir=/var/lib',
'warning_level=2',
'b_lto=true',
]
)
cc = meson.get_compiler('c')
cc_flags = [
'-D_GNU_SOURCE',
]
cc_warning_flags = [
'-Wno-sign-compare', # Lots of pointless warnings
'-Werror=implicit-function-declaration', # A warning is too weak
]
cc_flags += cc.get_supported_arguments(cc_warning_flags)
cc_extra_flags = [
'-ffunction-sections', # Generate each function in a separate section
'-fdata-sections', # Ditto for data
]
cc_flags += cc.get_supported_arguments(cc_extra_flags)
add_project_arguments(cc_flags, language: 'c')
ld_flags = []
ld_extra_flags = [
'-Wl,-z,defs', # Detect and reject underlinking
'-Wl,-z,now', # Disable lazy binding
'-Wl,-z,relro', # Read-only segments after relocation
'-Wl,--gc-sections', # Remove unused sections
]
ld_flags += cc.get_supported_link_arguments(ld_extra_flags)
add_project_link_arguments(ld_flags, language: 'c')
sysconfdir = join_paths(get_option('sysconfdir'), meson.project_name())
localstatedir = join_paths(get_option('prefix'), get_option('sharedstatedir'), meson.project_name())
mainconfname = meson.project_name() + '.conf'
conf = configuration_data()
conf.set_quoted('VERSION', '@0@-@VCS_TAG@'.format(meson.project_version()))
conf.set_quoted('DEFAULT_CFG_DIR', sysconfdir)
conf.set_quoted('DEFAULT_DATA_DIR', localstatedir)
conf.set_quoted('DEFAULT_MAIN_CFG_FILE', mainconfname)
inc_config_h = include_directories('.')
dep_config_h = declare_dependency(
sources: vcs_tag(
command: ['git', 'rev-parse', '--short', 'HEAD'],
fallback: get_option('profile') != 'default' ? 'devel' : 'stable',
input: configure_file (
output: 'config.h.in',
input: 'config.h.in',
configuration: conf
),
output: 'config.h'
),
include_directories : inc_config_h,
)
subdir('shared')
subdir('examples')
subdir('minecproxy')
subdir('minecctl')
subdir('man')
|