-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmeson.build
116 lines (97 loc) · 3.52 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
project(
'qol-assist',
['c'],
version: '0.0.1',
license: [
'GPL-2.0',
],
default_options: [
'c_std=c11',
'prefix=/usr',
'sysconfdir=/etc',
'localstatedir=/var',
],
)
am_cflags = [
'-fstack-protector',
'-Wall',
'-pedantic',
'-Wstrict-prototypes',
'-Wundef',
'-fno-common',
'-Werror-implicit-function-declaration',
'-Wformat',
'-Wformat-security',
'-Werror=format-security',
'-Wconversion',
'-Wunused-variable',
'-Wunreachable-code',
'-W',
'-D_FORTIFY_SOURCE=2',
]
# Add our main flags
add_global_arguments(am_cflags, language: 'c')
# Get configuration bits together
path_prefix = get_option('prefix')
path_sysconfdir = join_paths(path_prefix, get_option('sysconfdir'))
path_datadir = join_paths(path_prefix, get_option('datadir'))
path_sbindir = join_paths(path_prefix, get_option('sbindir'))
path_vardir = join_paths(path_prefix, get_option('localstatedir'), 'lib', meson.project_name())
# Systemd configuration
with_systemd_system_unit_dir = get_option('with-systemd-system-unit-dir')
if with_systemd_system_unit_dir == ''
# Automatically discover systemd unit location from pkgconfig
message('Asking pkg-config for systemd\'s system unit directory')
dep_systemd = dependency('systemd')
with_systemd_system_unit_dir = dep_systemd.get_pkgconfig_variable('systemdsystemunitdir')
if with_systemd_system_unit_dir == ''
error('Cannot locate the systemd system unit directory')
endif
endif
# Sort out config.h now
cdata = configuration_data()
# General options..
cdata.set_quoted('PACKAGE_NAME', meson.project_name())
cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
cdata.set_quoted('PACKAGE_URL', 'https://solus-project.com')
cdata.set_quoted('PACKAGE_BUG_TRACKER', get_option('with-bug-tracker'))
# Tracking files
cdata.set_quoted('QOL_TRACK_DIR', path_vardir)
with_trigger_file = join_paths(path_vardir, 'trigger')
with_status_file = join_paths(path_vardir, 'status')
cdata.set_quoted('QOL_STATUS_FILE', with_status_file)
cdata.set_quoted('QOL_TRIGGER_FILE', with_trigger_file)
# If the uid isn't provided as a number, the build will freak out.
with_minimum_uid = get_option('with-minimum-uid').to_int()
cdata.set('QOL_MIN_UID', with_minimum_uid)
# Grab the name for the sudo group (admins)
with_wheel_group = get_option('with-wheel-group')
cdata.set_quoted('QOL_WHEEL_GROUP', with_wheel_group)
# Write config.h now
config_h = configure_file(
configuration: cdata,
output: 'config.h',
)
config_h_dir = include_directories('.')
# Sort out systemd unit
subdir('data')
# Now go build the source
subdir('src')
report = [
' Build configuration:',
' ====================',
'',
' prefix: @0@'.format(path_prefix),
' datadir: @0@'.format(path_datadir),
' sysconfdir: @0@'.format(path_sysconfdir),
' sbindir: @0@'.format(path_sbindir),
'',
' tracking directory: @0@'.format(path_vardir),
' trigger file: @0@'.format(with_trigger_file),
' status file: @0@'.format(with_status_file),
'',
' minimum UID for non system user: @0@'.format(with_minimum_uid),
' wheel (sudo) group name: @0@'.format(with_wheel_group),
]
# Output some stuff to validate the build config
message('\n\n\n' + '\n'.join(report) + '\n\n')