]> git.proxmox.com Git - mirror_lxc.git/blame - meson.build
meson: Rework options
[mirror_lxc.git] / meson.build
CommitLineData
9b9d56e6
CB
1# SPDX-License-Identifier: LGPL-2.1-or-later
2
20b03401
SG
3# Project.
4project(
5 'lxc',
6 'c',
7 version: '4.0.0',
8 license: 'LGPLv2+',
9 default_options: [
10 'b_lto=true',
11 'b_lto_mode=thin',
12 'b_colorout=always',
13 'b_asneeded=true',
14 'b_pie=true',
15 'b_staticpic=true',
16 'c_std=gnu11',
17 'warning_level=2',
18 ],
d841229e 19 meson_version: '>= 0.61')
9b9d56e6 20
20b03401
SG
21cc = meson.get_compiler('c')
22pkgconfig = import('pkgconfig')
0860988e 23pkgconfig_libs = []
9b9d56e6 24
20b03401 25# Version.
9b9d56e6
CB
26version_data = configuration_data()
27version_data.set('LXC_VERSION_MAJOR', '4')
28version_data.set('LXC_VERSION_MINOR', '0')
29version_data.set('LXC_VERSION_MICRO', '7')
30version_data.set('LXC_ABI', '4.0.7')
31version_data.set('LXC_DEVEL', '1')
32version_data.set('LXC_VERSION', '4.0.7-devel')
4c7c1431 33liblxc_version = '1.7.0'
20b03401
SG
34
35# Configuration options.
36conf = configuration_data()
37conf.set_quoted('PROJECT', meson.project_name())
38conf.set_quoted('PROJECT_URL', 'https://linuxcontainers.org/lxc/')
39conf.set_quoted('PROJECT_VERSION', meson.project_version())
40conf.set_quoted('PACKAGE_VERSION', meson.project_version())
41conf.set('_GNU_SOURCE', true)
42conf.set('_FILE_OFFSET_BITS', 64)
43conf.set('__STDC_FORMAT_MACROS', true)
9b9d56e6
CB
44
45project_source_root = meson.current_source_dir()
46project_build_root = meson.current_build_dir()
47
20b03401 48# Path handling.
9b9d56e6 49prefixdir = get_option('prefix')
20b03401 50
7609de18
SG
51apparmorcachedir = get_option('apparmor-cache-path')
52globalconfig = get_option('global-config-path')
20b03401
SG
53localstatedir = join_paths('/', get_option('localstatedir'))
54logpath = get_option('log-path')
7609de18
SG
55lxcpathprefix = get_option('data-path')
56rootfsmount = get_option('rootfs-mount-path')
57user_network_db_opt = get_option('usernet-db-path')
58user_network_conf_opt = get_option('usernet-config-path')
20b03401 59
4a858b56 60bashcompletiondir = join_paths('/', 'usr', 'share', 'bash-completion', 'completions')
9b9d56e6 61bindir = join_paths(prefixdir, get_option('bindir'))
bf1f3470 62datadir = join_paths(prefixdir, get_option('datadir'))
7609de18 63docdir = join_paths(datadir, get_option('doc-path'))
9b9d56e6
CB
64includedir = join_paths(prefixdir, get_option('includedir'))
65libdir = join_paths(prefixdir, get_option('libdir'))
66libexecdir = join_paths(prefixdir, get_option('libexecdir'))
20b03401 67runtimepath = join_paths(prefixdir, get_option('runtime-path'))
bf1f3470
CB
68sbindir = join_paths(prefixdir, get_option('sbindir'))
69sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))
70
7609de18 71lxcapparmorcachedir = join_paths(localstatedir, apparmorcachedir)
bf1f3470 72lxcdefaultconfig = join_paths(sysconfdir, 'lxc/default.conf')
7609de18 73lxcexamplesdir = join_paths(docdir, 'examples')
20b03401 74lxcglobalconfig = join_paths(sysconfdir, globalconfig)
7609de18
SG
75lxchookbindir = join_paths(libexecdir, 'lxc/hooks')
76lxchookdir = join_paths(datadir, 'lxc/hooks')
1a9afacc 77lxcinclude = join_paths(includedir, 'lxc')
2f1bf5f5 78lxclibexec = join_paths(libexecdir, 'lxc')
bf1f3470 79lxclogpath = join_paths(localstatedir, logpath)
bf1f3470 80lxcpath = join_paths(localstatedir, lxcpathprefix)
7609de18 81lxcrootfsmount = join_paths(libdir, rootfsmount)
bf1f3470 82lxctemplateconfig = join_paths(datadir, 'lxc/config')
bf1f3470 83lxctemplatedir = join_paths(datadir, 'lxc/templates')
72f1c44a 84lxc_user_network_conf = join_paths(sysconfdir, user_network_conf_opt)
72f1c44a 85lxc_user_network_db = join_paths(runtimepath, user_network_db_opt)
72f1c44a 86
20b03401
SG
87conf.set_quoted('BINDIR', bindir)
88conf.set_quoted('DATADIR', datadir)
89conf.set_quoted('DOCDIR', docdir)
90conf.set_quoted('INCLUDEDIR', includedir)
91conf.set_quoted('LIBDIR', libdir)
92conf.set_quoted('LIBEXECDIR', libexecdir)
93conf.set_quoted('LOCALSTATEDIR', localstatedir)
94conf.set_quoted('RUNTIME_PATH', runtimepath)
95conf.set_quoted('SBINDIR', sbindir)
96conf.set_quoted('SYSCONFDIR', sysconfdir)
97
98conf.set_quoted('APPARMOR_CACHE_DIR', lxcapparmorcachedir)
99conf.set_quoted('LOGPATH', lxclogpath)
100conf.set_quoted('LXCBINHOOKDIR', lxchookbindir)
101conf.set_quoted('LXC_DEFAULT_CONFIG', lxcdefaultconfig)
102conf.set_quoted('LXC_GLOBAL_CONF', lxcglobalconfig)
103conf.set_quoted('LXCHOOKDIR', lxchookdir)
104conf.set_quoted('LXCINITDIR', libexecdir)
105conf.set_quoted('LXCPATH', lxcpath)
106conf.set_quoted('LXCROOTFSMOUNT', lxcrootfsmount)
107conf.set_quoted('LXCTEMPLATECONFIG', lxctemplateconfig)
108conf.set_quoted('LXCTEMPLATEDIR', lxctemplatedir)
109conf.set_quoted('LXC_USERNIC_CONF', lxc_user_network_conf)
110conf.set_quoted('LXC_USERNIC_DB', lxc_user_network_db)
111
112# Custom configuration.
113cgrouppattern = get_option('cgroup-pattern')
114wants_io_uring = get_option('io-uring-event-loop')
7609de18
SG
115want_examples = get_option('examples')
116want_mans = get_option('man')
20b03401
SG
117want_tests = get_option('tests')
118
119conf.set_quoted('DEFAULT_CGROUP_PATTERN', cgrouppattern)
9b9d56e6 120
20b03401
SG
121dummy_config_data = configuration_data()
122dummy_config_data.set_quoted('DUMMY_VARIABLE', '1')
9b9d56e6 123
20b03401 124# Build flags.
9b9d56e6 125possible_cc_flags = [
20b03401
SG
126 '-Wvla',
127 '-Wimplicit-fallthrough=5',
128 '-Wcast-align',
129 '-Wstrict-prototypes',
130 '-fno-strict-aliasing',
131 '-fstack-clash-protection',
132 '-fstack-protector-strong',
133 '--param=ssp-buffer-size=4',
134 '--mcet -fcf-protection',
135 '-Werror=implicit-function-declaration',
136 '-Wlogical-op',
137 '-Wmissing-include-dirs',
138 '-Wold-style-definition',
139 '-Winit-self',
140 '-Wunused-but-set-variable',
141 '-Wno-unused-parameter',
142 '-Wfloat-equal',
143 '-Wsuggest-attribute=noreturn',
144 '-Werror=return-type',
145 '-Werror=incompatible-pointer-types',
146 '-Wformat=2',
147 '-Wshadow',
148 '-Wendif-labels',
149 '-Werror=overflow',
150 '-fdiagnostics-show-option',
151 '-Werror=shift-count-overflow',
152 '-Werror=shift-overflow=2',
153 '-Wdate-time',
154 '-Wnested-externs',
155 '-fasynchronous-unwind-tables',
156 '-fexceptions',
157 '-Warray-bounds',
158 '-Wrestrict',
159 '-Wreturn-local-addr',
160 '-fsanitize=cfi',
161 '-Wstringop-overflow',
9b9d56e6
CB
162]
163
164possible_link_flags = [
20b03401
SG
165 '-Wl,--gc-sections',
166 '-Wl,-z,relro',
167 '-Wl,-z,now',
168 '-Wl,-fuse-ld=gold',
9b9d56e6
CB
169]
170
171if meson.version().version_compare('>=0.46')
20b03401 172 add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language: 'c')
9b9d56e6 173else
20b03401 174 add_project_link_arguments(possible_link_flags, language: 'c')
9b9d56e6
CB
175endif
176
20b03401 177add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language: 'c')
9b9d56e6 178
20b03401
SG
179# Feature detection
180## I/O uring.
747bc634 181if wants_io_uring == true
20b03401
SG
182 liburing = dependency('liburing')
183 if cc.has_function('io_uring_prep_poll_add', prefix: '#include <liburing.h>', dependencies: liburing) == false
184 error('liburing version does not support IORING_POLL_ADD_MULTI')
185 endif
186
187 conf.set10('HAVE_LIBURING', true)
747bc634
CB
188endif
189
20b03401 190## Time EPOCH.
ea6da257 191sh = find_program('sh')
23ba778f 192date = find_program('date')
20b03401 193git = find_program('git', required: false)
aa326e18
SG
194time_epoch = run_command(sh, '-c', 'echo "$SOURCE_DATE_EPOCH"', check: true).stdout().strip()
195if time_epoch == '' and git.found() and run_command('test', '-e', '.git', check: false).returncode() == 0
20b03401 196 # If we're in a git repository, use the creation time of the latest git tag.
aa326e18
SG
197 latest_tag = run_command(git, 'describe', '--abbrev=0', '--tags', check: true).stdout().strip()
198 time_epoch = run_command(git, 'log', '--no-show-signature', '-1', '--format=%at', latest_tag, check: true).stdout()
23ba778f
SG
199else
200 # Fallback to current epoch
201 time_epoch = run_command(date, '+%s', check: true).stdout()
ea6da257
CB
202endif
203time_epoch = time_epoch.to_int()
204conf.set('TIME_EPOCH', time_epoch)
205
20b03401 206## Threads.
9b9d56e6 207threads = dependency('threads')
20b03401
SG
208
209## Seccomp.
e4384f1c 210libseccomp = dependency('libseccomp')
c597905e 211conf.set10('HAVE_SECCOMP', libseccomp.found())
181cd6dc 212pkgconfig_libs += libseccomp
9b9d56e6 213if libseccomp.found()
20b03401
SG
214 if libseccomp.version().version_compare('>=2.5.0')
215 # https://github.com/seccomp/libseccomp/commit/dead12bc788b259b148cc4d93b970ef0bd602b1a
216 conf.set10('HAVE_DECL_SECCOMP_NOTIFY_FD', true)
217 else
218 conf.set10('HAVE_DECL_SECCOMP_NOTIFY_FD', false)
219 endif
220
221 if libseccomp.version().version_compare('>=2.0.0')
222 # https://github.com/seccomp/libseccomp/commit/6220c8c0fc479d97b6d3e3166a4e46fbfe25a3c0
223 conf.set10('HAVE_DECL_SECCOMP_SYSCALL_RESOLVE_NAME_ARCH', true)
224 else
225 conf.set10('HAVE_DECL_SECCOMP_SYSCALL_RESOLVE_NAME_ARCH', false)
226 endif
227
228 seccomp_headers = '''
229 #include <seccomp.h>
230 '''
231
232 foreach decl: [
233 'scmp_filter_ctx',
234 'struct seccomp_notif_sizes',
235 'struct clone_args',
236 ]
237
238 # We get -1 if the size cannot be determined
239 if cc.sizeof(decl, prefix: seccomp_headers, args: '-D_GNU_SOURCE') > 0
240 conf.set10('HAVE_' + decl.underscorify().to_upper(), true)
241 else
242 conf.set10('HAVE_' + decl.underscorify().to_upper(), false)
243 endif
244 endforeach
9b9d56e6
CB
245endif
246
20b03401
SG
247## SELinux.
248libselinux = dependency('libselinux', required: false)
c597905e 249conf.set10('HAVE_SELINUX', libselinux.found())
181cd6dc 250pkgconfig_libs += libselinux
9b9d56e6 251
20b03401
SG
252## AppArmor.
253libapparmor = dependency('libapparmor', required: false)
c597905e 254conf.set10('HAVE_APPARMOR', libapparmor.found())
9b9d56e6 255
20b03401
SG
256## OpenSSL.
257libopenssl = dependency('openssl', required: false)
c597905e 258conf.set10('HAVE_OPENSSL', libopenssl.found())
181cd6dc 259pkgconfig_libs += libopenssl
9b9d56e6 260
20b03401
SG
261## Libcap..
262libcap = dependency('libcap', required: false)
9b9d56e6 263if not libcap.found()
20b03401
SG
264 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
265 libcap = cc.find_library('cap', required: false)
9b9d56e6 266endif
c597905e 267conf.set10('HAVE_LIBCAP', libcap.found())
181cd6dc 268pkgconfig_libs += libcap
9b9d56e6 269
20b03401 270libcap_static = dependency('libcap', required: false, static: true)
d0a16061 271if not libcap_static.found()
20b03401
SG
272 # Compat with Ubuntu 14.04 which ships libcap w/o .pc file
273 libcap_static = cc.find_library('cap', required: false, static: true)
d0a16061 274endif
c597905e 275conf.set10('HAVE_STATIC_LIBCAP', libcap_static.found())
d0a16061 276
0860988e
SG
277## PAM.
278pam = cc.find_library('pam',
279 has_headers: 'security/pam_modules.h')
280conf.set10('HAVE_PAM', pam.found())
181cd6dc 281pkgconfig_libs += pam
0860988e 282
20b03401
SG
283## Others.
284have = cc.has_function('strchrnul', prefix: '#include <string.h>', args: '-D_GNU_SOURCE')
db4af8c5
CB
285conf.set10('HAVE_STRCHRNUL', have)
286
20b03401 287have = cc.has_function('openpty', prefix: '#include <pty.h>', args: '-D_GNU_SOURCE')
db4af8c5
CB
288conf.set10('HAVE_OPENPTY', have)
289
20b03401
SG
290## Compiler attributes.
291foreach ccattr: [
292 'fallthrough',
293 'nonnull',
294 'returns_nonnull',
295]
ae13cb3b 296
20b03401 297 conf.set10('HAVE_COMPILER_ATTR_' + ccattr.underscorify().to_upper(), cc.has_function_attribute(ccattr))
ae13cb3b 298endforeach
5c26176d 299
20b03401 300## Syscalls.
ea6da257
CB
301found_syscalls = []
302missing_syscalls = []
20b03401
SG
303foreach tuple: [
304 ['bpf'],
305 ['close_range'],
306 ['endmntent'],
307 ['execveat'],
308 ['faccessat'],
309 ['strchrnul'],
310 ['fgetln'],
311 ['fsconfig'],
312 ['fsmount'],
313 ['fsopen'],
314 ['fspick'],
315 ['getgrgid_r'],
316 ['getline'],
317 ['getsubopt'],
318 ['gettid'],
319 ['hasmntopt'],
320 ['kcmp'],
321 ['keyctl'],
322 ['memfd_create'],
323 ['mount_setattr'],
324 ['move_mount'],
325 ['openat2'],
326 ['open_tree'],
327 ['personality'],
328 ['pidfd_open'],
329 ['pidfd_send_signal'],
330 ['pivot_root'],
331 ['prlimit'],
332 ['prlimit64'],
333 ['renameat2'],
334 ['sethostname'],
335 ['setmntent'],
336 ['setns'],
337 ['sigdescr_np'],
338 ['signalfd'],
339 ['statx'],
340 ['strlcat'],
341 ['strlcpy'],
342 ['unshare'],
343]
344
345 if tuple.length() >= 2
346 cond = tuple[1]
347 else
348 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
349 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
350 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
351 endif
352
353 if cond
354 found_syscalls += tuple[0]
355 else
356 missing_syscalls += tuple[0]
357 endif
358endforeach
359
360## Types.
361decl_headers = '''
362#include <uchar.h>
363#include <sys/mount.h>
364#include <sys/stat.h>
365#include <linux/fs.h>
366#include <linux/types.h>
367#include <linux/openat2.h>
368#include <linux/sched.h>
369'''
ea6da257 370
20b03401
SG
371foreach decl: [
372 '__aligned_u64',
373 'struct mount_attr',
374 'struct open_how',
375 'struct clone_args',
ea6da257
CB
376]
377
20b03401
SG
378 # We get -1 if the size cannot be determined
379 if cc.sizeof(decl, prefix: decl_headers, args: '-D_GNU_SOURCE') > 0
380 conf.set10('HAVE_' + decl.underscorify().to_upper(), true)
381 else
382 conf.set10('HAVE_' + decl.underscorify().to_upper(), false)
383 endif
ea6da257
CB
384endforeach
385
386found_types = []
387missing_types = []
20b03401
SG
388foreach tuple: [
389 ['scmp_filter_ctx'],
390 ['struct seccomp_notif_sizes'],
391 ['struct clone_args'],
392 ['__aligned_u64'],
393 ['struct mount_attr'],
394 ['struct open_how'],
395]
ea6da257 396
20b03401
SG
397 if tuple.length() >= 2
398 cond = tuple[1]
399 else
400 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
401 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
402 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
403 endif
404
405 if cond
406 found_types += tuple[0]
407 else
408 missing_types += tuple[0]
409 endif
410endforeach
411
412## Headers.
413foreach ident: [
414 ['bpf', '''#include <sys/syscall.h>
415 #include <unistd.h>'''],
416 ['close_range', '''#include <unistd.h>'''],
417 ['execveat', '''#include <unistd.h>'''],
418 ['endmntent', '''#include <stdio.h>
419 #include <mntent.h>'''],
420 ['faccessat', '''#include <fcntl.h>
421 #include <unistd.h>'''],
422 ['fexecve', '''#include <unistd.h>'''],
423 ['fgetln', '''#include <stdio.h>'''],
424 ['fsconfig', '''#include <sys/mount.h>'''],
425 ['fsmount', '''#include <sys/mount.h>'''],
426 ['fsopen', '''#include <sys/mount.h>'''],
427 ['fspick', '''#include <sys/mount.h>'''],
428 ['getgrgid_r', '''#include <sys/types.h>
429 #include <grp.h>'''],
430 ['getline', '''#include <stdio.h>'''],
431 ['getsubopt', '''#include <stdlib.h>'''],
432 ['gettid', '''#include <sys/types.h>
433 #include <unistd.h>'''],
434 ['hasmntopt', '''#include <stdio.h>
435 #include <mntent.h>'''],
436 ['kcmp', '''#include <linux/kcmp.h>'''],
437 ['keyctl', '''#include <sys/types.h>
438 #include <keyutils.h>'''],
439 ['memfd_create', '''#include <sys/mman.h>'''],
440 ['mount_setattr', '''#include <sys/mount.h>'''],
441 ['move_mount', '''#include <sys/mount.h>'''],
442 ['openat2', '''#include <sys/types.h>
443 #include <sys/stat.h>
444 #include <fctnl.h>'''],
445 ['open_tree', '''#include <sys/mount.h>'''],
446 ['personality', '''#include <sys/personality.h>'''],
447 ['pidfd_open', '''#include <stdlib.h>
448 #include <unistd.h>
449 #include <signal.h>
450 #include <sys/wait.h>'''],
451 ['pidfd_send_signal', '''#include <stdlib.h>
452 #include <unistd.h>
453 #include <signal.h>
454 #include <sys/wait.h>'''],
455 ['pivot_root', '''#include <stdlib.h>
456 #include <unistd.h>'''], # no known header declares pivot_root
457 ['prlimit', '''#include <sys/time.h>
458 #include <sys/resource.h>'''],
459 ['prlimit64', '''#include <sys/time.h>
460 #include <sys/resource.h>'''],
461 ['renameat2', '''#include <stdio.h>
462 #include <fcntl.h>'''],
463 ['sethostname', '''#include <unistd.h>'''],
464 ['setmntent', '''#include <stdio.h>
465 #include <mntent.h>'''],
466 ['setns', '''#include <sched.h>'''],
467 ['sigdescr_np', '''#include <string.h>'''],
468 ['signalfd', '''#include <sys/signalfd.h>'''],
469 ['statx', '''#include <sys/types.h>
470 #include <sys/stat.h>
471 #include <unistd.h>'''],
472 ['strchrnul', '''#include <string.h>'''],
473 ['strlcat', '''#include <string.h>'''],
474 ['strlcpy', '''#include <string.h>'''],
475 ['unshare', '''#include <sched.h>'''],
ea6da257
CB
476]
477
20b03401
SG
478 have = cc.has_function(ident[0], prefix: ident[1], args: '-D_GNU_SOURCE')
479 conf.set10('HAVE_' + ident[0].to_upper(), have)
ea6da257
CB
480endforeach
481
482found_headers = []
483missing_headers = []
20b03401
SG
484foreach tuple: [
485 ['sys/resource.h'],
486 ['sys/memfd.h'],
487 ['sys/personality.h'],
488 ['sys/signalfd.h'],
489 ['sys/timerfd.h'],
490 ['pty.h'],
491 ['utmpx.h'],
ea6da257 492]
20b03401
SG
493 conf.set10('HAVE_' + tuple[0].underscorify().to_upper(), cc.has_header(tuple[0]))
494
495 if tuple.length() >= 2
496 cond = tuple[1]
497 else
498 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
499 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
500 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
501 endif
502
503 if cond
504 found_headers += tuple[0]
505 else
506 missing_headers += tuple[0]
507 endif
ea6da257
CB
508endforeach
509
20b03401 510## Deps.
ea6da257
CB
511found_deps = []
512missing_deps = []
20b03401
SG
513foreach tuple: [
514 ['AppArmor'],
515 ['SECCOMP'],
516 ['SELinux'],
517 ['libcap'],
518 ['static libcap'],
519 ['openssl'],
520 ['liburing'],
ea6da257
CB
521]
522
20b03401
SG
523 if tuple.length() >= 2
524 cond = tuple[1]
525 else
526 ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
527 ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
528 cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
529 endif
530
531 if cond
532 found_deps += tuple[0]
533 else
534 missing_deps += tuple[0]
535 endif
ea6da257
CB
536endforeach
537
20b03401
SG
538# Generate config.h
539config_h = configure_file(
540 output: 'config.h',
541 configuration: conf)
542
543add_project_arguments('-include', 'config.h', language: 'c')
544
545# Binaries.
546cmd_programs = []
547hook_programs = []
548public_programs = []
549template_scripts = []
550test_programs = []
551
552# Includes.
553basic_includes = include_directories(
554 '.',
555 'src',
556 'src/include')
557
558liblxc_includes = [basic_includes, include_directories(
559 'src/lxc/cgroups',
560 'src/lxc/lsm',
561 'src/lxc/storage')]
562
563# Early sub-directories.
564subdir('src/include')
565subdir('src/lxc')
566
567# Library.
568liblxc_dependencies = [
569 threads,
570 libseccomp,
571 libcap,
572 libopenssl,
573 libselinux,
574 libapparmor,
575]
576
577if wants_io_uring == true
578 liblxc_dependencies += [liburing]
579endif
580
581liblxc = shared_library(
582 'lxc',
583 version: liblxc_version,
584 include_directories: liblxc_includes,
585 link_args: ['-DPIC'],
586 c_args: ['-DPIC'],
587 link_whole: [liblxc_static],
588 dependencies: liblxc_dependencies,
589 install: true)
590
591liblxc_dep = declare_dependency(
592 link_with: liblxc,
593 dependencies: liblxc_dependencies)
594
595# Rest of sub-directories.
4a858b56 596subdir('config/bash')
6dfabed1 597subdir('doc/rootfs')
20b03401
SG
598subdir('hooks')
599subdir('src/lxc/cmd')
600subdir('src/lxc/tools')
601subdir('src/lxc/tools/include')
602subdir('src/tests')
603subdir('templates')
604
0860988e
SG
605# Pkg-config.
606pkg_config_file = pkgconfig.generate(liblxc,
607 description: 'linux container tools',
608 version: version_data.get('LXC_VERSION'),
609 url: 'http://linuxcontainers.org',
610 libraries: '-lutil -lpthread -ldl',
611 libraries_private: pkgconfig_libs,
0860988e
SG
612)
613
1404fcb8
SG
614# Empty dirs.
615install_emptydir(join_paths(localstatedir, 'cache', 'lxc'))
616install_emptydir(join_paths(localstatedir, 'lib', 'lxc'))
617
20b03401 618# Build overview.
bf1f3470 619status = [
20b03401
SG
620 '@0@ @1@'.format(meson.project_name(), meson.project_version()),
621
622 'Meson version: @0@'.format(meson.version()),
623
624 'prefix directory: @0@'.format(prefixdir),
625 'bin directory: @0@'.format(bindir),
626 'data directory: @0@'.format(datadir),
627 'doc directory: @0@'.format(docdir),
628 'include directory: @0@'.format(includedir),
629 'lib directory: @0@'.format(libdir),
630 'libexec directory: @0@'.format(libexecdir),
631 'local state directory: @0@'.format(localstatedir),
632 'sbin directory: @0@'.format(sbindir),
633 'sysconf directory: @0@'.format(sysconfdir),
634
635 'lxc cgroup pattern: @0@'.format(cgrouppattern),
636 'lxc init directory: @0@'.format(libexecdir),
637 'runtime path: @0@'.format(runtimepath),
638
639 'lxc default config: @0@'.format(lxcdefaultconfig),
640 'lxc global config: @0@'.format(lxcglobalconfig),
641 'lxc hook directory: @0@'.format(lxchookdir),
642 'lxc hook bin directory: @0@'.format(lxchookbindir),
643 'lxc rootfs mount directory: @0@'.format(lxcrootfsmount),
644 'log path: @0@'.format(lxclogpath),
645 'lxc path: @0@'.format(lxcpath),
646 'lxc template config: @0@'.format(lxctemplateconfig),
647 'lxc template directory: @0@'.format(lxctemplatedir),
648 'lxc user network config: @0@'.format(lxc_user_network_conf),
649 'lxc user network database: @0@'.format(lxc_user_network_db)]
bf1f3470 650
ea6da257 651alt_time_epoch = run_command('date', '-Is', '-u', '-d',
aa326e18 652 '@@0@'.format(time_epoch), check: true).stdout().strip()
ea6da257 653status += [
20b03401 654 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
ea6da257
CB
655
656status += [
20b03401
SG
657 '',
658 'supported dependencies: @0@'.format(', '.join(found_deps)),
659 '',
660 'unsupported dependencies: @0@'.format(', '.join(missing_deps)),
661 '']
ea6da257
CB
662
663status += [
20b03401
SG
664 '',
665 'supported headers: @0@'.format(', '.join(found_headers)),
666 '',
667 'unsupported headers: @0@'.format(', '.join(missing_headers)),
668 '']
ea6da257
CB
669
670status += [
20b03401
SG
671 '',
672 'supported calls: @0@'.format(', '.join(found_syscalls)),
673 '',
674 'unsupported calls: @0@'.format(', '.join(missing_syscalls)),
675 '']
ea6da257
CB
676
677status += [
20b03401
SG
678 '',
679 'supported types: @0@'.format(', '.join(found_types)),
680 '',
681 'unsupported types: @0@'.format(', '.join(missing_types)),
682 '']
ea6da257 683
20b03401 684message('\n '.join(status))