]>
Commit | Line | Data |
---|---|---|
d4c880d5 | 1 | project('util-linux', 'c', |
e0c1a86b | 2 | version : run_command('tools/git-version-gen', check: true).stdout(), |
c12276dd | 3 | meson_version: '>=0.60.0', |
6240e445 TW |
4 | license : 'GPLv2+', |
5 | default_options : [ | |
6 | 'c_std=c99', | |
7 | 'cpp_std=c++11', | |
8 | ]) | |
d4c880d5 | 9 | |
3e0bbb12 | 10 | fs = import('fs') |
d4c880d5 ZJS |
11 | pkgconfig = import('pkgconfig') |
12 | ||
13 | libblkid_version = '1.1.0' | |
50736e49 | 14 | libblkid_date = '01-Jun-2021' |
d4c880d5 ZJS |
15 | libuuid_version = '1.3.0' |
16 | libmount_version = '1.1.0' | |
17 | libsmartcols_version = '1.1.0' | |
18 | libfdisk_version = '1.1.0' | |
19 | ||
20 | prefixdir = get_option('prefix') | |
21 | if not prefixdir.startswith('/') | |
22 | error('Prefix is not absolute: "@0@"'.format(prefixdir)) | |
23 | endif | |
24 | bindir = join_paths(prefixdir, get_option('bindir')) | |
25 | sbindir = join_paths(prefixdir, get_option('sbindir')) | |
26 | sysconfstaticdir = join_paths(prefixdir, 'lib') | |
12ebed03 | 27 | docdir = join_paths(prefixdir, get_option('datadir'), 'doc', 'util-linux') |
53b37016 | 28 | mandir = join_paths(prefixdir, get_option('mandir')) |
d4c880d5 | 29 | runstatedir = '/run' |
0eb2a476 | 30 | execprefixdir = prefixdir |
5e67b421 | 31 | sysconfdir = join_paths(prefixdir, get_option('sysconfdir')) |
0eb2a476 KL |
32 | usrbin_exec_dir = join_paths(execprefixdir, bindir) |
33 | usrsbin_exec_dir = join_paths(execprefixdir, sbindir) | |
38bb89ee | 34 | bash_completion = dependency('bash-completion', required : get_option('build-bash-completion')) |
d4c880d5 | 35 | |
308a0979 KZ |
36 | vendordir = get_option('vendordir') |
37 | ||
d4c880d5 ZJS |
38 | add_project_arguments('-D_GNU_SOURCE', language : 'c') |
39 | ||
40 | cc = meson.get_compiler('c') | |
41 | ||
42 | conf = configuration_data() | |
3e43f629 RP |
43 | conf.set_quoted('PACKAGE', meson.project_name()) |
44 | conf.set_quoted('PACKAGE_VERSION', meson.project_version()) | |
d4c880d5 ZJS |
45 | package_string = '@0@ @1@'.format(meson.project_name(), meson.project_version()) |
46 | conf.set_quoted('PACKAGE_STRING', package_string) | |
d4c880d5 | 47 | |
d4c880d5 | 48 | pc_version = [] |
922d025a | 49 | pc_version = meson.project_version().split('-')[0].split('.') |
50 | ||
51 | if pc_version.length() < 3 | |
52 | pc_version += '0' | |
53 | endif | |
54 | ||
d4c880d5 ZJS |
55 | pc_version = '.'.join(pc_version) |
56 | ||
57 | conf.set_quoted('LIBBLKID_VERSION', libblkid_version) | |
58 | conf.set_quoted('LIBBLKID_DATE', libblkid_date) | |
59 | ||
60 | conf.set('bindir', bindir) | |
61 | conf.set('sbindir', sbindir) | |
62 | conf.set('runstatedir', runstatedir) | |
5e67b421 | 63 | conf.set('sysconfdir', sysconfdir) |
d4c880d5 ZJS |
64 | conf.set('usrsbin_execdir', usrsbin_exec_dir) |
65 | conf.set('docdir', docdir) | |
66 | conf.set_quoted('_PATH_SYSCONFSTATICDIR', sysconfstaticdir) | |
67 | conf.set_quoted('_PATH_RUNSTATEDIR', runstatedir) | |
68 | conf.set_quoted('CONFIG_ADJTIME_PATH', '/etc/adjtime') | |
69 | conf.set_quoted('ADJTIME_PATH', '/etc/adjtime') # yes, both are used :( | |
70 | ||
308a0979 KZ |
71 | conf.set_quoted('_PATH_VENDORDIR', vendordir) |
72 | conf.set('USE_VENDORDIR', vendordir == '' ? false : 1) | |
73 | ||
d4c880d5 ZJS |
74 | build_libblkid = not get_option('build-libblkid').disabled() |
75 | conf.set('HAVE_LIBBLKID', build_libblkid ? 1 : false) | |
76 | summary('libblkid', build_libblkid ? 'enabled' : 'disabled', section : 'components') | |
77 | ||
78 | build_libuuid = not get_option('build-libuuid').disabled() | |
79 | conf.set('HAVE_LIBUUID', build_libuuid ? 1 : false) | |
80 | summary('libuuid', build_libuuid ? 'enabled' : 'disabled', section : 'components') | |
81 | ||
e23c3262 KZ |
82 | have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/mount.h>') > 0 |
83 | conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false) | |
84 | conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false) | |
85 | ||
7d679f29 | 86 | have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0 |
8bcf89d3 TW |
87 | conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false) |
88 | ||
d4c880d5 ZJS |
89 | build_libmount = not get_option('build-libmount').disabled() |
90 | conf.set('HAVE_LIBMOUNT', build_libmount ? 1 : false) | |
375ccf08 | 91 | conf.set('USE_LIBMOUNT_SUPPORT_NAMESPACES', 1) |
e23c3262 | 92 | conf.set('USE_LIBMOUNT_MOUNTFD_SUPPORT', have_mountfd_api ? 1 : false) |
d4c880d5 ZJS |
93 | summary('libmount', build_libmount ? 'enabled' : 'disabled', section : 'components') |
94 | ||
95 | build_libsmartcols = not get_option('build-libsmartcols').disabled() | |
96 | conf.set('HAVE_LIBSMARTCOLS', build_libsmartcols ? 1 : false) | |
97 | summary('libsmartcols', build_libsmartcols ? 'enabled' : 'disabled', section : 'components') | |
98 | ||
99 | build_libfdisk = not get_option('build-libfdisk').disabled() | |
100 | conf.set('HAVE_LIBFDISK', build_libfdisk ? 1 : false) | |
101 | summary('libfdisk', build_libfdisk ? 'enabled' : 'disabled', section : 'components') | |
102 | ||
103 | build_uuidd = not get_option('build-uuidd').disabled() | |
104 | conf.set('HAVE_UUIDD', build_uuidd ? 1 : false) | |
105 | summary('uuidd', build_uuidd ? 'enabled' : 'disabled', section : 'components') | |
106 | ||
69939195 ZJS |
107 | static_programs = get_option('static-programs') |
108 | need_static_libs = static_programs.length() > 0 # a rough estimate... | |
109 | summary('static programs', static_programs) | |
110 | ||
d4c880d5 ZJS |
111 | LINUX = host_machine.system() in ['linux'] |
112 | BSD = host_machine.system() in ['dragonfly', 'freebsd', 'netbsd', 'openbsd'] | |
113 | ||
114 | ############################################################ | |
115 | ||
116 | code = ''' | |
117 | #include <wchar.h> | |
118 | #include <wctype.h> | |
119 | #include <stdio.h> | |
120 | #include <stdlib.h> | |
121 | int main(void) { | |
122 | wchar_t wc; | |
123 | wint_t w; | |
124 | w = fgetwc(stdin); | |
125 | if (w == WEOF) | |
126 | return 1; | |
127 | wc = w; | |
128 | fputwc(wc,stdout); | |
129 | return 0; | |
130 | } | |
131 | ''' | |
132 | have = cc.compiles(code, name : 'wchar_t support') | |
133 | if not have and get_option('widechar').enabled() | |
134 | error('widechar support requested but unavailable') | |
135 | endif | |
136 | if get_option('ncurses').enabled() and get_option('widechar').enabled() | |
137 | error('widechar support is incompatible with non-wide ncurses') | |
138 | endif | |
139 | conf.set('HAVE_WIDECHAR', have ? 1 : false) | |
140 | ||
141 | headers = ''' | |
142 | byteswap.h | |
143 | crypt.h | |
144 | endian.h | |
145 | err.h | |
146 | errno.h | |
147 | fcntl.h | |
148 | getopt.h | |
149 | inttypes.h | |
150 | langinfo.h | |
151 | lastlog.h | |
152 | libutil.h | |
153 | locale.h | |
154 | mntent.h | |
155 | paths.h | |
156 | pty.h | |
157 | shadow.h | |
158 | stdint.h | |
159 | stdio_ext.h | |
160 | stdlib.h | |
161 | string.h | |
162 | strings.h | |
163 | unistd.h | |
164 | utmp.h | |
165 | utmpx.h | |
908ac36f MY |
166 | asm-generic/fcntl.h |
167 | asm/fcntl.h | |
d4c880d5 ZJS |
168 | asm/io.h |
169 | linux/blkzoned.h | |
170 | linux/capability.h | |
171 | linux/cdrom.h | |
172 | linux/compiler.h | |
173 | linux/falloc.h | |
174 | linux/fd.h | |
0e186591 | 175 | linux/fs.h |
647f80e4 KZ |
176 | linux/fiemap.h |
177 | linux/gsmmux.h | |
0e186591 TW |
178 | linux/if_alg.h |
179 | linux/kcmp.h | |
d4c880d5 | 180 | linux/net_namespace.h |
647f80e4 | 181 | linux/nsfs.h |
241e4a48 | 182 | linux/mount.h |
0e186591 | 183 | linux/pr.h |
d4c880d5 ZJS |
184 | linux/securebits.h |
185 | linux/tiocl.h | |
186 | linux/version.h | |
187 | linux/watchdog.h | |
188 | net/if.h | |
189 | net/if_dl.h | |
190 | netinet/in.h | |
191 | security/openpam.h | |
192 | security/pam_appl.h | |
193 | security/pam_misc.h | |
194 | sys/disk.h | |
195 | sys/disklabel.h | |
196 | sys/endian.h | |
197 | sys/file.h | |
198 | sys/io.h | |
199 | sys/ioccom.h | |
200 | sys/ioctl.h | |
201 | sys/mkdev.h | |
202 | sys/mount.h | |
203 | sys/param.h | |
aa5adf24 | 204 | sys/pidfd.h |
d4c880d5 ZJS |
205 | sys/prctl.h |
206 | sys/resource.h | |
6e92db54 | 207 | sys/sendfile.h |
d4c880d5 ZJS |
208 | sys/signalfd.h |
209 | sys/socket.h | |
210 | sys/sockio.h | |
211 | sys/stat.h | |
0e186591 | 212 | sys/statfs.h |
d4c880d5 ZJS |
213 | sys/swap.h |
214 | sys/syscall.h | |
215 | sys/sysmacros.h | |
216 | sys/time.h | |
217 | sys/timex.h | |
218 | sys/ttydefaults.h | |
219 | sys/types.h | |
220 | sys/ucred.h | |
221 | sys/un.h | |
0e186591 | 222 | sys/vfs.h |
647f80e4 | 223 | sys/xattr.h |
d4c880d5 ZJS |
224 | '''.split() |
225 | ||
226 | lib_m = cc.find_library('m') | |
227 | ||
228 | lib_tinfo = dependency( | |
229 | 'tinfo', | |
230 | required : get_option('tinfo')) | |
231 | ||
232 | lib_ncursesw = dependency( | |
233 | 'ncursesw', | |
234 | required : get_option('ncursesw')) | |
235 | if lib_ncursesw.found() | |
236 | headers += ['ncursesw/ncurses.h', | |
237 | 'ncursesw/term.h', | |
238 | 'ncurses.h', | |
239 | 'term.h'] | |
240 | lib_ncurses = disabler() | |
241 | else | |
242 | lib_ncurses = dependency( | |
243 | 'ncurses', | |
244 | required : get_option('ncurses')) | |
245 | headers += ['ncurses.h', | |
246 | 'term.h'] | |
247 | endif | |
248 | ||
249 | conf.set('HAVE_LIBNCURSESW', lib_ncursesw.found()) | |
250 | conf.set('HAVE_LIBNCURSES', lib_ncurses.found()) | |
251 | conf.set('HAVE_NCURSES', lib_ncursesw.found() or lib_ncurses.found()) | |
252 | ||
253 | lib_slang = dependency( | |
254 | 'slang', | |
255 | required : get_option('slang')) | |
256 | if lib_slang.found() | |
257 | headers += ['slang.h', | |
258 | 'slang/slang.h', | |
259 | 'slcurses.h', | |
260 | 'slang/slcurses.h'] | |
261 | endif | |
262 | conf.set('HAVE_SLANG', lib_slang.found()) | |
263 | ||
264 | foreach curses_libs : [lib_slang, lib_ncursesw, lib_ncurses] | |
265 | if curses_libs.found() | |
6e13cfed KZ |
266 | have = cc.has_function('use_default_colors', dependencies : curses_libs) |
267 | conf.set('HAVE_USE_DEFAULT_COLORS', have ? 1 : false) | |
268 | have = cc.has_function('resizeterm', dependencies : curses_libs) | |
269 | conf.set('HAVE_RESIZETERM', have ? 1 : false) | |
d4c880d5 ZJS |
270 | break |
271 | endif | |
272 | endforeach | |
273 | ||
274 | lib_z = dependency( | |
275 | 'zlib', | |
276 | required : get_option('zlib')) | |
277 | ||
278 | lib_readline = dependency( | |
279 | 'readline', | |
280 | required : get_option('readline')) | |
281 | conf.set('HAVE_LIBREADLINE', lib_readline.found() ? 1 : false) | |
282 | ||
69939195 ZJS |
283 | lib_readline_static = dependency( |
284 | 'readline', | |
285 | static : true, | |
286 | required : need_static_libs ? get_option('readline') : disabler()) | |
287 | ||
fc63a3d0 RP |
288 | if meson.version().version_compare('>= 0.59.0') |
289 | lib_intl = dependency( | |
290 | 'intl', | |
291 | required : get_option('nls')) | |
292 | conf.set('ENABLE_NLS', lib_intl.found() ? 1 : false) | |
293 | else | |
294 | if get_option('nls').enabled() | |
295 | error('nls is not supported with meson before 0.59.0') | |
296 | endif | |
297 | lib_intl = dependency('', required : false) | |
298 | endif | |
299 | ||
d4c880d5 ZJS |
300 | lib_user = dependency( |
301 | 'libuser', | |
302 | version : '>= 0.58', | |
303 | required : get_option('libuser')) | |
304 | conf.set('HAVE_LIBUSER', lib_user.found() ? 1 : false) | |
305 | ||
306 | lib_util = cc.find_library( | |
307 | 'util', | |
308 | required : get_option('libutil')) | |
309 | conf.set('HAVE_LIBUTIL', lib_util.found() ? 1 : false) | |
310 | ||
311 | lib_utempter = cc.find_library( | |
312 | 'utempter', | |
313 | required : get_option('libutempter')) | |
314 | conf.set('HAVE_LIBUTEMPTER', lib_utempter.found() ? 1 : false) | |
315 | ||
316 | systemd = dependency( | |
317 | 'systemd', | |
318 | required : get_option('systemd')) | |
319 | ||
320 | lib_systemd = dependency( | |
321 | 'libsystemd', | |
322 | required : get_option('systemd')) | |
323 | conf.set('HAVE_LIBSYSTEMD', lib_systemd.found() ? 1 : false) | |
0e186591 | 324 | conf.set('USE_SYSTEMD', lib_systemd.found() ? 1 : false) |
d4c880d5 | 325 | |
87fcd95a TK |
326 | have = cc.has_function( |
327 | 'sd_session_get_username', | |
328 | dependencies : lib_systemd) | |
329 | conf.set('HAVE_DECL_SD_SESSION_GET_USERNAME', have ? 1 : false) | |
330 | ||
d4c880d5 ZJS |
331 | lib_udev = dependency( |
332 | 'libudev', | |
333 | required : get_option('systemd')) | |
334 | conf.set('HAVE_LIBUDEV', lib_udev.found() ? 1 : false) | |
335 | ||
336 | lib_crypt = cc.find_library('crypt') | |
337 | ||
e279e9b2 RP |
338 | lib_pam = cc.find_library('pam', required : get_option('build-login')) |
339 | if not lib_pam.found() | |
340 | lib_pam = cc.find_library('pam', required : get_option('build-chfn-chsh')) | |
341 | endif | |
342 | if not lib_pam.found() | |
343 | lib_pam = cc.find_library('pam', required : get_option('build-su')) | |
344 | endif | |
345 | if not lib_pam.found() | |
346 | lib_pam = cc.find_library('pam', required : get_option('build-runuser')) | |
347 | endif | |
d4c880d5 ZJS |
348 | if lib_pam.found() |
349 | lib_pam_misc = cc.find_library('pam_misc') | |
350 | lib_pam = [lib_pam, lib_pam_misc] | |
7bce9496 RP |
351 | else |
352 | lib_pam_misc = declare_dependency() | |
d4c880d5 ZJS |
353 | endif |
354 | ||
355 | lib_cryptsetup = dependency( | |
356 | 'libcryptsetup', | |
357 | required : get_option('cryptsetup')) | |
358 | conf.set('HAVE_CRYPTSETUP', lib_cryptsetup.found() ? 1 : false) | |
359 | ||
e6a4b4a1 | 360 | if not get_option('cryptsetup').disabled() and get_option('cryptsetup-dlopen').enabled() |
324aa32c RP |
361 | if meson.version().version_compare('>= 0.62.0') |
362 | lib_dl = dependency('dl') | |
363 | else | |
364 | lib_dl = cc.find_library('dl') | |
365 | endif | |
e6a4b4a1 LB |
366 | conf.set('CRYPTSETUP_VIA_DLOPEN', 1) |
367 | summary('cryptsetup support (dlopen)', | |
368 | 'enabled', | |
369 | section : 'components') | |
370 | else | |
371 | summary('cryptsetup support', | |
372 | lib_cryptsetup.found() ? 'enabled' : 'disabled', | |
373 | section : 'components') | |
374 | endif | |
6e92db54 | 375 | |
d4c880d5 ZJS |
376 | have = cc.has_function( |
377 | 'crypt_activate_by_signed_key', | |
378 | dependencies : lib_cryptsetup) | |
5a6e9adf | 379 | conf.set('HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY', have ? 1 : false) |
d4c880d5 ZJS |
380 | |
381 | lib_cap_ng = dependency( | |
cd23a433 RP |
382 | 'libcap-ng', |
383 | required : get_option('build-setpriv')) | |
512c91a6 TW |
384 | if not lib_cap_ng.found() |
385 | lib_cap_ng = disabler() | |
386 | endif | |
d4c880d5 ZJS |
387 | |
388 | lib_selinux = dependency( | |
389 | 'libselinux', | |
6e92db54 | 390 | version : '>= 2.5', |
d4c880d5 ZJS |
391 | required : get_option('selinux')) |
392 | conf.set('HAVE_LIBSELINUX', lib_selinux.found() ? 1 : false) | |
393 | ||
6e92db54 KZ |
394 | lib_magic = dependency( |
395 | 'libmagic', | |
396 | required : get_option('magic')) | |
397 | conf.set('HAVE_MAGIC', lib_magic.found() ? 1 : false) | |
398 | ||
399 | lib_econf = dependency( | |
400 | 'libeconf', | |
401 | required : get_option('econf')) | |
402 | conf.set('HAVE_LIBECONF', lib_econf.found() ? 1 : false) | |
403 | ||
d4c880d5 | 404 | lib_audit = dependency( |
b2ae39f6 | 405 | 'audit', |
d4c880d5 ZJS |
406 | required : get_option('audit')) |
407 | conf.set('HAVE_LIBAUDIT', lib_audit.found() ? 1 : false) | |
408 | ||
409 | conf.set('HAVE_SMACK', not get_option('smack').disabled()) | |
410 | ||
411 | foreach header : headers | |
412 | have = cc.has_header(header) | |
413 | conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false) | |
414 | endforeach | |
415 | ||
416 | header = 'linux/btrfs.h' | |
417 | enable_btrfs = cc.has_header(header, | |
418 | required : get_option('btrfs')) | |
419 | conf.set('HAVE_' + header.underscorify().to_upper(), enable_btrfs ? 1 : false) | |
420 | conf.set('HAVE_BTRFS_SUPPORT', enable_btrfs ? 1 : false) | |
421 | ||
422 | prefix = conf.get('HAVE_LINUX_COMPILER_H') ? '#include <linux/compiler.h>' : '' | |
423 | foreach header : [ | |
424 | 'linux/blkpg.h', | |
425 | 'linux/major.h', | |
426 | ] | |
427 | have = cc.has_header(header, | |
428 | prefix : prefix) | |
429 | conf.set('HAVE_' + header.underscorify().to_upper(), have ? 1 : false) | |
430 | endforeach | |
431 | ||
432 | have = cc.has_header('sched.h') | |
433 | conf.set10('HAVE_DECL_CPU_ALLOC', have) | |
434 | # We get -1 if the size cannot be determined | |
4194bb5b | 435 | have_cpu_set_t = cc.sizeof('cpu_set_t', prefix : '#define _GNU_SOURCE\n#include <sched.h>') > 0 |
d4c880d5 ZJS |
436 | conf.set('HAVE_CPU_SET_T', have_cpu_set_t ? 1 : false) |
437 | ||
5afe34ef | 438 | have = cc.has_header_symbol('unistd.h', 'environ', args : '-D_GNU_SOURCE') |
d4c880d5 ZJS |
439 | conf.set10('HAVE_ENVIRON_DECL', have) |
440 | ||
5afe34ef | 441 | have = cc.has_header_symbol('signal.h', 'sighandler_t', args : '-D_GNU_SOURCE') |
d4c880d5 ZJS |
442 | conf.set('HAVE_SIGHANDLER_T', have ? 1 : false) |
443 | ||
f3b9a18e | 444 | have = cc.has_function('strsignal') |
d4c880d5 ZJS |
445 | conf.set10('HAVE_STRSIGNAL_DECL', have) |
446 | ||
447 | have = cc.sizeof('union semun', prefix : '#include <sys/sem.h>') > 0 | |
448 | conf.set('HAVE_UNION_SEMUN', have ? 1 : false) | |
449 | ||
0e186591 TW |
450 | have = cc.has_type('loff_t', prefix : '#include <sys/types.h>') |
451 | conf.set('HAVE_LOFF_T', have ? 1 : false) | |
452 | ||
d4c880d5 ZJS |
453 | have = cc.compiles(''' |
454 | #define _GNU_SOURCE 1 | |
455 | #include <langinfo.h> | |
456 | int main(void) { | |
457 | char *str; | |
458 | str = nl_langinfo (ALTMON_1); | |
459 | str = nl_langinfo (ALTMON_2); | |
460 | str = nl_langinfo (ALTMON_3); | |
461 | str = nl_langinfo (ALTMON_4); | |
462 | str = nl_langinfo (ALTMON_5); | |
463 | str = nl_langinfo (ALTMON_6); | |
464 | str = nl_langinfo (ALTMON_7); | |
465 | str = nl_langinfo (ALTMON_8); | |
466 | str = nl_langinfo (ALTMON_9); | |
467 | str = nl_langinfo (ALTMON_10); | |
468 | str = nl_langinfo (ALTMON_11); | |
469 | str = nl_langinfo (ALTMON_12); | |
470 | return 0; | |
471 | } | |
472 | ''', | |
473 | name : 'langinfo.h defines ALTMON_x constants') | |
474 | conf.set('HAVE_LANGINFO_ALTMON', have ? 1 : false) | |
475 | ||
476 | have = cc.compiles(''' | |
477 | #define _GNU_SOURCE 1 | |
478 | #include <langinfo.h> | |
479 | int main(void) { | |
480 | char *str; | |
481 | str = nl_langinfo (_NL_ABALTMON_1); | |
482 | str = nl_langinfo (_NL_ABALTMON_2); | |
483 | str = nl_langinfo (_NL_ABALTMON_3); | |
484 | str = nl_langinfo (_NL_ABALTMON_4); | |
485 | str = nl_langinfo (_NL_ABALTMON_5); | |
486 | str = nl_langinfo (_NL_ABALTMON_6); | |
487 | str = nl_langinfo (_NL_ABALTMON_7); | |
488 | str = nl_langinfo (_NL_ABALTMON_8); | |
489 | str = nl_langinfo (_NL_ABALTMON_9); | |
490 | str = nl_langinfo (_NL_ABALTMON_10); | |
491 | str = nl_langinfo (_NL_ABALTMON_11); | |
492 | str = nl_langinfo (_NL_ABALTMON_12); | |
493 | return 0; | |
494 | } | |
495 | ''', | |
496 | name : 'langinfo.h defines _NL_ABALTMON_x constants') | |
497 | conf.set('HAVE_LANGINFO_NL_ABALTMON', have ? 1 : false) | |
498 | ||
17bc58e0 CH |
499 | have = cc.compiles(''' |
500 | #define _GNU_SOURCE 1 | |
501 | #include <langinfo.h> | |
502 | int main(void) { | |
503 | char *str; | |
504 | str = nl_langinfo (_NL_TIME_WEEK_1STDAY); | |
505 | return 0; | |
506 | } | |
507 | ''', | |
508 | name : 'langinfo.h defines _NL_TIME_WEEK_1STDAY constant') | |
509 | conf.set('HAVE_DECL__NL_TIME_WEEK_1STDAY', have ? 1 : false) | |
510 | ||
d4c880d5 | 511 | funcs = ''' |
c214cbeb | 512 | cachestat |
d4c880d5 | 513 | clearenv |
5bd1462d | 514 | close_range |
d4c880d5 ZJS |
515 | __fpurge |
516 | fpurge | |
517 | __fpending | |
518 | secure_getenv | |
519 | __secure_getenv | |
520 | eaccess | |
521 | err | |
522 | errx | |
523 | explicit_bzero | |
d9b022bd | 524 | fnmatch |
d4c880d5 | 525 | fseeko |
0120be6f KZ |
526 | fsconfig |
527 | fsmount | |
528 | fsopen | |
529 | fspick | |
d4c880d5 | 530 | fsync |
0e186591 | 531 | getttynam |
d4c880d5 ZJS |
532 | utimensat |
533 | getdomainname | |
534 | getdtablesize | |
535 | getexecname | |
536 | getmntinfo | |
537 | getrandom | |
538 | getrlimit | |
539 | getsgnam | |
540 | inotify_init | |
541 | jrand48 | |
542 | lchown | |
6124a6a3 TW |
543 | lgetxattr |
544 | llistxattr | |
d4c880d5 | 545 | llseek |
5bd1462d | 546 | newlocale |
d4c880d5 ZJS |
547 | mempcpy |
548 | mkostemp | |
10efb9ea KZ |
549 | move_mount |
550 | mount_setattr | |
d4c880d5 ZJS |
551 | nanosleep |
552 | ntp_gettime | |
10efb9ea | 553 | open_tree |
d4c880d5 ZJS |
554 | personality |
555 | pidfd_open | |
556 | pidfd_send_signal | |
557 | posix_fadvise | |
558 | prctl | |
559 | qsort_r | |
0322c9cd | 560 | reallocarray |
d4c880d5 ZJS |
561 | rpmatch |
562 | scandirat | |
563 | setprogname | |
5bd1462d | 564 | sendfile |
d4c880d5 ZJS |
565 | setns |
566 | setresgid | |
567 | setresuid | |
568 | sched_setattr | |
569 | sched_setscheduler | |
570 | sigqueue | |
571 | srandom | |
30c59d67 | 572 | statx |
d4c880d5 ZJS |
573 | strnchr |
574 | strndup | |
575 | strnlen | |
5bd1462d | 576 | strtod_l |
d4c880d5 ZJS |
577 | sysconf |
578 | sysinfo | |
579 | swapon | |
580 | swapoff | |
581 | timegm | |
582 | unshare | |
583 | usleep | |
5bd1462d TW |
584 | uselocale |
585 | utimensat | |
d4c880d5 ZJS |
586 | vwarnx |
587 | warn | |
588 | warnx | |
589 | prlimit | |
590 | ||
591 | openat | |
592 | fstatat | |
593 | unlinkat | |
594 | ioperm | |
595 | iopl | |
596 | futimens | |
597 | inotify_init1 | |
598 | open_memstream | |
599 | reboot | |
600 | getusershell | |
601 | '''.split() | |
602 | ||
603 | foreach func: funcs | |
604 | have = cc.has_function(func) | |
993556aa | 605 | # For autotools compatibility, use either #define FOO 1 or #undef FOO. |
d4c880d5 ZJS |
606 | # This makes little sense, but is necessary to avoid warnings about |
607 | # redefined macros from Python.h, which uses this convention. | |
608 | conf.set('HAVE_' + func.to_upper(), have ? 1 : false) | |
d4c880d5 ZJS |
609 | endforeach |
610 | ||
611 | have = conf.get('HAVE_FUTIMENS') in [1] and conf.get('HAVE_INOTIFY_INIT1') in [1] | |
612 | conf.set('AGETTY_RELOAD', have ? 1 : false) | |
613 | if not have | |
614 | warning('futimens or inotify_init1 not found; agetty(8) will not provide --reload functionality') | |
615 | endif | |
616 | ||
617 | have_dirfd = (cc.has_function('dirfd') or | |
618 | cc.has_header_symbol('dirent.h', 'dirfd', | |
619 | prefix : '#include <sys/types.h>')) | |
620 | conf.set('HAVE_DIRFD', have_dirfd ? 1 : false) | |
621 | ||
622 | have_ddfd = cc.has_member('DIR', 'dd_fd', | |
623 | prefix : ''' | |
624 | #include <sys/types.h> | |
625 | #include <dirent.h> | |
626 | ''') | |
627 | conf.set('HAVE_DECL_DDFD', have_ddfd ? 1 : false) | |
628 | ||
629 | have = cc.has_member('struct tm', 'tm_gmtoff', | |
630 | prefix : ''' | |
631 | #include <time.h> | |
632 | #include <unistd.h> | |
633 | ''') | |
634 | conf.set('HAVE_TM_GMTOFF', have ? 1 : false) | |
635 | ||
10efb9ea | 636 | |
10efb9ea | 637 | |
0120be6f | 638 | have = cc.sizeof('enum fsconfig_command', prefix : '#include <linux/mount.h>') > 0 |
e23c3262 | 639 | conf.set('HAVE_ENUM_FSCONFIG_COMMAND', have ? 1 : false) |
0120be6f | 640 | |
d4c880d5 ZJS |
641 | have = cc.has_member('struct termios', 'c_line', |
642 | prefix : '#include <termios.h>') | |
643 | conf.set('HAVE_STRUCT_TERMIOS_C_LINE', have ? 1 : false) | |
644 | ||
645 | have = cc.has_member('struct stat', 'st_mtim.tv_nsec', | |
646 | prefix : '#include <sys/stat.h>') | |
647 | conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false) | |
648 | ||
2f82c248 | 649 | have = cc.has_member('struct statx', 'stx_mnt_id', |
7d679f29 | 650 | prefix : '#include <sys/stat.h>') |
2f82c248 KZ |
651 | conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false) |
652 | ||
d4c880d5 ZJS |
653 | # replacement for AC_STRUCT_TIMEZONE |
654 | have = cc.has_member('struct tm', 'tm_zone', | |
655 | prefix : '#include <time.h>') | |
656 | conf.set('HAVE_STRUCT_TM_TM_ZONE', have ? 1 : false) | |
657 | ||
5afe34ef | 658 | have = cc.has_header_symbol('time.h', 'tzname', args: '-D_GNU_SOURCE') |
d4c880d5 ZJS |
659 | conf.set('HAVE_DECL_TZNAME', have ? 1 : false) |
660 | ||
0e186591 TW |
661 | have = cc.has_header_symbol('linux/blkzoned.h', 'BLK_ZONE_REP_CAPACITY') |
662 | conf.set('HAVE_DECL_BLK_ZONE_REP_CAPACITY', have ? 1 : false) | |
663 | ||
664 | have = cc.has_header_symbol('linux/pr.h', 'PR_REP_CAPACITY') | |
665 | conf.set('HAVE_DECL_PR_REP_CAPACITY', have ? 1 : false) | |
666 | ||
d4c880d5 ZJS |
667 | code = ''' |
668 | #include <time.h> | |
669 | #if !@0@ | |
670 | extern char *tzname[]; | |
671 | #endif | |
672 | int main(void) { | |
673 | return tzname ? 0 : 1; | |
674 | } | |
675 | '''.format(have ? 1 : 0) | |
e25db916 | 676 | have = cc.compiles(code, name : 'using tzname[]') |
d4c880d5 ZJS |
677 | conf.set('HAVE_TZNAME', have ? 1 : false) |
678 | ||
679 | socket_libs = [] | |
680 | if not cc.has_function('socket') | |
681 | socket_libs += cc.find_library('socket', required : true) | |
682 | have = cc.has_function('socket', | |
683 | dependencies : socket_libs) | |
684 | if not have | |
685 | error('socket() function not available') | |
686 | endif | |
687 | endif | |
688 | ||
689 | realtime_libs = [] | |
690 | have = cc.has_function('clock_gettime') | |
691 | if not have | |
692 | realtime_libs += cc.find_library('rt', required : true) | |
693 | have = cc.has_function('clock_gettime', | |
694 | dependencies : realtime_libs) | |
695 | endif | |
e51565b6 | 696 | conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false) |
d4c880d5 ZJS |
697 | |
698 | thread_libs = dependency('threads') | |
699 | ||
700 | have = cc.has_function('timer_create') | |
701 | if not have | |
c41e47c1 | 702 | realtime_libs = [cc.find_library('rt', required : true)] |
d4c880d5 ZJS |
703 | have = cc.has_function('timer_create', |
704 | dependencies : realtime_libs) | |
705 | if not have | |
706 | realtime_libs += thread_libs | |
707 | have = cc.has_function('timer_create', | |
708 | dependencies : realtime_libs) | |
709 | endif | |
710 | endif | |
711 | conf.set('HAVE_TIMER_CREATE', have ? 1 : false) | |
712 | if not have | |
713 | have = cc.has_function('setitimer') | |
714 | conf.set('HAVE_SETITIMER', have ? 1 : false) | |
715 | endif | |
716 | ||
717 | rtas_libs = cc.find_library('rtas', required : false) | |
718 | conf.set('HAVE_LIBRTAS', rtas_libs.found() ? 1 : false) | |
719 | ||
720 | math_libs = [] | |
77765258 | 721 | if not cc.has_header_symbol('math.h', 'isnan') |
d4c880d5 ZJS |
722 | lib = cc.find_library('m', required : true) |
723 | if (cc.has_function('isnan', dependencies : lib) and | |
724 | cc.has_function('__isnan', dependencies : lib)) | |
725 | math_libs += lib | |
726 | endif | |
727 | endif | |
728 | ||
729 | have = cc.has_header_symbol('errno.h', 'program_invocation_short_name', | |
730 | args : '-D_GNU_SOURCE') | |
731 | conf.set('HAVE_PROGRAM_INVOCATION_SHORT_NAME', have ? 1 : false) | |
732 | ||
733 | code = ''' | |
734 | extern char *__progname; | |
735 | int main(void) { | |
736 | return (*__progname != 0); | |
737 | } | |
738 | ''' | |
e25db916 | 739 | have = cc.compiles(code, name : 'using __progname') |
d4c880d5 ZJS |
740 | conf.set('HAVE___PROGNAME', have ? 1 : false) |
741 | ||
941e1d55 TW |
742 | have = conf.get('HAVE_PTY_H').to_string() == '1' \ |
743 | and conf.get('HAVE_SYS_SIGNALFD_H').to_string() == '1' | |
44475360 ZJS |
744 | conf.set('HAVE_PTY', have ? 1 : false) |
745 | ||
a0cf9105 LB |
746 | have_opal_get_status= cc.has_header_symbol('linux/sed-opal.h', 'IOC_OPAL_GET_STATUS') |
747 | conf.set('HAVE_OPAL_GET_STATUS', have_opal_get_status ? 1 : false) | |
748 | ||
d4c880d5 ZJS |
749 | build_plymouth_support = get_option('build-plymouth-support') |
750 | have_tiocglcktrmios = cc.has_header_symbol( | |
751 | 'sys/ioctl.h', 'TIOCGLCKTRMIOS', | |
752 | required : build_plymouth_support.enabled()) | |
753 | have_sock_cloexec = cc.has_header_symbol( | |
754 | 'sys/socket.h', 'SOCK_CLOEXEC', | |
755 | prefix : '#include <sys/types.h>', | |
756 | required : build_plymouth_support.enabled()) | |
757 | have_sock_nonblock = cc.has_header_symbol( | |
758 | 'sys/socket.h', 'SOCK_NONBLOCK', | |
759 | prefix : '#include <sys/types.h>', | |
760 | required : build_plymouth_support.enabled()) | |
761 | have_so_passcred = cc.has_header_symbol( | |
762 | 'sys/socket.h', 'SO_PASSCRED', | |
763 | prefix : '#include <sys/types.h>', | |
764 | required : build_plymouth_support.enabled()) | |
765 | ||
766 | build_plymouth_support = (not build_plymouth_support.disabled() and | |
767 | have_tiocglcktrmios and | |
768 | have_sock_cloexec and | |
769 | have_sock_nonblock and | |
770 | have_so_passcred) | |
771 | conf.set('ENABLE_PLYMOUTH_SUPPORT', build_plymouth_support ? 1 : false) | |
772 | summary('plymouth support', | |
773 | build_plymouth_support ? 'enabled' : 'disabled', | |
774 | section : 'components') | |
775 | ||
776 | # check for valid fallocate() function | |
777 | # with 32 bits glibc 2.10, fallocate() exists but not fallocate64() | |
778 | # when _FILE_OFFSET_BITS==64, fallocate() is redirect to fallocate64() | |
779 | # and program can't be linked. | |
780 | code = ''' | |
781 | #define _GNU_SOURCE | |
782 | #include <unistd.h> | |
783 | #include <fcntl.h> | |
784 | ||
785 | int main(void) { | |
786 | long ret; | |
787 | ret = fallocate(0, FALLOC_FL_KEEP_SIZE, 0xfffffffful, 0xfffffffful); | |
788 | return ret == 0 ? 0 : 1; | |
789 | } | |
790 | ''' | |
791 | have = cc.links(code, name : 'fallocate() function') | |
792 | conf.set('HAVE_FALLOCATE', have ? 1 : false) | |
793 | ||
794 | code = ''' | |
795 | #include <unistd.h> | |
796 | #include <fcntl.h> | |
797 | ||
798 | int main(void) { | |
799 | long ret; | |
800 | ret = posix_fallocate(0, 0xfffffffful, 0xfffffffful); | |
801 | return ret == 0 ? 0 : 1; | |
802 | } | |
803 | ''' | |
804 | have = cc.links(code, name : 'posix_fallocate() function') | |
805 | conf.set('HAVE_POSIX_FALLOCATE', have ? 1 : false) | |
806 | ||
807 | use_hwclock_cmos = host_machine.cpu_family() in ['x86', 'x86_64'] | |
808 | message('Use CMOS clock: @0@'.format(use_hwclock_cmos)) | |
809 | conf.set('USE_HWCLOCK_CMOS', use_hwclock_cmos ? 1 : false) | |
810 | ||
811 | conf.set('HAVE_TLS', get_option('use-tls') ? 1 : false) | |
812 | conf.set('PG_BELL', get_option('pg-bell') ? 1 : false) | |
e0806c40 | 813 | conf.set('USE_COLORS_BY_DEFAULT', get_option('colors-default') ? 1 : false) |
d4c880d5 | 814 | |
8886d84e TW |
815 | is_glibc = cc.has_header_symbol('limits.h', '__GLIBC__') |
816 | ||
d4c880d5 ZJS |
817 | ############################################################ |
818 | ||
6e92db54 | 819 | |
d4c880d5 ZJS |
820 | fs_search_path = get_option('fs-search-path') |
821 | fs_search_path_extra = get_option('fs-search-path-extra') | |
822 | if fs_search_path_extra != '' | |
823 | fs_search_path = ':'.join(fs_search_path, fs_search_path_extra) | |
824 | endif | |
825 | conf.set_quoted('FS_SEARCH_PATH', fs_search_path) | |
826 | ||
38b15ca2 | 827 | systemdsystemunitdir = '' |
fcbcb0cd | 828 | if systemd.found() |
e2b4f5be | 829 | systemdsystemunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir') |
fcbcb0cd | 830 | endif |
6e92db54 | 831 | |
5e67b421 CH |
832 | sysvinit = get_option('sysvinit').enabled() |
833 | sysvinitrcdir = sysconfdir + '/init.d' | |
834 | ||
ba30b89c | 835 | program_tests = get_option('program-tests') |
836 | ||
d4c880d5 ZJS |
837 | chfn_chsh_password = get_option('chfn-chsh-password') or lib_user.found() |
838 | conf.set('CHFN_CHSH_PASSWORD', chfn_chsh_password ? 1 : false) | |
839 | ||
840 | have = get_option('chsh-only-listed') | |
841 | conf.set('ONLY_LISTED_SHELLS', have ? 1 : false) | |
842 | ||
843 | have = get_option('use-tty-group') | |
844 | conf.set('USE_TTY_GROUP', have ? 1 : false) | |
845 | ||
a4eeda56 KZ |
846 | bison = find_program('bison') |
847 | flex = find_program('flex') | |
848 | ||
d4c880d5 | 849 | build_hwclock = not get_option('build-hwclock').disabled() |
d4c880d5 ZJS |
850 | bison_gen = generator( |
851 | bison, | |
852 | output : ['@BASENAME@.tab.c', '@BASENAME@.tab.h'], | |
853 | arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@']) | |
854 | ||
855 | meson_make_symlink = meson.current_source_dir() + '/tools/meson-make-symlink.sh' | |
38bb89ee | 856 | meson_make_manpage_stub = meson.current_source_dir() + '/tools/meson-make-manpage-stub.sh' |
d4c880d5 | 857 | |
7da59534 | 858 | configure_file( |
d4c880d5 ZJS |
859 | output : 'config.h', |
860 | configuration : conf) | |
861 | ||
5f2c862a | 862 | add_project_arguments('-include', meson.current_build_dir() / 'config.h', language : 'c') |
d4c880d5 | 863 | |
24b8804b TW |
864 | compiler_flags = [ |
865 | '-fno-common', | |
866 | ||
867 | '-Waddress-of-packed-member', | |
868 | '-Wdiscarded-qualifiers', | |
869 | '-Wembedded-directive', | |
870 | '-Wextra-semi', | |
871 | '-Wformat-security', | |
872 | '-Wimplicit-function-declaration', | |
873 | '-Wmissing-declarations', | |
874 | '-Wmissing-parameter-type', | |
875 | '-Wmissing-prototypes', | |
876 | '-Wnested-externs', | |
877 | '-Wno-missing-field-initializers', | |
9df5ac34 | 878 | '-Wold-style-definition', |
24b8804b TW |
879 | '-Wpointer-arith', |
880 | '-Wredundant-decls', | |
881 | '-Wsign-compare', | |
882 | '-Wstrict-prototypes', | |
883 | '-Wtype-limits', | |
884 | '-Wuninitialized', | |
885 | '-Wunused-but-set-parameter', | |
886 | '-Wunused-but-set-variable', | |
887 | '-Wunused-parameter', | |
888 | '-Wunused-result', | |
889 | '-Wunused-variable', | |
a52f9bdd | 890 | '-Wvla', |
2a91b213 | 891 | '-Walloca', |
24b8804b TW |
892 | ] |
893 | foreach compiler_flag : compiler_flags | |
894 | if cc.has_argument(compiler_flag) | |
895 | add_project_arguments(compiler_flag, language : 'c') | |
896 | endif | |
897 | endforeach | |
898 | ||
53b37016 | 899 | manadocs = [] |
38bb89ee | 900 | manlinks = {} |
aa519054 | 901 | |
38bb89ee | 902 | bashcompletions = [] |
aa519054 | 903 | bashcompletionslinks = {} |
53b37016 | 904 | |
d4c880d5 ZJS |
905 | subdir('include') |
906 | subdir('lib') | |
907 | subdir('libblkid') | |
908 | subdir('libmount') | |
909 | subdir('libsmartcols') | |
910 | subdir('libuuid') | |
911 | subdir('libfdisk') | |
912 | subdir('login-utils') | |
913 | subdir('sys-utils') | |
914 | subdir('disk-utils') | |
915 | subdir('misc-utils') | |
916 | subdir('text-utils') | |
917 | subdir('term-utils') | |
918 | subdir('po') | |
919 | ||
920 | includes = [dir_include, | |
921 | dir_libblkid, | |
922 | dir_libsmartcols, | |
923 | dir_libmount, | |
924 | dir_libfdisk, | |
925 | dir_libuuid, | |
926 | dir_sys_utils] | |
927 | ||
928 | exes = [] | |
929 | ||
930 | opt = not get_option('build-chfn-chsh').disabled() | |
931 | exe = executable( | |
932 | 'chfn', | |
933 | chfn_sources, | |
934 | chfn_chsh_sources, | |
935 | include_directories : includes, | |
0333c40b | 936 | link_with : [lib_common, logindefs_c], |
d4c880d5 ZJS |
937 | dependencies : chfn_chsh_deps, |
938 | install_dir : usrbin_exec_dir, | |
60d457f5 | 939 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
940 | install : opt, |
941 | build_by_default : opt) | |
38bb89ee | 942 | |
d4c880d5 ZJS |
943 | exe2 = executable( |
944 | 'chsh', | |
945 | 'login-utils/chsh.c', | |
4b724469 | 946 | 'lib/shells.c', |
d4c880d5 ZJS |
947 | chfn_chsh_sources, |
948 | include_directories : includes, | |
949 | link_with : lib_common, | |
950 | dependencies : chfn_chsh_deps, | |
951 | install_dir : usrbin_exec_dir, | |
a13574b1 | 952 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
953 | install : opt, |
954 | build_by_default : opt) | |
955 | if opt and not is_disabler(exe) | |
956 | exes += [exe, exe2] | |
38bb89ee TW |
957 | manadocs += ['login-utils/chfn.1.adoc', 'login-utils/chsh.1.adoc'] |
958 | bashcompletions += ['chfn', 'chsh'] | |
d4c880d5 ZJS |
959 | endif |
960 | ||
961 | exe = executable( | |
962 | 'test_islocal', | |
963 | test_islocal_sources, | |
964 | include_directories : includes, | |
ba30b89c | 965 | c_args : '-DTEST_PROGRAM', |
966 | build_by_default : program_tests) | |
d4c880d5 ZJS |
967 | exes += exe |
968 | ||
d4c880d5 ZJS |
969 | exe = executable( |
970 | 'test-consoles', | |
971 | test_consoles_sources, | |
972 | c_args : ['-DTEST_PROGRAM'], | |
973 | include_directories : includes, | |
ba30b89c | 974 | link_with : lib_common, |
975 | build_by_default : program_tests) | |
d4c880d5 ZJS |
976 | exes += exe |
977 | ||
978 | opt = not get_option('build-last').disabled() | |
979 | exe = executable( | |
980 | 'last', | |
981 | last_sources, | |
982 | include_directories : includes, | |
983 | link_with : [lib_common], | |
984 | install_dir : usrbin_exec_dir, | |
985 | install : opt, | |
986 | build_by_default : opt) | |
987 | if opt and not is_disabler(exe) | |
988 | exes += exe | |
989 | meson.add_install_script(meson_make_symlink, | |
990 | 'last', | |
991 | join_paths(usrbin_exec_dir, 'lastb')) | |
38bb89ee TW |
992 | manadocs += ['login-utils/last.1.adoc'] |
993 | manlinks += {'lastb.1': 'last.1'} | |
994 | bashcompletions += ['last'] | |
aa519054 | 995 | bashcompletionslinks += {'lastb': 'last'} |
d4c880d5 ZJS |
996 | endif |
997 | ||
998 | opt = not get_option('build-nologin').disabled() | |
999 | exe = executable( | |
1000 | 'nologin', | |
1001 | 'login-utils/nologin.c', | |
1002 | include_directories : includes, | |
1003 | install_dir : sbindir, | |
308a0979 | 1004 | link_with : [lib_common], |
d4c880d5 ZJS |
1005 | install : opt, |
1006 | build_by_default : opt) | |
1007 | if opt and not is_disabler(exe) | |
1008 | exes += exe | |
38bb89ee | 1009 | manadocs += ['login-utils/nologin.8.adoc'] |
d4c880d5 ZJS |
1010 | endif |
1011 | ||
1012 | opt = not get_option('build-utmpdump').disabled() | |
1013 | exe = executable( | |
1014 | 'utmpdump', | |
1015 | 'login-utils/utmpdump.c', | |
1016 | include_directories : includes, | |
1017 | link_with : [lib_common], | |
1018 | install_dir : usrbin_exec_dir, | |
1019 | install : opt, | |
1020 | build_by_default : opt) | |
1021 | if opt and not is_disabler(exe) | |
1022 | exes += exe | |
38bb89ee TW |
1023 | manadocs += ['login-utils/utmpdump.1.adoc'] |
1024 | bashcompletions += ['utmpdump'] | |
d4c880d5 ZJS |
1025 | endif |
1026 | ||
1027 | opt = not get_option('build-su').disabled() | |
1028 | exe = executable( | |
1029 | 'su', | |
1030 | 'login-utils/su.c', | |
1031 | 'login-utils/su-common.c', | |
1032 | 'login-utils/su-common.h', | |
4b724469 | 1033 | 'lib/shells.c', |
d4c880d5 ZJS |
1034 | pty_session_c, |
1035 | monotonic_c, | |
1036 | include_directories : includes, | |
0333c40b | 1037 | link_with : [lib_common, logindefs_c], |
d4c880d5 ZJS |
1038 | dependencies : [lib_pam, |
1039 | lib_pam_misc, | |
1040 | lib_util, | |
1041 | realtime_libs], | |
fb8c224e | 1042 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
1043 | install : opt, |
1044 | build_by_default : opt) | |
1045 | if opt and not is_disabler(exe) | |
1046 | exes += exe | |
38bb89ee TW |
1047 | manadocs += ['login-utils/su.1.adoc'] |
1048 | bashcompletions += ['su'] | |
d4c880d5 ZJS |
1049 | endif |
1050 | ||
1051 | opt = not get_option('build-newgrp').disabled() | |
1052 | exe = executable( | |
1053 | 'newgrp', | |
1054 | 'login-utils/newgrp.c', | |
1055 | include_directories : includes, | |
1056 | dependencies : [lib_crypt], | |
1057 | install_dir : usrbin_exec_dir, | |
cb3dee5a | 1058 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
1059 | install : opt, |
1060 | build_by_default : opt) | |
1061 | if opt and not is_disabler(exe) | |
1062 | exes += exe | |
38bb89ee | 1063 | manadocs += ['login-utils/newgrp.1.adoc'] |
f265b432 | 1064 | bashcompletions += ['newgrp'] |
d4c880d5 ZJS |
1065 | endif |
1066 | ||
1067 | opt = not get_option('build-lslogins').disabled() | |
1068 | exe = executable( | |
1069 | 'lslogins', | |
1070 | 'login-utils/lslogins.c', | |
d4c880d5 ZJS |
1071 | include_directories : includes, |
1072 | link_with : [lib_common, | |
0333c40b TW |
1073 | lib_smartcols, |
1074 | logindefs_c], | |
d4c880d5 ZJS |
1075 | dependencies : [lib_selinux, |
1076 | lib_systemd], | |
1077 | install_dir : usrbin_exec_dir, | |
1078 | install : opt, | |
1079 | build_by_default : opt) | |
1080 | if opt and not is_disabler(exe) | |
1081 | exes += exe | |
38bb89ee TW |
1082 | manadocs += ['login-utils/lslogins.1.adoc'] |
1083 | bashcompletions += ['lslogins'] | |
d4c880d5 ZJS |
1084 | endif |
1085 | ||
1086 | opt = not get_option('build-vipw').disabled() | |
1087 | exe = executable( | |
1088 | 'vipw', | |
1089 | 'login-utils/vipw.c', | |
1090 | 'login-utils/setpwnam.h', | |
1091 | include_directories : includes, | |
1092 | link_with : [lib_common], | |
1093 | dependencies : [lib_selinux], | |
1094 | install_dir : usrbin_exec_dir, | |
1095 | install : opt, | |
1096 | build_by_default : opt) | |
1097 | if opt and not is_disabler(exe) | |
1098 | exes += exe | |
1099 | meson.add_install_script(meson_make_symlink, | |
1100 | 'vipw', | |
1101 | join_paths(usrbin_exec_dir, 'vigr')) | |
38bb89ee | 1102 | manadocs += ['login-utils/vipw.8.adoc'] |
f6fb7fa7 CH |
1103 | meson.add_install_script(meson_make_symlink, |
1104 | 'vipw.8', | |
1105 | join_paths(mandir, 'man8/vigr.8')) | |
d4c880d5 ZJS |
1106 | endif |
1107 | ||
1108 | opt = not get_option('build-runuser').disabled() | |
1109 | exe = executable( | |
1110 | 'runuser', | |
1111 | 'login-utils/runuser.c', | |
1112 | 'login-utils/su-common.c', | |
1113 | 'login-utils/su-common.h', | |
4b724469 | 1114 | 'lib/shells.c', |
d4c880d5 ZJS |
1115 | pty_session_c, |
1116 | monotonic_c, | |
1117 | include_directories : includes, | |
0333c40b | 1118 | link_with : [lib_common, logindefs_c], |
d4c880d5 ZJS |
1119 | dependencies : [lib_pam, |
1120 | lib_pam_misc, | |
1121 | lib_util, | |
1122 | realtime_libs], | |
1123 | install_dir : sbindir, | |
1124 | install : opt, | |
1125 | build_by_default : opt) | |
1126 | if opt and not is_disabler(exe) | |
1127 | exes += exe | |
38bb89ee | 1128 | manadocs += ['login-utils/runuser.1.adoc'] |
aa519054 | 1129 | bashcompletionslinks += {'runuser': 'su'} |
d4c880d5 ZJS |
1130 | endif |
1131 | ||
1132 | ############################################################ | |
1133 | ||
8886d84e TW |
1134 | if is_glibc |
1135 | exe = executable( | |
1136 | 'col', | |
1137 | col_sources, | |
1138 | include_directories : includes, | |
1139 | link_with : lib_common, | |
1140 | install_dir : usrbin_exec_dir, | |
1141 | install : true) | |
1142 | exes += exe | |
1143 | manadocs += ['text-utils/col.1.adoc'] | |
1144 | bashcompletions += ['col'] | |
1145 | endif | |
d4c880d5 ZJS |
1146 | |
1147 | exe = executable( | |
1148 | 'colcrt', | |
1149 | colcrt_sources, | |
1150 | include_directories : includes, | |
1151 | install_dir : usrbin_exec_dir, | |
1152 | install : true) | |
1153 | exes += exe | |
38bb89ee TW |
1154 | manadocs += ['text-utils/colcrt.1.adoc'] |
1155 | bashcompletions += ['colcrt'] | |
d4c880d5 ZJS |
1156 | |
1157 | exe = executable( | |
1158 | 'colrm', | |
1159 | colrm_sources, | |
1160 | include_directories : includes, | |
1161 | link_with : lib_common, | |
1162 | install_dir : usrbin_exec_dir, | |
1163 | install : true) | |
1164 | exes += exe | |
38bb89ee TW |
1165 | manadocs += ['text-utils/colrm.1.adoc'] |
1166 | bashcompletions += ['colrm'] | |
d4c880d5 ZJS |
1167 | |
1168 | exe = executable( | |
1169 | 'rev', | |
1170 | rev_sources, | |
1171 | include_directories : includes, | |
1172 | install_dir : usrbin_exec_dir, | |
1173 | install : true) | |
1174 | exes += exe | |
38bb89ee TW |
1175 | manadocs += ['text-utils/rev.1.adoc'] |
1176 | bashcompletions += ['rev'] | |
d4c880d5 ZJS |
1177 | |
1178 | exe = executable( | |
1179 | 'column', | |
1180 | column_sources, | |
1181 | include_directories : includes, | |
1182 | link_with : [lib_common, | |
1183 | lib_smartcols], | |
1184 | install_dir : usrbin_exec_dir, | |
1185 | install : true) | |
1186 | if not is_disabler(exe) | |
1187 | exes += exe | |
38bb89ee TW |
1188 | manadocs += ['text-utils/column.1.adoc'] |
1189 | bashcompletions += ['column'] | |
d4c880d5 ZJS |
1190 | endif |
1191 | ||
1192 | opt = not get_option('build-line').disabled() | |
1193 | exe = executable( | |
1194 | 'line', | |
1195 | line_sources, | |
1196 | include_directories : includes, | |
1197 | install_dir : usrbin_exec_dir, | |
1198 | install : opt, | |
1199 | build_by_default : opt) | |
1200 | if opt and not is_disabler(exe) | |
1201 | exes += exe | |
38bb89ee | 1202 | manadocs += ['text-utils/line.1.adoc'] |
d4c880d5 ZJS |
1203 | endif |
1204 | ||
1205 | opt = not get_option('build-pg').disabled() | |
1206 | exe = executable( | |
1207 | 'pg', | |
1208 | pg_sources, | |
1209 | link_with : lib_common, | |
1210 | include_directories : includes, | |
1211 | dependencies : [lib_tinfo, | |
1212 | curses_libs], | |
1213 | install_dir : usrbin_exec_dir, | |
1214 | install : opt, | |
1215 | build_by_default : opt) | |
1216 | if opt and not is_disabler(exe) | |
1217 | exes += exe | |
38bb89ee TW |
1218 | manadocs += ['text-utils/pg.1.adoc'] |
1219 | bashcompletions += ['pg'] | |
d4c880d5 ZJS |
1220 | endif |
1221 | ||
1222 | opt = not get_option('build-ul').disabled() | |
1223 | exe = executable( | |
1224 | 'ul', | |
1225 | ul_sources, | |
1226 | include_directories : includes, | |
1227 | dependencies : [lib_tinfo, | |
1228 | curses_libs], | |
1229 | install_dir : usrbin_exec_dir, | |
1230 | install : opt, | |
1231 | build_by_default : opt) | |
1232 | if opt and not is_disabler(exe) | |
1233 | exes += exe | |
38bb89ee TW |
1234 | manadocs += ['text-utils/ul.1.adoc'] |
1235 | bashcompletions += ['ul'] | |
d4c880d5 ZJS |
1236 | endif |
1237 | ||
1238 | opt = not get_option('build-more').disabled() | |
1239 | exe = executable( | |
1240 | 'more', | |
1241 | more_sources, | |
308a0979 | 1242 | link_with : [lib_common], |
d4c880d5 ZJS |
1243 | include_directories : includes, |
1244 | dependencies : [lib_tinfo, | |
6e92db54 KZ |
1245 | curses_libs, |
1246 | lib_magic], | |
d4c880d5 ZJS |
1247 | install : opt, |
1248 | build_by_default : opt) | |
1249 | exe2 = executable( | |
1250 | 'test_more', | |
1251 | more_sources, | |
308a0979 | 1252 | link_with : [lib_common], |
d4c880d5 ZJS |
1253 | include_directories : includes, |
1254 | c_args : '-DTEST_PROGRAM', | |
1255 | dependencies : [lib_tinfo, | |
6e92db54 KZ |
1256 | curses_libs, |
1257 | lib_magic], | |
ba30b89c | 1258 | build_by_default : opt and program_tests) |
d4c880d5 ZJS |
1259 | exes += exe |
1260 | if opt and not is_disabler(exe) | |
1261 | exes += [exe, exe2] | |
38bb89ee TW |
1262 | manadocs += ['text-utils/more.1.adoc'] |
1263 | bashcompletions += ['more'] | |
d4c880d5 ZJS |
1264 | endif |
1265 | ||
1266 | exe = executable( | |
1267 | 'hexdump', | |
1268 | hexdump_sources, | |
1269 | include_directories : includes, | |
1270 | link_with : [lib_common, | |
1271 | lib_tcolors], | |
1272 | install_dir : usrbin_exec_dir, | |
1273 | install : true) | |
1274 | if not is_disabler(exe) | |
1275 | exes += exe | |
53b37016 | 1276 | manadocs += ['text-utils/hexdump.1.adoc'] |
38bb89ee | 1277 | bashcompletions += ['hexdump'] |
d4c880d5 ZJS |
1278 | endif |
1279 | ||
1280 | opt = not get_option('build-lsmem').disabled() | |
1281 | exe = executable( | |
1282 | 'lsmem', | |
1283 | lsmem_sources, | |
1284 | include_directories : includes, | |
1285 | link_with : [lib_common, | |
1286 | lib_smartcols], | |
1287 | install_dir : usrbin_exec_dir, | |
1288 | install : opt, | |
1289 | build_by_default : opt) | |
1290 | if opt and not is_disabler(exe) | |
1291 | exes += exe | |
53b37016 | 1292 | manadocs += ['sys-utils/lsmem.1.adoc'] |
38bb89ee | 1293 | bashcompletions += ['lsmem'] |
d4c880d5 ZJS |
1294 | endif |
1295 | ||
1296 | opt = not get_option('build-chmem').disabled() | |
1297 | exe = executable( | |
1298 | 'chmem', | |
1299 | chmem_sources, | |
1300 | include_directories : includes, | |
1301 | link_with : [lib_common], | |
1302 | install_dir : usrbin_exec_dir, | |
1303 | install : opt, | |
1304 | build_by_default : opt) | |
1305 | if opt and not is_disabler(exe) | |
1306 | exes += exe | |
53b37016 | 1307 | manadocs += ['sys-utils/chmem.8.adoc'] |
38bb89ee | 1308 | bashcompletions += ['chmem'] |
d4c880d5 ZJS |
1309 | endif |
1310 | ||
1311 | exe = executable( | |
1312 | 'choom', | |
1313 | choom_sources, | |
1314 | include_directories : includes, | |
1315 | link_with : [lib_common], | |
1316 | install_dir : usrbin_exec_dir, | |
1317 | install : true) | |
1318 | exes += exe | |
53b37016 | 1319 | manadocs += ['sys-utils/choom.1.adoc'] |
d4c880d5 ZJS |
1320 | |
1321 | exe = executable( | |
1322 | 'ipcmk', | |
1323 | ipcmk_sources, | |
1324 | include_directories : includes, | |
1325 | link_with : [lib_common], | |
1326 | install_dir : usrbin_exec_dir, | |
1327 | install : true) | |
1328 | exes += exe | |
53b37016 | 1329 | manadocs += ['sys-utils/ipcmk.1.adoc'] |
38bb89ee | 1330 | bashcompletions += ['ipcmk'] |
d4c880d5 ZJS |
1331 | |
1332 | exe = executable( | |
1333 | 'ipcrm', | |
1334 | ipcrm_sources, | |
1335 | include_directories : includes, | |
1336 | link_with : [lib_common], | |
1337 | install_dir : usrbin_exec_dir, | |
1338 | install : true) | |
1339 | exes += exe | |
53b37016 | 1340 | manadocs += ['sys-utils/ipcrm.1.adoc'] |
38bb89ee | 1341 | bashcompletions += ['ipcrm'] |
d4c880d5 ZJS |
1342 | |
1343 | opt = not get_option('build-ipcs').disabled() | |
1344 | exe = executable( | |
1345 | 'ipcs', | |
1346 | ipcs_sources, | |
1347 | include_directories : includes, | |
1348 | link_with : [lib_common], | |
1349 | install_dir : usrbin_exec_dir, | |
1350 | install : opt, | |
1351 | build_by_default : opt) | |
1352 | if opt and not is_disabler(exe) | |
1353 | exes += exe | |
53b37016 | 1354 | manadocs += ['sys-utils/ipcs.1.adoc'] |
38bb89ee | 1355 | bashcompletions += ['ipcs'] |
d4c880d5 ZJS |
1356 | endif |
1357 | ||
1358 | opt = not get_option('build-rfkill').disabled() | |
1359 | exe = executable( | |
1360 | 'rfkill', | |
1361 | rfkill_sources, | |
1362 | include_directories : includes, | |
1363 | link_with : [lib_common, | |
1364 | lib_smartcols], | |
1365 | install_dir : usrsbin_exec_dir, | |
1366 | install : opt, | |
1367 | build_by_default : opt) | |
1368 | if opt and not is_disabler(exe) | |
1369 | exes += exe | |
53b37016 | 1370 | manadocs += ['sys-utils/rfkill.8.adoc'] |
38bb89ee | 1371 | bashcompletions += ['rfkill'] |
d4c880d5 ZJS |
1372 | endif |
1373 | ||
1374 | exe = executable( | |
1375 | 'renice', | |
1376 | renice_sources, | |
1377 | include_directories : includes, | |
1378 | link_with : [lib_common, | |
1379 | lib_smartcols], | |
1380 | install_dir : usrbin_exec_dir, | |
1381 | install : true) | |
1382 | if not is_disabler(exe) | |
1383 | exes += exe | |
53b37016 | 1384 | manadocs += ['sys-utils/renice.1.adoc'] |
38bb89ee | 1385 | bashcompletions += ['renice'] |
d4c880d5 ZJS |
1386 | endif |
1387 | ||
f092076f DDM |
1388 | exe = executable( |
1389 | 'setpgid', | |
1390 | setpgid_sources, | |
1391 | include_directories: includes, | |
1392 | link_with : [lib_common, | |
1393 | lib_smartcols], | |
1394 | install_dir : usrbin_exec_dir, | |
1395 | install : true) | |
1396 | if opt and not is_disabler(exe) | |
1397 | exes += exe | |
1398 | manadocs += ['sys-utils/setpgid.1.adoc'] | |
1399 | bashcompletions += ['setpgid'] | |
1400 | endif | |
1401 | ||
d4c880d5 ZJS |
1402 | exe = executable( |
1403 | 'setsid', | |
1404 | setsid_sources, | |
1405 | include_directories : includes, | |
1406 | link_with : [lib_common, | |
1407 | lib_smartcols], | |
1408 | install_dir : usrbin_exec_dir, | |
1409 | install : true) | |
1410 | if opt and not is_disabler(exe) | |
1411 | exes += exe | |
53b37016 | 1412 | manadocs += ['sys-utils/setsid.1.adoc'] |
38bb89ee | 1413 | bashcompletions += ['setsid'] |
d4c880d5 ZJS |
1414 | endif |
1415 | ||
1416 | exe = executable( | |
1417 | 'readprofile', | |
1418 | readprofile_sources, | |
1419 | include_directories : includes, | |
1420 | link_with : [lib_common, | |
1421 | lib_smartcols], | |
1422 | install_dir : usrsbin_exec_dir, | |
1423 | install : true) | |
1424 | if not is_disabler(exe) | |
1425 | exes += exe | |
53b37016 | 1426 | manadocs += ['sys-utils/readprofile.8.adoc'] |
38bb89ee | 1427 | bashcompletions += ['readprofile'] |
d4c880d5 ZJS |
1428 | endif |
1429 | ||
1430 | opt = not get_option('build-tunelp').disabled() | |
1431 | exe = executable( | |
1432 | 'tunelp', | |
1433 | tunelp_sources, | |
1434 | include_directories : includes, | |
1435 | link_with : [lib_common], | |
1436 | install_dir : usrsbin_exec_dir, | |
1437 | install : opt, | |
1438 | build_by_default : opt) | |
1439 | if opt and not is_disabler(exe) | |
1440 | exes += exe | |
53b37016 | 1441 | manadocs += ['sys-utils/tunelp.8.adoc'] |
38bb89ee | 1442 | bashcompletions += ['tunelp'] |
d4c880d5 ZJS |
1443 | endif |
1444 | ||
1445 | exe = executable( | |
1446 | 'fstrim', | |
1447 | fstrim_sources, | |
1448 | include_directories : includes, | |
1449 | link_with : [lib_common, | |
1450 | lib_mount], | |
1451 | install_dir : sbindir, | |
1452 | install : true) | |
1453 | if not is_disabler(exe) | |
1454 | exes += exe | |
53b37016 | 1455 | manadocs += ['sys-utils/fstrim.8.adoc'] |
38bb89ee | 1456 | bashcompletions += ['fstrim'] |
d4c880d5 ZJS |
1457 | endif |
1458 | ||
1459 | exe = executable( | |
1460 | 'dmesg', | |
1461 | dmesg_sources, | |
1462 | include_directories : includes, | |
1463 | link_with : [lib_common, | |
1464 | lib_tcolors], | |
1465 | install : true) | |
1466 | if not is_disabler(exe) | |
1467 | exes += exe | |
53b37016 | 1468 | manadocs += ['sys-utils/dmesg.1.adoc'] |
38bb89ee | 1469 | bashcompletions += ['dmesg'] |
d4c880d5 ZJS |
1470 | endif |
1471 | ||
1472 | exe = executable( | |
1473 | 'test_dmesg', | |
1474 | dmesg_sources, | |
1475 | include_directories : dir_include, | |
1476 | c_args : '-DTEST_DMESG', | |
1477 | link_with : [lib_common, | |
ba30b89c | 1478 | lib_tcolors], |
1479 | build_by_default : program_tests) | |
d4c880d5 ZJS |
1480 | if not is_disabler(exe) |
1481 | exes += exe | |
1482 | endif | |
1483 | ||
1484 | exe = executable( | |
1485 | 'ctrlaltdel', | |
1486 | ctrlaltdel_sources, | |
1487 | include_directories : includes, | |
1488 | link_with : [lib_common], | |
1489 | install_dir : sbindir, | |
1490 | install : true) | |
1491 | exes += exe | |
53b37016 | 1492 | manadocs += ['sys-utils/ctrlaltdel.8.adoc'] |
38bb89ee | 1493 | bashcompletions += ['ctrlaltdel'] |
d4c880d5 ZJS |
1494 | |
1495 | exe = executable( | |
1496 | 'fsfreeze', | |
1497 | fsfreeze_sources, | |
1498 | include_directories : includes, | |
1499 | install_dir : sbindir, | |
1500 | install : true) | |
1501 | exes += exe | |
53b37016 | 1502 | manadocs += ['sys-utils/fsfreeze.8.adoc'] |
38bb89ee | 1503 | bashcompletions += ['fsfreeze'] |
d4c880d5 ZJS |
1504 | |
1505 | exe = executable( | |
1506 | 'blkdiscard', | |
1507 | blkdiscard_sources, | |
1508 | include_directories : includes, | |
308a0979 KZ |
1509 | link_with : [lib_common, |
1510 | lib_blkid], | |
d4c880d5 ZJS |
1511 | install_dir : sbindir, |
1512 | install : true) | |
1513 | exes += exe | |
53b37016 | 1514 | manadocs += ['sys-utils/blkdiscard.8.adoc'] |
38bb89ee | 1515 | bashcompletions += ['blkdiscard'] |
d4c880d5 ZJS |
1516 | |
1517 | exe = executable( | |
1518 | 'blkzone', | |
1519 | blkzone_sources, | |
1520 | include_directories : includes, | |
1521 | link_with : [lib_common], | |
1522 | install_dir : sbindir, | |
1523 | install : true) | |
1524 | exes += exe | |
53b37016 | 1525 | manadocs += ['sys-utils/blkzone.8.adoc'] |
38bb89ee | 1526 | bashcompletions += ['blkzone'] |
d4c880d5 | 1527 | |
61c2946d TW |
1528 | exe = executable( |
1529 | 'blkpr', | |
1530 | blkpr_sources, | |
1531 | include_directories : includes, | |
1532 | link_with : [lib_common], | |
1533 | install_dir : sbindir, | |
1534 | install : true) | |
1535 | exes += exe | |
1536 | manadocs += ['sys-utils/blkpr.8.adoc'] | |
1537 | ||
d4c880d5 ZJS |
1538 | exe = executable( |
1539 | 'ldattach', | |
1540 | ldattach_sources, | |
1541 | include_directories : includes, | |
1542 | link_with : [lib_common], | |
1543 | install_dir : usrsbin_exec_dir, | |
1544 | install : true) | |
1545 | exes += exe | |
53b37016 | 1546 | manadocs += ['sys-utils/ldattach.8.adoc'] |
38bb89ee | 1547 | bashcompletions += ['ldattach'] |
d4c880d5 ZJS |
1548 | |
1549 | exe = executable( | |
1550 | 'rtcwake', | |
1551 | rtcwake_sources, | |
1552 | include_directories : includes, | |
1553 | link_with : [lib_common], | |
1554 | install_dir : usrsbin_exec_dir, | |
1555 | install : true) | |
1556 | exes += exe | |
53b37016 | 1557 | manadocs += ['sys-utils/rtcwake.8.adoc'] |
38bb89ee | 1558 | bashcompletions += ['rtcwake'] |
d4c880d5 ZJS |
1559 | |
1560 | exe = executable( | |
1561 | 'setarch', | |
1562 | setarch_sources, | |
1563 | include_directories : includes, | |
035fc2d9 | 1564 | link_with : [lib_common], |
d4c880d5 ZJS |
1565 | install_dir : usrbin_exec_dir, |
1566 | install : true) | |
1567 | exes += exe | |
53b37016 | 1568 | manadocs += ['sys-utils/setarch.8.adoc'] |
38bb89ee | 1569 | bashcompletions += ['setarch'] |
d4c880d5 ZJS |
1570 | |
1571 | setarch_links = ['uname26', 'linux32', 'linux64'] | |
1572 | setarch_links_arch = { | |
1573 | 's390x' : ['s390', 's390x'], | |
1574 | 'x86' : ['i386'], | |
1575 | 'x86_64' : ['i386', 'x86_64'], | |
1576 | 'ppc64' : ['ppc', 'ppc64', 'ppc32'], | |
1577 | 'space64' : ['sparc', 'sparc64', 'sparc32', 'sparc32bash'], | |
1578 | 'mips64' : ['mips', 'mips64', 'mips32'], | |
1579 | 'ia64' : ['i386', 'ia64'], | |
1580 | 'hppa' : ['parisc', 'parisc64', 'parisc32'], | |
1581 | } | |
1582 | setarch_links += setarch_links_arch.get(host_machine.cpu_family(), []) | |
1583 | ||
1584 | foreach link: setarch_links | |
1585 | meson.add_install_script(meson_make_symlink, | |
1586 | 'setarch', | |
1587 | join_paths(usrbin_exec_dir, link)) | |
38bb89ee | 1588 | manlinks += {link + '.8': 'setarch.8'} |
d4c880d5 ZJS |
1589 | endforeach |
1590 | ||
1591 | opt = not get_option('build-eject').disabled() | |
1592 | exe = executable( | |
1593 | 'eject', | |
1594 | eject_sources, | |
1595 | include_directories : includes, | |
1596 | link_with : [lib_common, | |
1597 | lib_mount], | |
1598 | install_dir : usrbin_exec_dir, | |
1599 | install : opt, | |
1600 | build_by_default : opt) | |
1601 | if opt and not is_disabler(exe) | |
1602 | exe = exe | |
53b37016 | 1603 | manadocs += ['sys-utils/eject.1.adoc'] |
38bb89ee | 1604 | bashcompletions += ['eject'] |
d4c880d5 ZJS |
1605 | endif |
1606 | ||
1607 | opt = not get_option('build-losetup').disabled() | |
1608 | exe = executable( | |
1609 | 'losetup', | |
1610 | losetup_sources, | |
1611 | include_directories : includes, | |
1612 | link_with : [lib_common, | |
1613 | lib_smartcols], | |
1614 | install_dir : sbindir, | |
1615 | install : opt, | |
1616 | build_by_default : opt) | |
1617 | if opt and not is_disabler(exe) | |
53b37016 | 1618 | manadocs += ['sys-utils/losetup.8.adoc'] |
d4c880d5 | 1619 | exes += exe |
38bb89ee | 1620 | bashcompletions += ['losetup'] |
d4c880d5 ZJS |
1621 | endif |
1622 | ||
69939195 ZJS |
1623 | opt = opt and 'losetup' in static_programs |
1624 | exe = executable( | |
1625 | 'losetup.static', | |
1626 | losetup_sources, | |
1627 | include_directories : includes, | |
1628 | link_args : ['--static'], | |
1629 | link_with : [lib_common, | |
1630 | lib_smartcols.get_static_lib()], | |
1631 | install_dir : sbindir, | |
1632 | install : opt, | |
1633 | build_by_default : opt) | |
1634 | if opt and not is_disabler(exe) | |
1635 | exes += exe | |
1636 | endif | |
1637 | ||
d4c880d5 ZJS |
1638 | opt = not get_option('build-zramctl').disabled() |
1639 | exe = executable( | |
1640 | 'zramctl', | |
1641 | zramctl_sources, | |
1642 | include_directories : includes, | |
1643 | link_with : [lib_common, | |
1644 | lib_smartcols], | |
1645 | install_dir : sbindir, | |
1646 | install : opt, | |
1647 | build_by_default : opt) | |
1648 | if opt and not is_disabler(exe) | |
1649 | exes += exe | |
53b37016 | 1650 | manadocs += ['sys-utils/zramctl.8.adoc'] |
38bb89ee | 1651 | bashcompletions += ['zramctl'] |
d4c880d5 ZJS |
1652 | endif |
1653 | ||
1654 | exe = executable( | |
1655 | 'prlimit', | |
1656 | prlimit_sources, | |
1657 | include_directories : includes, | |
1658 | link_with : [lib_common, | |
1659 | lib_smartcols], | |
1660 | install_dir : usrbin_exec_dir, | |
1661 | install : true) | |
1662 | if not is_disabler(exe) | |
1663 | exes += exe | |
53b37016 | 1664 | manadocs += ['sys-utils/prlimit.1.adoc'] |
38bb89ee | 1665 | bashcompletions += ['prlimit'] |
d4c880d5 ZJS |
1666 | endif |
1667 | ||
1668 | exe = executable( | |
1669 | 'lsns', | |
1670 | lsns_sources, | |
1671 | include_directories : includes, | |
1672 | link_with : [lib_common, | |
1673 | lib_smartcols, | |
1674 | lib_mount], | |
1675 | install_dir : usrbin_exec_dir, | |
1676 | install : true) | |
1677 | if not is_disabler(exe) | |
1678 | exes += exe | |
53b37016 | 1679 | manadocs += ['sys-utils/lsns.8.adoc'] |
38bb89ee | 1680 | bashcompletions += ['lsns'] |
d4c880d5 ZJS |
1681 | endif |
1682 | ||
1683 | opt = not get_option('build-mount').disabled() | |
1684 | exe = executable( | |
1685 | 'mount', | |
1686 | mount_sources, | |
1687 | include_directories : includes, | |
1688 | link_with : [lib_common, | |
1689 | lib_smartcols, | |
1690 | lib_mount], | |
1691 | dependencies : lib_selinux, | |
8f49b369 | 1692 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
1693 | install : opt, |
1694 | build_by_default : opt) | |
1695 | exe2 = executable( | |
1696 | 'umount', | |
1697 | umount_sources, | |
1698 | include_directories : includes, | |
1699 | link_with : [lib_common, | |
1700 | lib_mount], | |
1cb3c90c | 1701 | install_mode : 'rwsr-xr-x', |
d4c880d5 ZJS |
1702 | install : opt, |
1703 | build_by_default : opt) | |
1704 | if opt and not is_disabler(exe) | |
1705 | exes += [exe, exe2] | |
53b37016 KZ |
1706 | manadocs += ['sys-utils/fstab.5.adoc', |
1707 | 'sys-utils/mount.8.adoc', | |
1708 | 'sys-utils/umount.8.adoc'] | |
38bb89ee | 1709 | bashcompletions += ['mount', 'umount'] |
d4c880d5 ZJS |
1710 | endif |
1711 | ||
69939195 ZJS |
1712 | opt2 = opt and 'mount' in static_programs |
1713 | exe = executable( | |
1714 | 'mount.static', | |
1715 | mount_sources, | |
1716 | include_directories : includes, | |
1717 | link_args : ['--static'], | |
1718 | link_with : [lib_common, | |
1719 | lib_smartcols_static, | |
1720 | lib_mount_static], | |
1721 | install : opt2, | |
1722 | build_by_default : opt2) | |
1723 | if opt2 and not is_disabler(exe) | |
1724 | exes += exe | |
1725 | endif | |
1726 | ||
1727 | opt2 = opt and 'umount' in static_programs | |
1728 | exe = executable( | |
1729 | 'umount.static', | |
1730 | umount_sources, | |
1731 | include_directories : includes, | |
1732 | link_args : ['--static'], | |
1733 | link_with : [lib_common, | |
1734 | lib_mount_static], | |
1735 | install : opt2, | |
1736 | build_by_default : opt2) | |
1737 | if opt2 and not is_disabler(exe) | |
1738 | exes += exe | |
1739 | endif | |
1740 | ||
d4c880d5 ZJS |
1741 | # setuid? |
1742 | ||
1743 | exe = executable( | |
1744 | 'swapon', | |
1745 | swapon_sources, | |
1746 | include_directories : includes, | |
1747 | link_with : [lib_common, | |
1748 | lib_blkid, | |
1749 | lib_mount, | |
1750 | lib_smartcols], | |
1751 | install_dir : sbindir, | |
1752 | install : true) | |
1753 | if not is_disabler(exe) | |
1754 | exes += exe | |
53b37016 | 1755 | manadocs += ['sys-utils/swapon.8.adoc'] |
38bb89ee | 1756 | bashcompletions += ['swapon'] |
d4c880d5 ZJS |
1757 | endif |
1758 | ||
1759 | exe = executable( | |
1760 | 'swapoff', | |
1761 | swapoff_sources, | |
1762 | include_directories : includes, | |
1763 | link_with : [lib_common, | |
1764 | lib_blkid, | |
1765 | lib_mount], | |
1766 | install_dir : sbindir, | |
1767 | install : true) | |
1768 | if not is_disabler(exe) | |
1769 | exes += exe | |
38bb89ee TW |
1770 | manlinks += {'swapoff.8': 'swapon.8'} |
1771 | bashcompletions += ['swapoff'] | |
d4c880d5 ZJS |
1772 | endif |
1773 | ||
1774 | exe = executable( | |
1775 | 'lscpu', | |
1776 | lscpu_sources, | |
1777 | include_directories : includes, | |
1778 | link_with : [lib_common, | |
1779 | lib_smartcols], | |
1780 | dependencies : [rtas_libs], | |
1781 | install_dir : usrbin_exec_dir, | |
1782 | install : true) | |
1783 | if not is_disabler(exe) | |
1784 | exes += exe | |
53b37016 | 1785 | manadocs += ['sys-utils/lscpu.1.adoc'] |
38bb89ee | 1786 | bashcompletions += ['lscpu'] |
d4c880d5 ZJS |
1787 | endif |
1788 | ||
1789 | exe = executable( | |
1790 | 'chcpu', | |
1791 | chcpu_sources, | |
1792 | include_directories : includes, | |
1793 | link_with : [lib_common], | |
1794 | install_dir : sbindir, | |
1795 | install : true) | |
1796 | exes += exe | |
53b37016 | 1797 | manadocs += ['sys-utils/chcpu.8.adoc'] |
38bb89ee | 1798 | bashcompletions += ['chcpu'] |
d4c880d5 ZJS |
1799 | |
1800 | exe = executable( | |
1801 | 'wdctl', | |
1802 | wdctl_sources, | |
1803 | include_directories : includes, | |
1804 | link_with : [lib_common, | |
1805 | lib_smartcols], | |
1806 | install : true) | |
1807 | if not is_disabler(exe) | |
1808 | exes += exe | |
53b37016 | 1809 | manadocs += ['sys-utils/wdctl.8.adoc'] |
38bb89ee | 1810 | bashcompletions += ['wdctl'] |
d4c880d5 ZJS |
1811 | endif |
1812 | ||
1813 | opt = not get_option('build-mountpoint').disabled() | |
1814 | exe = executable( | |
1815 | 'mountpoint', | |
1816 | mountpoint_sources, | |
1817 | include_directories : includes, | |
1818 | link_with : [lib_mount], | |
1819 | install : opt, | |
1820 | build_by_default : opt) | |
1821 | if opt and not is_disabler(exe) | |
1822 | exes += exe | |
53b37016 | 1823 | manadocs += ['sys-utils/mountpoint.1.adoc'] |
38bb89ee | 1824 | bashcompletions += ['mountpoint'] |
d4c880d5 ZJS |
1825 | endif |
1826 | ||
1827 | opt = not get_option('build-fallocate').disabled() | |
1828 | exe = executable( | |
1829 | 'fallocate', | |
1830 | fallocate_sources, | |
1831 | include_directories : includes, | |
1832 | link_with : [lib_common], | |
1833 | install_dir : usrbin_exec_dir, | |
1834 | install : opt, | |
1835 | build_by_default : opt) | |
1836 | if opt and not is_disabler(exe) | |
1837 | exes += exe | |
53b37016 | 1838 | manadocs += ['sys-utils/fallocate.1.adoc'] |
38bb89ee | 1839 | bashcompletions += ['fallocate'] |
d4c880d5 ZJS |
1840 | endif |
1841 | ||
1842 | opt = not get_option('build-pivot_root').disabled() | |
1843 | exe = executable( | |
1844 | 'pivot_root', | |
1845 | pivot_root_sources, | |
1846 | include_directories : includes, | |
1847 | install_dir : sbindir, | |
1848 | install : opt, | |
1849 | build_by_default : opt) | |
1850 | if opt and not is_disabler(exe) | |
1851 | exes += exe | |
53b37016 | 1852 | manadocs += ['sys-utils/pivot_root.8.adoc'] |
38bb89ee | 1853 | bashcompletions += ['pivot_root'] |
d4c880d5 ZJS |
1854 | endif |
1855 | ||
1856 | opt = not get_option('build-switch_root').disabled() | |
1857 | if opt and not have_dirfd and not have_ddfd | |
1858 | error('neither dirfd nor ddfd are available') | |
1859 | endif | |
1860 | exe = executable( | |
1861 | 'switch_root', | |
1862 | switch_root_sources, | |
1863 | include_directories : includes, | |
1864 | install_dir : sbindir, | |
1865 | install : opt, | |
1866 | build_by_default : opt) | |
1867 | if opt and not is_disabler(exe) | |
1868 | exes += exe | |
53b37016 | 1869 | manadocs += ['sys-utils/switch_root.8.adoc'] |
d4c880d5 ZJS |
1870 | endif |
1871 | ||
1872 | opt = not get_option('build-unshare').disabled() | |
1873 | exe = executable( | |
1874 | 'unshare', | |
1875 | unshare_sources, | |
1876 | include_directories : includes, | |
1877 | link_with : [lib_common], | |
1878 | install_dir : usrbin_exec_dir, | |
1879 | install : opt, | |
1880 | build_by_default : opt) | |
1881 | if opt and not is_disabler(exe) | |
1882 | exes += exe | |
53b37016 | 1883 | manadocs += ['sys-utils/unshare.1.adoc'] |
38bb89ee | 1884 | bashcompletions += ['unshare'] |
d4c880d5 ZJS |
1885 | endif |
1886 | ||
69939195 ZJS |
1887 | opt = opt and 'unshare' in static_programs |
1888 | exe = executable( | |
1889 | 'unshare.static', | |
1890 | unshare_sources, | |
1891 | include_directories : includes, | |
1892 | link_with : [lib_common], | |
1893 | install_dir : usrbin_exec_dir, | |
1894 | install : opt, | |
1895 | build_by_default : opt) | |
1896 | if opt and not is_disabler(exe) | |
1897 | exes += exe | |
1898 | endif | |
1899 | ||
d4c880d5 ZJS |
1900 | opt = not get_option('build-nsenter').disabled() |
1901 | exe = executable( | |
1902 | 'nsenter', | |
1903 | nsenter_sources, | |
1904 | include_directories : includes, | |
1905 | link_with : [lib_common], | |
1906 | dependencies : [lib_selinux], | |
1907 | install_dir : usrbin_exec_dir, | |
1908 | install : opt, | |
1909 | build_by_default : opt) | |
1910 | if opt and not is_disabler(exe) | |
1911 | exes += exe | |
53b37016 | 1912 | manadocs += ['sys-utils/nsenter.1.adoc'] |
38bb89ee | 1913 | bashcompletions += ['nsenter'] |
d4c880d5 ZJS |
1914 | endif |
1915 | ||
69939195 ZJS |
1916 | opt = opt and 'nsenter' in static_programs |
1917 | exe = executable( | |
1918 | 'nsenter.static', | |
1919 | nsenter_sources, | |
1920 | include_directories : includes, | |
1921 | link_with : [lib_common], | |
1922 | dependencies : [lib_selinux], | |
1923 | install_dir : usrbin_exec_dir, | |
1924 | install : opt, | |
1925 | build_by_default : opt) | |
1926 | if opt and not is_disabler(exe) | |
1927 | exes += exe | |
1928 | endif | |
1929 | ||
cd23a433 | 1930 | opt = not get_option('build-setpriv').disabled() and lib_cap_ng.found() |
d4c880d5 ZJS |
1931 | exe = executable( |
1932 | 'setpriv', | |
1933 | setpriv_sources, | |
1934 | include_directories : includes, | |
1935 | link_with : [lib_common], | |
1936 | dependencies : [lib_cap_ng], | |
1937 | install_dir : usrbin_exec_dir, | |
1938 | install : opt, | |
1939 | build_by_default : opt) | |
1940 | if opt and not is_disabler(exe) | |
1941 | exes += exe | |
53b37016 | 1942 | manadocs += ['sys-utils/setpriv.1.adoc'] |
38bb89ee | 1943 | bashcompletions += ['setpriv'] |
d4c880d5 ZJS |
1944 | endif |
1945 | ||
1946 | exe = executable( | |
1947 | 'flock', | |
1948 | flock_sources, | |
1949 | include_directories : includes, | |
1950 | link_with : [lib_common], | |
1951 | dependencies : realtime_libs, | |
1952 | install_dir : usrbin_exec_dir, | |
1953 | install : true) | |
1954 | exes += exe | |
53b37016 | 1955 | manadocs += ['sys-utils/flock.1.adoc'] |
38bb89ee | 1956 | bashcompletions += ['flock'] |
d4c880d5 | 1957 | |
645577c7 KZ |
1958 | opt = not get_option('build-lsirq').disabled() |
1959 | exe = executable( | |
1960 | 'lsirq', | |
1961 | lsirq_sources, | |
1962 | include_directories : includes, | |
1963 | link_with : [lib_common, | |
1964 | lib_smartcols], | |
1965 | install_dir : usrbin_exec_dir, | |
1966 | install : opt, | |
1967 | build_by_default : opt) | |
1968 | if opt and not is_disabler(exe) | |
1969 | exes += exe | |
53b37016 | 1970 | manadocs += ['sys-utils/lsirq.1.adoc'] |
38bb89ee | 1971 | bashcompletions += ['lsirq'] |
645577c7 KZ |
1972 | endif |
1973 | ||
1974 | opt = not get_option('build-irqtop').disabled() | |
1975 | exe = executable( | |
1976 | 'irqtop', | |
1977 | irqtop_sources, | |
1978 | include_directories : includes, | |
1979 | dependencies : [realtime_libs, curses_libs], | |
1980 | link_with : [lib_common, | |
1981 | lib_smartcols, | |
1982 | lib_tcolors], | |
1983 | install_dir : usrbin_exec_dir, | |
1984 | install : opt, | |
1985 | build_by_default : opt) | |
1986 | if opt and not is_disabler(exe) | |
1987 | exes += exe | |
53b37016 | 1988 | manadocs += ['sys-utils/irqtop.1.adoc'] |
38bb89ee | 1989 | bashcompletions += ['irqtop'] |
645577c7 KZ |
1990 | endif |
1991 | ||
d4c880d5 ZJS |
1992 | opt = not get_option('build-ipcs').disabled() |
1993 | exe = executable( | |
1994 | 'lsipc', | |
1995 | lsipc_sources, | |
1996 | include_directories : includes, | |
1997 | link_with : [lib_common, | |
1998 | lib_smartcols], | |
1999 | install_dir : usrbin_exec_dir, | |
2000 | install : opt, | |
2001 | build_by_default : opt) | |
2002 | if opt and not is_disabler(exe) | |
2003 | exes += exe | |
53b37016 | 2004 | manadocs += ['sys-utils/lsipc.1.adoc'] |
38bb89ee | 2005 | bashcompletions += ['lsipc'] |
d4c880d5 ZJS |
2006 | endif |
2007 | ||
2008 | opt = build_hwclock | |
2009 | exe = executable( | |
2010 | 'hwclock', | |
2011 | hwclock_sources, | |
2012 | include_directories : includes, | |
2013 | link_with : [lib_common], | |
2014 | dependencies : [lib_m, | |
2015 | lib_audit], | |
2016 | install_dir : sbindir, | |
2017 | install : opt, | |
2018 | build_by_default : opt) | |
2019 | if opt and not is_disabler(exe) | |
2020 | exes += exe | |
38bb89ee TW |
2021 | manadocs += ['sys-utils/hwclock.8.adoc', 'sys-utils/adjtime_config.5.adoc'] |
2022 | bashcompletions += ['hwclock'] | |
d4c880d5 ZJS |
2023 | endif |
2024 | ||
2025 | exe = executable( | |
2026 | 'mkfs', | |
2027 | mkfs_sources, | |
2028 | include_directories : includes, | |
2029 | install_dir : sbindir, | |
2030 | install : true) | |
2031 | exes += exe | |
53b37016 | 2032 | manadocs += ['disk-utils/mkfs.8.adoc'] |
38bb89ee | 2033 | bashcompletions += ['mkfs'] |
d4c880d5 ZJS |
2034 | |
2035 | opt = not get_option('build-bfs').disabled() | |
2036 | exe = executable( | |
2037 | 'mkfs.bfs', | |
2038 | mkfs_bfs_sources, | |
2039 | include_directories : includes, | |
2040 | link_with : [lib_common], | |
2041 | install_dir : sbindir, | |
2042 | install : opt, | |
2043 | build_by_default : opt) | |
2044 | if opt and not is_disabler(exe) | |
2045 | exes += exe | |
53b37016 | 2046 | manadocs += ['disk-utils/mkfs.bfs.8.adoc'] |
38bb89ee | 2047 | bashcompletions += ['mkfs.bfs'] |
d4c880d5 ZJS |
2048 | endif |
2049 | ||
2050 | exe = executable( | |
2051 | 'isosize', | |
2052 | isosize_sources, | |
2053 | include_directories : includes, | |
2054 | link_with : [lib_common], | |
2055 | install_dir : usrbin_exec_dir, | |
2056 | install : true) | |
2057 | exes += exe | |
53b37016 | 2058 | manadocs += ['disk-utils/isosize.8.adoc'] |
38bb89ee | 2059 | bashcompletions += ['isosize'] |
d4c880d5 ZJS |
2060 | |
2061 | exe = executable( | |
2062 | 'mkswap', | |
2063 | mkswap_sources, | |
2064 | include_directories : includes, | |
2065 | link_with : [lib_common, | |
2066 | lib_blkid, | |
2067 | lib_uuid], | |
2068 | dependencies: [lib_selinux], | |
2069 | install_dir : sbindir, | |
2070 | install : true) | |
2071 | if opt and not is_disabler(exe) | |
2072 | exes += exe | |
53b37016 | 2073 | manadocs += ['disk-utils/mkswap.8.adoc'] |
38bb89ee | 2074 | bashcompletions += ['mkswap'] |
d4c880d5 ZJS |
2075 | endif |
2076 | ||
2077 | exe = executable( | |
2078 | 'swaplabel', | |
2079 | swaplabel_sources, | |
2080 | include_directories : includes, | |
2081 | link_with : [lib_common, | |
2082 | lib_blkid, | |
2083 | lib_uuid], | |
2084 | install_dir : sbindir, | |
2085 | install : true) | |
2086 | if opt and not is_disabler(exe) | |
2087 | exes += exe | |
53b37016 | 2088 | manadocs += ['disk-utils/swaplabel.8.adoc'] |
38bb89ee | 2089 | bashcompletions += ['swaplabel'] |
d4c880d5 ZJS |
2090 | endif |
2091 | ||
2092 | opt = not get_option('build-fsck').disabled() | |
2093 | exe = executable( | |
2094 | 'fsck', | |
2095 | fsck_sources, | |
2096 | include_directories : includes, | |
2097 | link_with : [lib_common, | |
2098 | lib_blkid, | |
2099 | lib_mount], | |
2100 | dependencies : realtime_libs, | |
2101 | install_dir : sbindir, | |
2102 | install : opt, | |
2103 | build_by_default : opt) | |
2104 | if opt and not is_disabler(exe) | |
2105 | exes += exe | |
53b37016 | 2106 | manadocs += ['disk-utils/fsck.8.adoc'] |
38bb89ee | 2107 | bashcompletions += ['fsck'] |
d4c880d5 ZJS |
2108 | endif |
2109 | ||
2110 | opt = not get_option('build-minix').disabled() | |
2111 | exe = executable( | |
2112 | 'mkfs.minix', | |
2113 | mkfs_minix_sources, | |
2114 | include_directories : includes, | |
2115 | link_with : [lib_common], | |
2116 | install_dir : sbindir, | |
2117 | install : opt, | |
2118 | build_by_default : opt) | |
2119 | exe2 = executable( | |
2120 | 'test_mkfs_minix', | |
2121 | mkfs_minix_sources, | |
2122 | include_directories : includes, | |
2123 | c_args : '-DTEST_SCRIPT', | |
2124 | link_with : [lib_common], | |
ba30b89c | 2125 | build_by_default : opt and program_tests) |
d4c880d5 ZJS |
2126 | exe3 = executable( |
2127 | 'fsck.minix', | |
2128 | fsck_minix_sources, | |
2129 | include_directories : includes, | |
2130 | link_with : [lib_common], | |
2131 | install_dir : sbindir, | |
2132 | install : opt, | |
2133 | build_by_default : opt) | |
2134 | if opt and not is_disabler(exe) | |
2135 | exes += [exe, exe2, exe3] | |
53b37016 | 2136 | manadocs += ['disk-utils/mkfs.minix.8.adoc','disk-utils/fsck.minix.8.adoc'] |
38bb89ee | 2137 | bashcompletions += ['mkfs.minix', 'fsck.minix'] |
d4c880d5 ZJS |
2138 | endif |
2139 | ||
2140 | opt = not get_option('build-cramfs').disabled() | |
2141 | exe = executable( | |
2142 | 'mkfs.cramfs', | |
2143 | mkfs_cramfs_sources, | |
2144 | include_directories : includes, | |
2145 | link_with : [lib_common], | |
2146 | dependencies : [lib_z], | |
2147 | install_dir : sbindir, | |
2148 | install : opt, | |
2149 | build_by_default : opt) | |
2150 | exe2 = executable( | |
2151 | 'fsck.cramfs', | |
2152 | fsck_cramfs_sources, | |
2153 | include_directories : includes, | |
2154 | link_with : [lib_common], | |
2155 | dependencies : [lib_z], | |
2156 | install_dir : sbindir, | |
2157 | install : opt, | |
2158 | build_by_default : opt) | |
2159 | if not is_disabler(exe) | |
2160 | exes += [exe, exe2] | |
53b37016 | 2161 | manadocs += ['disk-utils/mkfs.cramfs.8.adoc','disk-utils/fsck.cramfs.8.adoc'] |
38bb89ee | 2162 | bashcompletions += ['mkfs.cramfs', 'fsck.cramfs'] |
d4c880d5 ZJS |
2163 | endif |
2164 | ||
2165 | opt = not get_option('build-raw').disabled() | |
dff176e2 | 2166 | if opt |
433e4b77 | 2167 | cc.has_header('linux/raw.h', required: opt) |
dff176e2 | 2168 | endif |
d4c880d5 ZJS |
2169 | exe = executable( |
2170 | 'raw', | |
2171 | raw_sources, | |
2172 | include_directories : includes, | |
2173 | install_dir : sbindir, | |
2174 | install : opt, | |
2175 | build_by_default : opt) | |
2176 | if opt and not is_disabler(exe) | |
2177 | exes += exe | |
53b37016 | 2178 | manadocs += ['disk-utils/raw.8.adoc'] |
38bb89ee | 2179 | bashcompletions += ['raw'] |
d4c880d5 ZJS |
2180 | endif |
2181 | ||
2182 | opt = not get_option('build-fdformat').disabled() | |
2183 | exe = executable( | |
2184 | 'fdformat', | |
2185 | fdformat_sources, | |
2186 | include_directories : includes, | |
2187 | link_with : [lib_common], | |
2188 | install_dir : usrsbin_exec_dir, | |
2189 | install : opt, | |
2190 | build_by_default : opt) | |
2191 | if opt and not is_disabler(exe) | |
2192 | exes += exe | |
53b37016 | 2193 | manadocs += ['disk-utils/fdformat.8.adoc'] |
d4c880d5 ZJS |
2194 | endif |
2195 | ||
2196 | exe = executable( | |
2197 | 'blockdev', | |
2198 | blockdev_sources, | |
2199 | include_directories : includes, | |
2200 | link_with : [lib_common], | |
2201 | install_dir : sbindir, | |
2202 | install : true) | |
53b37016 | 2203 | manadocs += ['disk-utils/blockdev.8.adoc'] |
38bb89ee | 2204 | bashcompletions += ['blockdev'] |
d4c880d5 ZJS |
2205 | |
2206 | opt = not get_option('build-fdisks').disabled() | |
2207 | if opt and not have_dirfd and not have_ddfd | |
2208 | error('neither dirfd nor ddfd are available') | |
2209 | endif | |
2210 | exe = executable( | |
2211 | 'fdisk', | |
2212 | fdisk_sources, | |
2213 | include_directories : includes, | |
2214 | link_with : [lib_common, | |
2215 | lib_fdisk, | |
2216 | lib_smartcols, | |
2217 | lib_tcolors], | |
2218 | dependencies : [lib_readline], | |
2219 | install_dir : sbindir, | |
2220 | install : opt, | |
2221 | build_by_default : opt) | |
2222 | if opt and not is_disabler(exe) | |
2223 | exes += exe | |
38bb89ee | 2224 | bashcompletions += ['fdisk'] |
d4c880d5 ZJS |
2225 | endif |
2226 | ||
69939195 ZJS |
2227 | opt2 = opt and 'fdisk' in static_programs |
2228 | exe = executable( | |
2229 | 'fdisk.static', | |
2230 | fdisk_sources, | |
2231 | link_args : ['--static'], | |
2232 | include_directories : includes, | |
2233 | link_with : [lib_common, | |
2234 | lib_tcolors, | |
2235 | lib_fdisk_static, | |
2236 | lib_smartcols.get_static_lib()], | |
2237 | dependencies : [lib_readline_static], | |
2238 | install_dir : sbindir, | |
2239 | install : opt2, | |
2240 | build_by_default : opt2) | |
2241 | if opt2 and not is_disabler(exe) | |
2242 | exes += exe | |
2243 | endif | |
d4c880d5 ZJS |
2244 | |
2245 | exe = executable( | |
2246 | 'sfdisk', | |
2247 | sfdisk_sources, | |
2248 | include_directories : includes, | |
2249 | link_with : [lib_common, | |
2250 | lib_fdisk, | |
2251 | lib_smartcols, | |
2252 | lib_tcolors], | |
2253 | dependencies : [lib_readline], | |
2254 | install_dir : sbindir, | |
2255 | install : opt, | |
2256 | build_by_default : opt) | |
2257 | if opt and not is_disabler(exe) | |
2258 | exes += exe | |
38bb89ee | 2259 | bashcompletions += ['sfdisk'] |
d4c880d5 ZJS |
2260 | endif |
2261 | ||
69939195 ZJS |
2262 | opt2 = opt and 'sfdisk' in static_programs |
2263 | exe = executable( | |
2264 | 'sfdisk.static', | |
2265 | sfdisk_sources, | |
2266 | include_directories : includes, | |
2267 | link_with : [lib_common, | |
2268 | lib_tcolors, | |
2269 | lib_fdisk_static, | |
2270 | lib_smartcols.get_static_lib()], | |
2271 | dependencies : [lib_readline_static], | |
2272 | install_dir : sbindir, | |
2273 | install : opt2, | |
2274 | build_by_default : opt2) | |
2275 | if opt2 and not is_disabler(exe) | |
2276 | exes += exe | |
2277 | endif | |
d4c880d5 ZJS |
2278 | |
2279 | exe = executable( | |
2280 | 'cfdisk', | |
2281 | cfdisk_sources, | |
2282 | include_directories : includes, | |
2283 | link_with : [lib_common, | |
2284 | lib_fdisk, | |
2285 | lib_smartcols, | |
2286 | lib_tcolors, | |
2287 | lib_mount], | |
2288 | dependencies : [curses_libs], | |
2289 | install_dir : sbindir, | |
2290 | install : opt, | |
2291 | build_by_default : opt) | |
2292 | if opt and not is_disabler(exe) | |
2293 | exes += exe | |
53b37016 KZ |
2294 | manadocs += ['disk-utils/fdisk.8.adoc', |
2295 | 'disk-utils/sfdisk.8.adoc', | |
2296 | 'disk-utils/cfdisk.8.adoc'] | |
38bb89ee | 2297 | bashcompletions += ['cfdisk'] |
d4c880d5 ZJS |
2298 | endif |
2299 | ||
2300 | opt = not get_option('build-partx').disabled() | |
2301 | exe = executable( | |
2302 | 'addpart', | |
2303 | addpart_sources, | |
2304 | include_directories : includes, | |
2305 | link_with : [lib_common], | |
2306 | install_dir : usrsbin_exec_dir, | |
2307 | install : opt, | |
2308 | build_by_default : opt) | |
2309 | exe2 = executable( | |
2310 | 'delpart', | |
2311 | delpart_sources, | |
2312 | include_directories : includes, | |
2313 | link_with : [lib_common], | |
2314 | install_dir : usrsbin_exec_dir, | |
2315 | install : opt, | |
2316 | build_by_default : opt) | |
2317 | exe3 = executable( | |
2318 | 'resizepart', | |
2319 | resizepart_sources, | |
2320 | include_directories : includes, | |
2321 | link_with : [lib_common], | |
2322 | install_dir : usrsbin_exec_dir, | |
2323 | install : opt, | |
2324 | build_by_default : opt) | |
2325 | exe4 = executable( | |
2326 | 'partx', | |
2327 | partx_sources, | |
2328 | include_directories : includes, | |
2329 | link_with : [lib_common, | |
2330 | lib_blkid, | |
2331 | lib_smartcols], | |
2332 | install_dir : usrsbin_exec_dir, | |
2333 | install : opt, | |
2334 | build_by_default : opt) | |
2335 | if opt | |
2336 | exes += [exe, exe2, exe3, exe4] | |
53b37016 KZ |
2337 | manadocs += ['disk-utils/addpart.8.adoc', |
2338 | 'disk-utils/delpart.8.adoc', | |
2339 | 'disk-utils/resizepart.8.adoc', | |
2340 | 'disk-utils/partx.8.adoc'] | |
38bb89ee | 2341 | bashcompletions += ['addpart', 'delpart', 'resizepart', 'partx'] |
d4c880d5 ZJS |
2342 | endif |
2343 | ||
2344 | ############################################################ | |
2345 | ||
2346 | exe = executable( | |
2347 | 'script', | |
2348 | script_sources, | |
2349 | include_directories : includes, | |
2350 | link_with : [lib_common], | |
2351 | dependencies : [lib_util, | |
2352 | lib_utempter, | |
2353 | realtime_libs, | |
2354 | math_libs], | |
2355 | install_dir : usrbin_exec_dir, | |
2356 | install : true) | |
2357 | exes += exe | |
53b37016 | 2358 | manadocs += ['term-utils/script.1.adoc'] |
38bb89ee | 2359 | bashcompletions += ['script'] |
d4c880d5 ZJS |
2360 | |
2361 | exe = executable( | |
2362 | 'test_script', | |
2363 | script_sources, | |
2364 | include_directories : includes, | |
2365 | c_args : '-DTEST_SCRIPT', | |
2366 | link_with : [lib_common], | |
2367 | dependencies : [lib_util, | |
2368 | lib_utempter, | |
2369 | realtime_libs, | |
ba30b89c | 2370 | math_libs], |
2371 | build_by_default : program_tests) | |
d4c880d5 ZJS |
2372 | exes += exe |
2373 | ||
2374 | exe = executable( | |
2375 | 'scriptlive', | |
2376 | scriptlive_sources, | |
2377 | include_directories : includes, | |
2378 | link_with : [lib_common], | |
2379 | dependencies : [lib_util, | |
2380 | realtime_libs, | |
2381 | math_libs], | |
2382 | install_dir : usrbin_exec_dir, | |
2383 | install : true) | |
2384 | exes += exe | |
53b37016 | 2385 | manadocs += ['term-utils/scriptlive.1.adoc'] |
38bb89ee | 2386 | bashcompletions += ['scriptlive'] |
d4c880d5 ZJS |
2387 | |
2388 | exe = executable( | |
2389 | 'scriptreplay', | |
2390 | scriptreplay_sources, | |
2391 | include_directories : includes, | |
2392 | link_with : [lib_common], | |
2393 | dependencies : [math_libs], | |
2394 | install_dir : usrbin_exec_dir, | |
2395 | install : true) | |
2396 | exes += exe | |
53b37016 | 2397 | manadocs += ['term-utils/scriptreplay.1.adoc'] |
38bb89ee | 2398 | bashcompletions += ['scriptreplay'] |
d4c880d5 ZJS |
2399 | |
2400 | opt = not get_option('build-agetty').disabled() | |
2401 | exe = executable( | |
2402 | 'agetty', | |
2403 | agetty_sources, | |
2404 | include_directories : includes, | |
0333c40b | 2405 | link_with : [lib_common, logindefs_c], |
87fcd95a | 2406 | dependencies : [BSD ? lib_util : [], lib_systemd], |
d4c880d5 ZJS |
2407 | install_dir : sbindir, |
2408 | install : opt, | |
2409 | build_by_default : opt) | |
2410 | if opt | |
2411 | exes += exe | |
53b37016 | 2412 | manadocs += ['term-utils/agetty.8.adoc'] |
d4c880d5 ZJS |
2413 | endif |
2414 | ||
2415 | opt = not get_option('build-setterm').disabled() | |
2416 | exe = executable( | |
2417 | 'setterm', | |
2418 | setterm_sources, | |
2419 | include_directories : includes, | |
2420 | link_with : [lib_common], | |
2421 | dependencies : [curses_libs], | |
2422 | install_dir : usrbin_exec_dir, | |
2423 | install : opt, | |
2424 | build_by_default : opt) | |
2425 | if opt | |
2426 | exes += exe | |
53b37016 | 2427 | manadocs += ['term-utils/setterm.1.adoc'] |
38bb89ee | 2428 | bashcompletions += ['setterm'] |
d4c880d5 ZJS |
2429 | endif |
2430 | ||
2431 | opt = not get_option('build-mesg').disabled() | |
2432 | exe = executable( | |
2433 | 'mesg', | |
2434 | mesg_sources, | |
2435 | include_directories : includes, | |
2436 | link_with : [lib_common], | |
2437 | install_dir : usrbin_exec_dir, | |
2438 | install : opt, | |
2439 | build_by_default : opt) | |
2440 | if opt | |
2441 | exes += exe | |
53b37016 | 2442 | manadocs += ['term-utils/mesg.1.adoc'] |
38bb89ee | 2443 | bashcompletions += ['mesg'] |
d4c880d5 ZJS |
2444 | endif |
2445 | ||
2446 | opt = not get_option('build-wall').disabled() | |
2447 | exe = executable( | |
2448 | 'wall', | |
2449 | wall_sources, | |
2450 | include_directories : includes, | |
2451 | link_with : [lib_common], | |
87fcd95a | 2452 | dependencies : [lib_systemd], |
d4c880d5 | 2453 | install_dir : usrbin_exec_dir, |
5f3359c5 | 2454 | install_mode : [ 'rwxr-sr-x', 'root', 'tty' ], |
d4c880d5 ZJS |
2455 | install : opt, |
2456 | build_by_default : opt) | |
2457 | if opt | |
2458 | exes += exe | |
53b37016 | 2459 | manadocs += ['term-utils/wall.1.adoc'] |
38bb89ee | 2460 | bashcompletions += ['wall'] |
d4c880d5 ZJS |
2461 | endif |
2462 | ||
2463 | # chgrp tty $(DESTDIR)$(usrbin_execdir)/wall | |
2464 | # chmod g+s $(DESTDIR)$(usrbin_execdir)/wall | |
2465 | ||
2466 | opt = not get_option('build-write').disabled() | |
2467 | exe = executable( | |
2468 | 'write', | |
2469 | write_sources, | |
2470 | include_directories : includes, | |
2471 | link_with : [lib_common], | |
87fcd95a | 2472 | dependencies : [lib_systemd], |
d4c880d5 | 2473 | install_dir : usrbin_exec_dir, |
00f115d8 | 2474 | install_mode : [ 'rwxr-sr-x', 'root', 'tty' ], |
d4c880d5 ZJS |
2475 | install : opt, |
2476 | build_by_default : opt) | |
2477 | if opt | |
2478 | exes += exe | |
53b37016 | 2479 | manadocs += ['term-utils/write.1.adoc'] |
e1cd4002 | 2480 | bashcompletions += ['write'] |
d4c880d5 ZJS |
2481 | endif |
2482 | ||
2483 | # chgrp tty $(DESTDIR)$(usrbin_execdir)/write | |
2484 | # chmod g+s $(DESTDIR)$(usrbin_execdir)/write | |
2485 | ||
2486 | opt = not get_option('build-login').disabled() | |
2487 | exe = executable( | |
2488 | 'login', | |
2489 | login_sources, | |
2490 | include_directories : includes, | |
0333c40b | 2491 | link_with : [lib_common, logindefs_c], |
d4c880d5 ZJS |
2492 | dependencies : [lib_pam, |
2493 | lib_audit, | |
2494 | lib_selinux], | |
2495 | install : opt, | |
2496 | build_by_default : opt) | |
2497 | if not is_disabler(exe) | |
2498 | exes += exe | |
53b37016 | 2499 | manadocs += ['login-utils/login.1.adoc'] |
d4c880d5 ZJS |
2500 | endif |
2501 | ||
2502 | opt = not get_option('build-sulogin').disabled() | |
2503 | exe = executable( | |
2504 | 'sulogin', | |
2505 | sulogin_sources, | |
2506 | include_directories : includes, | |
2507 | link_with : [lib_common], | |
2508 | dependencies : [lib_crypt, | |
2509 | lib_selinux], | |
2510 | install_dir : sbindir, | |
2511 | install : opt, | |
2512 | build_by_default : opt) | |
2513 | if not is_disabler(exe) | |
2514 | exes += exe | |
53b37016 | 2515 | manadocs += ['login-utils/sulogin.8.adoc'] |
d4c880d5 ZJS |
2516 | endif |
2517 | ||
2518 | exe = executable( | |
2519 | 'cal', | |
2520 | cal_sources, | |
2521 | include_directories : includes, | |
2522 | link_with : [lib_common, | |
2523 | lib_tcolors], | |
2524 | dependencies : [curses_libs], | |
2525 | install_dir : usrbin_exec_dir, | |
2526 | install : true) | |
2527 | exes += exe | |
53b37016 | 2528 | manadocs += ['misc-utils/cal.1.adoc'] |
38bb89ee | 2529 | bashcompletions += ['cal'] |
d4c880d5 ZJS |
2530 | |
2531 | opt = not get_option('build-logger').disabled() | |
2532 | exe = executable( | |
2533 | 'logger', | |
2534 | logger_sources, | |
2535 | include_directories : includes, | |
dbb9999f | 2536 | link_with : [lib_common], |
d4c880d5 ZJS |
2537 | dependencies : [lib_systemd], |
2538 | install_dir : usrbin_exec_dir, | |
2539 | install : opt, | |
2540 | build_by_default : opt) | |
2541 | if opt and not is_disabler(exe) | |
2542 | exes += exe | |
53b37016 | 2543 | manadocs += ['misc-utils/logger.1.adoc'] |
38bb89ee | 2544 | bashcompletions += ['logger'] |
d4c880d5 ZJS |
2545 | endif |
2546 | ||
2547 | exe = executable( | |
2548 | 'test_logger', | |
2549 | logger_sources, | |
2550 | include_directories : includes, | |
2551 | c_args : '-DTEST_LOGGER', | |
dbb9999f | 2552 | link_with : [lib_common], |
ba30b89c | 2553 | dependencies : [lib_systemd], |
2554 | build_by_default: program_tests) | |
d4c880d5 ZJS |
2555 | if not is_disabler(exe) |
2556 | exes += exe | |
2557 | endif | |
2558 | ||
2559 | exe = executable( | |
2560 | 'look', | |
2561 | look_sources, | |
2562 | include_directories : includes, | |
2563 | install_dir : usrbin_exec_dir, | |
2564 | install : true) | |
2565 | exes += exe | |
53b37016 | 2566 | manadocs += ['misc-utils/look.1.adoc'] |
38bb89ee | 2567 | bashcompletions += ['look'] |
d4c880d5 ZJS |
2568 | |
2569 | exe = executable( | |
2570 | 'mcookie', | |
2571 | mcookie_sources, | |
2572 | include_directories : includes, | |
2573 | link_with : [lib_common], | |
2574 | install_dir : usrbin_exec_dir, | |
2575 | install : true) | |
2576 | exes += exe | |
53b37016 | 2577 | manadocs += ['misc-utils/mcookie.1.adoc'] |
38bb89ee | 2578 | bashcompletions += ['mcookie'] |
d4c880d5 ZJS |
2579 | |
2580 | exe = executable( | |
2581 | 'namei', | |
2582 | namei_sources, | |
2583 | include_directories : includes, | |
c07f7b4e | 2584 | dependencies : [lib_selinux], |
d4c880d5 ZJS |
2585 | install_dir : usrbin_exec_dir, |
2586 | install : true) | |
2587 | exes += exe | |
53b37016 | 2588 | manadocs += ['misc-utils/namei.1.adoc'] |
38bb89ee | 2589 | bashcompletions += ['namei'] |
d4c880d5 ZJS |
2590 | |
2591 | exe = executable( | |
2592 | 'whereis', | |
2593 | whereis_sources, | |
2594 | include_directories : includes, | |
2595 | link_with : [lib_common], | |
2596 | install_dir : usrbin_exec_dir, | |
2597 | install : true) | |
2598 | exes += exe | |
53b37016 | 2599 | manadocs += ['misc-utils/whereis.1.adoc'] |
38bb89ee | 2600 | bashcompletions += ['whereis'] |
d4c880d5 ZJS |
2601 | |
2602 | exe = executable( | |
2603 | 'lslocks', | |
2604 | lslocks_sources, | |
2605 | include_directories : includes, | |
2606 | link_with : [lib_common, | |
2607 | lib_mount, | |
2608 | lib_smartcols], | |
2609 | install_dir : usrbin_exec_dir, | |
2610 | install : true) | |
2611 | if not is_disabler(exe) | |
2612 | exes += exe | |
53b37016 | 2613 | manadocs += ['misc-utils/lslocks.8.adoc'] |
38bb89ee | 2614 | bashcompletions += ['lslocks'] |
d4c880d5 ZJS |
2615 | endif |
2616 | ||
2617 | exe = executable( | |
2618 | 'lsblk', | |
2619 | lsblk_sources, | |
2620 | include_directories : includes, | |
2621 | link_with : [lib_common, | |
2622 | lib_blkid, | |
2623 | lib_mount, | |
c3317cdc | 2624 | lib_tcolors, |
d4c880d5 ZJS |
2625 | lib_smartcols], |
2626 | dependencies : lib_udev, | |
2627 | install : true) | |
2628 | if not is_disabler(exe) | |
2629 | exes += exe | |
53b37016 | 2630 | manadocs += ['misc-utils/lsblk.8.adoc'] |
38bb89ee | 2631 | bashcompletions += ['lsblk'] |
d4c880d5 ZJS |
2632 | endif |
2633 | ||
e3dedb01 MY |
2634 | mq_libs = [] |
2635 | mq_libs += cc.find_library('rt', required : true) | |
2636 | ||
ee194909 KZ |
2637 | exe = executable( |
2638 | 'lsfd', | |
2639 | lsfd_sources, | |
2640 | include_directories : includes, | |
2641 | link_with : [lib_common, | |
2642 | lib_smartcols], | |
e3dedb01 | 2643 | dependencies : mq_libs, |
ee194909 KZ |
2644 | install_dir : usrbin_exec_dir, |
2645 | install : true) | |
2646 | if not is_disabler(exe) | |
2647 | exes += exe | |
2648 | manadocs += ['misc-utils/lsfd.1.adoc'] | |
2649 | endif | |
2650 | ||
d4c880d5 ZJS |
2651 | exe = executable( |
2652 | 'uuidgen', | |
2653 | uuidgen_sources, | |
2654 | include_directories : includes, | |
06d3a851 KZ |
2655 | link_with : [lib_common, |
2656 | lib_uuid], | |
d4c880d5 ZJS |
2657 | install_dir : usrbin_exec_dir, |
2658 | install : true) | |
2659 | if not is_disabler(exe) | |
2660 | exes += exe | |
53b37016 | 2661 | manadocs += ['misc-utils/uuidgen.1.adoc'] |
38bb89ee | 2662 | bashcompletions += ['uuidgen'] |
d4c880d5 ZJS |
2663 | endif |
2664 | ||
2665 | exe = executable( | |
2666 | 'uuidparse', | |
2667 | uuidparse_sources, | |
2668 | include_directories : includes, | |
2669 | link_with : [lib_common, | |
2670 | lib_uuid, | |
2671 | lib_smartcols], | |
2672 | install_dir : usrbin_exec_dir, | |
2673 | install : true) | |
2674 | if not is_disabler(exe) | |
2675 | exes += exe | |
53b37016 | 2676 | manadocs += ['misc-utils/uuidparse.1.adoc'] |
38bb89ee | 2677 | bashcompletions += ['uuidparse'] |
d4c880d5 ZJS |
2678 | endif |
2679 | ||
2680 | opt = build_uuidd | |
2681 | exe = executable( | |
2682 | 'uuidd', | |
2683 | uuidd_sources, | |
2684 | include_directories : includes, | |
2685 | link_with : [lib_common, | |
2686 | lib_uuid], | |
2687 | dependencies : [realtime_libs, | |
2688 | lib_systemd], | |
2689 | install_dir : usrsbin_exec_dir, | |
2690 | install : opt, | |
2691 | build_by_default : opt) | |
2692 | exe2 = executable( | |
2693 | 'test_uuidd', | |
2694 | test_uuidd_sources, | |
2695 | include_directories : includes, | |
2696 | link_with : [lib_common, | |
2697 | lib_uuid], | |
2698 | dependencies : thread_libs, | |
ba30b89c | 2699 | build_by_default : opt and program_tests) |
d4c880d5 ZJS |
2700 | if not is_disabler(exe) |
2701 | exes += [exe, exe2] | |
53b37016 | 2702 | manadocs += ['misc-utils/uuidd.8.adoc'] |
38bb89ee | 2703 | bashcompletions += ['uuidd'] |
d4c880d5 ZJS |
2704 | endif |
2705 | ||
2706 | opt = build_libblkid | |
2707 | exe = executable( | |
2708 | 'blkid', | |
2709 | blkid_sources, | |
2710 | include_directories : includes, | |
2711 | link_with : [lib_common, | |
2712 | lib_blkid], | |
2713 | install_dir : sbindir, | |
2714 | install : opt, | |
2715 | build_by_default : opt) | |
2716 | if opt and not is_disabler(exe) | |
2717 | exes += exe | |
53b37016 | 2718 | manadocs += ['misc-utils/blkid.8.adoc'] |
38bb89ee | 2719 | bashcompletions += ['blkid'] |
d4c880d5 ZJS |
2720 | endif |
2721 | ||
69939195 ZJS |
2722 | opt = opt and 'blkid' in static_programs |
2723 | exe = executable( | |
2724 | 'blkid.static', | |
2725 | blkid_sources, | |
2726 | include_directories : includes, | |
2727 | link_with : [lib_common, | |
2728 | lib_blkid_static], | |
2729 | install_dir : sbindir, | |
2730 | install : opt, | |
2731 | build_by_default : opt) | |
2732 | if opt and not is_disabler(exe) | |
2733 | exes += exe | |
2734 | endif | |
d4c880d5 ZJS |
2735 | |
2736 | exe = executable( | |
2737 | 'sample-mkfs', | |
2738 | 'libblkid/samples/mkfs.c', | |
2739 | include_directories : includes, | |
2740 | link_with : lib_blkid) | |
2741 | if not is_disabler(exe) | |
2742 | exes += exe | |
2743 | endif | |
2744 | ||
2745 | exe = executable( | |
2746 | 'sample-partitions', | |
2747 | 'libblkid/samples/partitions.c', | |
2748 | include_directories : includes, | |
2749 | link_with : lib_blkid) | |
2750 | if not is_disabler(exe) | |
2751 | exes += exe | |
2752 | endif | |
2753 | ||
2754 | exe = executable( | |
2755 | 'sample-superblocks', | |
2756 | 'libblkid/samples/superblocks.c', | |
2757 | include_directories : includes, | |
2758 | link_with : lib_blkid) | |
2759 | if not is_disabler(exe) | |
2760 | exes += exe | |
2761 | endif | |
2762 | ||
2763 | exe = executable( | |
2764 | 'sample-topology', | |
2765 | 'libblkid/samples/topology.c', | |
2766 | include_directories : includes, | |
2767 | link_with : lib_blkid) | |
2768 | if not is_disabler(exe) | |
2769 | exes += exe | |
2770 | endif | |
2771 | ||
97e673a0 TW |
2772 | exe = executable( |
2773 | 'test_blkid_fuzz_sample', | |
2774 | 'libblkid/src/fuzz.c', | |
2775 | include_directories: includes, | |
ba30b89c | 2776 | link_with: lib_blkid, |
2777 | build_by_default: program_tests) | |
97e673a0 TW |
2778 | if not is_disabler(exe) |
2779 | exes += exe | |
2780 | endif | |
2781 | ||
d4c880d5 ZJS |
2782 | ############################################################ |
2783 | ||
2784 | exe = executable( | |
2785 | 'findfs', | |
2786 | findfs_sources, | |
2787 | include_directories : includes, | |
2788 | link_with : [lib_blkid], | |
2789 | install_dir : sbindir, | |
2790 | install : true) | |
2791 | if not is_disabler(exe) | |
2792 | exes += exe | |
53b37016 | 2793 | manadocs += ['misc-utils/findfs.8.adoc'] |
38bb89ee | 2794 | bashcompletions += ['findfs'] |
d4c880d5 ZJS |
2795 | endif |
2796 | ||
2797 | exe = executable( | |
2798 | 'wipefs', | |
2799 | wipefs_sources, | |
2800 | include_directories : includes, | |
2801 | link_with : [lib_common, | |
2802 | lib_blkid, | |
2803 | lib_smartcols], | |
2804 | install_dir : sbindir, | |
2805 | install : true) | |
2806 | if not is_disabler(exe) | |
2807 | exes += exe | |
53b37016 | 2808 | manadocs += ['misc-utils/wipefs.8.adoc'] |
38bb89ee | 2809 | bashcompletions += ['wipefs'] |
d4c880d5 ZJS |
2810 | endif |
2811 | ||
2812 | exe = executable( | |
2813 | 'findmnt', | |
2814 | findmnt_sources, | |
2815 | include_directories : includes, | |
2816 | link_with : [lib_common, | |
2817 | lib_blkid, | |
2818 | lib_mount, | |
2819 | lib_smartcols], | |
2820 | dependencies : [lib_udev], | |
2821 | install : true) | |
2822 | if not is_disabler(exe) | |
2823 | exes += exe | |
53b37016 | 2824 | manadocs += ['misc-utils/findmnt.8.adoc'] |
38bb89ee | 2825 | bashcompletions += ['findmnt'] |
d4c880d5 ZJS |
2826 | endif |
2827 | ||
2828 | exe = executable( | |
2829 | 'kill', | |
2830 | kill_sources, | |
2831 | include_directories : includes, | |
2832 | link_with : [lib_common], | |
2833 | install : true) | |
2834 | if not is_disabler(exe) | |
2835 | exes += exe | |
53b37016 | 2836 | manadocs += ['misc-utils/kill.1.adoc'] |
d4c880d5 ZJS |
2837 | endif |
2838 | ||
2839 | opt = not get_option('build-rename').disabled() | |
2840 | exe = executable( | |
2841 | 'rename', | |
2842 | rename_sources, | |
2843 | include_directories : includes, | |
2844 | install_dir : usrbin_exec_dir, | |
2845 | install : opt, | |
2846 | build_by_default : opt) | |
2847 | if opt and not is_disabler(exe) | |
2848 | exes += exe | |
53b37016 | 2849 | manadocs += ['misc-utils/rename.1.adoc'] |
38bb89ee | 2850 | bashcompletions += ['rename'] |
d4c880d5 ZJS |
2851 | endif |
2852 | ||
2853 | exe = executable( | |
2854 | 'getopt', | |
2855 | getopt_sources, | |
2856 | include_directories : includes, | |
308a0979 | 2857 | link_with : [lib_common], |
d4c880d5 ZJS |
2858 | install_dir : usrbin_exec_dir, |
2859 | install : true) | |
2860 | exes += exe | |
53b37016 | 2861 | manadocs += ['misc-utils/getopt.1.adoc'] |
38bb89ee | 2862 | bashcompletions += ['getopt'] |
d4c880d5 ZJS |
2863 | |
2864 | exe = executable( | |
2865 | 'fincore', | |
2866 | fincore_sources, | |
2867 | include_directories : includes, | |
2868 | link_with : [lib_common, | |
2869 | lib_smartcols], | |
2870 | install_dir : usrbin_exec_dir, | |
2871 | install : true) | |
2872 | if not is_disabler(exe) | |
2873 | exes += exe | |
53b37016 | 2874 | manadocs += ['misc-utils/fincore.1.adoc'] |
38bb89ee | 2875 | bashcompletions += ['fincore'] |
d4c880d5 ZJS |
2876 | endif |
2877 | ||
2878 | exe = executable( | |
2879 | 'hardlink', | |
2880 | hardlink_sources, | |
2881 | include_directories : includes, | |
2882 | link_with : [lib_common], | |
d4c880d5 ZJS |
2883 | install_dir : usrbin_exec_dir, |
2884 | install : true) | |
2885 | if not is_disabler(exe) | |
2886 | exes += exe | |
53b37016 | 2887 | manadocs += ['misc-utils/hardlink.1.adoc'] |
38bb89ee | 2888 | bashcompletions += ['hardlink'] |
d4c880d5 ZJS |
2889 | endif |
2890 | ||
c221578e NS |
2891 | opt = not get_option('build-pipesz').disabled() |
2892 | exe = executable( | |
2893 | 'pipesz', | |
2894 | pipesz_sources, | |
2895 | include_directories : includes, | |
2896 | link_with : [lib_common], | |
2897 | install_dir : usrbin_exec_dir, | |
2898 | install : true) | |
2899 | if opt and not is_disabler(exe) | |
2900 | exes += exe | |
62c27bd0 | 2901 | manadocs += ['misc-utils/pipesz.1.adoc'] |
80af57ed | 2902 | bashcompletions += ['pipesz'] |
c221578e NS |
2903 | endif |
2904 | ||
d4c880d5 ZJS |
2905 | exe = executable( |
2906 | 'test_cal', | |
2907 | cal_sources, | |
2908 | include_directories : includes, | |
2909 | c_args : '-DTEST_CAL', | |
2910 | link_with : [lib_common, | |
2911 | lib_tcolors], | |
ba30b89c | 2912 | dependencies : [curses_libs], |
2913 | build_by_default: program_tests) | |
d4c880d5 ZJS |
2914 | if not is_disabler(exe) |
2915 | exes += exe | |
2916 | endif | |
2917 | ||
64bc8ab5 MY |
2918 | exe = executable( |
2919 | 'fadvise', | |
2920 | fadvise_sources, | |
2921 | include_directories : includes, | |
2922 | link_with : [lib_common], | |
2923 | install_dir : usrbin_exec_dir, | |
2924 | install : true) | |
2925 | if not is_disabler(exe) | |
2926 | exes += exe | |
2927 | manadocs += ['misc-utils/fadvise.1.adoc'] | |
2928 | bashcompletions += ['fadvise'] | |
2929 | endif | |
2930 | ||
941e1d55 | 2931 | if LINUX and conf.get('HAVE_PIDFD_OPEN').to_string() == '1' |
334939a1 ZJS |
2932 | exe = executable( |
2933 | 'waitpid', | |
2934 | waitpid_sources, | |
2935 | include_directories : includes, | |
2936 | link_with : [lib_common], | |
2937 | install_dir : usrbin_exec_dir, | |
2938 | install : true) | |
2939 | if not is_disabler(exe) | |
2940 | exes += exe | |
2941 | manadocs += ['misc-utils/waitpid.1.adoc'] | |
2942 | bashcompletions += ['waitpid'] | |
2943 | endif | |
550d32c4 TW |
2944 | endif |
2945 | ||
69e542bd TW |
2946 | syscalls_h = custom_target('syscalls.h', |
2947 | input : 'tools/all_syscalls', | |
2948 | output : 'syscalls.h', | |
922d025a | 2949 | command : ['tools/all_syscalls', cc.cmd_array()] |
69e542bd TW |
2950 | ) |
2951 | ||
3e0bbb12 TW |
2952 | if cc.compiles(fs.read('include/audit-arch.h'), name : 'has AUDIT_ARCH_NATIVE') |
2953 | exe = executable( | |
2954 | 'enosys', | |
2955 | 'misc-utils/enosys.c', syscalls_h, | |
2956 | include_directories : includes, | |
2957 | link_with : [lib_common], | |
2958 | install_dir : usrbin_exec_dir, | |
2959 | install : true) | |
2960 | if not is_disabler(exe) | |
2961 | exes += exe | |
2962 | manadocs += ['misc-utils/enosys.1.adoc'] | |
2963 | bashcompletions += ['enosys'] | |
2964 | endif | |
cba52cc1 TW |
2965 | endif |
2966 | ||
e9ddea79 TW |
2967 | exe = executable( |
2968 | 'lsclocks', | |
2969 | lsclocks_sources, | |
2970 | include_directories : includes, | |
2971 | link_with : [lib_common, lib_smartcols], | |
2972 | install_dir : usrbin_exec_dir, | |
2973 | install : true) | |
2974 | if not is_disabler(exe) | |
2975 | exes += exe | |
2976 | manadocs += ['misc-utils/lsclocks.1.adoc'] | |
2977 | bashcompletions += ['lsclocks'] | |
2978 | endif | |
2979 | ||
d4c880d5 ZJS |
2980 | ############################################################ |
2981 | ||
2982 | opt = not get_option('build-schedutils').disabled() | |
2983 | exe = executable( | |
2984 | 'chrt', | |
2985 | 'schedutils/chrt.c', | |
2986 | include_directories : includes, | |
2987 | link_with : lib_common, | |
2988 | install_dir : usrbin_exec_dir, | |
2989 | install : opt, | |
2990 | build_by_default : opt) | |
2991 | ||
2992 | exe2 = executable( | |
2993 | 'ionice', | |
2994 | 'schedutils/ionice.c', | |
2995 | include_directories : includes, | |
2996 | link_with : lib_common, | |
2997 | install_dir : usrbin_exec_dir, | |
2998 | install : opt, | |
2999 | build_by_default : opt) | |
3000 | ||
3001 | exe3 = executable( | |
3002 | 'taskset', | |
3003 | 'schedutils/taskset.c', | |
3004 | include_directories : includes, | |
3005 | link_with : lib_common, | |
3006 | install_dir : usrbin_exec_dir, | |
3007 | install : opt, | |
3008 | build_by_default : opt) | |
3009 | ||
6e92db54 KZ |
3010 | exe4 = executable( |
3011 | 'uclampset', | |
3012 | 'schedutils/uclampset.c', | |
3013 | include_directories : includes, | |
3014 | link_with : lib_common, | |
3015 | install_dir : usrbin_exec_dir, | |
3016 | install : opt, | |
3017 | build_by_default : opt) | |
3018 | ||
d4c880d5 | 3019 | if opt and not is_disabler(exe) |
6e92db54 | 3020 | exes += [exe, exe2, exe3, exe4] |
53b37016 KZ |
3021 | manadocs += ['schedutils/chrt.1.adoc', |
3022 | 'schedutils/ionice.1.adoc', | |
3023 | 'schedutils/taskset.1.adoc', | |
3024 | 'schedutils/uclampset.1.adoc'] | |
38bb89ee | 3025 | bashcompletions += ['chrt', 'ionice', 'taskset', 'uclampset'] |
d4c880d5 ZJS |
3026 | endif |
3027 | ||
3028 | ############################################################ | |
3029 | ||
3030 | # TODO: when autotools compat is not needed, s/_/-/g in file names? | |
3031 | ||
3032 | exe = executable( | |
3033 | 'test_ttyutils', | |
3034 | 'lib/ttyutils.c', | |
3035 | c_args : ['-DTEST_PROGRAM_TTYUTILS'], | |
3036 | include_directories : dir_include, | |
ba30b89c | 3037 | link_with : lib_common, |
3038 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3039 | exes += exe |
3040 | ||
3041 | exe = executable( | |
3042 | 'test_blkdev', | |
3043 | 'lib/blkdev.c', | |
3044 | c_args : ['-DTEST_PROGRAM_BLKDEV'], | |
3045 | include_directories : dir_include, | |
ba30b89c | 3046 | link_with : lib_common, |
3047 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3048 | exes += exe |
3049 | ||
3050 | exe = executable( | |
3051 | 'test_ismounted', | |
3052 | 'lib/ismounted.c', | |
3053 | c_args : ['-DTEST_PROGRAM_ISMOUNTED'], | |
3054 | include_directories : dir_include, | |
ba30b89c | 3055 | link_with : lib_common, |
3056 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3057 | exes += exe |
3058 | ||
3059 | exe = executable( | |
3060 | 'test_mangle', | |
3061 | 'lib/mangle.c', | |
3062 | c_args : ['-DTEST_PROGRAM_MANGLE'], | |
ba30b89c | 3063 | include_directories : dir_include, |
3064 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3065 | exes += exe |
3066 | ||
3067 | exe = executable( | |
3068 | 'test_strutils', | |
3069 | 'lib/strutils.c', | |
3070 | c_args : ['-DTEST_PROGRAM_STRUTILS'], | |
ba30b89c | 3071 | include_directories : dir_include, |
3072 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3073 | exes += exe |
3074 | ||
3075 | exe = executable( | |
3076 | 'test_colors', | |
3077 | 'lib/colors.c', | |
3078 | 'lib/color-names.c', | |
3079 | c_args : ['-DTEST_PROGRAM_COLORS'], | |
3080 | include_directories : dir_include, | |
ba30b89c | 3081 | link_with : [lib_common, lib_tcolors], |
3082 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3083 | exes += exe |
3084 | ||
3085 | exe = executable( | |
3086 | 'test_randutils', | |
3087 | 'lib/randutils.c', | |
3088 | c_args : ['-DTEST_PROGRAM_RANDUTILS'], | |
ba30b89c | 3089 | include_directories : dir_include, |
3090 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3091 | exes += exe |
3092 | ||
941e1d55 TW |
3093 | if conf.get('HAVE_OPENAT').to_string() == '1' \ |
3094 | and conf.get('HAVE_DIRFD').to_string() == '1' | |
d6418774 ZJS |
3095 | exe = executable( |
3096 | 'test_procfs', | |
3097 | 'lib/procfs.c', | |
3098 | c_args : ['-DTEST_PROGRAM_PROCFS'], | |
3099 | include_directories : dir_include, | |
ba30b89c | 3100 | link_with : lib_common, |
3101 | build_by_default: program_tests) | |
d6418774 | 3102 | exes += exe |
d4c880d5 | 3103 | |
d6418774 ZJS |
3104 | exe = executable( |
3105 | 'test_path', | |
3106 | 'lib/path.c', | |
3107 | 'lib/fileutils.c', | |
3108 | have_cpu_set_t ? 'lib/cpuset.c' : [], | |
3109 | c_args : ['-DTEST_PROGRAM_PATH'], | |
3110 | include_directories : dir_include, | |
ba30b89c | 3111 | link_with : lib_common, |
3112 | build_by_default: program_tests) | |
d6418774 ZJS |
3113 | exes += exe |
3114 | endif | |
d4c880d5 | 3115 | |
941e1d55 | 3116 | if conf.get('HAVE_PTY').to_string() == '1' |
44475360 ZJS |
3117 | exe = executable( |
3118 | 'test_pty', | |
3119 | pty_session_c, | |
3120 | monotonic_c, | |
3121 | c_args : ['-DTEST_PROGRAM_PTY'], | |
3122 | include_directories : dir_include, | |
3123 | link_with : [lib_common], | |
3124 | dependencies : [lib_m, | |
3125 | realtime_libs, | |
ba30b89c | 3126 | lib_util], |
3127 | build_by_default: program_tests) | |
44475360 ZJS |
3128 | exes += exe |
3129 | endif | |
d4c880d5 | 3130 | |
d6418774 ZJS |
3131 | if LINUX |
3132 | exe = executable( | |
3133 | 'test_cpuset', | |
3134 | 'lib/cpuset.c', | |
3135 | c_args : ['-DTEST_PROGRAM_CPUSET'], | |
ba30b89c | 3136 | include_directories : dir_include, |
3137 | build_by_default: program_tests) | |
d6418774 ZJS |
3138 | exes += exe |
3139 | endif | |
d4c880d5 ZJS |
3140 | |
3141 | exe = executable( | |
3142 | 'test_sysfs', | |
3143 | 'lib/sysfs.c', | |
3144 | 'lib/path.c', | |
35d26ae8 | 3145 | 'lib/buffer.c', |
fb8493fd | 3146 | 'lib/mbsalign.c', |
d4c880d5 ZJS |
3147 | 'lib/fileutils.c', |
3148 | have_cpu_set_t ? 'lib/cpuset.c' : [], | |
3149 | c_args : ['-DTEST_PROGRAM_SYSFS'], | |
ba30b89c | 3150 | include_directories : dir_include, |
3151 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3152 | exes += exe |
3153 | ||
3154 | exe = executable( | |
3155 | 'test_pager', | |
3156 | 'lib/pager.c', | |
3157 | c_args : ['-DTEST_PROGRAM_PAGER'], | |
ba30b89c | 3158 | include_directories : dir_include, |
3159 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3160 | exes += exe |
3161 | ||
3162 | exe = executable( | |
3163 | 'test_linux_version', | |
3164 | 'lib/linux_version.c', | |
3165 | c_args : ['-DTEST_PROGRAM_LINUXVERSION'], | |
ba30b89c | 3166 | include_directories : dir_include, |
3167 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3168 | exes += exe |
3169 | ||
3170 | exe = executable( | |
3171 | 'test_fileutils', | |
3172 | 'lib/fileutils.c', | |
3173 | c_args : ['-DTEST_PROGRAM_FILEUTILS'], | |
ba30b89c | 3174 | include_directories : dir_include, |
3175 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3176 | exes += exe |
3177 | ||
3178 | exe = executable( | |
3179 | 'test_canonicalize', | |
3180 | 'lib/canonicalize.c', | |
3181 | c_args : ['-DTEST_PROGRAM_CANONICALIZE'], | |
ba30b89c | 3182 | include_directories : dir_include, |
3183 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3184 | exes += exe |
3185 | ||
3186 | exe = executable( | |
3187 | 'test_timeutils', | |
3188 | 'lib/timeutils.c', | |
3189 | 'lib/strutils.c', | |
3190 | c_args : ['-DTEST_PROGRAM_TIMEUTILS'], | |
ba30b89c | 3191 | include_directories : dir_include, |
3192 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3193 | exes += exe |
3194 | ||
3195 | exe = executable( | |
3196 | 'test_pwdutils', | |
3197 | 'lib/pwdutils.c', | |
3198 | c_args : ['-DTEST_PROGRAM'], | |
3199 | include_directories : dir_include, | |
ba30b89c | 3200 | link_with : lib_common, |
3201 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3202 | exes += exe |
3203 | ||
866d922b KZ |
3204 | exe = executable( |
3205 | 'test_logindefs', | |
3206 | 'lib/logindefs.c', | |
3207 | c_args : ['-DTEST_PROGRAM'], | |
3208 | include_directories : dir_include, | |
ba30b89c | 3209 | link_with : [lib_common, logindefs_c], |
3210 | build_by_default: program_tests) | |
866d922b KZ |
3211 | exes += exe |
3212 | ||
3213 | ||
d4c880d5 ZJS |
3214 | ############################################################ |
3215 | ||
3216 | exe = executable( | |
3217 | 'test_uuid_parser', | |
3218 | 'libuuid/src/test_uuid.c', | |
3219 | include_directories : [dir_include, dir_libuuid], | |
3220 | link_with : lib_uuid, | |
ba30b89c | 3221 | dependencies : socket_libs, |
3222 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3223 | if not is_disabler(exe) |
3224 | exes += exe | |
3225 | endif | |
3226 | ||
3227 | ############################################################ | |
3228 | ||
2a472ae8 | 3229 | libfdisk_tests_cflags = ['-DTEST_PROGRAM'] |
69939195 | 3230 | libfdisk_tests_ldadd = [lib_fdisk_static, lib_uuid, lib_blkid] |
d4c880d5 ZJS |
3231 | |
3232 | exe = executable( | |
3233 | 'test_fdisk_ask', | |
3234 | 'libfdisk/src/ask.c', | |
3235 | c_args : libfdisk_tests_cflags, | |
3236 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3237 | link_with : libfdisk_tests_ldadd, |
3238 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3239 | if not is_disabler(exe) |
3240 | exes += exe | |
3241 | endif | |
3242 | ||
3243 | exe = executable( | |
3244 | 'test_fdisk_gpt', | |
3245 | 'libfdisk/src/gpt.c', | |
3246 | c_args : libfdisk_tests_cflags, | |
3247 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3248 | link_with : libfdisk_tests_ldadd, |
3249 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3250 | if not is_disabler(exe) |
3251 | exes += exe | |
3252 | endif | |
3253 | ||
3254 | exe = executable( | |
3255 | 'test_fdisk_utils', | |
3256 | 'libfdisk/src/utils.c', | |
3257 | c_args : libfdisk_tests_cflags, | |
3258 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3259 | link_with : libfdisk_tests_ldadd, |
3260 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3261 | if not is_disabler(exe) |
3262 | exes += exe | |
3263 | endif | |
3264 | ||
3265 | exe = executable( | |
3266 | 'test_fdisk_script', | |
3267 | 'libfdisk/src/script.c', | |
3268 | c_args : libfdisk_tests_cflags, | |
3269 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3270 | link_with : libfdisk_tests_ldadd, |
3271 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3272 | if not is_disabler(exe) |
3273 | exes += exe | |
3274 | endif | |
3275 | ||
3276 | exe = executable( | |
3277 | 'test_fdisk_version', | |
3278 | 'libfdisk/src/version.c', | |
3279 | c_args : libfdisk_tests_cflags, | |
3280 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3281 | link_with : libfdisk_tests_ldadd, |
3282 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3283 | if not is_disabler(exe) |
3284 | exes += exe | |
3285 | endif | |
3286 | ||
3287 | exe = executable( | |
3288 | 'test_fdisk_item', | |
3289 | 'libfdisk/src/item.c', | |
3290 | c_args : libfdisk_tests_cflags, | |
3291 | include_directories : lib_fdisk_includes, | |
ba30b89c | 3292 | link_with : libfdisk_tests_ldadd, |
3293 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3294 | if not is_disabler(exe) |
3295 | exes += exe | |
3296 | endif | |
3297 | ||
d4c880d5 ZJS |
3298 | sample_fdisk_ldadd = [lib_common, lib_fdisk] |
3299 | ||
3300 | exe = executable( | |
3301 | 'sample-fdisk-mkpart', | |
3302 | 'libfdisk/samples/mkpart.c', | |
d4c880d5 ZJS |
3303 | include_directories : lib_fdisk_includes, |
3304 | link_with : sample_fdisk_ldadd) | |
3305 | if not is_disabler(exe) | |
3306 | exes += exe | |
3307 | endif | |
3308 | ||
3309 | exe = executable( | |
3310 | 'sample-fdisk-mkpart-fullspec', | |
3311 | 'libfdisk/samples/mkpart-fullspec.c', | |
d4c880d5 ZJS |
3312 | include_directories : lib_fdisk_includes, |
3313 | link_with : sample_fdisk_ldadd) | |
3314 | if not is_disabler(exe) | |
3315 | exes += exe | |
3316 | endif | |
3317 | ||
3318 | ############################################################ | |
3319 | ||
a76299c1 TW |
3320 | exe = executable( |
3321 | 'test_cap', | |
3322 | 'tests/helpers/test_cap.c', | |
3323 | include_directories : includes, | |
3324 | dependencies : [lib_cap_ng], | |
3325 | build_by_default: program_tests) | |
512c91a6 TW |
3326 | if not is_disabler(exe) |
3327 | exes += exe | |
3328 | endif | |
a76299c1 | 3329 | |
d4c880d5 ZJS |
3330 | exe = executable( |
3331 | 'test_mbsencode', | |
3332 | 'tests/helpers/test_mbsencode.c', | |
3333 | include_directories : includes, | |
ba30b89c | 3334 | link_with : lib_common, |
3335 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3336 | exes += exe |
3337 | ||
3338 | exe = executable( | |
3339 | 'test_byteswap', | |
3340 | 'tests/helpers/test_byteswap.c', | |
ba30b89c | 3341 | include_directories : includes, |
3342 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3343 | exes += exe |
3344 | ||
3345 | exe = executable( | |
3346 | 'test_md5', | |
3347 | 'tests/helpers/test_md5.c', | |
3348 | md5_c, | |
ba30b89c | 3349 | include_directories : includes, |
3350 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3351 | exes += exe |
3352 | ||
3353 | exe = executable( | |
3354 | 'test_sha1', | |
3355 | 'tests/helpers/test_sha1.c', | |
3356 | sha1_c, | |
ba30b89c | 3357 | include_directories : includes, |
3358 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3359 | exes += exe |
3360 | ||
3361 | exe = executable( | |
3362 | 'test_pathnames', | |
3363 | 'tests/helpers/test_pathnames.c', | |
ba30b89c | 3364 | include_directories : includes, |
3365 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3366 | exes += exe |
3367 | ||
3368 | exe = executable( | |
3369 | 'test_strerror', | |
3370 | 'tests/helpers/test_strerror.c', | |
ba30b89c | 3371 | include_directories : includes, |
3372 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3373 | exes += exe |
3374 | ||
3375 | exe = executable( | |
3376 | 'test_sysinfo', | |
3377 | 'tests/helpers/test_sysinfo.c', | |
ba30b89c | 3378 | include_directories : includes, |
3379 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3380 | exes += exe |
3381 | ||
3382 | exe = executable( | |
3383 | 'test_sigreceive', | |
3384 | 'tests/helpers/test_sigreceive.c', | |
3385 | include_directories : includes, | |
ba30b89c | 3386 | link_with : lib_common, |
3387 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3388 | exes += exe |
3389 | ||
3390 | exe = executable( | |
3391 | 'test_tiocsti', | |
3392 | 'tests/helpers/test_tiocsti.c', | |
ba30b89c | 3393 | include_directories : includes, |
3394 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3395 | exes += exe |
3396 | ||
3397 | exe = executable( | |
3398 | 'test_uuid_namespace', | |
3399 | 'tests/helpers/test_uuid_namespace.c', | |
3400 | predefined_c, | |
3401 | unpack_c, | |
3402 | unparse_c, | |
ba30b89c | 3403 | include_directories : includes, |
3404 | build_by_default: program_tests) | |
d4c880d5 ZJS |
3405 | exes += exe |
3406 | ||
d6418774 ZJS |
3407 | if LINUX |
3408 | exe = executable( | |
3409 | 'test_mkfds', | |
3410 | 'tests/helpers/test_mkfds.c', | |
b2033a32 | 3411 | 'tests/helpers/test_mkfds.h', |
38ffd1e3 | 3412 | 'tests/helpers/test_mkfds_ppoll.c', |
d6418774 | 3413 | include_directories : includes, |
ba30b89c | 3414 | dependencies : mq_libs, |
3415 | build_by_default: program_tests) | |
d6418774 ZJS |
3416 | exes += exe |
3417 | endif | |
f7b41ef8 | 3418 | |
42900563 TW |
3419 | exe = executable( |
3420 | 'test_enosys', | |
3421 | 'tests/helpers/test_enosys.c', | |
ba30b89c | 3422 | include_directories : includes, |
3423 | build_by_default: program_tests) | |
42900563 TW |
3424 | exes += exe |
3425 | ||
d4c880d5 ZJS |
3426 | ############################################################ |
3427 | ||
941e1d55 | 3428 | if conf.get('HAVE_OPENAT').to_string() == '1' |
d6418774 ZJS |
3429 | exe = executable( |
3430 | 'sample-scols-tree', | |
3431 | 'libsmartcols/samples/tree.c', | |
3432 | include_directories : includes, | |
ba30b89c | 3433 | link_with : [lib_smartcols, lib_common], |
3434 | build_by_default: program_tests) | |
d6418774 ZJS |
3435 | if not is_disabler(exe) |
3436 | exes += exe | |
3437 | endif | |
d4c880d5 ZJS |
3438 | endif |
3439 | ||
3440 | exe = executable( | |
3441 | 'sample-scols-title', | |
3442 | 'libsmartcols/samples/title.c', | |
3443 | include_directories : includes, | |
3444 | link_with : [lib_smartcols, lib_common]) | |
3445 | if not is_disabler(exe) | |
3446 | exes += exe | |
3447 | endif | |
3448 | ||
3449 | exe = executable( | |
3450 | 'sample-scols-wrap', | |
3451 | 'libsmartcols/samples/wrap.c', | |
3452 | include_directories : includes, | |
3453 | link_with : [lib_smartcols, lib_common]) | |
3454 | if not is_disabler(exe) | |
3455 | exes += exe | |
3456 | endif | |
3457 | ||
3458 | exe = executable( | |
3459 | 'sample-scols-continuous', | |
3460 | 'libsmartcols/samples/continuous.c', | |
3461 | include_directories : includes, | |
3462 | link_with : [lib_smartcols, lib_common]) | |
3463 | if not is_disabler(exe) | |
3464 | exes += exe | |
3465 | endif | |
3466 | ||
3467 | exe = executable( | |
3468 | 'sample-scols-maxout', | |
3469 | 'libsmartcols/samples/maxout.c', | |
3470 | include_directories : includes, | |
3471 | link_with : [lib_smartcols, lib_common]) | |
3472 | if not is_disabler(exe) | |
3473 | exes += exe | |
3474 | endif | |
3475 | ||
3476 | exe = executable( | |
3477 | 'sample-scols-fromfile', | |
3478 | 'libsmartcols/samples/fromfile.c', | |
3479 | include_directories : includes, | |
3480 | link_with : [lib_smartcols, lib_common]) | |
3481 | if not is_disabler(exe) | |
3482 | exes += exe | |
3483 | endif | |
3484 | ||
3485 | exe = executable( | |
3486 | 'sample-scols-grouping-simple', | |
3487 | 'libsmartcols/samples/grouping-simple.c', | |
3488 | include_directories : includes, | |
3489 | link_with : [lib_smartcols, lib_common]) | |
3490 | if not is_disabler(exe) | |
3491 | exes += exe | |
3492 | endif | |
3493 | ||
3494 | exe = executable( | |
3495 | 'sample-scols-grouping-overlay', | |
3496 | 'libsmartcols/samples/grouping-overlay.c', | |
3497 | include_directories : includes, | |
3498 | link_with : [lib_smartcols, lib_common]) | |
3499 | if not is_disabler(exe) | |
3500 | exes += exe | |
3501 | endif | |
3502 | ||
3503 | ############################################################ | |
3504 | ||
3505 | # Let the test runner know whether we're running under asan and export | |
3506 | # some paths. We use a file on disk so that it is possible to run the | |
3507 | # test scripts from commandline without setting any variables. | |
3508 | configure_file(output : 'meson.conf', | |
3509 | capture : true, | |
3510 | command : ['echo', | |
3511 | '''asan=@0@ | |
3512 | PYTHON=@1@ | |
3513 | '''.format(get_option('b_sanitize')=='address' ? 'yes' : '', | |
e2cd7446 | 3514 | python.full_path())]) |
d4c880d5 ZJS |
3515 | |
3516 | run_sh = find_program('tests/run.sh') | |
3517 | run_target( | |
3518 | 'check', | |
3519 | command : [run_sh, | |
3520 | '--srcdir=' + meson.current_source_dir(), | |
3521 | '--builddir=' + meson.current_build_dir(), | |
3522 | '--parallel', | |
3523 | '--nonroot'], | |
3524 | depends : exes) | |
53b37016 KZ |
3525 | |
3526 | ||
3527 | manadocs += ['lib/terminal-colors.d.5.adoc'] | |
3528 | manadocs += ['libblkid/libblkid.3.adoc'] | |
3529 | ||
3530 | if build_libuuid | |
3531 | manadocs += [ | |
3532 | 'libuuid/man/uuid.3.adoc', | |
3533 | 'libuuid/man/uuid_clear.3.adoc', | |
3534 | 'libuuid/man/uuid_compare.3.adoc', | |
3535 | 'libuuid/man/uuid_copy.3.adoc', | |
3536 | 'libuuid/man/uuid_generate.3.adoc', | |
3537 | 'libuuid/man/uuid_is_null.3.adoc', | |
3538 | 'libuuid/man/uuid_parse.3.adoc', | |
3539 | 'libuuid/man/uuid_time.3.adoc', | |
3540 | 'libuuid/man/uuid_unparse.3.adoc'] | |
38bb89ee TW |
3541 | manlinks += { |
3542 | 'uuid_generate_random.3': 'uuid_generate.3', | |
3543 | 'uuid_generate_time.3': 'uuid_generate.3', | |
3544 | 'uuid_generate_time_safe.3': 'uuid_generate.3', | |
3545 | } | |
53b37016 KZ |
3546 | endif |
3547 | ||
00b8a51f | 3548 | asciidoctor = find_program('asciidoctor', required : false) |
53b37016 KZ |
3549 | if asciidoctor.found() |
3550 | foreach adoc : manadocs | |
3551 | name = adoc.split('/')[-1] | |
3552 | page = name.split('.adoc')[0] | |
3553 | section = page.split('.')[-1] | |
3554 | mandirn = join_paths(mandir, 'man' + section) | |
3555 | input = adoc | |
3556 | ||
3557 | custom_target( | |
3558 | page, | |
3559 | command : [ asciidoctor, | |
3560 | '-b', 'manpage', | |
3561 | '-a', 'VERSION=' + meson.project_version(), | |
38bb89ee | 3562 | '-a', 'release-version=' + meson.project_version(), |
53b37016 | 3563 | '-a', 'ADJTIME_PATH=/etc/adjtime', |
38bb89ee | 3564 | '-a', 'package-docdir=' + docdir, |
53b37016 KZ |
3565 | '--base-dir=' + meson.current_source_dir(), |
3566 | '--destination-dir=' + meson.current_build_dir(), | |
adcab835 TW |
3567 | '--load-path', '@SOURCE_ROOT@/tools', |
3568 | '--require', 'asciidoctor-includetracker', | |
53b37016 KZ |
3569 | '@INPUT@'], |
3570 | input : input, | |
3571 | output : [page], | |
adcab835 | 3572 | depfile : page + '.deps', |
53b37016 KZ |
3573 | install: true, |
3574 | install_dir : mandirn) | |
3575 | endforeach | |
38bb89ee TW |
3576 | |
3577 | foreach link_name, target : manlinks | |
3578 | link_section = link_name.split('.')[-1] | |
3579 | target_section = target.split('.')[-1] | |
3580 | meson.add_install_script(meson_make_manpage_stub, | |
3581 | join_paths('man' + target_section, target), | |
3582 | join_paths(mandir, 'man' + link_section, link_name)) | |
3583 | endforeach | |
3584 | endif | |
3585 | ||
3586 | if bash_completion.found() | |
3587 | foreach completion : bashcompletions | |
3588 | install_data( | |
3589 | join_paths('bash-completion', completion), | |
caa85688 | 3590 | install_dir : bash_completion.get_variable(pkgconfig : 'completionsdir') |
38bb89ee TW |
3591 | ) |
3592 | endforeach | |
aa519054 KZ |
3593 | foreach link_name, target : bashcompletionslinks |
3594 | meson.add_install_script(meson_make_symlink, | |
3595 | target, | |
caa85688 | 3596 | join_paths(bash_completion.get_variable(pkgconfig : 'completionsdir'), link_name)) |
aa519054 | 3597 | endforeach |
53b37016 | 3598 | endif |