Skip to content

Commit

Permalink
meson: Rework options
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
  • Loading branch information
stgraber committed May 7, 2022
1 parent 5730c26 commit 7609de1
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 38 deletions.
25 changes: 14 additions & 11 deletions meson.build
Expand Up @@ -48,38 +48,39 @@ project_build_root = meson.current_build_dir()
# Path handling.
prefixdir = get_option('prefix')

apparmorcachedir = get_option('apparmor-cache-dir')
globalconfig = get_option('global-config')
apparmorcachedir = get_option('apparmor-cache-path')
globalconfig = get_option('global-config-path')
localstatedir = join_paths('/', get_option('localstatedir'))
logpath = get_option('log-path')
lxcpathprefix = get_option('config-path')
rootfsmount = get_option('rootfs-mount-dir')
user_network_db_opt = get_option('user-network-db')
user_network_conf_opt = get_option('user-network-conf')
lxcpathprefix = get_option('data-path')
rootfsmount = get_option('rootfs-mount-path')
user_network_db_opt = get_option('usernet-db-path')
user_network_conf_opt = get_option('usernet-config-path')

bashcompletiondir = join_paths('/', 'usr', 'share', 'bash-completion', 'completions')
bindir = join_paths(prefixdir, get_option('bindir'))
datadir = join_paths(prefixdir, get_option('datadir'))
docdir = join_paths(prefixdir, get_option('docdir'))
docdir = join_paths(datadir, get_option('doc-path'))
includedir = join_paths(prefixdir, get_option('includedir'))
libdir = join_paths(prefixdir, get_option('libdir'))
libexecdir = join_paths(prefixdir, get_option('libexecdir'))
runtimepath = join_paths(prefixdir, get_option('runtime-path'))
sbindir = join_paths(prefixdir, get_option('sbindir'))
sysconfdir = join_paths(prefixdir, get_option('sysconfdir'))

lxcapparmorcachedir = join_paths(localstatedir, apparmorcachedir)
lxcdefaultconfig = join_paths(sysconfdir, 'lxc/default.conf')
lxcexamplesdir = join_paths(docdir, 'examples')
lxcglobalconfig = join_paths(sysconfdir, globalconfig)
lxcapparmorcachedir = join_paths(localstatedir, apparmorcachedir)
lxcrootfsmount = join_paths(prefixdir, rootfsmount)
lxchookbindir = join_paths(libexecdir, 'lxc/hooks')
lxchookdir = join_paths(datadir, 'lxc/hooks')
lxcinclude = join_paths(includedir, 'lxc')
lxclibexec = join_paths(libexecdir, 'lxc')
lxclogpath = join_paths(localstatedir, logpath)
lxcpath = join_paths(localstatedir, lxcpathprefix)
lxcrootfsmount = join_paths(libdir, rootfsmount)
lxctemplateconfig = join_paths(datadir, 'lxc/config')
lxctemplatedir = join_paths(datadir, 'lxc/templates')
lxchookdir = join_paths(datadir, 'lxc/hooks')
lxchookbindir = join_paths(libexecdir, 'lxc/hooks')
lxc_user_network_conf = join_paths(sysconfdir, user_network_conf_opt)
lxc_user_network_db = join_paths(runtimepath, user_network_db_opt)

Expand Down Expand Up @@ -111,6 +112,8 @@ conf.set_quoted('LXC_USERNIC_DB', lxc_user_network_db)
# Custom configuration.
cgrouppattern = get_option('cgroup-pattern')
wants_io_uring = get_option('io-uring-event-loop')
want_examples = get_option('examples')
want_mans = get_option('man')
want_tests = get_option('tests')

conf.set_quoted('DEFAULT_CGROUP_PATTERN', cgrouppattern)
Expand Down
62 changes: 35 additions & 27 deletions meson_options.txt
@@ -1,41 +1,49 @@
# -*- mode: meson -*-

option('tests', type : 'boolean', value: 'false',
description : 'enable tests')
# Main options
option('cgroup-pattern', type: 'string', value: '',
description: 'CGroup pattern')

option('runtime-path', type : 'string', value : '/run',
description : 'the runtime directory')
option('examples', type: 'boolean', value: 'true',
description: 'build and install examples')

option('init-script', type : 'combo',
choices : ['systemd', 'sysvinit', 'openrc', 'upstart'], value : 'systemd',
description : 'init script')
option('init-script', type: 'combo',
choices: ['systemd', 'sysvinit', 'openrc', 'upstart'], value: 'systemd',
description: 'init script')

option('apparmor-cache-dir', type : 'string', value : 'cache/lxc/apparmor',
description : 'the AppArmor cache directory')
option('io-uring-event-loop', type: 'boolean', value: 'false',
description: 'Enable io-uring based event loop')

option('rootfs-mount-dir', type : 'string', value : 'lib/x86_64-linux-gnu/lxc/rootfs',
description : 'the rootfs mount directory')
option('man', type: 'boolean', value: 'true',
description: 'build and install manpages')

option('cgroup-pattern', type : 'string', value : '',
description : 'the rootfs mount directory')
option('tests', type: 'boolean', value: 'false',
description: 'build and install tests')

option('log-path', type : 'string', value : 'log/lxc',
description : 'the rootfs mount directory')
# Paths
option('apparmor-cache-path', type: 'string', value: 'cache/lxc/apparmor',
description: 'AppArmor cache directory')

option('config-path', type : 'string', value : 'lib/lxc',
description : 'the rootfs mount directory')
option('data-path', type: 'string', value: 'lib/lxc',
description: 'Container storage directory')

option('global-config', type : 'string', value : 'lxc/lxc.conf',
description : 'the rootfs mount directory')
option('doc-path', type: 'string', value: 'doc/lxc',
description: 'Documentation directory')

option('docdir', type : 'string',
description : 'documentation directory')
option('global-config-path', type: 'string', value: 'lxc/lxc.conf',
description: 'Global configuration file path')

option('user-network-conf', type : 'string', value : 'lxc/lxc-usernet',
description : 'user network interface configuration file')
option('log-path', type: 'string', value: 'log/lxc',
description: 'Loging directory')

option('user-network-db', type : 'string', value : 'lxc/nics',
description : 'user network database')
option('rootfs-mount-path', type: 'string', value: 'lxc/rootfs',
description: 'Container rootfs mount directory')

option('io-uring-event-loop', type : 'boolean', value: 'false',
description : 'enable io-uring based event loop')
option('runtime-path', type: 'string', value: '/run',
description: 'Main runtime directory')

option('usernet-config-path', type: 'string', value: 'lxc/lxc-usernet',
description: 'User network configuration file path')

option('usernet-db-path', type: 'string', value: 'lxc/nics',
description: 'User network database file path')

0 comments on commit 7609de1

Please sign in to comment.