-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmeson.build
More file actions
177 lines (153 loc) · 4.38 KB
/
Copy pathmeson.build
File metadata and controls
177 lines (153 loc) · 4.38 KB
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
project(
'coordinatool',
'c',
version: '0.5',
license: 'LGPL3.0-or-later',
default_options: ['warning_level=3', 'werror=true'],
)
cc = meson.get_compiler('c')
global_arguments = cc.get_supported_arguments(
['-D_GNU_SOURCE', '-Wno-pedantic', '-Wno-unknown-pragmas'],
)
add_project_arguments(global_arguments, language: 'c')
hiredis = dependency('hiredis')
jansson = dependency('jansson')
libdl = cc.find_library('dl')
lustre = cc.find_library('lustreapi')
systemd = dependency('systemd', required: false)
systemd_system_unit_dir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
urcu = dependency('liburcu')
use_phobos = get_option('phobos')
phobos = cc.find_library('phobos_store', required: use_phobos)
glib = dependency('glib-2.0', required: use_phobos)
conf_data = configuration_data()
have_phobos = phobos.found() and glib.found()
conf_data.set10('HAVE_PHOBOS', have_phobos)
if have_phobos
have_phobos_init = cc.has_function(
'phobos_init',
prefix: '#define _GNU_SOURCE\n#include <phobos_store.h>',
dependencies: [glib, phobos],
)
conf_data.set10('HAVE_PHOBOS_INIT', have_phobos_init)
have_phobos_1_95 = cc.compiles(
'''
#include <phobos_store.h>
void func() {
char *hostname;
int nb_new_lock;
phobos_locate("obj", NULL, 0, NULL, &hostname, &nb_new_lock);
}
''',
name: 'phobos_locate 1.95 check',
dependencies: [glib, phobos],
)
have_phobos_3 = cc.compiles(
'''
#include <phobos_store.h>
void func() {
char *hostname;
int nb_new_lock;
phobos_locate("obj", NULL, 0, NULL, NULL, &hostname, &nb_new_lock);
}
''',
name: 'phobos_locate 3 check',
dependencies: [glib, phobos],
)
if have_phobos_3
conf_data.set('PHOBOS_VERSION', 300)
elif have_phobos_1_95
conf_data.set('PHOBOS_VERSION', 195)
endif
endif
have_gettid = cc.has_function(
'gettid',
prefix: '#define _GNU_SOURCE\n#include <unistd.h>',
)
conf_data.set10('HAVE_GETTID', have_gettid)
configure_file(output: 'config.h', configuration: conf_data)
install_data('coordinatool.conf', install_dir: '/etc')
if systemd.found()
configure_file(
copy: true,
input: 'systemd/coordinatool@.service',
install: true,
install_dir: systemd_system_unit_dir,
output: 'coordinatool@.service',
)
configure_file(
copy: true,
input: 'systemd/coordinatool.sysconfig',
install: true,
install_dir: '/etc/sysconfig',
output: 'coordinatool',
)
endif
version_h = vcs_tag(
command: ['git', 'describe', '--always'],
input: 'common/version.h.in',
output: 'version.h',
replace_string: '@VERSION@',
)
common = static_library(
'coordinatool_common',
files(
'common/config.c',
'common/lustre.c',
'common/protocol.c',
'common/protocol_lustre.c',
),
# need lustre for logs
dependencies: [lustre, jansson],
)
client_common = static_library(
'coordinatool_client_common',
files(
'client_common/client.c',
'client_common/protocol.c',
'client_common/tcp.c',
),
include_directories: include_directories('common'),
link_with: [common],
)
subdir('tests')
lhsmd_coordinatool_sources = [
'copytool/batch.c',
'copytool/config.c',
'copytool/coordinatool.c',
'copytool/lhsm.c',
'copytool/protocol.c',
'copytool/queue.c',
'copytool/redis.c',
'copytool/reporting.c',
'copytool/scheduler.c',
'copytool/tcp.c',
'copytool/timer.c',
'copytool/utils.c',
]
if have_phobos
lhsmd_coordinatool_sources += 'copytool/phobos.c'
endif
executable(
'lhsmd_coordinatool',
sources: files(lhsmd_coordinatool_sources) + [version_h],
dependencies: [hiredis, urcu, glib, phobos],
include_directories: include_directories(['common', '.']),
link_with: [common],
install: true,
)
executable(
'coordinatool-client',
sources: files('client/client.c', 'client/protocol.c') + [version_h],
include_directories: include_directories(['common', 'client_common']),
link_with: [client_common],
install: true,
)
library(
'coordinatool_client',
sources: files('preload/preload.c', 'preload/protocol.c', 'preload/tree.c'),
include_directories: include_directories(['common', 'client_common']),
link_with: [client_common],
dependencies: [libdl],
install: true,
)