forked from cleech/open-isns
-
Notifications
You must be signed in to change notification settings - Fork 22
/
meson.build
204 lines (172 loc) · 4.03 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# meson build for open-isns
project('libisns', 'c',
version: '0.103',
meson_version: '>= 0.54.0',
license: 'LGPL-2.1-or-later',
default_options: [
'c_std=gnu99',
'warning_level=2',
'buildtype=release',
'libdir=/usr/lib64',
'prefix=/usr']
)
# we will need this below
cc = meson.get_compiler('c')
# get feature options
security_dep = dependency('libcrypto', required: get_option('security'))
slp_dep = cc.find_library('slp', required: get_option('slp'))
subdir('tests')
subdir('doc')
subdir('etc')
subdir('include/libisns')
lib_srcs = files([
'server.c',
'client.c',
'objects.c',
'callback.c',
'timer.c',
'vendor.c',
'db.c',
'db-file.c',
'db-policy.c',
'relation.c',
'scope.c',
'message.c',
'security.c',
'authblock.c',
'policy.c',
'pki.c',
'register.c',
'query.c',
'getnext.c',
'deregister.c',
'esi.c',
'scn.c',
'dd.c',
'entity.c',
'portal-group.c',
'storage-node.c',
'domain.c',
'simple.c',
'tags.c',
'attrs.c',
'export.c',
'socket.c',
'slp.c',
'error.c',
'logging.c',
'config.c',
'parser.c',
'buffer.c',
'pidfile.c',
'sysdep-unix.c',
'util.c',
'bitvector.c',
'mdebug.c'])
incl_dirs = include_directories(['.', 'include'])
add_project_arguments(
['-D_GNU_SOURCE'],
language: 'c')
#
# build our config.h file
#
conf = configuration_data()
conf.set('WITH_SECURITY', security_dep.found())
conf.set('WITH_SLP', slp_dep.found())
conf.set('HAVE_SLP_H', slp_dep.found())
config_h = configure_file(
output: 'config.h',
configuration: conf)
config_incdir = include_directories('.')
config_dep = declare_dependency(
include_directories: config_incdir,
sources: config_h)
#
# build our library -- we always build either the static or
# the shared library, or both
#
lib_deps = [config_dep, security_dep, slp_dep]
shared_link_args = []
if get_option('shared_version')
shared_link_args = '-Wl,--version-script=@0@/libisns.vers'.format(meson.current_source_dir())
endif
libisns_lib = library('isns',
lib_srcs,
include_directories: incl_dirs,
dependencies: lib_deps,
link_args: shared_link_args,
version: '0',
install: true)
libisns_dep = declare_dependency(link_with: libisns_lib)
#
# build binaries
#
our_dependencies = [config_dep, security_dep, libisns_dep, slp_dep]
sbin_dir = get_option('sbindir')
executable('isnsd',
sources: files('isnsd.c'),
include_directories: incl_dirs,
dependencies: our_dependencies,
install: true,
install_dir: sbin_dir)
executable('isnsdd',
sources: files(['isnsdd.c', 'local.c']),
include_directories: incl_dirs,
dependencies: our_dependencies,
install: true,
install_dir: sbin_dir)
executable('isnsadm',
sources: files('isnsadm.c'),
include_directories: incl_dirs,
dependencies: our_dependencies,
install: true,
install_dir: sbin_dir)
# A test program that validates the
# bitvector library routines
e = executable('bitvector',
sources: files('bitvector.c'),
include_directories: incl_dirs,
dependencies: our_dependencies,
c_args: ['-DTEST'])
test('test bitvector', e)
# test programs used by the unit tests in the tests subdirectory
# (not to be called directly for testing)
foreach t: tests
e = executable(t,
sources: files('tests' / t + '.c'),
include_directories: incl_dirs,
dependencies: our_dependencies)
endforeach
#
# man pages
#
install_man([man8_pages, man5_pages])
#
# config files
#
install_data(config_files,
install_dir: get_option('sysconfdir') / 'isns')
#
# systemd service files
#
install_data(files(['isnsd.service', 'isnsd.socket']),
install_dir: get_option('systemddir') / 'system')
#
# our package file
#
pkg_mod = import('pkgconfig')
pkg_mod.generate(libraries: libisns_lib,
version: '0',
name: 'libisns',
description: 'iSNS userspace library')
#
# public header files are installed from # include/libisns
#
#
# lastly, create our runtime directory (empty)
#
# NOTE: this can be replaced with install_emptydir() once
# the minimum requirement of Meson is bumped to >=0.60.0
install_subdir('isns',
install_dir: '/var/lib',
install_mode: 'r--------')