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