1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-14 14:32:42 +01:00

Merge pull request #13706 from xokdvium/meson-format

meson: Apply formatting universally
This commit is contained in:
John Ericson 2025-08-06 20:50:44 -04:00 committed by GitHub
commit c4c3203b7b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
75 changed files with 469 additions and 476 deletions

View file

@ -9,12 +9,12 @@ config_pub_h = configure_file(
output : 'config.hh',
)
headers = [config_pub_h] + files(
headers = [ config_pub_h ] + files(
'binary-cache-store.hh',
'build-result.hh',
'build/derivation-goal.hh',
'build/derivation-building-goal.hh',
'build/derivation-building-misc.hh',
'build/derivation-goal.hh',
'build/derivation-trampoline-goal.hh',
'build/drv-output-substitution-goal.hh',
'build/goal.hh',
@ -27,8 +27,8 @@ headers = [config_pub_h] + files(
'common-ssh-store-config.hh',
'content-address.hh',
'daemon.hh',
'derivations.hh',
'derivation-options.hh',
'derivations.hh',
'derived-path-map.hh',
'derived-path.hh',
'downstream-placeholder.hh',

View file

@ -2,5 +2,4 @@ include_dirs += include_directories('../..')
headers += files(
'personality.hh',
# hack for trailing newline
)

View file

@ -1,6 +1,5 @@
sources += files(
'personality.cc',
# hack for trailing newline
)
subdir('include/nix/store')

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)

View file

@ -1,21 +1,35 @@
# vim: filetype=meson
option('embedded-sandbox-shell', type : 'boolean', value : false,
option(
'embedded-sandbox-shell',
type : 'boolean',
value : false,
description : 'include the sandbox shell in the Nix binary',
)
option('seccomp-sandboxing', type : 'feature',
option(
'seccomp-sandboxing',
type : 'feature',
description : 'build support for seccomp sandboxing (recommended unless your arch doesn\'t support libseccomp, only relevant on Linux)',
)
option('sandbox-shell', type : 'string', value : 'busybox',
option(
'sandbox-shell',
type : 'string',
value : 'busybox',
description : 'path to a statically-linked shell to use as /bin/sh in sandboxes (usually busybox)',
)
option('store-dir', type : 'string', value : '/nix/store',
option(
'store-dir',
type : 'string',
value : '/nix/store',
description : 'path of the Nix store',
)
option('log-dir', type : 'string', value : '/nix/var/log/nix',
option(
'log-dir',
type : 'string',
value : '/nix/var/log/nix',
description : 'path to store logs in for Nix',
)

View file

@ -7,5 +7,4 @@ include_dirs += include_directories(
#'build',
)
headers += files(
)
headers += files()