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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -59,108 +59,6 @@
${lib.getExe meson} format -ic ${../meson.format} "$file" ${lib.getExe meson} format -ic ${../meson.format} "$file"
done 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 = { nixfmt-rfc-style = {
enable = true; enable = true;

View file

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

View file

@ -2,5 +2,5 @@ if host_machine.system() == 'windows'
# libexpr's primops creates a large object # libexpr's primops creates a large object
# Without the following flag, we'll get errors when cross-compiling to mingw32: # 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' # 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 endif

View file

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

View file

@ -1,12 +1,12 @@
requires_private = [] requires_private = []
foreach dep : deps_private_subproject foreach dep : deps_private_subproject
requires_private += dep.name() requires_private += dep.name()
endforeach endforeach
requires_private += deps_private requires_private += deps_private
requires_public = [] requires_public = []
foreach dep : deps_public_subproject foreach dep : deps_public_subproject
requires_public += dep.name() requires_public += dep.name()
endforeach endforeach
requires_public += deps_public requires_public += deps_public
@ -14,7 +14,7 @@ extra_pkg_config_variables = get_variable('extra_pkg_config_variables', {})
extra_cflags = [] extra_cflags = []
if not meson.project_name().endswith('-c') if not meson.project_name().endswith('-c')
extra_cflags += ['-std=c++2a'] extra_cflags += [ '-std=c++2a' ]
endif endif
import('pkgconfig').generate( import('pkgconfig').generate(
@ -29,10 +29,13 @@ import('pkgconfig').generate(
variables : extra_pkg_config_variables, variables : extra_pkg_config_variables,
) )
meson.override_dependency(meson.project_name(), declare_dependency( meson.override_dependency(
include_directories : include_dirs, meson.project_name(),
link_with : this_library, declare_dependency(
compile_args : ['-std=c++2a'], include_directories : include_dirs,
dependencies : deps_public_subproject + deps_public, link_with : this_library,
variables : extra_pkg_config_variables, 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( gen_header = generator(
bash, 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', output : '@PLAINNAME@.gen.hh',
) )

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,14 +2,14 @@
option( option(
'markdown', 'markdown',
type: 'feature', type : 'feature',
description: 'Enable Markdown rendering in the Nix binary (requires lowdown)', description : 'Enable Markdown rendering in the Nix binary (requires lowdown)',
) )
option( option(
'readline-flavor', 'readline-flavor',
type : 'combo', type : 'combo',
choices : ['editline', 'readline'], choices : [ 'editline', 'readline' ],
value : 'editline', value : 'editline',
description : 'Which library to use for nice line editing with the Nix language REPL', 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'), version : files('.version'),
default_options : [ default_options : [
'cpp_std=c++2a', 'cpp_std=c++2a',
@ -33,7 +35,7 @@ sources = files(
'nix_api_value.cc', 'nix_api_value.cc',
) )
include_dirs = [include_directories('.')] include_dirs = [ include_directories('.') ]
headers = files( headers = files(
'nix_api_expr.h', 'nix_api_expr.h',
@ -50,7 +52,7 @@ this_library = library(
sources, sources,
dependencies : deps_public + deps_private + deps_other, dependencies : deps_public + deps_private + deps_other,
include_directories : include_dirs, include_directories : include_dirs,
link_args: linker_export_flags, link_args : linker_export_flags,
prelink : true, # For C++ static initializers prelink : true, # For C++ static initializers
install : true, install : true,
) )

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,6 @@
project('nix-fetchers', 'cpp', project(
'nix-fetchers',
'cpp',
version : files('.version'), version : files('.version'),
default_options : [ default_options : [
'cpp_std=c++2a', 'cpp_std=c++2a',
@ -16,8 +18,7 @@ subdir('nix-meson-build-support/deps-lists')
configuration_data() configuration_data()
deps_private_maybe_subproject = [ deps_private_maybe_subproject = []
]
deps_public_maybe_subproject = [ deps_public_maybe_subproject = [
dependency('nix-util'), dependency('nix-util'),
dependency('nix-store'), dependency('nix-store'),
@ -62,7 +63,7 @@ this_library = library(
sources, sources,
dependencies : deps_public + deps_private + deps_other, dependencies : deps_public + deps_private + deps_other,
include_directories : include_dirs, include_directories : include_dirs,
link_args: linker_export_flags, link_args : linker_export_flags,
prelink : true, # For C++ static initializers prelink : true, # For C++ static initializers
install : true, install : true,
) )

View file

@ -1,4 +1,6 @@
project('nix-flake-c', 'cpp', project(
'nix-flake-c',
'cpp',
version : files('.version'), version : files('.version'),
default_options : [ default_options : [
'cpp_std=c++2a', 'cpp_std=c++2a',
@ -35,7 +37,7 @@ sources = files(
'nix_api_flake.cc', 'nix_api_flake.cc',
) )
include_dirs = [include_directories('.')] include_dirs = [ include_directories('.') ]
headers = files( headers = files(
'nix_api_flake.h', 'nix_api_flake.h',
@ -53,7 +55,7 @@ this_library = library(
sources, sources,
dependencies : deps_public + deps_private + deps_other, dependencies : deps_public + deps_private + deps_other,
include_directories : include_dirs, include_directories : include_dirs,
link_args: linker_export_flags, link_args : linker_export_flags,
prelink : true, # For C++ static initializers prelink : true, # For C++ static initializers
install : true, install : true,
) )

View file

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

View file

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

View file

@ -1,4 +1,6 @@
project('nix-flake', 'cpp', project(
'nix-flake',
'cpp',
version : files('.version'), version : files('.version'),
default_options : [ default_options : [
'cpp_std=c++2a', 'cpp_std=c++2a',
@ -14,8 +16,7 @@ cxx = meson.get_compiler('cpp')
subdir('nix-meson-build-support/deps-lists') subdir('nix-meson-build-support/deps-lists')
deps_private_maybe_subproject = [ deps_private_maybe_subproject = []
]
deps_public_maybe_subproject = [ deps_public_maybe_subproject = [
dependency('nix-util'), dependency('nix-util'),
dependency('nix-store'), dependency('nix-store'),
@ -40,10 +41,10 @@ endforeach
sources = files( sources = files(
'config.cc', 'config.cc',
'flake-primops.cc',
'flake.cc', 'flake.cc',
'flakeref.cc', 'flakeref.cc',
'lockfile.cc', 'lockfile.cc',
'flake-primops.cc',
'settings.cc', 'settings.cc',
'url-name.cc', 'url-name.cc',
) )
@ -59,7 +60,7 @@ this_library = library(
generated_headers, generated_headers,
dependencies : deps_public + deps_private + deps_other, dependencies : deps_public + deps_private + deps_other,
include_directories : include_dirs, include_directories : include_dirs,
link_args: linker_export_flags, link_args : linker_export_flags,
prelink : true, # For C++ static initializers prelink : true, # For C++ static initializers
install : true, install : true,
) )

View file

@ -1,4 +1,6 @@
project('nix-main-c', 'cpp', project(
'nix-main-c',
'cpp',
version : files('.version'), version : files('.version'),
default_options : [ default_options : [
'cpp_std=c++2a', 'cpp_std=c++2a',
@ -31,7 +33,7 @@ sources = files(
'nix_api_main.cc', 'nix_api_main.cc',
) )
include_dirs = [include_directories('.')] include_dirs = [ include_directories('.') ]
headers = files( headers = files(
'nix_api_main.h', 'nix_api_main.h',
@ -45,7 +47,7 @@ this_library = library(
sources, sources,
dependencies : deps_public + deps_private + deps_other, dependencies : deps_public + deps_private + deps_other,
include_directories : include_dirs, include_directories : include_dirs,
link_args: linker_export_flags, link_args : linker_export_flags,
prelink : true, # For C++ static initializers prelink : true, # For C++ static initializers
install : true, install : true,
) )

View file

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

View file

@ -1,4 +1,6 @@
project('nix-main', 'cpp', project(
'nix-main',
'cpp',
version : files('.version'), version : files('.version'),
default_options : [ default_options : [
'cpp_std=c++2a', 'cpp_std=c++2a',
@ -16,8 +18,7 @@ subdir('nix-meson-build-support/deps-lists')
configdata = configuration_data() configdata = configuration_data()
deps_private_maybe_subproject = [ deps_private_maybe_subproject = []
]
deps_public_maybe_subproject = [ deps_public_maybe_subproject = [
dependency('nix-util'), dependency('nix-util'),
dependency('nix-store'), dependency('nix-store'),
@ -43,7 +44,7 @@ int main() {
configdata.set( configdata.set(
'HAVE_PUBSETBUF', 'HAVE_PUBSETBUF',
cxx.compiles(pubsetbuf_test).to_int(), 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( config_priv_h = configure_file(
@ -78,7 +79,7 @@ this_library = library(
config_priv_h, config_priv_h,
dependencies : deps_public + deps_private + deps_other, dependencies : deps_public + deps_private + deps_other,
include_directories : include_dirs, include_directories : include_dirs,
link_args: linker_export_flags, link_args : linker_export_flags,
prelink : true, # For C++ static initializers prelink : true, # For C++ static initializers
install : true, install : true,
) )

View file

@ -1,4 +1,6 @@
project('nix-store-c', 'cpp', project(
'nix-store-c',
'cpp',
version : files('.version'), version : files('.version'),
default_options : [ default_options : [
'cpp_std=c++2a', 'cpp_std=c++2a',
@ -29,7 +31,7 @@ sources = files(
'nix_api_store.cc', 'nix_api_store.cc',
) )
include_dirs = [include_directories('.')] include_dirs = [ include_directories('.') ]
headers = files( headers = files(
'nix_api_store.h', 'nix_api_store.h',
@ -46,7 +48,7 @@ this_library = library(
sources, sources,
dependencies : deps_public + deps_private + deps_other, dependencies : deps_public + deps_private + deps_other,
include_directories : include_dirs, include_directories : include_dirs,
link_args: linker_export_flags, link_args : linker_export_flags,
prelink : true, # For C++ static initializers prelink : true, # For C++ static initializers
install : true, install : true,
) )

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,21 +1,35 @@
# vim: filetype=meson # 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', 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)', 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)', 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', 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', description : 'path to store logs in for Nix',
) )

View file

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

View file

@ -1,4 +1,6 @@
project('nix-util-c', 'cpp', project(
'nix-util-c',
'cpp',
version : files('.version'), version : files('.version'),
default_options : [ default_options : [
'cpp_std=c++2a', 'cpp_std=c++2a',
@ -19,8 +21,7 @@ configdata = configuration_data()
deps_private_maybe_subproject = [ deps_private_maybe_subproject = [
dependency('nix-util'), dependency('nix-util'),
] ]
deps_public_maybe_subproject = [ deps_public_maybe_subproject = []
]
subdir('nix-meson-build-support/subprojects') subdir('nix-meson-build-support/subprojects')
configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
@ -36,7 +37,7 @@ sources = files(
'nix_api_util.cc', 'nix_api_util.cc',
) )
include_dirs = [include_directories('.')] include_dirs = [ include_directories('.') ]
headers = files( headers = files(
'nix_api_util.h', 'nix_api_util.h',
@ -54,7 +55,7 @@ this_library = library(
config_priv_h, config_priv_h,
dependencies : deps_public + deps_private + deps_other, dependencies : deps_public + deps_private + deps_other,
include_directories : include_dirs, include_directories : include_dirs,
link_args: linker_export_flags, link_args : linker_export_flags,
prelink : true, # For C++ static initializers prelink : true, # For C++ static initializers
install : true, install : true,
) )

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -5,7 +5,7 @@ configdata_unix = configuration_data()
configdata_unix.set( configdata_unix.set(
'HAVE_DECL_AT_SYMLINK_NOFOLLOW', 'HAVE_DECL_AT_SYMLINK_NOFOLLOW',
cxx.has_header_symbol('fcntl.h', 'AT_SYMLINK_NOFOLLOW').to_int(), 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 # Check for each of these functions, and create a define like `#define
@ -39,7 +39,7 @@ check_funcs_unix = [
foreach funcspec : check_funcs_unix foreach funcspec : check_funcs_unix
define_name = 'HAVE_' + funcspec[0].underscorify().to_upper() define_name = 'HAVE_' + funcspec[0].underscorify().to_upper()
define_value = cxx.has_function(funcspec[0]).to_int() 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 endforeach
config_unix_priv_h = configure_file( config_unix_priv_h = configure_file(

View file

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

View file

@ -1,6 +1,9 @@
# vim: filetype=meson # vim: filetype=meson
# A relative path means it gets appended to prefix. # 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', description : 'the path to install shell profile files',
) )

View file

@ -34,7 +34,7 @@ nix_perl_store_cc = custom_target(
'Store.cc', 'Store.cc',
output : 'Store.cc', output : 'Store.cc',
input : nix_perl_store_xs, input : nix_perl_store_xs,
command : [xsubpp, '@INPUT@', '-output', '@OUTPUT@'], command : [ xsubpp, '@INPUT@', '-output', '@OUTPUT@' ],
) )
# Build Nix::Store Library # Build Nix::Store Library
@ -42,7 +42,7 @@ nix_perl_store_cc = custom_target(
nix_perl_store_lib = library( nix_perl_store_lib = library(
'Store', 'Store',
sources : nix_perl_store_cc, sources : nix_perl_store_cc,
name_prefix : '', name_prefix : '',
prelink : true, # For C++ static initializers prelink : true, # For C++ static initializers
install : true, install : true,
install_mode : 'rwxr-xr-x', install_mode : 'rwxr-xr-x',
@ -56,5 +56,5 @@ nix_perl_store_lib = library(
install_data( install_data(
nix_perl_scripts, nix_perl_scripts,
install_mode : 'rw-r--r--', 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 # init project
#============================================================================ #============================================================================
project ( project(
'nix-perl', 'nix-perl',
'cpp', 'cpp',
version : files('.version'), version : files('.version'),
@ -65,7 +65,7 @@ yath = find_program('yath', required : false)
# Required Libraries # Required Libraries
#------------------------------------------------- #-------------------------------------------------
bzip2_dep = dependency('bzip2', required: false) bzip2_dep = dependency('bzip2', required : false)
if not bzip2_dep.found() if not bzip2_dep.found()
bzip2_dep = cpp.find_library('bz2') bzip2_dep = cpp.find_library('bz2')
if not bzip2_dep.found() if not bzip2_dep.found()
@ -87,15 +87,36 @@ nix_store_dep = dependency('nix-store')
# the perl bindings does not appear to be possible. # the perl bindings does not appear to be possible.
#------------------------------------------------- #-------------------------------------------------
perl_archname = run_command( 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_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_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_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( 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 # 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_check_dbi = run_command(
perl, 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('dbi_path')),
'-I@0@'.format(get_option('dbd_sqlite_path')), '-I@0@'.format(get_option('dbd_sqlite_path')),
check: true check : true,
) )
if perl_check_dbi.returncode() == 2 if perl_check_dbi.returncode() == 2
@ -128,10 +150,11 @@ endif
#------------------------------------------------- #-------------------------------------------------
perl_dep = declare_dependency( perl_dep = declare_dependency(
dependencies : cpp.find_library( dependencies : cpp.find_library(
'perl', 'perl',
has_headers : [ has_headers : [
join_paths(perl_archlibexp, 'CORE', 'perl.h'), join_paths(perl_archlibexp, 'CORE', 'perl.h'),
join_paths(perl_archlibexp, 'CORE', 'EXTERN.h')], join_paths(perl_archlibexp, 'CORE', 'EXTERN.h'),
],
dirs : [ dirs : [
join_paths(perl_archlibexp, 'CORE'), join_paths(perl_archlibexp, 'CORE'),
], ],
@ -166,8 +189,8 @@ if get_option('tests').enabled()
test( test(
'nix-perl-test', 'nix-perl-test',
yath, yath,
args : ['test'], args : [ 'test' ],
workdir : meson.current_build_dir(), workdir : meson.current_build_dir(),
depends : [nix_perl_store_lib], depends : [ nix_perl_store_lib ],
) )
endif endif

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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