'libkmod',
content_files : version_file,
ignore_headers : [
- '@0@/libkmod/libkmod-index.h'.format(meson.project_source_root()),
- '@0@/libkmod/libkmod-internal-file.h'.format(meson.project_source_root()),
- '@0@/libkmod/libkmod-internal.h'.format(meson.project_source_root()),
+ f'@project_source_root@/libkmod/libkmod-index.h',
+ f'@project_source_root@/libkmod/libkmod-internal-file.h',
+ f'@project_source_root@/libkmod/libkmod-internal.h',
],
scan_args : '--ignore-decorators="KMOD_EXPORT"',
- src_dir : '@0@/libkmod/'.format(meson.project_source_root()),
+ src_dir : f'@project_source_root@/libkmod/',
namespace : 'kmod',
module_version : '3',
main_xml : 'libkmod-docs.xml',
man = tuple[1]
custom_target(
- 'man_@0@_@1@'.format(section, man),
+ f'man_@section@_@man@',
command : [
build_scdoc,
scdoc,
's|@DISTCONFDIR@|@0@|g;'.format(distconfdir) +
's|@MODULE_DIRECTORY@|@0@|g;'.format(moduledir),
],
- input : '@0@.@1@.scd'.format(man, section),
- output : '@0@.@1@'.format(man, section),
+ input : f'@man@.@section@.scd',
+ output : f'@man@.@section@',
capture : true,
install : true,
- install_dir : get_option('mandir') / 'man@0@'.format(section)
+ install_dir : get_option('mandir') / f'man@section@',
)
endforeach
dest = tuple[2]
custom_target(
- 'man_@0@_@1@'.format(section, man),
- command : ['echo', '.so @0@'.format(dest)],
- output : '@0@.@1@'.format(man, section),
+ f'man_@section@_@man@',
+ command : ['echo', f'.so @dest@'],
+ output : f'@man@.@section@',
capture : true,
install : true,
- install_dir : get_option('mandir') / 'man@0@'.format(section)
+ install_dir : get_option('mandir') / f'man@section@',
)
endforeach
'secure_getenv',
]
foreach func : _funcs
- cdata.set10('HAVE_@0@'.format(func.to_upper()), cc.has_function(func, args : '-D_GNU_SOURCE'))
+ func_to_upper = func.to_upper()
+ cdata.set10(f'HAVE_@func_to_upper@', cc.has_function(func, args : '-D_GNU_SOURCE'))
endforeach
# Meson has some amount of support for finding builtins by passing the symbol
args = tuple[1]
required = tuple[2]
# XXX: meson 1.5.0 has links(... required ) flag
- have = cc.links('int main(void){@0@(@1@);return 0;}'.format(builtin, args))
+ have = cc.links(f'int main(void){@builtin@(@args@);return 0;}')
if required and not have
- error('required builtin function not found: @0@'.format(builtin))
+ error(f'required builtin function not found: @builtin@')
endif
- cdata.set10('HAVE_@0@'.format(builtin.to_upper()), have)
+ builtin_to_upper = builtin.to_upper()
+ cdata.set10(f'HAVE_@builtin_to_upper@', have)
endforeach
# basename may be only available in libgen.h with the POSIX behavior,
decl = tuple[0]
header = tuple[1]
have = cc.has_header_symbol(header, decl, args : '-D_GNU_SOURCE')
- cdata.set10('HAVE_DECL_@0@'.format(decl.to_upper()), have)
+ decl_to_upper = decl.to_upper()
+ cdata.set10(f'HAVE_DECL_@decl_to_upper@', have)
endforeach
cdata.set10('HAVE_STATIC_ASSERT', cc.compiles('_Static_assert(1, "Test");', name : '_Static_assert'))
# Directories
#-------------------------------------------------------------------------------
+project_source_root = meson.project_source_root()
+project_build_root = meson.project_build_root()
+
prefixdir = get_option('prefix')
sysconfdir = get_option('sysconfdir')
bindir = prefixdir / get_option('bindir')
customdir = def_path
else
if not customdir.startswith('/')
- error('User provided @0@, \'@1@\' is not an absolute path.'
- .format(dir_option, customdir))
+ error(f'User provided @dir_option@, \'@customdir@\' is not an absolute path.')
endif
# Strip all leading/trailing and re-add only the leading one.
customdir = '/' / customdir.strip('/')
if completion.found()
completion_prefix = completion.get_variable(pkgconfig : 'prefix')
if completion_prefix != prefixdir
- warning('User provided prefix \'@0@\' differs from @1@ one \'@2@\'.'
- .format(prefixdir, pkg_dep, completion_prefix))
- warning('Not installing completion. To re-enable, manually set @0@.'
- .format(dir_option))
+ warning(f'User provided prefix \'@prefixdir@\' differs from @pkg_dep@ one \'@completion_prefix@\'.')
+ warning(f'Not installing completion. To re-enable, manually set @dir_option@.')
completiondir = 'no'
else
completiondir = completion.get_variable(pkgconfig : 'completionsdir')
dlopen = dlopen_all or get_option('dlopen').contains(opt)
if not dlopen_all and dlopen and get_option(opt).disabled()
- error('Incompatiable options: dlopen=@0@ for disabled @0@'.format(opt))
+ error(f'Incompatiable options: dlopen=@opt@ for disabled @opt@')
endif
dep = dependency(pkg_dep, version : pkg_dep_version, required : get_option(opt))
cdata.set10('ENABLE_' + opt.to_upper() + '_DLOPEN', have and dlopen)
if have
- module_compressions += '@0@ '.format(opt)
+ module_compressions += f'@opt@ '
endif
features += ['@0@@1@'.format(have ? '+' : '-', opt.to_upper())]
'build-module-playground',
command : [
setup_modules,
- meson.project_source_root(),
+ project_source_root,
'testsuite/module-playground', # do not prepend source/build root
],
# The command ensures we don't do extra work, so the missing output token file
'create-rootfs',
command : [
setup_rootfs,
- meson.project_source_root() / 'testsuite/rootfs-pristine',
- meson.project_build_root() / 'testsuite/rootfs',
- meson.project_build_root() / 'testsuite/module-playground',
- meson.project_build_root() / 'config.h',
+ f'@project_source_root@/testsuite/rootfs-pristine',
+ f'@project_build_root@/testsuite/rootfs',
+ f'@project_build_root@/testsuite/module-playground',
+ f'@project_build_root@/config.h',
sysconfdir,
moduledir,
],
foreach mod : _test_override_mods
test_override_mods += shared_module(
mod,
- files('@0@.c'.format(mod)),
+ files(f'@mod@.c'),
include_directories : top_include,
- c_args : '-DABS_TOP_BUILDDIR="@0@"'.format(meson.project_build_root()),
+ c_args : f'-DABS_TOP_BUILDDIR="@project_build_root@"',
dependencies : libdl,
link_with : [libshared, libkmod_internal],
gnu_symbol_visibility : 'hidden',
testsuite_c_args = [
'-UNDEBUG',
- '-DTESTSUITE_ROOTFS="@0@/testsuite/rootfs/"'.format(meson.project_build_root()),
- '-DTOOLS_DIR="@0@/"'.format(meson.project_build_root()),
- '-DOVERRIDE_LIBDIR="@0@/testsuite/"'.format(meson.project_build_root()),
+ f'-DTESTSUITE_ROOTFS="@project_build_root@/testsuite/rootfs/"',
+ f'-DTOOLS_DIR="@project_build_root@/"',
+ f'-DOVERRIDE_LIBDIR="@project_build_root@/testsuite/"',
]
libtestsuite = static_library(
foreach input : _testsuite
exec = executable(
input,
- files('@0@.c'.format(input)),
+ files(f'@input@.c'),
include_directories : top_include,
c_args : testsuite_c_args,
link_with : [libshared, libkmod_internal, libtestsuite],