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