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