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',
@ -24,7 +25,8 @@ nix_env_for_docs = {
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',
] ]
@ -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@
@ -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

@ -6,8 +6,7 @@ xp_features_json = custom_target(
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

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

@ -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(
meson.project_name(),
declare_dependency(
include_directories : include_dirs, include_directories : include_dirs,
link_with : this_library, link_with : this_library,
compile_args : [ '-std=c++2a' ], compile_args : [ '-std=c++2a' ],
dependencies : deps_public_subproject + deps_public, dependencies : deps_public_subproject + deps_public,
variables : extra_pkg_config_variables, variables : extra_pkg_config_variables,
)) ),
)

View file

@ -2,6 +2,11 @@ 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

@ -3,7 +3,7 @@ configure_file(
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' ]

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',

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',

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'
@ -92,7 +100,7 @@ this_library = library(
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

@ -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',

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'),

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')

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'),
@ -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@',
], ],
@ -178,7 +178,7 @@ this_library = library(
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',

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')

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'),

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',

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')

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',
) )

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',

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(

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',

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'),

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')
@ -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

@ -12,9 +12,9 @@ config_pub_h = configure_file(
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,
@ -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
@ -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,
@ -239,8 +249,7 @@ 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',
) )
@ -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',
@ -350,7 +359,7 @@ this_library = library(
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())

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'),

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')

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
@ -59,7 +59,7 @@ 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
@ -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',
@ -193,7 +198,7 @@ this_library = library(
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)

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

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')
@ -60,7 +61,6 @@ 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',
@ -186,7 +187,7 @@ this_exe = executable(
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,7 +218,7 @@ 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@' ],
@ -225,7 +226,7 @@ foreach linkname : nix_symlinks
# 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)
@ -236,7 +237,7 @@ install_symlink(
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(
@ -245,7 +246,7 @@ custom_target(
# 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

@ -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
@ -131,7 +153,8 @@ perl_dep = declare_dependency(
'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'),
], ],

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

@ -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',
@ -234,7 +235,8 @@ foreach suite : suites
'-x', '-x',
'-e', '-e',
'-u', '-u',
'-o', 'pipefail', '-o',
'pipefail',
script, script,
], ],
suite : suite_name, suite : suite_name,