-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
126 lines (108 loc) · 3.18 KB
/
meson.build
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
project('com.redhat.network', 'c',
version : '1',
license : 'ASL2.0',
default_options: [
'c_std=gnu99',
'prefix=/usr',
'sysconfdir=/etc',
'localstatedir=/var',
],
meson_version : '>= 0.40')
cc = meson.get_compiler('c')
c_args = '''
-ftrapv
-ffast-math
-fno-common
-fdiagnostics-show-option
-fno-strict-aliasing
-fvisibility=hidden
-ffunction-sections
-fdata-sections
-fstack-protector
-fPIC
--param=ssp-buffer-size=4
-Wall
-Wextra
-Wno-inline
-Wundef
-Wformat=2
-Wformat-security
-Wformat-nonliteral
-Wsuggest-attribute=format
-Wsign-compare
-Wmissing-include-dirs
-Wold-style-definition
-Wpointer-arith
-Winit-self
-Wdeclaration-after-statement
-Wfloat-equal
-Wmissing-prototypes
-Wstrict-prototypes
-Wswitch-enum
-Wredundant-decls
-Wmissing-declarations
-Wmissing-noreturn
-Wshadow
-Wendif-labels
-Wstrict-aliasing=2
-Wwrite-strings
-Wno-long-long
-Wno-overlength-strings
-Wno-unused-parameter
-Wno-missing-field-initializers
-Wno-unused-result
-Werror=overflow
-Wnested-externs
'''.split()
foreach arg : c_args
add_project_arguments(arg, language : 'c')
endforeach
ld_args = '''
-Wl,--as-needed
-Wl,--no-undefined
-Wl,--gc-sections
-Wl,-z,relro
-Wl,-z,now
-pie
'''.split()
foreach arg : ld_args
add_project_link_arguments(arg, language : 'c')
endforeach
libm = cc.find_library('m')
conf = configuration_data()
conf.set('_GNU_SOURCE', true)
conf.set('__SANE_USERSPACE_TYPES__', true)
conf.set_quoted('VERSION', meson.project_version())
config_h = configure_file(
output : 'config.h',
configuration : conf)
add_project_arguments('-include', 'config.h', language : 'c')
prefixdir = get_option('prefix')
if not prefixdir.startswith('/')
error('Prefix is not absolute: "@0@"'.format(prefixdir))
endif
substs = configuration_data()
substs.set('VERSION', meson.project_version())
varlink_wrapper_py = find_program('./varlink-wrapper.py')
libvarlink = dependency('libvarlink')
libnl = dependency('libnl-3.0')
libnlroute = dependency('libnl-route-3.0')
subdir('src')
############################################################
git = find_program('git', required : false)
if git.found()
all_files = run_command(
git,
['--git-dir=@0@/.git'.format(meson.current_source_dir()),
'ls-files',
':/*.[ch]'])
all_files = files(all_files.stdout().split())
custom_target(
'tags',
output : 'tags',
command : ['env', 'etags', '-o', '@0@/TAGS'.format(meson.current_source_dir())] + all_files)
custom_target(
'ctags',
output : 'ctags',
command : ['env', 'ctags', '-o', '@0@/tags'.format(meson.current_source_dir())] + all_files)
endif