diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libcmd/meson.build | 58 | ||||
-rw-r--r-- | src/libexpr/meson.build | 153 | ||||
-rw-r--r-- | src/libfetchers/meson.build | 42 | ||||
-rw-r--r-- | src/libmain/meson.build | 33 | ||||
-rw-r--r-- | src/libmain/shared.cc | 2 | ||||
-rw-r--r-- | src/libstore/meson.build | 188 | ||||
-rw-r--r-- | src/libutil/meson.build | 112 | ||||
-rw-r--r-- | src/meson.build | 65 | ||||
-rw-r--r-- | src/nix/meson.build | 119 | ||||
-rw-r--r-- | src/toml11/toml.hpp | 3 |
10 files changed, 773 insertions, 2 deletions
diff --git a/src/libcmd/meson.build b/src/libcmd/meson.build new file mode 100644 index 000000000..e033bb1cd --- /dev/null +++ b/src/libcmd/meson.build @@ -0,0 +1,58 @@ +libcmd_sources = files( + 'built-path.cc', + 'command-installable-value.cc', + 'command.cc', + 'common-eval-args.cc', + 'editor-for.cc', + 'installable-attr-path.cc', + 'installable-derived-path.cc', + 'installable-flake.cc', + 'installable-value.cc', + 'installables.cc', + 'legacy.cc', + 'markdown.cc', + 'repl.cc', + 'repl-interacter.cc', +) + +libcmd_headers = files( + 'built-path.hh', + 'command-installable-value.hh', + 'command.hh', + 'common-eval-args.hh', + 'editor-for.hh', + 'installable-attr-path.hh', + 'installable-derived-path.hh', + 'installable-flake.hh', + 'installable-value.hh', + 'installables.hh', + 'legacy.hh', + 'markdown.hh', + 'repl-interacter.hh', + 'repl.hh', +) + +libcmd = library( + 'nixcmd', + libcmd_sources, + dependencies : [ + liblixutil, + liblixstore, + liblixexpr, + liblixfetchers, + liblixmain, + boehm, + editline, + lowdown, + ], + install : true, + # FIXME(Qyriad): is this right? + install_rpath : libdir, +) + +install_headers(libcmd_headers, subdir : 'nix', preserve_path : true) + +liblixcmd = declare_dependency( + include_directories : '.', + link_with : libcmd, +) diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build new file mode 100644 index 000000000..baac9bb24 --- /dev/null +++ b/src/libexpr/meson.build @@ -0,0 +1,153 @@ +parser_tab = custom_target( + input : 'parser.y', + output : [ + 'parser-tab.cc', + 'parser-tab.hh', + ], + command : [ + 'bison', + '-v', + '-o', + '@OUTPUT0@', + '@INPUT@', + '-d', + ], + # NOTE(Qyriad): Meson doesn't support installing only part of a custom target, so we add + # an install script below which removes parser-tab.cc. + install : true, + install_dir : includedir / 'nix', +) + +lexer_tab = custom_target( + input : [ + 'lexer.l', + parser_tab, + ], + output : [ + 'lexer-tab.cc', + 'lexer-tab.hh', + ], + command : [ + 'flex', + '--outfile', + '@OUTPUT0@', + '--header-file=' + '@OUTPUT1@', + '@INPUT0@', + ], + # NOTE(Qyriad): Meson doesn't support installing only part of a custom target, so we add + # an install script below which removes lexer-tab.cc. + install : true, + install_dir : includedir / 'nix', +) + +# TODO(Qyriad): When the parser and lexer are rewritten this should be removed. +# NOTE(Qyriad): We do this this way instead of an inline bash or rm command +# due to subtleties in Meson. Check the comments in cleanup-install.bash for details. +meson.add_install_script( + bash, + meson.project_source_root() / 'meson/cleanup-install.bash', + '@0@'.format(includedir), +) + +imported_drv_to_derivation_gen = gen_header.process('imported-drv-to-derivation.nix') +fetchurl_gen = gen_header.process('fetchurl.nix') +derivation_gen = gen_header.process('primops/derivation.nix', preserve_path_from : meson.current_source_dir()) +call_flake_gen = gen_header.process('flake/call-flake.nix') + +libexpr_sources = files( + 'attr-path.cc', + 'attr-set.cc', + 'eval-cache.cc', + 'eval-error.cc', + 'eval-settings.cc', + 'eval.cc', + 'function-trace.cc', + 'get-drvs.cc', + 'json-to-value.cc', + 'nixexpr.cc', + 'paths.cc', + 'primops.cc', + 'print-ambiguous.cc', + 'print.cc', + 'search-path.cc', + 'value-to-json.cc', + 'value-to-xml.cc', + 'flake/config.cc', + 'flake/flake.cc', + 'flake/flakeref.cc', + 'flake/lockfile.cc', + 'primops/context.cc', + 'primops/fetchClosure.cc', + 'primops/fetchMercurial.cc', + 'primops/fetchTree.cc', + 'primops/fromTOML.cc', + 'value/context.cc', +) + +libexpr_headers = files( + 'attr-path.hh', + 'attr-set.hh', + 'eval-cache.hh', + 'eval-error.hh', + 'eval-inline.hh', + 'eval-settings.hh', + 'eval.hh', + 'flake/flake.hh', + 'flake/flakeref.hh', + 'flake/lockfile.hh', + 'function-trace.hh', + 'gc-small-vector.hh', + 'get-drvs.hh', + 'json-to-value.hh', + 'nixexpr.hh', + 'parser-state.hh', + 'pos-idx.hh', + 'pos-table.hh', + 'primops.hh', + 'print-ambiguous.hh', + 'print-options.hh', + 'print.hh', + 'repl-exit-status.hh', + 'search-path.hh', + 'symbol-table.hh', + 'value/context.hh', + 'value-to-json.hh', + 'value-to-xml.hh', + 'value.hh', +) + +libexpr = library( + 'nixexpr', + libexpr_sources, + parser_tab, + lexer_tab, + imported_drv_to_derivation_gen, + fetchurl_gen, + derivation_gen, + call_flake_gen, + dependencies : [ + liblixutil, + liblixstore, + liblixfetchers, + boehm, + boost, + ], + # for shared.hh + include_directories : [ + '../libmain', + ], + install : true, + # FIXME(Qyriad): is this right? + install_rpath : libdir, +) + +install_headers( + libexpr_headers, + subdir : 'nix', + preserve_path : true, +) + +liblixexpr = declare_dependency( + include_directories : include_directories('.'), + link_with : libexpr, +) diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build new file mode 100644 index 000000000..5eacfd5c4 --- /dev/null +++ b/src/libfetchers/meson.build @@ -0,0 +1,42 @@ +libfetchers_sources = files( + 'attrs.cc', + 'cache.cc', + 'fetch-settings.cc', + 'fetch-to-store.cc', + 'fetchers.cc', + 'git.cc', + 'github.cc', + 'indirect.cc', + 'mercurial.cc', + 'path.cc', + 'registry.cc', + 'tarball.cc', +) + +libfetchers_headers = files( + 'attrs.hh', + 'cache.hh', + 'fetch-settings.hh', + 'fetch-to-store.hh', + 'fetchers.hh', + 'registry.hh', +) + +libfetchers = library( + 'nixfetchers', + libfetchers_sources, + dependencies : [ + liblixstore, + liblixutil, + ], + install : true, + # FIXME(Qyriad): is this right? + install_rpath : libdir, +) + +install_headers(libfetchers_headers, subdir : 'nix', preserve_path : true) + +liblixfetchers = declare_dependency( + include_directories : include_directories('.'), + link_with : libfetchers, +) diff --git a/src/libmain/meson.build b/src/libmain/meson.build new file mode 100644 index 000000000..54326c305 --- /dev/null +++ b/src/libmain/meson.build @@ -0,0 +1,33 @@ +libmain_sources = files( + 'common-args.cc', + 'loggers.cc', + 'progress-bar.cc', + 'shared.cc', + 'stack.cc', +) + +libmain_headers = files( + 'common-args.hh', + 'loggers.hh', + 'progress-bar.hh', + 'shared.hh', +) + +libmain = library( + 'nixmain', + libmain_sources, + dependencies : [ + liblixutil, + liblixstore, + ], + install : true, + # FIXME(Qyriad): is this right? + install_rpath : libdir, +) + +install_headers(libmain_headers, subdir : 'nix', preserve_path : true) + +liblixmain = declare_dependency( + include_directories : include_directories('.'), + link_with : libmain, +) diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index 6d851d776..cd62b1398 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -114,10 +114,8 @@ static void sigHandler(int signo) { } void initNix() { /* Turn on buffering for cerr. */ -#if HAVE_PUBSETBUF static char buf[1024]; std::cerr.rdbuf()->pubsetbuf(buf, sizeof(buf)); -#endif initLibStore(); diff --git a/src/libstore/meson.build b/src/libstore/meson.build new file mode 100644 index 000000000..33e475f70 --- /dev/null +++ b/src/libstore/meson.build @@ -0,0 +1,188 @@ +schema_sql_gen = gen_header.process('schema.sql') +ca_specific_schema_gen = gen_header.process('ca-specific-schema.sql') + +libstore_sources = files( + 'binary-cache-store.cc', + 'build-result.cc', + 'common-protocol.cc', + 'content-address.cc', + 'crypto.cc', + 'daemon.cc', + 'derivations.cc', + 'derived-path-map.cc', + 'derived-path.cc', + 'downstream-placeholder.cc', + 'dummy-store.cc', + 'export-import.cc', + 'filetransfer.cc', + 'gc.cc', + 'globals.cc', + 'http-binary-cache-store.cc', + 'legacy-ssh-store.cc', + 'local-binary-cache-store.cc', + 'local-fs-store.cc', + 'local-store.cc', + 'lock.cc', + 'log-store.cc', + 'machines.cc', + 'make-content-addressed.cc', + 'misc.cc', + 'names.cc', + 'nar-accessor.cc', + 'nar-info-disk-cache.cc', + 'nar-info.cc', + 'optimise-store.cc', + 'outputs-spec.cc', + 'parsed-derivations.cc', + 'path-info.cc', + 'path-references.cc', + 'path-with-outputs.cc', + 'path.cc', + 'pathlocks.cc', + 'profiles.cc', + 'realisation.cc', + 'remote-fs-accessor.cc', + 'remote-store.cc', + 's3-binary-cache-store.cc', + 'serve-protocol.cc', + 'sqlite.cc', + 'ssh-store.cc', + 'ssh.cc', + 'store-api.cc', + 'uds-remote-store.cc', + 'worker-protocol.cc', + 'build/derivation-goal.cc', + 'build/drv-output-substitution-goal.cc', + 'build/entry-points.cc', + 'build/goal.cc', + 'build/hook-instance.cc', + 'build/local-derivation-goal.cc', + 'build/personality.cc', + 'build/substitution-goal.cc', + 'build/worker.cc', + 'builtins/buildenv.cc', + 'builtins/fetchurl.cc', + 'builtins/unpack-channel.cc', +) + + +libstore_headers = files( + 'binary-cache-store.hh', + 'build/derivation-goal.hh', + 'build/drv-output-substitution-goal.hh', + 'build/goal.hh', + 'build/hook-instance.hh', + 'build/local-derivation-goal.hh', + 'build/personality.hh', + 'build/substitution-goal.hh', + 'build/worker.hh', + 'build-result.hh', + 'builtins/buildenv.hh', + 'builtins.hh', + 'common-protocol-impl.hh', + 'common-protocol.hh', + 'content-address.hh', + 'crypto.hh', + 'daemon.hh', + 'derivations.hh', + 'derived-path-map.hh', + 'derived-path.hh', + 'downstream-placeholder.hh', + 'filetransfer.hh', + 'fs-accessor.hh', + 'gc-store.hh', + 'globals.hh', + 'indirect-root-store.hh', + 'length-prefixed-protocol-helper.hh', + 'local-fs-store.hh', + 'local-store.hh', + 'lock.hh', + 'log-store.hh', + 'machines.hh', + 'make-content-addressed.hh', + 'names.hh', + 'nar-accessor.hh', + 'nar-info-disk-cache.hh', + 'nar-info.hh', + 'outputs-spec.hh', + 'parsed-derivations.hh', + 'path-info.hh', + 'path-references.hh', + 'path-regex.hh', + 'path-with-outputs.hh', + 'path.hh', + 'pathlocks.hh', + 'profiles.hh', + 'realisation.hh', + 'remote-fs-accessor.hh', + 'remote-store-connection.hh', + 'remote-store.hh', + 's3-binary-cache-store.hh', + 's3.hh', + 'serve-protocol-impl.hh', + 'serve-protocol.hh', + 'sqlite.hh', + 'ssh-store-config.hh', + 'ssh.hh', + 'store-api.hh', + 'store-cast.hh', + 'uds-remote-store.hh', + 'worker-protocol-impl.hh', + 'worker-protocol.hh', +) + +# These variables (aside from LSOF) are created pseudo-dynamically, near the beginning of +# the top-level meson.build. 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, state-dir, and log-dir). +cpp_str_defines = { + 'LSOF': lsof.full_path(), + 'NIX_PREFIX': prefix, + 'NIX_STORE_DIR': store_dir, + 'NIX_DATA_DIR': datadir, + 'NIX_STATE_DIR': state_dir, + 'NIX_LOG_DIR': log_dir, + 'NIX_CONF_DIR': sysconfdir, + 'NIX_BIN_DIR': bindir, + 'NIX_MAN_DIR': mandir, +} + +cpp_args = [] + +foreach name, value : cpp_str_defines + cpp_args += [ + '-D' + name + '=' + '"' + value + '"' + ] +endforeach + +libstore = library( + 'nixstore', + schema_sql_gen, + ca_specific_schema_gen, + libstore_sources, + dependencies : [ + libarchive, + liblixutil, # Internal. + seccomp, + sqlite, + sodium, + seccomp, + curl, + openssl, + aws_sdk, + aws_s3, + aws_sdk_transfer, + ], + cpp_args : cpp_args, + install : true, + # FIXME(Qyriad): is this right? + install_rpath : libdir, +) + +install_headers(libstore_headers, subdir : 'nix', preserve_path : true) + +# Used by libfetchers. +liblixstore = declare_dependency( + include_directories : include_directories('.'), + link_with : libstore, +) diff --git a/src/libutil/meson.build b/src/libutil/meson.build new file mode 100644 index 000000000..084d7ed11 --- /dev/null +++ b/src/libutil/meson.build @@ -0,0 +1,112 @@ +libutil_sources = files( + 'archive.cc', + 'args.cc', + 'canon-path.cc', + 'cgroup.cc', + 'compression.cc', + 'compute-levels.cc', + 'config.cc', + 'english.cc', + 'error.cc', + 'exit.cc', + 'experimental-features.cc', + 'filesystem.cc', + 'git.cc', + 'hash.cc', + 'hilite.cc', + 'json-utils.cc', + 'logging.cc', + 'namespaces.cc', + 'position.cc', + 'references.cc', + 'serialise.cc', + 'signals.cc', + 'source-path.cc', + 'suggestions.cc', + 'tarfile.cc', + 'thread-pool.cc', + 'url.cc', + 'util.cc', + 'xml-writer.cc', +) + +libutil_headers = files( + 'abstract-setting-to-json.hh', + 'ansicolor.hh', + 'archive.hh', + 'args.hh', + 'box_ptr.hh', + 'callback.hh', + 'canon-path.hh', + 'cgroup.hh', + 'chunked-vector.hh', + 'closure.hh', + 'comparator.hh', + 'compression.hh', + 'compute-levels.hh', + 'config-impl.hh', + 'config.hh', + 'english.hh', + 'error.hh', + 'exit.hh', + 'experimental-features.hh', + 'finally.hh', + 'fmt.hh', + 'git.hh', + 'hash.hh', + 'hilite.hh', + 'input-accessor.hh', + 'json-impls.hh', + 'json-utils.hh', + 'logging.hh', + 'lru-cache.hh', + 'monitor-fd.hh', + 'namespaces.hh', + 'pool.hh', + 'position.hh', + 'ref.hh', + 'references.hh', + 'regex-combinators.hh', + 'repair-flag.hh', + 'serialise.hh', + 'signals.hh', + 'source-path.hh', + 'split.hh', + 'suggestions.hh', + 'sync.hh', + 'tarfile.hh', + 'thread-pool.hh', + 'topo-sort.hh', + 'types.hh', + 'url-parts.hh', + 'url.hh', + 'util.hh', + 'variant-wrapper.hh', + 'xml-writer.hh', +) + +libutil = library( + 'nixutil', + libutil_sources, + dependencies : [ + aws_sdk, + aws_s3, + boehm, + boost, + cpuid, + seccomp, + libarchive, + brotli, + openssl, + ], + implicit_include_directories : true, + install : true, +) + +install_headers(libutil_headers, subdir : 'nix', preserve_path : true) + +# Used by libstore and libfetchers. +liblixutil = declare_dependency( + include_directories : include_directories('.'), + link_with : libutil +) diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 000000000..f97b66252 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,65 @@ +# Subcomponents: these link into artifacts themselves, and have interdependencies. + +subdir('libutil') +# Load-bearing order. libstore depends on libutil. +subdir('libstore') +# libfetchers depends on libstore +subdir('libfetchers') +# libexpr depends on all of the above +subdir('libexpr') +# libmain depends on libutil and libstore +subdir('libmain') +# libcmd depends on everything +subdir('libcmd') + + +# The rest of the subdirectories aren't separate components, +# just source files in another directory, so we process them here. + +build_remote_sources = files( + 'build-remote/build-remote.cc', +) +nix_build_sources = files( + 'nix-build/nix-build.cc', +) +nix_channel_sources = files( + 'nix-channel/nix-channel.cc', +) +unpack_channel_gen = gen_header.process('nix-channel/unpack-channel.nix') +nix_collect_garbage_sources = files( + 'nix-collect-garbage/nix-collect-garbage.cc', +) +nix_copy_closure_sources = files( + 'nix-copy-closure/nix-copy-closure.cc', +) +nix_env_buildenv_gen = gen_header.process('nix-env/buildenv.nix') +nix_env_sources = files( + 'nix-env/nix-env.cc', + 'nix-env/user-env.cc', +) +nix_instantiate_sources = files( + 'nix-instantiate/nix-instantiate.cc', +) +nix_store_sources = files( + 'nix-store/dotgraph.cc', + 'nix-store/graphml.cc', + 'nix-store/nix-store.cc', +) + +# Hurray for Meson list flattening! +nix2_commands_sources = [ + build_remote_sources, + nix_build_sources, + nix_channel_sources, + unpack_channel_gen, + nix_collect_garbage_sources, + nix_copy_closure_sources, + nix_env_buildenv_gen, + nix_env_sources, + nix_instantiate_sources, + nix_store_sources, +] + +# Finally, the nix command itself, which all of the other commands are implmented in terms of +# as a multicall binary. +subdir('nix') diff --git a/src/nix/meson.build b/src/nix/meson.build new file mode 100644 index 000000000..2585ba3c3 --- /dev/null +++ b/src/nix/meson.build @@ -0,0 +1,119 @@ +generate_manpage_gen = gen_header.process(meson.project_source_root() / 'doc/manual/generate-manpage.nix') + +utils_gen = gen_header.process(meson.project_source_root() / 'doc/manual/utils.nix') + +get_env_gen = gen_header.process('get-env.sh') + +# src/nix/profile.cc includes src/nix/profile.md, which includes "doc/files/profiles.md.gen.hh". +# Unfortunately, https://github.com/mesonbuild/meson/issues/2320. +# "docs/files" isn't a directory hierarchy that already exists somewhere in this source tree, +# and Meson refuses to create targets with specific directory paths. +# So run_command() it is. +# NOTE(Qyriad): This corresponds to the previous buildsystem's `src/nix/doc/files/%.md` rule, +# which as far as I can tell was only used for this file. +run_command( + installcmd, + '-D', + meson.project_source_root() / 'doc/manual/src/command-ref/files/profiles.md', + meson.current_build_dir() / 'doc/files/profiles.md', + check : true, +) +profiles_md_gen = gen_header.process( + meson.current_build_dir() / 'doc/files/profiles.md', + preserve_path_from : meson.current_build_dir(), +) + +nix_sources = files( + 'add-to-store.cc', + 'app.cc', + 'build.cc', + 'bundle.cc', + 'cat.cc', + 'copy.cc', + 'daemon.cc', + 'derivation-add.cc', + 'derivation-show.cc', + 'derivation.cc', + 'develop.cc', + 'diff-closures.cc', + 'doctor.cc', + 'dump-path.cc', + 'edit.cc', + 'eval.cc', + 'flake.cc', + 'fmt.cc', + 'hash.cc', + 'log.cc', + 'ls.cc', + 'main.cc', + 'make-content-addressed.cc', + 'nar.cc', + 'optimise-store.cc', + 'path-from-hash-part.cc', + 'path-info.cc', + 'ping-store.cc', + 'prefetch.cc', + 'profile.cc', + 'realisation.cc', + 'registry.cc', + 'repl.cc', + 'run.cc', + 'search.cc', + 'show-config.cc', + 'sigs.cc', + 'store-copy-log.cc', + 'store-delete.cc', + 'store-gc.cc', + 'store-repair.cc', + 'store.cc', + 'upgrade-nix.cc', + 'verify.cc', + 'why-depends.cc', +) + +nix = executable( + 'nix', + nix_sources, + generate_manpage_gen, + utils_gen, + get_env_gen, + profiles_md_gen, + nix2_commands_sources, + dependencies : [ + liblixcmd, + liblixutil, + liblixstore, + liblixexpr, + liblixfetchers, + liblixmain, + boehm, + ], + install : true, + # FIXME(Qyriad): is this right? + install_rpath : libdir, +) + +nix_symlinks = [ + 'nix-build', + 'nix-channel', + 'nix-collect-garbage', + 'nix-copy-closure', + 'nix-daemon', + 'nix-env', + 'nix-hash', + 'nix-instantiate', + 'nix-prefetch-url', + 'nix-shell', + 'nix-store', +] + +foreach linkname : nix_symlinks + install_symlink( + linkname, + # TODO(Qyriad): should these continue to be relative symlinks? + pointing_to : 'nix', + install_dir : bindir, + # The 'runtime' tag is what executables default to, which we want to emulate here. + install_tag : 'runtime' + ) +endforeach diff --git a/src/toml11/toml.hpp b/src/toml11/toml.hpp index f34cfccca..f9a7430f2 100644 --- a/src/toml11/toml.hpp +++ b/src/toml11/toml.hpp @@ -22,6 +22,9 @@ * THE SOFTWARE. */ +// TODO(Qyriad): let's get vendored toml11 out of here. +#pragma GCC system_header + #ifndef TOML_FOR_MODERN_CPP #define TOML_FOR_MODERN_CPP |