From b4d07656ff2c43b1144eb97658b9528dd39418ce Mon Sep 17 00:00:00 2001 From: Qyriad Date: Thu, 21 Mar 2024 13:41:23 -0600 Subject: 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 --- src/libstore/meson.build | 188 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 src/libstore/meson.build (limited to 'src/libstore/meson.build') 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, +) -- cgit v1.2.3