1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-08 19:46:02 +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,5 @@
project('nix-manual',
project(
'nix-manual',
version : files('.version'),
meson_version : '>= 1.1',
license : 'LGPL-2.1-or-later',
@ -8,44 +9,45 @@ nix = find_program('nix', native : true)
mdbook = find_program('mdbook', native : true)
bash = find_program('bash', native : true)
rsync = find_program('rsync', required: true, native: true)
rsync = find_program('rsync', required : true, native : true)
pymod = import('python')
python = pymod.find_installation('python3')
nix_env_for_docs = {
'HOME': '/dummy',
'NIX_CONF_DIR': '/dummy',
'NIX_SSL_CERT_FILE': '/dummy/no-ca-bundle.crt',
'NIX_STATE_DIR': '/dummy',
'NIX_CONFIG': 'cores = 0',
'HOME' : '/dummy',
'NIX_CONF_DIR' : '/dummy',
'NIX_SSL_CERT_FILE' : '/dummy/no-ca-bundle.crt',
'NIX_STATE_DIR' : '/dummy',
'NIX_CONFIG' : 'cores = 0',
}
nix_for_docs = [nix, '--experimental-features', 'nix-command']
nix_for_docs = [ nix, '--experimental-features', 'nix-command' ]
nix_eval_for_docs_common = nix_for_docs + [
'eval',
'-I', 'nix=' + meson.current_source_dir(),
'-I',
'nix=' + meson.current_source_dir(),
'--store', 'dummy://',
'--impure',
]
nix_eval_for_docs = nix_eval_for_docs_common + '--raw'
conf_file_json = custom_target(
command : nix_for_docs + ['config', 'show', '--json'],
command : nix_for_docs + [ 'config', 'show', '--json' ],
capture : true,
output : 'conf-file.json',
env : nix_env_for_docs,
)
language_json = custom_target(
command: [nix, '__dump-language'],
command : [ nix, '__dump-language' ],
output : 'language.json',
capture : true,
env : nix_env_for_docs,
)
nix3_cli_json = custom_target(
command : [nix, '__dump-cli'],
command : [ nix, '__dump-cli' ],
capture : true,
output : 'nix.json',
env : nix_env_for_docs,
@ -79,7 +81,8 @@ manual = custom_target(
'manual',
command : [
bash,
'-euo', 'pipefail',
'-euo',
'pipefail',
'-c',
'''
@0@ @INPUT0@ @CURRENT_SOURCE_DIR@ > @DEPFILE@
@ -120,8 +123,8 @@ manual = custom_target(
],
depfile : 'manual.d',
env : {
'RUST_LOG': 'info',
'MDBOOK_SUBSTITUTE_SEARCH': meson.current_build_dir() / 'source',
'RUST_LOG' : 'info',
'MDBOOK_SUBSTITUTE_SEARCH' : meson.current_build_dir() / 'source',
},
)
manual_html = manual[0]
@ -133,7 +136,8 @@ install_subdir(
)
nix_nested_manpages = [
[ 'nix-env',
[
'nix-env',
[
'delete-generations',
'install',
@ -148,7 +152,8 @@ nix_nested_manpages = [
'upgrade',
],
],
[ 'nix-store',
[
'nix-store',
[
'add-fixed',
'add',

View file

@ -1,13 +1,12 @@
xp_features_json = custom_target(
command : [nix, '__dump-xp-features'],
command : [ nix, '__dump-xp-features' ],
capture : true,
output : 'xp-features.json',
)
experimental_features_shortlist_md = custom_target(
command : nix_eval_for_docs + [
'--expr',
'import @INPUT0@ (builtins.fromJSON (builtins.readFile ./@INPUT1@))',
'--expr', 'import @INPUT0@ (builtins.fromJSON (builtins.readFile ./@INPUT1@))',
],
input : [
'../../generate-xp-features-shortlist.nix',
@ -19,14 +18,8 @@ experimental_features_shortlist_md = custom_target(
)
nix3_cli_files = custom_target(
command : [
python.full_path(),
'@INPUT0@',
'@OUTPUT@',
'--'
] + nix_eval_for_docs + [
'--expr',
'import @INPUT1@ true (builtins.readFile ./@INPUT2@)',
command : [ python.full_path(), '@INPUT0@', '@OUTPUT@', '--' ] + nix_eval_for_docs + [
'--expr', 'import @INPUT1@ true (builtins.readFile ./@INPUT2@)',
],
input : [
'../../remove_before_wrapper.py',
@ -40,8 +33,7 @@ nix3_cli_files = custom_target(
conf_file_md_body = custom_target(
command : [
nix_eval_for_docs,
'--expr',
'import @INPUT0@ { prefix = "conf"; } (builtins.fromJSON (builtins.readFile ./@INPUT1@))',
'--expr', 'import @INPUT0@ { prefix = "conf"; } (builtins.fromJSON (builtins.readFile ./@INPUT1@))',
],
capture : true,
input : [

View file

@ -1,7 +1,6 @@
experimental_feature_descriptions_md = custom_target(
command : nix_eval_for_docs + [
'--expr',
'import @INPUT0@ (builtins.fromJSON (builtins.readFile @INPUT1@))',
'--expr', 'import @INPUT0@ (builtins.fromJSON (builtins.readFile @INPUT1@))',
],
input : [
'../../generate-xp-features.nix',

View file

@ -1,19 +1,13 @@
builtins_md = custom_target(
command : [
python.full_path(),
'@INPUT0@',
'@OUTPUT@',
'--'
] + nix_eval_for_docs + [
'--expr',
'(builtins.readFile @INPUT3@) + import @INPUT1@ (builtins.fromJSON (builtins.readFile ./@INPUT2@)) + (builtins.readFile @INPUT4@)',
command : [ python.full_path(), '@INPUT0@', '@OUTPUT@', '--' ] + nix_eval_for_docs + [
'--expr', '(builtins.readFile @INPUT3@) + import @INPUT1@ (builtins.fromJSON (builtins.readFile ./@INPUT2@)) + (builtins.readFile @INPUT4@)',
],
input : [
'../../remove_before_wrapper.py',
'../../generate-builtins.nix',
language_json,
'builtins-prefix.md',
'builtins-suffix.md'
'builtins-suffix.md',
],
output : 'builtins.md',
env : nix_env_for_docs,

View file

@ -1,7 +1,8 @@
summary_rl_next = custom_target(
command : [
bash,
'-euo', 'pipefail',
'-euo',
'pipefail',
'-c',
'''
if [ -e "@INPUT@" ]; then
@ -12,6 +13,6 @@ summary_rl_next = custom_target(
input : [
rl_next_generated,
],
capture: true,
capture : true,
output : 'SUMMARY-rl-next.md',
)

View file

@ -1,12 +1,6 @@
types_dir = custom_target(
command : [
python.full_path(),
'@INPUT0@',
'@OUTPUT@',
'--'
] + nix_eval_for_docs + [
'--expr',
'import @INPUT1@ (builtins.fromJSON (builtins.readFile ./@INPUT2@)).stores',
command : [ python.full_path(), '@INPUT0@', '@OUTPUT@', '--' ] + nix_eval_for_docs + [
'--expr', 'import @INPUT1@ (builtins.fromJSON (builtins.readFile ./@INPUT2@)).stores',
],
input : [
'../../remove_before_wrapper.py',

View file

@ -59,108 +59,6 @@
${lib.getExe meson} format -ic ${../meson.format} "$file"
done
''}";
excludes = [
# We haven't applied formatting to these files yet
''^doc/manual/meson.build$''
''^doc/manual/source/command-ref/meson.build$''
''^doc/manual/source/development/meson.build$''
''^doc/manual/source/language/meson.build$''
''^doc/manual/source/meson.build$''
''^doc/manual/source/release-notes/meson.build$''
''^doc/manual/source/store/meson.build$''
''^misc/bash/meson.build$''
''^misc/fish/meson.build$''
''^misc/launchd/meson.build$''
''^misc/meson.build$''
''^misc/systemd/meson.build$''
''^misc/zsh/meson.build$''
''^nix-meson-build-support/$''
''^nix-meson-build-support/big-objs/meson.build$''
''^nix-meson-build-support/common/meson.build$''
''^nix-meson-build-support/deps-lists/meson.build$''
''^nix-meson-build-support/export/meson.build$''
''^nix-meson-build-support/export-all-symbols/meson.build$''
''^nix-meson-build-support/generate-header/meson.build$''
''^nix-meson-build-support/libatomic/meson.build$''
''^nix-meson-build-support/subprojects/meson.build$''
''^scripts/meson.build$''
''^src/external-api-docs/meson.build$''
''^src/internal-api-docs/meson.build$''
''^src/libcmd/include/nix/cmd/meson.build$''
''^src/libcmd/meson.build$''
''^src/libcmd/nix-meson-build-support$''
''^src/libexpr/include/nix/expr/meson.build$''
''^src/libexpr/meson.build$''
''^src/libexpr/nix-meson-build-support$''
''^src/libexpr-c/meson.build$''
''^src/libexpr-c/nix-meson-build-support$''
''^src/libexpr-test-support/meson.build$''
''^src/libexpr-test-support/nix-meson-build-support$''
''^src/libexpr-tests/meson.build$''
''^src/libexpr-tests/nix-meson-build-support$''
''^src/libfetchers/include/nix/fetchers/meson.build$''
''^src/libfetchers/meson.build$''
''^src/libfetchers/nix-meson-build-support$''
''^src/libfetchers-c/meson.build$''
''^src/libfetchers-c/nix-meson-build-support$''
''^src/libfetchers-tests/meson.build$''
''^src/libfetchers-tests/nix-meson-build-support$''
''^src/libflake/include/nix/flake/meson.build$''
''^src/libflake/meson.build$''
''^src/libflake/nix-meson-build-support$''
''^src/libflake-c/meson.build$''
''^src/libflake-c/nix-meson-build-support$''
''^src/libflake-tests/meson.build$''
''^src/libflake-tests/nix-meson-build-support$''
''^src/libmain/include/nix/main/meson.build$''
''^src/libmain/meson.build$''
''^src/libmain/nix-meson-build-support$''
''^src/libmain-c/meson.build$''
''^src/libmain-c/nix-meson-build-support$''
''^src/libstore/include/nix/store/meson.build$''
''^src/libstore/meson.build$''
''^src/libstore/nix-meson-build-support$''
''^src/libstore/unix/include/nix/store/meson.build$''
''^src/libstore/unix/meson.build$''
''^src/libstore/windows/meson.build$''
''^src/libstore-c/meson.build$''
''^src/libstore-c/nix-meson-build-support$''
''^src/libstore-test-support/include/nix/store/tests/meson.build$''
''^src/libstore-test-support/meson.build$''
''^src/libstore-test-support/nix-meson-build-support$''
''^src/libstore-tests/meson.build$''
''^src/libstore-tests/nix-meson-build-support$''
''^src/libutil/meson.build$''
''^src/libutil/nix-meson-build-support$''
''^src/libutil/unix/include/nix/util/meson.build$''
''^src/libutil/unix/meson.build$''
''^src/libutil/windows/meson.build$''
''^src/libutil-c/meson.build$''
''^src/libutil-c/nix-meson-build-support$''
''^src/libutil-test-support/include/nix/util/tests/meson.build$''
''^src/libutil-test-support/meson.build$''
''^src/libutil-test-support/nix-meson-build-support$''
''^src/libutil-tests/meson.build$''
''^src/libutil-tests/nix-meson-build-support$''
''^src/nix/meson.build$''
''^src/nix/nix-meson-build-support$''
''^src/perl/lib/Nix/meson.build$''
''^src/perl/meson.build$''
''^tests/functional/ca/meson.build$''
''^tests/functional/common/meson.build$''
''^tests/functional/dyn-drv/meson.build$''
''^tests/functional/flakes/meson.build$''
''^tests/functional/git-hashing/meson.build$''
''^tests/functional/local-overlay-store/meson.build$''
''^tests/functional/meson.build$''
''^src/libcmd/meson.options$''
''^src/libexpr/meson.options$''
''^src/libstore/meson.options$''
''^src/libutil/meson.options$''
''^src/libutil-c/meson.options$''
''^src/nix/meson.options$''
''^src/perl/meson.options$''
];
};
nixfmt-rfc-style = {
enable = true;

View file

@ -9,5 +9,5 @@ configure_file(
# 'storedir' : store_dir,
# 'localstatedir' : localstatedir,
# 'bindir' : bindir,
},
},
)

View file

@ -2,5 +2,5 @@ if host_machine.system() == 'windows'
# libexpr's primops creates a large object
# Without the following flag, we'll get errors when cross-compiling to mingw32:
# Fatal error: can't write 66 bytes to section .text of src/libexpr/libnixexpr.dll.p/primops.cc.obj: 'file too big'
add_project_arguments([ '-Wa,-mbig-obj' ], language: 'cpp')
add_project_arguments([ '-Wa,-mbig-obj' ], language : 'cpp')
endif

View file

@ -6,7 +6,7 @@
# *interface*.
#
# See `man pkg-config` for some details.
deps_private = [ ]
deps_private = []
# These are public dependencies with pkg-config files. Public is the
# opposite of private: these dependencies are used in installed header
@ -23,14 +23,14 @@ deps_private = [ ]
# N.B. For distributions that care about "ABI" stability and not just
# "API" stability, the private dependencies also matter as they can
# potentially affect the public ABI.
deps_public = [ ]
deps_public = []
# These are subproject deps (type == "internal"). They are other
# packages in `/src` in this repo. The private vs public distinction is
# the same as above.
deps_private_subproject = [ ]
deps_public_subproject = [ ]
deps_private_subproject = []
deps_public_subproject = []
# These are dependencencies without pkg-config files. Ideally they are
# just private, but they may also be public (e.g. boost).
deps_other = [ ]
deps_other = []

View file

@ -5,7 +5,7 @@ if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
# and not detail with this yet.
#
# TODO do not do this, and instead do fine-grained export annotations.
linker_export_flags = ['-Wl,--export-all-symbols']
linker_export_flags = [ '-Wl,--export-all-symbols' ]
else
linker_export_flags = []
endif

View file

@ -14,7 +14,7 @@ extra_pkg_config_variables = get_variable('extra_pkg_config_variables', {})
extra_cflags = []
if not meson.project_name().endswith('-c')
extra_cflags += ['-std=c++2a']
extra_cflags += [ '-std=c++2a' ]
endif
import('pkgconfig').generate(
@ -29,10 +29,13 @@ import('pkgconfig').generate(
variables : extra_pkg_config_variables,
)
meson.override_dependency(meson.project_name(), declare_dependency(
meson.override_dependency(
meson.project_name(),
declare_dependency(
include_directories : include_dirs,
link_with : this_library,
compile_args : ['-std=c++2a'],
compile_args : [ '-std=c++2a' ],
dependencies : deps_public_subproject + deps_public,
variables : extra_pkg_config_variables,
))
),
)

View file

@ -1,7 +1,12 @@
bash = find_program('bash', native: true)
bash = find_program('bash', native : true)
gen_header = generator(
bash,
arguments : [ '-c', '{ echo \'R"__NIX_STR(\' && cat @INPUT@ && echo \')__NIX_STR"\'; } > "$1"', '_ignored_argv0', '@OUTPUT@' ],
arguments : [
'-c',
'{ echo \'R"__NIX_STR(\' && cat @INPUT@ && echo \')__NIX_STR"\'; } > "$1"',
'_ignored_argv0',
'@OUTPUT@',
],
output : '@PLAINNAME@.gen.hh',
)

View file

@ -2,8 +2,8 @@ configure_file(
input : 'nix-profile.sh.in',
output : 'nix-profile.sh',
configuration : {
'localstatedir': localstatedir,
}
'localstatedir' : localstatedir,
},
)
foreach rc : [ '.sh', '.fish', '-daemon.sh', '-daemon.fish' ]
@ -14,7 +14,7 @@ foreach rc : [ '.sh', '.fish', '-daemon.sh', '-daemon.fish' ]
install_dir : get_option('profile-dir'),
install_mode : 'rw-r--r--',
configuration : {
'localstatedir': localstatedir,
'localstatedir' : localstatedir,
},
)
endforeach

View file

@ -1,4 +1,5 @@
project('nix-external-api-docs',
project(
'nix-external-api-docs',
version : files('.version'),
meson_version : '>= 1.1',
license : 'LGPL-2.1-or-later',
@ -10,7 +11,7 @@ doxygen_cfg = configure_file(
input : 'doxygen.cfg.in',
output : 'doxygen.cfg',
configuration : {
'PROJECT_NUMBER': meson.project_version(),
'PROJECT_NUMBER' : meson.project_version(),
'OUTPUT_DIRECTORY' : meson.current_build_dir(),
'src' : fs.parent(fs.parent(meson.project_source_root())),
},
@ -20,7 +21,7 @@ doxygen = find_program('doxygen', native : true, required : true)
custom_target(
'external-api-docs',
command : [ doxygen , doxygen_cfg ],
command : [ doxygen, doxygen_cfg ],
input : [
doxygen_cfg,
],

View file

@ -1,4 +1,5 @@
project('nix-internal-api-docs',
project(
'nix-internal-api-docs',
version : files('.version'),
meson_version : '>= 1.1',
license : 'LGPL-2.1-or-later',
@ -10,7 +11,7 @@ doxygen_cfg = configure_file(
input : 'doxygen.cfg.in',
output : 'doxygen.cfg',
configuration : {
'PROJECT_NUMBER': meson.project_version(),
'PROJECT_NUMBER' : meson.project_version(),
'OUTPUT_DIRECTORY' : meson.current_build_dir(),
'BUILD_ROOT' : meson.build_root(),
'src' : fs.parent(fs.parent(meson.project_source_root())) / 'src',
@ -21,7 +22,7 @@ doxygen = find_program('doxygen', native : true, required : true)
custom_target(
'internal-api-docs',
command : [ doxygen , doxygen_cfg ],
command : [ doxygen, doxygen_cfg ],
input : [
doxygen_cfg,
],

View file

@ -1,6 +1,6 @@
# Public headers directory
include_dirs = [include_directories('../..')]
include_dirs = [ include_directories('../..') ]
headers = files(
'built-path.hh',

View file

@ -1,4 +1,6 @@
project('nix-cmd', 'cpp',
project(
'nix-cmd',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -16,8 +18,7 @@ subdir('nix-meson-build-support/deps-lists')
configdata = configuration_data()
deps_private_maybe_subproject = [
]
deps_private_maybe_subproject = []
deps_public_maybe_subproject = [
dependency('nix-util'),
dependency('nix-store'),
@ -31,11 +32,18 @@ subdir('nix-meson-build-support/subprojects')
nlohmann_json = dependency('nlohmann_json', version : '>= 3.9')
deps_public += nlohmann_json
lowdown = dependency('lowdown', version : '>= 0.9.0', required : get_option('markdown'))
lowdown = dependency(
'lowdown',
version : '>= 0.9.0',
required : get_option('markdown'),
)
deps_private += lowdown
configdata.set('HAVE_LOWDOWN', lowdown.found().to_int())
# The API changed slightly around terminal initialization.
configdata.set('HAVE_LOWDOWN_1_4', lowdown.version().version_compare('>= 1.4.0').to_int())
configdata.set(
'HAVE_LOWDOWN_1_4',
lowdown.version().version_compare('>= 1.4.0').to_int(),
)
readline_flavor = get_option('readline-flavor')
if readline_flavor == 'editline'
@ -50,7 +58,7 @@ endif
configdata.set(
'USE_READLINE',
(readline_flavor == 'readline').to_int(),
description: 'Use readline instead of editline',
description : 'Use readline instead of editline',
)
config_priv_h = configure_file(
@ -89,10 +97,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/cmd', preserve_path : true)

View file

@ -2,14 +2,14 @@
option(
'markdown',
type: 'feature',
description: 'Enable Markdown rendering in the Nix binary (requires lowdown)',
type : 'feature',
description : 'Enable Markdown rendering in the Nix binary (requires lowdown)',
)
option(
'readline-flavor',
type : 'combo',
choices : ['editline', 'readline'],
choices : [ 'editline', 'readline' ],
value : 'editline',
description : 'Which library to use for nice line editing with the Nix language REPL',
)

View file

@ -1,4 +1,6 @@
project('nix-expr-c', 'cpp',
project(
'nix-expr-c',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -33,7 +35,7 @@ sources = files(
'nix_api_value.cc',
)
include_dirs = [include_directories('.')]
include_dirs = [ include_directories('.') ]
headers = files(
'nix_api_expr.h',
@ -50,7 +52,7 @@ this_library = library(
sources,
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,
)

View file

@ -1,4 +1,6 @@
project('nix-expr-test-support', 'cpp',
project(
'nix-expr-test-support',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -14,8 +16,7 @@ cxx = meson.get_compiler('cpp')
subdir('nix-meson-build-support/deps-lists')
deps_private_maybe_subproject = [
]
deps_private_maybe_subproject = []
deps_public_maybe_subproject = [
dependency('nix-util'),
dependency('nix-util-test-support'),
@ -47,7 +48,7 @@ this_library = library(
include_directories : include_dirs,
# TODO: Remove `-lrapidcheck` when https://github.com/emil-e/rapidcheck/pull/326
# is available. See also ../libutil/build.meson
link_args: linker_export_flags + ['-lrapidcheck'],
link_args : linker_export_flags + [ '-lrapidcheck' ],
prelink : true, # For C++ static initializers
install : true,
)

View file

@ -1,4 +1,6 @@
project('nix-expr-tests', 'cpp',
project(
'nix-expr-tests',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -19,8 +21,7 @@ deps_private_maybe_subproject = [
dependency('nix-expr-c'),
dependency('nix-expr-test-support'),
]
deps_public_maybe_subproject = [
]
deps_public_maybe_subproject = []
subdir('nix-meson-build-support/subprojects')
subdir('nix-meson-build-support/export-all-symbols')
@ -62,7 +63,7 @@ sources = files(
'value/value.cc',
)
include_dirs = [include_directories('.')]
include_dirs = [ include_directories('.') ]
this_exe = executable(
@ -72,7 +73,7 @@ this_exe = executable(
dependencies : deps_private_subproject + deps_private + deps_other,
include_directories : include_dirs,
# TODO: -lrapidcheck, see ../libutil-support/build.meson
link_args: linker_export_flags + ['-lrapidcheck'],
link_args : linker_export_flags + [ '-lrapidcheck' ],
install : true,
)
@ -80,7 +81,7 @@ test(
meson.project_name(),
this_exe,
env : {
'_NIX_TEST_UNIT_DATA': meson.current_source_dir() / 'data',
'_NIX_TEST_UNIT_DATA' : meson.current_source_dir() / 'data',
},
protocol : 'gtest',
)

View file

@ -1,13 +1,13 @@
# Public headers directory
include_dirs = [include_directories('../..')]
include_dirs = [ include_directories('../..') ]
config_pub_h = configure_file(
configuration : configdata_pub,
output : 'config.hh',
)
headers = [config_pub_h] + files(
headers = [ config_pub_h ] + files(
'attr-path.hh',
'attr-set.hh',
'eval-cache.hh',

View file

@ -1,4 +1,6 @@
project('nix-expr', 'cpp',
project(
'nix-expr',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -17,8 +19,7 @@ subdir('nix-meson-build-support/deps-lists')
configdata_pub = configuration_data()
configdata_priv = configuration_data()
deps_private_maybe_subproject = [
]
deps_private_maybe_subproject = []
deps_public_maybe_subproject = [
dependency('nix-util'),
dependency('nix-store'),
@ -39,8 +40,8 @@ endforeach
boost = dependency(
'boost',
modules : ['container', 'context'],
include_type: 'system',
modules : [ 'container', 'context' ],
include_type : 'system',
)
# boost is a public dependency, but not a pkg-config dependency unfortunately, so we
# put in `deps_other`.
@ -70,7 +71,7 @@ toml11 = dependency(
'toml11',
version : '>=3.7.0',
method : 'cmake',
include_type: 'system',
include_type : 'system',
)
deps_other += toml11
@ -113,8 +114,7 @@ lexer_tab = custom_target(
command : [
'flex',
'-Cf', # Use full scanner tables
'--outfile',
'@OUTPUT0@',
'--outfile', '@OUTPUT0@',
'--header-file=' + '@OUTPUT1@',
'@INPUT0@',
],
@ -175,10 +175,10 @@ this_library = library(
generated_headers,
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/expr', preserve_path : true)

View file

@ -1,3 +1,5 @@
option('gc', type : 'feature',
option(
'gc',
type : 'feature',
description : 'enable garbage collection in the Nix expression evaluator (requires Boehm GC)',
)

View file

@ -1,4 +1,6 @@
project('nix-fetchers-c', 'cpp',
project(
'nix-fetchers-c',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -35,7 +37,7 @@ sources = files(
'nix_api_fetchers.cc',
)
include_dirs = [include_directories('.')]
include_dirs = [ include_directories('.') ]
headers = files(
'nix_api_fetchers.h',
@ -53,7 +55,7 @@ this_library = library(
sources,
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,
)

View file

@ -1,4 +1,6 @@
project('nix-fetchers-tests', 'cpp',
project(
'nix-fetchers-tests',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -19,8 +21,7 @@ deps_private_maybe_subproject = [
dependency('nix-fetchers'),
dependency('nix-fetchers-c'),
]
deps_public_maybe_subproject = [
]
deps_public_maybe_subproject = []
subdir('nix-meson-build-support/subprojects')
subdir('nix-meson-build-support/export-all-symbols')
@ -44,7 +45,7 @@ sources = files(
'public-key.cc',
)
include_dirs = [include_directories('.')]
include_dirs = [ include_directories('.') ]
this_exe = executable(
@ -53,7 +54,7 @@ this_exe = executable(
dependencies : deps_private_subproject + deps_private + deps_other,
include_directories : include_dirs,
# TODO: -lrapidcheck, see ../libutil-support/build.meson
link_args: linker_export_flags + ['-lrapidcheck'],
link_args : linker_export_flags + [ '-lrapidcheck' ],
# get main from gtest
install : true,
)
@ -62,7 +63,7 @@ test(
meson.project_name(),
this_exe,
env : {
'_NIX_TEST_UNIT_DATA': meson.current_source_dir() / 'data',
'_NIX_TEST_UNIT_DATA' : meson.current_source_dir() / 'data',
},
protocol : 'gtest',
)

View file

@ -1,4 +1,4 @@
include_dirs = [include_directories('../..')]
include_dirs = [ include_directories('../..') ]
headers = files(
'attrs.hh',

View file

@ -1,4 +1,6 @@
project('nix-fetchers', 'cpp',
project(
'nix-fetchers',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -16,8 +18,7 @@ subdir('nix-meson-build-support/deps-lists')
configuration_data()
deps_private_maybe_subproject = [
]
deps_private_maybe_subproject = []
deps_public_maybe_subproject = [
dependency('nix-util'),
dependency('nix-store'),
@ -62,7 +63,7 @@ this_library = library(
sources,
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,
)

View file

@ -1,4 +1,6 @@
project('nix-flake-c', 'cpp',
project(
'nix-flake-c',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -35,7 +37,7 @@ sources = files(
'nix_api_flake.cc',
)
include_dirs = [include_directories('.')]
include_dirs = [ include_directories('.') ]
headers = files(
'nix_api_flake.h',
@ -53,7 +55,7 @@ this_library = library(
sources,
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,
)

View file

@ -1,4 +1,6 @@
project('nix-flake-tests', 'cpp',
project(
'nix-flake-tests',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -19,8 +21,7 @@ deps_private_maybe_subproject = [
dependency('nix-flake'),
dependency('nix-flake-c'),
]
deps_public_maybe_subproject = [
]
deps_public_maybe_subproject = []
subdir('nix-meson-build-support/subprojects')
subdir('nix-meson-build-support/export-all-symbols')
@ -40,7 +41,7 @@ sources = files(
'url-name.cc',
)
include_dirs = [include_directories('.')]
include_dirs = [ include_directories('.') ]
this_exe = executable(
@ -49,7 +50,7 @@ this_exe = executable(
dependencies : deps_private_subproject + deps_private + deps_other,
include_directories : include_dirs,
# TODO: -lrapidcheck, see ../libutil-support/build.meson
link_args: linker_export_flags + ['-lrapidcheck'],
link_args : linker_export_flags + [ '-lrapidcheck' ],
# get main from gtest
install : true,
)
@ -58,9 +59,9 @@ test(
meson.project_name(),
this_exe,
env : {
'_NIX_TEST_UNIT_DATA': meson.current_source_dir() / 'data',
'NIX_CONFIG': 'extra-experimental-features = flakes',
'HOME': meson.current_build_dir() / 'test-home',
'_NIX_TEST_UNIT_DATA' : meson.current_source_dir() / 'data',
'NIX_CONFIG' : 'extra-experimental-features = flakes',
'HOME' : meson.current_build_dir() / 'test-home',
},
protocol : 'gtest',
)

View file

@ -1,6 +1,6 @@
# Public headers directory
include_dirs = [include_directories('../..')]
include_dirs = [ include_directories('../..') ]
headers = files(
'flake.hh',

View file

@ -1,4 +1,6 @@
project('nix-flake', 'cpp',
project(
'nix-flake',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -14,8 +16,7 @@ cxx = meson.get_compiler('cpp')
subdir('nix-meson-build-support/deps-lists')
deps_private_maybe_subproject = [
]
deps_private_maybe_subproject = []
deps_public_maybe_subproject = [
dependency('nix-util'),
dependency('nix-store'),
@ -40,10 +41,10 @@ endforeach
sources = files(
'config.cc',
'flake-primops.cc',
'flake.cc',
'flakeref.cc',
'lockfile.cc',
'flake-primops.cc',
'settings.cc',
'url-name.cc',
)
@ -59,7 +60,7 @@ this_library = library(
generated_headers,
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,
)

View file

@ -1,4 +1,6 @@
project('nix-main-c', 'cpp',
project(
'nix-main-c',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -31,7 +33,7 @@ sources = files(
'nix_api_main.cc',
)
include_dirs = [include_directories('.')]
include_dirs = [ include_directories('.') ]
headers = files(
'nix_api_main.h',
@ -45,7 +47,7 @@ this_library = library(
sources,
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,
)

View file

@ -1,6 +1,6 @@
# Public headers directory
include_dirs = [include_directories('../..')]
include_dirs = [ include_directories('../..') ]
headers = files(
'common-args.hh',

View file

@ -1,4 +1,6 @@
project('nix-main', 'cpp',
project(
'nix-main',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -16,8 +18,7 @@ subdir('nix-meson-build-support/deps-lists')
configdata = configuration_data()
deps_private_maybe_subproject = [
]
deps_private_maybe_subproject = []
deps_public_maybe_subproject = [
dependency('nix-util'),
dependency('nix-store'),
@ -43,7 +44,7 @@ int main() {
configdata.set(
'HAVE_PUBSETBUF',
cxx.compiles(pubsetbuf_test).to_int(),
description: 'Optionally used for buffering on standard error'
description : 'Optionally used for buffering on standard error',
)
config_priv_h = configure_file(
@ -78,7 +79,7 @@ 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,
)

View file

@ -1,4 +1,6 @@
project('nix-store-c', 'cpp',
project(
'nix-store-c',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -29,7 +31,7 @@ sources = files(
'nix_api_store.cc',
)
include_dirs = [include_directories('.')]
include_dirs = [ include_directories('.') ]
headers = files(
'nix_api_store.h',
@ -46,7 +48,7 @@ this_library = library(
sources,
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,
)

View file

@ -1,6 +1,6 @@
# Public headers directory
include_dirs = [include_directories('../../..')]
include_dirs = [ include_directories('../../..') ]
headers = files(
'derived-path.hh',

View file

@ -1,4 +1,6 @@
project('nix-store-test-support', 'cpp',
project(
'nix-store-test-support',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -14,8 +16,7 @@ cxx = meson.get_compiler('cpp')
subdir('nix-meson-build-support/deps-lists')
deps_private_maybe_subproject = [
]
deps_private_maybe_subproject = []
deps_public_maybe_subproject = [
dependency('nix-util'),
dependency('nix-util-test-support'),
@ -47,7 +48,7 @@ this_library = library(
include_directories : include_dirs,
# TODO: Remove `-lrapidcheck` when https://github.com/emil-e/rapidcheck/pull/326
# is available. See also ../libutil/build.meson
link_args: linker_export_flags + ['-lrapidcheck'],
link_args : linker_export_flags + [ '-lrapidcheck' ],
prelink : true, # For C++ static initializers
install : true,
)

View file

@ -1,4 +1,6 @@
project('nix-store-tests', 'cpp',
project(
'nix-store-tests',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -21,8 +23,7 @@ deps_private_maybe_subproject = [
dependency('nix-store-c'),
dependency('nix-store-test-support'),
]
deps_public_maybe_subproject = [
]
deps_public_maybe_subproject = []
subdir('nix-meson-build-support/subprojects')
subdir('nix-meson-build-support/export-all-symbols')
@ -80,7 +81,7 @@ sources = files(
'worker-protocol.cc',
)
include_dirs = [include_directories('.')]
include_dirs = [ include_directories('.') ]
this_exe = executable(
@ -90,7 +91,7 @@ this_exe = executable(
dependencies : deps_private_subproject + deps_private + deps_other,
include_directories : include_dirs,
# TODO: -lrapidcheck, see ../libutil-support/build.meson
link_args: linker_export_flags + ['-lrapidcheck'],
link_args : linker_export_flags + [ '-lrapidcheck' ],
# get main from gtest
install : true,
)
@ -99,9 +100,9 @@ test(
meson.project_name(),
this_exe,
env : {
'_NIX_TEST_UNIT_DATA': meson.current_source_dir() / 'data',
'HOME': meson.current_build_dir() / 'test-home',
'NIX_REMOTE': meson.current_build_dir() / 'test-home' / 'store',
'_NIX_TEST_UNIT_DATA' : meson.current_source_dir() / 'data',
'HOME' : meson.current_build_dir() / 'test-home',
'NIX_REMOTE' : meson.current_build_dir() / 'test-home' / 'store',
},
protocol : 'gtest',
)
@ -120,11 +121,15 @@ if get_option('benchmarks')
'nix-store-benchmarks',
benchmark_sources,
config_priv_h,
dependencies : deps_private_subproject + deps_private + deps_other + [gbenchmark],
dependencies : deps_private_subproject + deps_private + deps_other + [
gbenchmark,
],
include_directories : include_dirs,
link_args: linker_export_flags,
link_args : linker_export_flags,
install : true,
cpp_args : ['-DNIX_UNIT_TEST_DATA="' + meson.current_source_dir() + '/data"'],
cpp_args : [
'-DNIX_UNIT_TEST_DATA="' + meson.current_source_dir() + '/data"',
],
)
benchmark('nix-store-benchmarks', benchmark_exe)

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

@ -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,
@ -239,10 +249,9 @@ configdata_priv.set_quoted('NIX_MAN_DIR', mandir)
lsof = find_program('lsof', required : false)
configdata_priv.set_quoted(
'LSOF',
lsof.found()
? lsof.full_path()
lsof.found() ? lsof.full_path()
# Just look up on the PATH
: 'lsof',
: '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()

View file

@ -1,4 +1,6 @@
project('nix-util-c', 'cpp',
project(
'nix-util-c',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -19,8 +21,7 @@ configdata = configuration_data()
deps_private_maybe_subproject = [
dependency('nix-util'),
]
deps_public_maybe_subproject = [
]
deps_public_maybe_subproject = []
subdir('nix-meson-build-support/subprojects')
configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
@ -36,7 +37,7 @@ sources = files(
'nix_api_util.cc',
)
include_dirs = [include_directories('.')]
include_dirs = [ include_directories('.') ]
headers = files(
'nix_api_util.h',
@ -54,7 +55,7 @@ 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,
)

View file

@ -1,6 +1,6 @@
# Public headers directory
include_dirs = [include_directories('../../..')]
include_dirs = [ include_directories('../../..') ]
headers = files(
'characterization.hh',

View file

@ -1,4 +1,6 @@
project('nix-util-test-support', 'cpp',
project(
'nix-util-test-support',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -14,8 +16,7 @@ cxx = meson.get_compiler('cpp')
subdir('nix-meson-build-support/deps-lists')
deps_private_maybe_subproject = [
]
deps_private_maybe_subproject = []
deps_public_maybe_subproject = [
dependency('nix-util'),
dependency('nix-util-c'),
@ -44,7 +45,7 @@ this_library = library(
include_directories : include_dirs,
# TODO: Remove `-lrapidcheck` when https://github.com/emil-e/rapidcheck/pull/326
# is available. See also ../libutil/build.meson
link_args: linker_export_flags + ['-lrapidcheck'],
link_args : linker_export_flags + [ '-lrapidcheck' ],
prelink : true, # For C++ static initializers
install : true,
)

View file

@ -1,4 +1,6 @@
project('nix-util-tests', 'cpp',
project(
'nix-util-tests',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -19,8 +21,7 @@ deps_private_maybe_subproject = [
dependency('nix-util-c'),
dependency('nix-util-test-support'),
]
deps_public_maybe_subproject = [
]
deps_public_maybe_subproject = []
subdir('nix-meson-build-support/subprojects')
subdir('nix-meson-build-support/export-all-symbols')
@ -76,7 +77,7 @@ sources = files(
'xml-writer.cc',
)
include_dirs = [include_directories('.')]
include_dirs = [ include_directories('.') ]
this_exe = executable(
@ -86,7 +87,7 @@ this_exe = executable(
dependencies : deps_private_subproject + deps_private + deps_other,
include_directories : include_dirs,
# TODO: -lrapidcheck, see ../libutil-support/build.meson
link_args: linker_export_flags + ['-lrapidcheck'],
link_args : linker_export_flags + [ '-lrapidcheck' ],
# get main from gtest
install : true,
)
@ -95,7 +96,7 @@ test(
meson.project_name(),
this_exe,
env : {
'_NIX_TEST_UNIT_DATA': meson.current_source_dir() / 'data',
'_NIX_TEST_UNIT_DATA' : meson.current_source_dir() / 'data',
},
protocol : 'gtest',
)

View file

@ -1,4 +1,6 @@
project('nix-util', 'cpp',
project(
'nix-util',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -16,10 +18,8 @@ subdir('nix-meson-build-support/deps-lists')
configdata = configuration_data()
deps_private_maybe_subproject = [
]
deps_public_maybe_subproject = [
]
deps_private_maybe_subproject = []
deps_public_maybe_subproject = []
subdir('nix-meson-build-support/subprojects')
# Check for each of these functions, and create a define like `#define
@ -34,7 +34,7 @@ check_funcs = [
foreach funcspec : check_funcs
define_name = 'HAVE_' + funcspec[0].underscorify().to_upper()
define_value = cxx.has_function(funcspec[0]).to_int()
configdata.set(define_name, define_value, description: funcspec[1])
configdata.set(define_name, define_value, description : funcspec[1])
endforeach
subdir('nix-meson-build-support/libatomic')
@ -45,21 +45,21 @@ if host_machine.system() == 'windows'
elif host_machine.system() == 'sunos'
socket = cxx.find_library('socket')
network_service_library = cxx.find_library('nsl')
deps_other += [socket, network_service_library]
deps_other += [ socket, network_service_library ]
endif
blake3 = dependency(
'libblake3',
version: '>= 1.8.2',
version : '>= 1.8.2',
method : 'pkg-config',
)
deps_private += blake3
boost = dependency(
'boost',
modules : ['context', 'coroutine', 'iostreams', 'url'],
include_type: 'system',
version: '>=1.82.0'
modules : [ 'context', 'coroutine', 'iostreams', 'url' ],
include_type : 'system',
version : '>=1.82.0',
)
# boost is a public dependency, but not a pkg-config dependency unfortunately, so we
# put in `deps_other`.
@ -93,7 +93,12 @@ cpuid_required = get_option('cpuid')
if host_machine.cpu_family() != 'x86_64' and cpuid_required.enabled()
warning('Force-enabling seccomp on non-x86_64 does not make sense')
endif
cpuid = dependency('libcpuid', 'cpuid', version : '>= 0.7.0', required : cpuid_required)
cpuid = dependency(
'libcpuid',
'cpuid',
version : '>= 0.7.0',
required : cpuid_required,
)
configdata.set('HAVE_LIBCPUID', cpuid.found().to_int())
deps_private += cpuid
@ -109,7 +114,7 @@ config_priv_h = configure_file(
subdir('nix-meson-build-support/common')
sources = [config_priv_h] + files(
sources = [ config_priv_h ] + files(
'archive.cc',
'args.cc',
'base-n.cc',
@ -117,8 +122,8 @@ sources = [config_priv_h] + files(
'canon-path.cc',
'compression.cc',
'compute-levels.cc',
'configuration.cc',
'config-global.cc',
'configuration.cc',
'current-process.cc',
'english.cc',
'environment-variables.cc',
@ -137,8 +142,8 @@ sources = [config_priv_h] + files(
'logging.cc',
'memory-source-accessor.cc',
'mounted-source-accessor.cc',
'position.cc',
'pos-table.cc',
'position.cc',
'posix-source-accessor.cc',
'references.cc',
'serialise.cc',
@ -146,8 +151,8 @@ sources = [config_priv_h] + files(
'signature/signer.cc',
'source-accessor.cc',
'source-path.cc',
'subdir-source-accessor.cc',
'strings.cc',
'subdir-source-accessor.cc',
'suggestions.cc',
'tarfile.cc',
'tee-logger.cc',
@ -190,10 +195,10 @@ this_library = library(
sources,
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/util', preserve_path : true)
@ -202,7 +207,7 @@ libraries_private = []
if host_machine.system() == 'windows'
# `libraries_private` cannot contain ad-hoc dependencies (from
# `find_library), so we need to do this manually
libraries_private += ['-lws2_32']
libraries_private += [ '-lws2_32' ]
endif
subdir('nix-meson-build-support/export')

View file

@ -1,5 +1,7 @@
# vim: filetype=meson
option('cpuid', type : 'feature',
option(
'cpuid',
type : 'feature',
description : 'determine microarchitecture levels with libcpuid (only relevant on x86_64)',
)

View file

@ -5,7 +5,7 @@ configdata_unix = configuration_data()
configdata_unix.set(
'HAVE_DECL_AT_SYMLINK_NOFOLLOW',
cxx.has_header_symbol('fcntl.h', 'AT_SYMLINK_NOFOLLOW').to_int(),
description : 'Optionally used for changing the files and symlinks.'
description : 'Optionally used for changing the files and symlinks.',
)
# Check for each of these functions, and create a define like `#define
@ -39,7 +39,7 @@ check_funcs_unix = [
foreach funcspec : check_funcs_unix
define_name = 'HAVE_' + funcspec[0].underscorify().to_upper()
define_value = cxx.has_function(funcspec[0]).to_int()
configdata_unix.set(define_name, define_value, description: funcspec[1])
configdata_unix.set(define_name, define_value, description : funcspec[1])
endforeach
config_unix_priv_h = configure_file(

View file

@ -1,4 +1,6 @@
project('nix', 'cpp',
project(
'nix',
'cpp',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -26,8 +28,7 @@ deps_private_maybe_subproject = [
dependency('nix-main'),
dependency('nix-cmd'),
]
deps_public_maybe_subproject = [
]
deps_public_maybe_subproject = []
subdir('nix-meson-build-support/subprojects')
subdir('nix-meson-build-support/export-all-symbols')
@ -57,10 +58,9 @@ config_priv_h = configure_file(
subdir('nix-meson-build-support/common')
subdir('nix-meson-build-support/generate-header')
nix_sources = [config_priv_h] + files(
nix_sources = [ config_priv_h ] + files(
'add-to-store.cc',
'app.cc',
'self-exe.cc',
'build.cc',
'bundle.cc',
'cat.cc',
@ -96,6 +96,7 @@ nix_sources = [config_priv_h] + files(
'repl.cc',
'run.cc',
'search.cc',
'self-exe.cc',
'sigs.cc',
'store-copy-log.cc',
'store-delete.cc',
@ -177,16 +178,16 @@ if host_machine.system() != 'windows'
]
endif
include_dirs = [include_directories('.')]
include_dirs = [ include_directories('.') ]
this_exe = executable(
meson.project_name(),
sources,
dependencies : deps_private_subproject + deps_private + deps_other,
include_directories : include_dirs,
link_args: linker_export_flags,
link_args : linker_export_flags,
install : true,
cpp_pch : do_pch ? ['pch/precompiled-headers.hh'] : []
cpp_pch : do_pch ? [ 'pch/precompiled-headers.hh' ] : [],
)
meson.override_find_program('nix', this_exe)
@ -217,15 +218,15 @@ foreach linkname : nix_symlinks
pointing_to : fs.name(this_exe),
install_dir : get_option('bindir'),
# The 'runtime' tag is what executables default to, which we want to emulate here.
install_tag : 'runtime'
install_tag : 'runtime',
)
custom_target(
command: ['ln', '-sf', fs.name(this_exe), '@OUTPUT@'],
output: linkname + executable_suffix,
command : [ 'ln', '-sf', fs.name(this_exe), '@OUTPUT@' ],
output : linkname + executable_suffix,
# native doesn't allow dangling symlinks, but the target executable often doesn't exist at this time
env : { 'MSYS' : 'winsymlinks:lnk' },
env : {'MSYS' : 'winsymlinks:lnk'},
# TODO(Ericson2314): Don't do this once we have the `meson.override_find_program` working)
build_by_default: true
build_by_default : true,
)
# TODO(Ericson3214): Doesn't yet work
#meson.override_find_program(linkname, t)
@ -233,19 +234,19 @@ endforeach
install_symlink(
'build-remote',
pointing_to : '..' / '..'/ get_option('bindir') / fs.name(this_exe),
pointing_to : '..' / '..' / get_option('bindir') / fs.name(this_exe),
install_dir : get_option('libexecdir') / fs.name(this_exe),
# The 'runtime' tag is what executables default to, which we want to emulate here.
install_tag : 'runtime'
install_tag : 'runtime',
)
custom_target(
command: ['ln', '-sf', fs.name(this_exe), '@OUTPUT@'],
output: 'build-remote' + executable_suffix,
command : [ 'ln', '-sf', fs.name(this_exe), '@OUTPUT@' ],
output : 'build-remote' + executable_suffix,
# native doesn't allow dangling symlinks, but the target executable often doesn't exist at this time
env : { 'MSYS' : 'winsymlinks:lnk' },
env : {'MSYS' : 'winsymlinks:lnk'},
# TODO(Ericson2314): Don't do this once we have the `meson.override_find_program` working)
build_by_default: true
build_by_default : true,
)
# TODO(Ericson3214): Doesn't yet work
#meson.override_find_program(linkname, t)

View file

@ -1,6 +1,9 @@
# vim: filetype=meson
# A relative path means it gets appended to prefix.
option('profile-dir', type : 'string', value : 'etc/profile.d',
option(
'profile-dir',
type : 'string',
value : 'etc/profile.d',
description : 'the path to install shell profile files',
)

View file

@ -34,7 +34,7 @@ nix_perl_store_cc = custom_target(
'Store.cc',
output : 'Store.cc',
input : nix_perl_store_xs,
command : [xsubpp, '@INPUT@', '-output', '@OUTPUT@'],
command : [ xsubpp, '@INPUT@', '-output', '@OUTPUT@' ],
)
# Build Nix::Store Library
@ -56,5 +56,5 @@ nix_perl_store_lib = library(
install_data(
nix_perl_scripts,
install_mode : 'rw-r--r--',
install_dir : join_paths(nix_perl_install_dir,'Nix'),
install_dir : join_paths(nix_perl_install_dir, 'Nix'),
)

View file

@ -4,7 +4,7 @@
# init project
#============================================================================
project (
project(
'nix-perl',
'cpp',
version : files('.version'),
@ -65,7 +65,7 @@ yath = find_program('yath', required : false)
# Required Libraries
#-------------------------------------------------
bzip2_dep = dependency('bzip2', required: false)
bzip2_dep = dependency('bzip2', required : false)
if not bzip2_dep.found()
bzip2_dep = cpp.find_library('bz2')
if not bzip2_dep.found()
@ -87,15 +87,36 @@ nix_store_dep = dependency('nix-store')
# the perl bindings does not appear to be possible.
#-------------------------------------------------
perl_archname = run_command(
perl, '-e', 'use Config; print $Config{archname};', check: true).stdout()
perl,
'-e',
'use Config; print $Config{archname};',
check : true,
).stdout()
perl_version = run_command(
perl, '-e', 'use Config; print $Config{version};', check: true).stdout()
perl,
'-e',
'use Config; print $Config{version};',
check : true,
).stdout()
perl_archlibexp = run_command(
perl, '-e', 'use Config; print $Config{archlibexp};', check: true).stdout()
perl,
'-e',
'use Config; print $Config{archlibexp};',
check : true,
).stdout()
perl_site_libdir = run_command(
perl, '-e', 'use Config; print $Config{installsitearch};', check: true).stdout()
perl,
'-e',
'use Config; print $Config{installsitearch};',
check : true,
).stdout()
nix_perl_install_dir = join_paths(
libdir, 'perl5', 'site_perl', perl_version, perl_archname)
libdir,
'perl5',
'site_perl',
perl_version,
perl_archname,
)
# print perl hints for logs
@ -110,10 +131,11 @@ message('Assumed Nix-Perl install dir: @0@'.format(nix_perl_install_dir))
#-------------------------------------------------
perl_check_dbi = run_command(
perl,
'-e', 'use DBI; use DBD::SQLite;',
'-e',
'use DBI; use DBD::SQLite;',
'-I@0@'.format(get_option('dbi_path')),
'-I@0@'.format(get_option('dbd_sqlite_path')),
check: true
check : true,
)
if perl_check_dbi.returncode() == 2
@ -131,7 +153,8 @@ perl_dep = declare_dependency(
'perl',
has_headers : [
join_paths(perl_archlibexp, 'CORE', 'perl.h'),
join_paths(perl_archlibexp, 'CORE', 'EXTERN.h')],
join_paths(perl_archlibexp, 'CORE', 'EXTERN.h'),
],
dirs : [
join_paths(perl_archlibexp, 'CORE'),
],
@ -166,8 +189,8 @@ if get_option('tests').enabled()
test(
'nix-perl-test',
yath,
args : ['test'],
args : [ 'test' ],
workdir : meson.current_build_dir(),
depends : [nix_perl_store_lib],
depends : [ nix_perl_store_lib ],
)
endif

View file

@ -9,7 +9,8 @@ option(
'tests',
type : 'feature',
value : 'disabled',
description : 'run nix-perl tests')
description : 'run nix-perl tests',
)
# Location of Perl Modules
@ -18,10 +19,12 @@ option(
'dbi_path',
type : 'string',
value : '/usr',
description : 'path to perl::dbi')
description : 'path to perl::dbi',
)
option(
'dbd_sqlite_path',
type : 'string',
value : '/usr',
description : 'path to perl::dbd-SQLite')
description : 'path to perl::dbd-SQLite',
)

View file

@ -5,9 +5,9 @@ configure_file(
)
suites += {
'name': 'ca',
'deps': [],
'tests': [
'name' : 'ca',
'deps' : [],
'tests' : [
'build-cache.sh',
'build-with-garbage-path.sh',
'build.sh',
@ -30,5 +30,5 @@ suites += {
'substitute.sh',
'why-depends.sh',
],
'workdir': meson.current_source_dir(),
'workdir' : meson.current_source_dir(),
}

View file

@ -5,9 +5,9 @@ configure_file(
)
suites += {
'name': 'dyn-drv',
'deps': [],
'tests': [
'name' : 'dyn-drv',
'deps' : [],
'tests' : [
'text-hashed-output.sh',
'recursive-mod-json.sh',
'build-built-drv.sh',
@ -17,5 +17,5 @@ suites += {
'old-daemon-error-hack.sh',
'dep-built-drv-2.sh',
],
'workdir': meson.current_source_dir(),
'workdir' : meson.current_source_dir(),
}

View file

@ -1,7 +1,7 @@
suites += {
'name': 'flakes',
'deps': [],
'tests': [
'name' : 'flakes',
'deps' : [],
'tests' : [
'flakes.sh',
'develop.sh',
'edit.sh',
@ -35,5 +35,5 @@ suites += {
'old-lockfiles.sh',
'trace-ifd.sh',
],
'workdir': meson.current_source_dir(),
'workdir' : meson.current_source_dir(),
}

View file

@ -1,10 +1,10 @@
suites += {
'name': 'git-hashing',
'deps': [],
'tests': [
'name' : 'git-hashing',
'deps' : [],
'tests' : [
'simple-sha1.sh',
'simple-sha256.sh',
'fixed.sh',
],
'workdir': meson.current_source_dir(),
'workdir' : meson.current_source_dir(),
}

View file

@ -1,7 +1,7 @@
suites += {
'name': 'local-overlay-store',
'deps': [],
'tests': [
'name' : 'local-overlay-store',
'deps' : [],
'tests' : [
'check-post-init.sh',
'redundant-add.sh',
'build.sh',
@ -14,5 +14,5 @@ suites += {
'optimise.sh',
'stale-file-handle.sh',
],
'workdir': meson.current_source_dir(),
'workdir' : meson.current_source_dir(),
}

View file

@ -1,4 +1,5 @@
project('nix-functional-tests',
project(
'nix-functional-tests',
version : files('.version'),
default_options : [
'cpp_std=c++2a',
@ -26,13 +27,13 @@ nix_bin_dir = fs.parent(nix.full_path())
subdir('nix-meson-build-support/default-system-cpu')
test_confdata = {
'bindir': nix_bin_dir,
'coreutils': fs.parent(coreutils.full_path()),
'dot': dot.found() ? dot.full_path() : '',
'bash': bash.full_path(),
'sandbox_shell': busybox.found() ? busybox.full_path() : '',
'PACKAGE_VERSION': meson.project_version(),
'system': nix_system_cpu + '-' + host_machine.system(),
'bindir' : nix_bin_dir,
'coreutils' : fs.parent(coreutils.full_path()),
'dot' : dot.found() ? dot.full_path() : '',
'bash' : bash.full_path(),
'sandbox_shell' : busybox.found() ? busybox.full_path() : '',
'PACKAGE_VERSION' : meson.project_version(),
'system' : nix_system_cpu + '-' + host_machine.system(),
}
# Just configures `common/vars-and-functions.sh.in`.
@ -48,8 +49,8 @@ configure_file(
suites = [
{
'name' : 'main',
'deps': [],
'tests': [
'deps' : [],
'tests' : [
'test-infra.sh',
'gc.sh',
'nix-collect-garbage-d.sh',
@ -174,7 +175,7 @@ suites = [
'help.sh',
'symlinks.sh',
],
'workdir': meson.current_source_dir(),
'workdir' : meson.current_source_dir(),
},
]
@ -183,14 +184,14 @@ if nix_store.found()
add_languages('cpp')
subdir('test-libstoreconsumer')
suites += {
'name': 'libstoreconsumer',
'deps': [
'name' : 'libstoreconsumer',
'deps' : [
libstoreconsumer_tester,
],
'tests': [
'tests' : [
'test-libstoreconsumer.sh',
],
'workdir': meson.current_source_dir(),
'workdir' : meson.current_source_dir(),
}
endif
@ -201,14 +202,14 @@ if nix_expr.found() and get_option('default_library') != 'static'
add_languages('cpp')
subdir('plugins')
suites += {
'name': 'plugins',
'deps': [
'name' : 'plugins',
'deps' : [
libplugintest,
],
'tests': [
'tests' : [
'plugins.sh',
],
'workdir': meson.current_source_dir(),
'workdir' : meson.current_source_dir(),
}
endif
@ -230,20 +231,21 @@ foreach suite : suites
test(
name,
bash,
args: [
args : [
'-x',
'-e',
'-u',
'-o', 'pipefail',
'-o',
'pipefail',
script,
],
suite : suite_name,
env : {
'_NIX_TEST_SOURCE_DIR': meson.current_source_dir(),
'_NIX_TEST_BUILD_DIR': meson.current_build_dir(),
'TEST_NAME': suite_name / name,
'NIX_REMOTE': '',
'PS4': '+(${BASH_SOURCE[0]-$0}:$LINENO) ',
'_NIX_TEST_SOURCE_DIR' : meson.current_source_dir(),
'_NIX_TEST_BUILD_DIR' : meson.current_build_dir(),
'TEST_NAME' : suite_name / name,
'NIX_REMOTE' : '',
'PS4' : '+(${BASH_SOURCE[0]-$0}:$LINENO) ',
},
# Some tests take 15+ seconds even on an otherwise idle machine;
# on a loaded machine this can easily drive them to failure. Give