1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-21 09:49:36 +01:00

meson: Apply formatting universally

Now that we have applied the [1] patch, the diff is much
nicer and less noisy.

[1]: https://www.github.com/mesonbuild/meson/pull/14861
This commit is contained in:
Sergei Zimmerman 2025-08-07 02:52:13 +03:00
parent bf80696ed9
commit 385e2c3542
No known key found for this signature in database
62 changed files with 444 additions and 454 deletions

View file

@ -1,4 +1,6 @@
project('nix-store', 'cpp',
project(
'nix-store',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -27,31 +29,34 @@ subdir('nix-meson-build-support/default-system-cpu')
configdata_pub.set_quoted(
'NIX_LOCAL_SYSTEM',
nix_system_cpu + '-' + host_machine.system(),
description :
'This is the system name Nix expects for local running instance of Nix.\n\n'
description : 'This is the system name Nix expects for local running instance of Nix.\n\n'
+ 'See the "system" setting for additional details',
)
deps_private_maybe_subproject = [
]
deps_private_maybe_subproject = []
deps_public_maybe_subproject = [
dependency('nix-util'),
]
subdir('nix-meson-build-support/subprojects')
run_command('ln', '-s',
run_command(
'ln',
'-s',
meson.project_build_root() / '__nothing_link_target',
meson.project_build_root() / '__nothing_symlink',
# native doesn't allow dangling symlinks, which the tests require
env : { 'MSYS' : 'winsymlinks:lnk' },
env : {'MSYS' : 'winsymlinks:lnk'},
check : true,
)
can_link_symlink = run_command('ln',
can_link_symlink = run_command(
'ln',
meson.project_build_root() / '__nothing_symlink',
meson.project_build_root() / '__nothing_hardlink',
check : false,
).returncode() == 0
run_command('rm', '-f',
run_command(
'rm',
'-f',
meson.project_build_root() / '__nothing_symlink',
meson.project_build_root() / '__nothing_hardlink',
check : true,
@ -84,20 +89,20 @@ configdata_pub.set(
if host_machine.system() == 'darwin'
sandbox = cxx.find_library('sandbox')
deps_other += [sandbox]
deps_other += [ sandbox ]
endif
if host_machine.system() == 'windows'
wsock32 = cxx.find_library('wsock32')
deps_other += [wsock32]
deps_other += [ wsock32 ]
endif
subdir('nix-meson-build-support/libatomic')
boost = dependency(
'boost',
modules : ['container', 'regex'],
include_type: 'system',
modules : [ 'container', 'regex' ],
include_type : 'system',
)
# boost is a public dependency, but not a pkg-config dependency unfortunately, so we
# put in `deps_other`.
@ -112,9 +117,16 @@ seccomp_required = get_option('seccomp-sandboxing')
if not is_linux and seccomp_required.enabled()
warning('Force-enabling seccomp on non-Linux does not make sense')
endif
seccomp = dependency('libseccomp', 'seccomp', required : seccomp_required, version : '>=2.5.5')
seccomp = dependency(
'libseccomp',
'seccomp',
required : seccomp_required,
version : '>=2.5.5',
)
if is_linux and not seccomp.found()
warning('Sandbox security is reduced because libseccomp has not been found! Please provide libseccomp if it supports your CPU architecture.')
warning(
'Sandbox security is reduced because libseccomp has not been found! Please provide libseccomp if it supports your CPU architecture.',
)
endif
configdata_priv.set('HAVE_SECCOMP', seccomp.found().to_int())
deps_private += seccomp
@ -132,8 +144,8 @@ aws_s3 = dependency('aws-cpp-sdk-s3', required : false)
configdata_pub.set('NIX_WITH_S3_SUPPORT', aws_s3.found().to_int())
if aws_s3.found()
aws_s3 = declare_dependency(
include_directories: include_directories(aws_s3.get_variable('includedir')),
link_args: [
include_directories : include_directories(aws_s3.get_variable('includedir')),
link_args : [
'-L' + aws_s3.get_variable('libdir'),
'-laws-cpp-sdk-transfer',
'-laws-cpp-sdk-s3',
@ -159,7 +171,10 @@ endforeach
busybox = find_program(get_option('sandbox-shell'), required : false)
configdata_priv.set('HAVE_EMBEDDED_SANDBOX_SHELL', get_option('embedded-sandbox-shell').to_int())
configdata_priv.set(
'HAVE_EMBEDDED_SANDBOX_SHELL',
get_option('embedded-sandbox-shell').to_int(),
)
if get_option('embedded-sandbox-shell')
configdata_priv.set_quoted('SANDBOX_SHELL', '__embedded_sandbox_shell__')
@ -171,12 +186,7 @@ if get_option('embedded-sandbox-shell')
hexdump = find_program('hexdump', native : true)
embedded_sandbox_shell_gen = custom_target(
'embedded-sandbox-shell.gen.hh',
command : [
hexdump,
'-v',
'-e',
'1/1 "0x%x," "\n"'
],
command : [ hexdump, '-v', '-e', '1/1 "0x%x," "\n"' ],
input : busybox.full_path(),
output : 'embedded-sandbox-shell.gen.hh',
capture : true,
@ -228,21 +238,20 @@ endif
# Aside from prefix itself, each of these was made into an absolute path
# by joining it with prefix, unless it was already an absolute path
# (which is the default for store-dir, localstatedir, and log-dir).
configdata_priv.set_quoted('NIX_PREFIX', prefix)
configdata_priv.set_quoted('NIX_PREFIX', prefix)
configdata_priv.set_quoted('NIX_STORE_DIR', store_dir)
configdata_priv.set_quoted('NIX_DATA_DIR', datadir)
configdata_priv.set_quoted('NIX_DATA_DIR', datadir)
configdata_priv.set_quoted('NIX_STATE_DIR', localstatedir / 'nix')
configdata_priv.set_quoted('NIX_LOG_DIR', log_dir)
configdata_priv.set_quoted('NIX_CONF_DIR', sysconfdir / 'nix')
configdata_priv.set_quoted('NIX_MAN_DIR', mandir)
configdata_priv.set_quoted('NIX_LOG_DIR', log_dir)
configdata_priv.set_quoted('NIX_CONF_DIR', sysconfdir / 'nix')
configdata_priv.set_quoted('NIX_MAN_DIR', mandir)
lsof = find_program('lsof', required : false)
configdata_priv.set_quoted(
'LSOF',
lsof.found()
? lsof.full_path()
# Just look up on the PATH
: 'lsof',
lsof.found() ? lsof.full_path()
# Just look up on the PATH
: 'lsof',
)
config_priv_h = configure_file(
@ -255,8 +264,8 @@ subdir('nix-meson-build-support/common')
sources = files(
'binary-cache-store.cc',
'build-result.cc',
'build/derivation-goal.cc',
'build/derivation-building-goal.cc',
'build/derivation-goal.cc',
'build/derivation-trampoline-goal.cc',
'build/drv-output-substitution-goal.cc',
'build/entry-points.cc',
@ -270,8 +279,8 @@ sources = files(
'common-ssh-store-config.cc',
'content-address.cc',
'daemon.cc',
'derivations.cc',
'derivation-options.cc',
'derivations.cc',
'derived-path-map.cc',
'derived-path.cc',
'downstream-placeholder.cc',
@ -318,8 +327,8 @@ sources = files(
'ssh.cc',
'store-api.cc',
'store-dir-config.cc',
'store-registration.cc',
'store-reference.cc',
'store-registration.cc',
'uds-remote-store.cc',
'worker-protocol-connection.cc',
'worker-protocol.cc',
@ -347,10 +356,10 @@ this_library = library(
config_priv_h,
dependencies : deps_public + deps_private + deps_other,
include_directories : include_dirs,
link_args: linker_export_flags,
link_args : linker_export_flags,
prelink : true, # For C++ static initializers
install : true,
cpp_pch : do_pch ? ['pch/precompiled-headers.hh'] : []
cpp_pch : do_pch ? [ 'pch/precompiled-headers.hh' ] : [],
)
install_headers(headers, subdir : 'nix/store', preserve_path : true)