From 385e2c3542c707d95e3784f7f6d623f67e77ab61 Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Thu, 7 Aug 2025 02:52:13 +0300 Subject: [PATCH] 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 --- doc/manual/meson.build | 39 ++++--- doc/manual/source/command-ref/meson.build | 18 +--- doc/manual/source/development/meson.build | 3 +- doc/manual/source/language/meson.build | 12 +-- doc/manual/source/meson.build | 5 +- doc/manual/source/store/meson.build | 10 +- maintainers/flake-module.nix | 102 ------------------ misc/launchd/meson.build | 2 +- nix-meson-build-support/big-objs/meson.build | 2 +- .../deps-lists/meson.build | 10 +- .../export-all-symbols/meson.build | 2 +- nix-meson-build-support/export/meson.build | 25 +++-- .../generate-header/meson.build | 9 +- scripts/meson.build | 8 +- src/external-api-docs/meson.build | 7 +- src/internal-api-docs/meson.build | 7 +- src/libcmd/include/nix/cmd/meson.build | 2 +- src/libcmd/meson.build | 24 +++-- src/libcmd/meson.options | 6 +- src/libexpr-c/meson.build | 8 +- src/libexpr-test-support/meson.build | 9 +- src/libexpr-tests/meson.build | 13 +-- src/libexpr/include/nix/expr/meson.build | 4 +- src/libexpr/meson.build | 20 ++-- src/libexpr/meson.options | 4 +- src/libfetchers-c/meson.build | 8 +- src/libfetchers-tests/meson.build | 13 +-- .../include/nix/fetchers/meson.build | 2 +- src/libfetchers/meson.build | 9 +- src/libflake-c/meson.build | 8 +- src/libflake-tests/meson.build | 17 +-- src/libflake/include/nix/flake/meson.build | 2 +- src/libflake/meson.build | 11 +- src/libmain-c/meson.build | 8 +- src/libmain/include/nix/main/meson.build | 2 +- src/libmain/meson.build | 11 +- src/libstore-c/meson.build | 8 +- .../include/nix/store/tests/meson.build | 2 +- src/libstore-test-support/meson.build | 9 +- src/libstore-tests/meson.build | 27 +++-- src/libstore/include/nix/store/meson.build | 6 +- src/libstore/meson.build | 85 ++++++++------- src/libstore/meson.options | 24 ++++- src/libstore/windows/meson.build | 3 +- src/libutil-c/meson.build | 11 +- .../include/nix/util/tests/meson.build | 2 +- src/libutil-test-support/meson.build | 9 +- src/libutil-tests/meson.build | 13 +-- src/libutil/meson.build | 43 ++++---- src/libutil/meson.options | 4 +- src/libutil/unix/meson.build | 4 +- src/nix/meson.build | 39 +++---- src/nix/meson.options | 5 +- src/perl/lib/Nix/meson.build | 6 +- src/perl/meson.build | 53 ++++++--- src/perl/meson.options | 9 +- tests/functional/ca/meson.build | 8 +- tests/functional/dyn-drv/meson.build | 8 +- tests/functional/flakes/meson.build | 8 +- tests/functional/git-hashing/meson.build | 8 +- .../local-overlay-store/meson.build | 8 +- tests/functional/meson.build | 54 +++++----- 62 files changed, 444 insertions(+), 454 deletions(-) diff --git a/doc/manual/meson.build b/doc/manual/meson.build index 0779cd267..2e372dedd 100644 --- a/doc/manual/meson.build +++ b/doc/manual/meson.build @@ -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', diff --git a/doc/manual/source/command-ref/meson.build b/doc/manual/source/command-ref/meson.build index 2976f69ff..92998dec1 100644 --- a/doc/manual/source/command-ref/meson.build +++ b/doc/manual/source/command-ref/meson.build @@ -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 : [ diff --git a/doc/manual/source/development/meson.build b/doc/manual/source/development/meson.build index 5ffbfe394..4831cf8f0 100644 --- a/doc/manual/source/development/meson.build +++ b/doc/manual/source/development/meson.build @@ -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', diff --git a/doc/manual/source/language/meson.build b/doc/manual/source/language/meson.build index 97469e2f3..ed4995bfb 100644 --- a/doc/manual/source/language/meson.build +++ b/doc/manual/source/language/meson.build @@ -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, diff --git a/doc/manual/source/meson.build b/doc/manual/source/meson.build index 098a29897..949d26526 100644 --- a/doc/manual/source/meson.build +++ b/doc/manual/source/meson.build @@ -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', ) diff --git a/doc/manual/source/store/meson.build b/doc/manual/source/store/meson.build index e3006020d..ec4659ebc 100644 --- a/doc/manual/source/store/meson.build +++ b/doc/manual/source/store/meson.build @@ -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', diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index 1905d6e6b..4815313dd 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -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; diff --git a/misc/launchd/meson.build b/misc/launchd/meson.build index 5168131d1..53a57b65b 100644 --- a/misc/launchd/meson.build +++ b/misc/launchd/meson.build @@ -9,5 +9,5 @@ configure_file( # 'storedir' : store_dir, # 'localstatedir' : localstatedir, # 'bindir' : bindir, - }, +}, ) diff --git a/nix-meson-build-support/big-objs/meson.build b/nix-meson-build-support/big-objs/meson.build index 7e422abd8..f8dd8d1a3 100644 --- a/nix-meson-build-support/big-objs/meson.build +++ b/nix-meson-build-support/big-objs/meson.build @@ -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 diff --git a/nix-meson-build-support/deps-lists/meson.build b/nix-meson-build-support/deps-lists/meson.build index 237eac545..b4609c176 100644 --- a/nix-meson-build-support/deps-lists/meson.build +++ b/nix-meson-build-support/deps-lists/meson.build @@ -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 = [] diff --git a/nix-meson-build-support/export-all-symbols/meson.build b/nix-meson-build-support/export-all-symbols/meson.build index d7c086749..6a562e80d 100644 --- a/nix-meson-build-support/export-all-symbols/meson.build +++ b/nix-meson-build-support/export-all-symbols/meson.build @@ -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 diff --git a/nix-meson-build-support/export/meson.build b/nix-meson-build-support/export/meson.build index 950bd9544..26f778324 100644 --- a/nix-meson-build-support/export/meson.build +++ b/nix-meson-build-support/export/meson.build @@ -1,12 +1,12 @@ requires_private = [] foreach dep : deps_private_subproject - requires_private += dep.name() + requires_private += dep.name() endforeach requires_private += deps_private -requires_public = [] +requires_public = [] foreach dep : deps_public_subproject - requires_public += dep.name() + requires_public += dep.name() endforeach requires_public += deps_public @@ -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( - include_directories : include_dirs, - link_with : this_library, - compile_args : ['-std=c++2a'], - dependencies : deps_public_subproject + deps_public, - variables : extra_pkg_config_variables, -)) +meson.override_dependency( + meson.project_name(), + declare_dependency( + include_directories : include_dirs, + link_with : this_library, + compile_args : [ '-std=c++2a' ], + dependencies : deps_public_subproject + deps_public, + variables : extra_pkg_config_variables, + ), +) diff --git a/nix-meson-build-support/generate-header/meson.build b/nix-meson-build-support/generate-header/meson.build index dfbe1375f..a6523bc9f 100644 --- a/nix-meson-build-support/generate-header/meson.build +++ b/nix-meson-build-support/generate-header/meson.build @@ -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', ) diff --git a/scripts/meson.build b/scripts/meson.build index 777da42b1..bbcf3ef56 100644 --- a/scripts/meson.build +++ b/scripts/meson.build @@ -2,19 +2,19 @@ configure_file( input : 'nix-profile.sh.in', output : 'nix-profile.sh', configuration : { - 'localstatedir': localstatedir, - } + 'localstatedir' : localstatedir, + }, ) foreach rc : [ '.sh', '.fish', '-daemon.sh', '-daemon.fish' ] configure_file( - input : 'nix-profile' + rc + '.in', + input : 'nix-profile' + rc + '.in', output : 'nix' + rc, install : true, install_dir : get_option('profile-dir'), install_mode : 'rw-r--r--', configuration : { - 'localstatedir': localstatedir, + 'localstatedir' : localstatedir, }, ) endforeach diff --git a/src/external-api-docs/meson.build b/src/external-api-docs/meson.build index 62474ffe4..cba6f646b 100644 --- a/src/external-api-docs/meson.build +++ b/src/external-api-docs/meson.build @@ -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, ], diff --git a/src/internal-api-docs/meson.build b/src/internal-api-docs/meson.build index c0426621e..daab4c93c 100644 --- a/src/internal-api-docs/meson.build +++ b/src/internal-api-docs/meson.build @@ -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, ], diff --git a/src/libcmd/include/nix/cmd/meson.build b/src/libcmd/include/nix/cmd/meson.build index 368edb28e..119d0814b 100644 --- a/src/libcmd/include/nix/cmd/meson.build +++ b/src/libcmd/include/nix/cmd/meson.build @@ -1,6 +1,6 @@ # Public headers directory -include_dirs = [include_directories('../..')] +include_dirs = [ include_directories('../..') ] headers = files( 'built-path.hh', diff --git a/src/libcmd/meson.build b/src/libcmd/meson.build index 0cb41b46f..2f8079496 100644 --- a/src/libcmd/meson.build +++ b/src/libcmd/meson.build @@ -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) diff --git a/src/libcmd/meson.options b/src/libcmd/meson.options index 79ae4fa55..31178d82f 100644 --- a/src/libcmd/meson.options +++ b/src/libcmd/meson.options @@ -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', ) diff --git a/src/libexpr-c/meson.build b/src/libexpr-c/meson.build index ed4582e40..606b93e70 100644 --- a/src/libexpr-c/meson.build +++ b/src/libexpr-c/meson.build @@ -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, ) diff --git a/src/libexpr-test-support/meson.build b/src/libexpr-test-support/meson.build index b97f94362..89dc1d20a 100644 --- a/src/libexpr-test-support/meson.build +++ b/src/libexpr-test-support/meson.build @@ -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, ) diff --git a/src/libexpr-tests/meson.build b/src/libexpr-tests/meson.build index 35ae8a9d0..1f3973681 100644 --- a/src/libexpr-tests/meson.build +++ b/src/libexpr-tests/meson.build @@ -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', ) diff --git a/src/libexpr/include/nix/expr/meson.build b/src/libexpr/include/nix/expr/meson.build index 333490ee4..04f8eaf71 100644 --- a/src/libexpr/include/nix/expr/meson.build +++ b/src/libexpr/include/nix/expr/meson.build @@ -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', diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index 9c8569293..adf26008d 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -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) diff --git a/src/libexpr/meson.options b/src/libexpr/meson.options index 242d30ea7..847bb211d 100644 --- a/src/libexpr/meson.options +++ b/src/libexpr/meson.options @@ -1,3 +1,5 @@ -option('gc', type : 'feature', +option( + 'gc', + type : 'feature', description : 'enable garbage collection in the Nix expression evaluator (requires Boehm GC)', ) diff --git a/src/libfetchers-c/meson.build b/src/libfetchers-c/meson.build index e34997f09..74ec9c9c2 100644 --- a/src/libfetchers-c/meson.build +++ b/src/libfetchers-c/meson.build @@ -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, ) diff --git a/src/libfetchers-tests/meson.build b/src/libfetchers-tests/meson.build index 33bc7f30e..51373aefa 100644 --- a/src/libfetchers-tests/meson.build +++ b/src/libfetchers-tests/meson.build @@ -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', ) diff --git a/src/libfetchers/include/nix/fetchers/meson.build b/src/libfetchers/include/nix/fetchers/meson.build index e6ddedd97..fcd446a6d 100644 --- a/src/libfetchers/include/nix/fetchers/meson.build +++ b/src/libfetchers/include/nix/fetchers/meson.build @@ -1,4 +1,4 @@ -include_dirs = [include_directories('../..')] +include_dirs = [ include_directories('../..') ] headers = files( 'attrs.hh', diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build index b549735e5..0b53ef44d 100644 --- a/src/libfetchers/meson.build +++ b/src/libfetchers/meson.build @@ -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, ) diff --git a/src/libflake-c/meson.build b/src/libflake-c/meson.build index 5a81618c8..8b844371d 100644 --- a/src/libflake-c/meson.build +++ b/src/libflake-c/meson.build @@ -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, ) diff --git a/src/libflake-tests/meson.build b/src/libflake-tests/meson.build index 8c082c7e0..08c48f137 100644 --- a/src/libflake-tests/meson.build +++ b/src/libflake-tests/meson.build @@ -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', ) diff --git a/src/libflake/include/nix/flake/meson.build b/src/libflake/include/nix/flake/meson.build index ece1ad4ea..fc580164e 100644 --- a/src/libflake/include/nix/flake/meson.build +++ b/src/libflake/include/nix/flake/meson.build @@ -1,6 +1,6 @@ # Public headers directory -include_dirs = [include_directories('../..')] +include_dirs = [ include_directories('../..') ] headers = files( 'flake.hh', diff --git a/src/libflake/meson.build b/src/libflake/meson.build index bc8533e15..faa12e7a9 100644 --- a/src/libflake/meson.build +++ b/src/libflake/meson.build @@ -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, ) diff --git a/src/libmain-c/meson.build b/src/libmain-c/meson.build index e420520e6..2c08cac41 100644 --- a/src/libmain-c/meson.build +++ b/src/libmain-c/meson.build @@ -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, ) diff --git a/src/libmain/include/nix/main/meson.build b/src/libmain/include/nix/main/meson.build index 992a5ff0e..338fa8257 100644 --- a/src/libmain/include/nix/main/meson.build +++ b/src/libmain/include/nix/main/meson.build @@ -1,6 +1,6 @@ # Public headers directory -include_dirs = [include_directories('../..')] +include_dirs = [ include_directories('../..') ] headers = files( 'common-args.hh', diff --git a/src/libmain/meson.build b/src/libmain/meson.build index 65fcb6239..252b28169 100644 --- a/src/libmain/meson.build +++ b/src/libmain/meson.build @@ -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, ) diff --git a/src/libstore-c/meson.build b/src/libstore-c/meson.build index eb5563161..1d01aa3aa 100644 --- a/src/libstore-c/meson.build +++ b/src/libstore-c/meson.build @@ -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, ) diff --git a/src/libstore-test-support/include/nix/store/tests/meson.build b/src/libstore-test-support/include/nix/store/tests/meson.build index ae5db049e..f79769d41 100644 --- a/src/libstore-test-support/include/nix/store/tests/meson.build +++ b/src/libstore-test-support/include/nix/store/tests/meson.build @@ -1,6 +1,6 @@ # Public headers directory -include_dirs = [include_directories('../../..')] +include_dirs = [ include_directories('../../..') ] headers = files( 'derived-path.hh', diff --git a/src/libstore-test-support/meson.build b/src/libstore-test-support/meson.build index 779b122fa..26da5d0f2 100644 --- a/src/libstore-test-support/meson.build +++ b/src/libstore-test-support/meson.build @@ -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, ) diff --git a/src/libstore-tests/meson.build b/src/libstore-tests/meson.build index bba991388..e5995bcb1 100644 --- a/src/libstore-tests/meson.build +++ b/src/libstore-tests/meson.build @@ -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) diff --git a/src/libstore/include/nix/store/meson.build b/src/libstore/include/nix/store/meson.build index 44d9815de..e883a89e4 100644 --- a/src/libstore/include/nix/store/meson.build +++ b/src/libstore/include/nix/store/meson.build @@ -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', diff --git a/src/libstore/meson.build b/src/libstore/meson.build index 708188178..0b6471af3 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -1,4 +1,6 @@ -project('nix-store', 'cpp', +project( + 'nix-store', + 'cpp', version : files('.version'), default_options : [ 'cpp_std=c++2a', @@ -27,31 +29,34 @@ subdir('nix-meson-build-support/default-system-cpu') configdata_pub.set_quoted( 'NIX_LOCAL_SYSTEM', nix_system_cpu + '-' + host_machine.system(), - description : - 'This is the system name Nix expects for local running instance of Nix.\n\n' + description : 'This is the system name Nix expects for local running instance of Nix.\n\n' + 'See the "system" setting for additional details', ) -deps_private_maybe_subproject = [ -] +deps_private_maybe_subproject = [] deps_public_maybe_subproject = [ dependency('nix-util'), ] subdir('nix-meson-build-support/subprojects') -run_command('ln', '-s', +run_command( + 'ln', + '-s', meson.project_build_root() / '__nothing_link_target', meson.project_build_root() / '__nothing_symlink', # native doesn't allow dangling symlinks, which the tests require - env : { 'MSYS' : 'winsymlinks:lnk' }, + env : {'MSYS' : 'winsymlinks:lnk'}, check : true, ) -can_link_symlink = run_command('ln', +can_link_symlink = run_command( + 'ln', meson.project_build_root() / '__nothing_symlink', meson.project_build_root() / '__nothing_hardlink', check : false, ).returncode() == 0 -run_command('rm', '-f', +run_command( + 'rm', + '-f', meson.project_build_root() / '__nothing_symlink', meson.project_build_root() / '__nothing_hardlink', check : true, @@ -84,20 +89,20 @@ configdata_pub.set( if host_machine.system() == 'darwin' sandbox = cxx.find_library('sandbox') - deps_other += [sandbox] + deps_other += [ sandbox ] endif if host_machine.system() == 'windows' wsock32 = cxx.find_library('wsock32') - deps_other += [wsock32] + deps_other += [ wsock32 ] endif subdir('nix-meson-build-support/libatomic') boost = dependency( 'boost', - modules : ['container', 'regex'], - include_type: 'system', + modules : [ 'container', 'regex' ], + include_type : 'system', ) # boost is a public dependency, but not a pkg-config dependency unfortunately, so we # put in `deps_other`. @@ -112,9 +117,16 @@ seccomp_required = get_option('seccomp-sandboxing') if not is_linux and seccomp_required.enabled() warning('Force-enabling seccomp on non-Linux does not make sense') endif -seccomp = dependency('libseccomp', 'seccomp', required : seccomp_required, version : '>=2.5.5') +seccomp = dependency( + 'libseccomp', + 'seccomp', + required : seccomp_required, + version : '>=2.5.5', +) if is_linux and not seccomp.found() - warning('Sandbox security is reduced because libseccomp has not been found! Please provide libseccomp if it supports your CPU architecture.') + warning( + 'Sandbox security is reduced because libseccomp has not been found! Please provide libseccomp if it supports your CPU architecture.', + ) endif configdata_priv.set('HAVE_SECCOMP', seccomp.found().to_int()) deps_private += seccomp @@ -132,8 +144,8 @@ aws_s3 = dependency('aws-cpp-sdk-s3', required : false) configdata_pub.set('NIX_WITH_S3_SUPPORT', aws_s3.found().to_int()) if aws_s3.found() aws_s3 = declare_dependency( - include_directories: include_directories(aws_s3.get_variable('includedir')), - link_args: [ + include_directories : include_directories(aws_s3.get_variable('includedir')), + link_args : [ '-L' + aws_s3.get_variable('libdir'), '-laws-cpp-sdk-transfer', '-laws-cpp-sdk-s3', @@ -159,7 +171,10 @@ endforeach busybox = find_program(get_option('sandbox-shell'), required : false) -configdata_priv.set('HAVE_EMBEDDED_SANDBOX_SHELL', get_option('embedded-sandbox-shell').to_int()) +configdata_priv.set( + 'HAVE_EMBEDDED_SANDBOX_SHELL', + get_option('embedded-sandbox-shell').to_int(), +) if get_option('embedded-sandbox-shell') configdata_priv.set_quoted('SANDBOX_SHELL', '__embedded_sandbox_shell__') @@ -171,12 +186,7 @@ if get_option('embedded-sandbox-shell') hexdump = find_program('hexdump', native : true) embedded_sandbox_shell_gen = custom_target( 'embedded-sandbox-shell.gen.hh', - command : [ - hexdump, - '-v', - '-e', - '1/1 "0x%x," "\n"' - ], + command : [ hexdump, '-v', '-e', '1/1 "0x%x," "\n"' ], input : busybox.full_path(), output : 'embedded-sandbox-shell.gen.hh', capture : true, @@ -228,21 +238,20 @@ endif # Aside from prefix itself, each of these was made into an absolute path # by joining it with prefix, unless it was already an absolute path # (which is the default for store-dir, localstatedir, and log-dir). -configdata_priv.set_quoted('NIX_PREFIX', prefix) +configdata_priv.set_quoted('NIX_PREFIX', prefix) configdata_priv.set_quoted('NIX_STORE_DIR', store_dir) -configdata_priv.set_quoted('NIX_DATA_DIR', datadir) +configdata_priv.set_quoted('NIX_DATA_DIR', datadir) configdata_priv.set_quoted('NIX_STATE_DIR', localstatedir / 'nix') -configdata_priv.set_quoted('NIX_LOG_DIR', log_dir) -configdata_priv.set_quoted('NIX_CONF_DIR', sysconfdir / 'nix') -configdata_priv.set_quoted('NIX_MAN_DIR', mandir) +configdata_priv.set_quoted('NIX_LOG_DIR', log_dir) +configdata_priv.set_quoted('NIX_CONF_DIR', sysconfdir / 'nix') +configdata_priv.set_quoted('NIX_MAN_DIR', mandir) lsof = find_program('lsof', required : false) configdata_priv.set_quoted( 'LSOF', - lsof.found() - ? lsof.full_path() - # Just look up on the PATH - : 'lsof', + lsof.found() ? lsof.full_path() + # Just look up on the PATH +: 'lsof', ) config_priv_h = configure_file( @@ -255,8 +264,8 @@ subdir('nix-meson-build-support/common') sources = files( 'binary-cache-store.cc', 'build-result.cc', - 'build/derivation-goal.cc', 'build/derivation-building-goal.cc', + 'build/derivation-goal.cc', 'build/derivation-trampoline-goal.cc', 'build/drv-output-substitution-goal.cc', 'build/entry-points.cc', @@ -270,8 +279,8 @@ sources = files( 'common-ssh-store-config.cc', 'content-address.cc', 'daemon.cc', - 'derivations.cc', 'derivation-options.cc', + 'derivations.cc', 'derived-path-map.cc', 'derived-path.cc', 'downstream-placeholder.cc', @@ -318,8 +327,8 @@ sources = files( 'ssh.cc', 'store-api.cc', 'store-dir-config.cc', - 'store-registration.cc', 'store-reference.cc', + 'store-registration.cc', 'uds-remote-store.cc', 'worker-protocol-connection.cc', 'worker-protocol.cc', @@ -347,10 +356,10 @@ this_library = library( config_priv_h, dependencies : deps_public + deps_private + deps_other, include_directories : include_dirs, - link_args: linker_export_flags, + link_args : linker_export_flags, prelink : true, # For C++ static initializers install : true, - cpp_pch : do_pch ? ['pch/precompiled-headers.hh'] : [] + cpp_pch : do_pch ? [ 'pch/precompiled-headers.hh' ] : [], ) install_headers(headers, subdir : 'nix/store', preserve_path : true) diff --git a/src/libstore/meson.options b/src/libstore/meson.options index ebad24dc4..b8414068d 100644 --- a/src/libstore/meson.options +++ b/src/libstore/meson.options @@ -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', ) diff --git a/src/libstore/windows/meson.build b/src/libstore/windows/meson.build index b81c5b2af..1cc30602a 100644 --- a/src/libstore/windows/meson.build +++ b/src/libstore/windows/meson.build @@ -7,5 +7,4 @@ include_dirs += include_directories( #'build', ) -headers += files( -) +headers += files() diff --git a/src/libutil-c/meson.build b/src/libutil-c/meson.build index 3414a6d31..3688ddeb6 100644 --- a/src/libutil-c/meson.build +++ b/src/libutil-c/meson.build @@ -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, ) diff --git a/src/libutil-test-support/include/nix/util/tests/meson.build b/src/libutil-test-support/include/nix/util/tests/meson.build index e6697b517..ab143757c 100644 --- a/src/libutil-test-support/include/nix/util/tests/meson.build +++ b/src/libutil-test-support/include/nix/util/tests/meson.build @@ -1,6 +1,6 @@ # Public headers directory -include_dirs = [include_directories('../../..')] +include_dirs = [ include_directories('../../..') ] headers = files( 'characterization.hh', diff --git a/src/libutil-test-support/meson.build b/src/libutil-test-support/meson.build index ec6bc15d9..9bee4a1a6 100644 --- a/src/libutil-test-support/meson.build +++ b/src/libutil-test-support/meson.build @@ -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, ) diff --git a/src/libutil-tests/meson.build b/src/libutil-tests/meson.build index 0097611c6..2dbb4d129 100644 --- a/src/libutil-tests/meson.build +++ b/src/libutil-tests/meson.build @@ -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', ) diff --git a/src/libutil/meson.build b/src/libutil/meson.build index ea2cb679e..afdddc6b5 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -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') diff --git a/src/libutil/meson.options b/src/libutil/meson.options index 21883af01..a82806162 100644 --- a/src/libutil/meson.options +++ b/src/libutil/meson.options @@ -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)', ) diff --git a/src/libutil/unix/meson.build b/src/libutil/unix/meson.build index ea2391d05..13bb380b4 100644 --- a/src/libutil/unix/meson.build +++ b/src/libutil/unix/meson.build @@ -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( diff --git a/src/nix/meson.build b/src/nix/meson.build index 23b876690..c6dc9c530 100644 --- a/src/nix/meson.build +++ b/src/nix/meson.build @@ -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) diff --git a/src/nix/meson.options b/src/nix/meson.options index 8430dd669..0fc680cfe 100644 --- a/src/nix/meson.options +++ b/src/nix/meson.options @@ -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', ) diff --git a/src/perl/lib/Nix/meson.build b/src/perl/lib/Nix/meson.build index 256e66096..5f8baee69 100644 --- a/src/perl/lib/Nix/meson.build +++ b/src/perl/lib/Nix/meson.build @@ -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 @@ -42,7 +42,7 @@ nix_perl_store_cc = custom_target( nix_perl_store_lib = library( 'Store', sources : nix_perl_store_cc, - name_prefix : '', + name_prefix : '', prelink : true, # For C++ static initializers install : true, install_mode : 'rwxr-xr-x', @@ -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'), ) diff --git a/src/perl/meson.build b/src/perl/meson.build index 599e91710..f33291051 100644 --- a/src/perl/meson.build +++ b/src/perl/meson.build @@ -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 @@ -128,10 +150,11 @@ endif #------------------------------------------------- perl_dep = declare_dependency( dependencies : cpp.find_library( - 'perl', - has_headers : [ - join_paths(perl_archlibexp, 'CORE', 'perl.h'), - join_paths(perl_archlibexp, 'CORE', 'EXTERN.h')], + 'perl', + has_headers : [ + join_paths(perl_archlibexp, 'CORE', 'perl.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 diff --git a/src/perl/meson.options b/src/perl/meson.options index 9b5b6b1d9..03ddf57f1 100644 --- a/src/perl/meson.options +++ b/src/perl/meson.options @@ -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', +) diff --git a/tests/functional/ca/meson.build b/tests/functional/ca/meson.build index a4611ca42..ec34e9644 100644 --- a/tests/functional/ca/meson.build +++ b/tests/functional/ca/meson.build @@ -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(), } diff --git a/tests/functional/dyn-drv/meson.build b/tests/functional/dyn-drv/meson.build index 07145000d..78950a954 100644 --- a/tests/functional/dyn-drv/meson.build +++ b/tests/functional/dyn-drv/meson.build @@ -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(), } diff --git a/tests/functional/flakes/meson.build b/tests/functional/flakes/meson.build index 801fefc6f..de76a5580 100644 --- a/tests/functional/flakes/meson.build +++ b/tests/functional/flakes/meson.build @@ -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(), } diff --git a/tests/functional/git-hashing/meson.build b/tests/functional/git-hashing/meson.build index 342c2799c..8e7f693c1 100644 --- a/tests/functional/git-hashing/meson.build +++ b/tests/functional/git-hashing/meson.build @@ -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(), } diff --git a/tests/functional/local-overlay-store/meson.build b/tests/functional/local-overlay-store/meson.build index b7ba5a323..6db2c728d 100644 --- a/tests/functional/local-overlay-store/meson.build +++ b/tests/functional/local-overlay-store/meson.build @@ -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(), } diff --git a/tests/functional/meson.build b/tests/functional/meson.build index d2989ee84..85373a70a 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -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