aboutsummaryrefslogtreecommitdiff
path: root/src/nix/meson.build
diff options
context:
space:
mode:
authorQyriad <qyriad@qyriad.me>2024-03-21 13:41:23 -0600
committerQyriad <qyriad@qyriad.me>2024-03-22 08:36:50 -0600
commitb4d07656ff2c43b1144eb97658b9528dd39418ce (patch)
treed6aeb04613749884ca328f41bdbab16a4585e17f /src/nix/meson.build
parenta7161b6c0f6f9640acc065f0bd18579babacb0cf (diff)
build: optionally build and install with meson
This commit adds several meson.build, which successfully build and install Lix executables, libraries, and headers. Meson does not yet build docs, Perl bindings, or run tests, which will be added in following commits. As such, this commit does not remove the existing build system, or make it the default, and also as such, this commit has several FIXMEs and TODOs as notes for what should be done before the existing autoconf + make buildsystem can be removed and Meson made the default. This commit does not modify any source files. A Meson-enabled build is also added as a Hydra job, and to `nix flake check`. Change-Id: I667c8685b13b7bab91e281053f807a11616ae3d4
Diffstat (limited to 'src/nix/meson.build')
-rw-r--r--src/nix/meson.build119
1 files changed, 119 insertions, 0 deletions
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