From 055139ac6aaecc7193972b65d2bcca022969c61d Mon Sep 17 00:00:00 2001 From: p01arst0rm Date: Mon, 21 Oct 2019 17:57:38 +0100 Subject: feat(3p/nix): added meson support (cherry picked from commit 086a81b7a5bbe1fc022efb5935ff68f6ad71ddaf) --- third_party/nix/src/libstore/meson.build | 170 +++++++++++++++++++++++++++ third_party/nix/src/libstore/remote-store.cc | 2 +- 2 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 third_party/nix/src/libstore/meson.build (limited to 'third_party/nix/src/libstore') diff --git a/third_party/nix/src/libstore/meson.build b/third_party/nix/src/libstore/meson.build new file mode 100644 index 000000000000..28ae0fdb2733 --- /dev/null +++ b/third_party/nix/src/libstore/meson.build @@ -0,0 +1,170 @@ +# Nix lib store build file +#============================================================================ + + + + +# src files +#============================================================================ + +src_inc += include_directories('.') + +libstore_src = files( + join_paths(meson.source_root(), 'src/libstore/binary-cache-store.cc'), + join_paths(meson.source_root(), 'src/libstore/build.cc'), + join_paths(meson.source_root(), 'src/libstore/crypto.cc'), + join_paths(meson.source_root(), 'src/libstore/derivations.cc'), + join_paths(meson.source_root(), 'src/libstore/download.cc'), + join_paths(meson.source_root(), 'src/libstore/export-import.cc'), + join_paths(meson.source_root(), 'src/libstore/gc.cc'), + join_paths(meson.source_root(), 'src/libstore/globals.cc'), + join_paths(meson.source_root(), 'src/libstore/http-binary-cache-store.cc'), + join_paths(meson.source_root(), 'src/libstore/legacy-ssh-store.cc'), + join_paths(meson.source_root(), 'src/libstore/local-binary-cache-store.cc'), + join_paths(meson.source_root(), 'src/libstore/local-fs-store.cc'), + join_paths(meson.source_root(), 'src/libstore/local-store.cc'), + join_paths(meson.source_root(), 'src/libstore/machines.cc'), + join_paths(meson.source_root(), 'src/libstore/misc.cc'), + join_paths(meson.source_root(), 'src/libstore/nar-accessor.cc'), + join_paths(meson.source_root(), 'src/libstore/nar-info.cc'), + join_paths(meson.source_root(), 'src/libstore/nar-info-disk-cache.cc'), + join_paths(meson.source_root(), 'src/libstore/optimise-store.cc'), + join_paths(meson.source_root(), 'src/libstore/parsed-derivations.cc'), + join_paths(meson.source_root(), 'src/libstore/pathlocks.cc'), + join_paths(meson.source_root(), 'src/libstore/profiles.cc'), + join_paths(meson.source_root(), 'src/libstore/references.cc'), + join_paths(meson.source_root(), 'src/libstore/remote-fs-accessor.cc'), + join_paths(meson.source_root(), 'src/libstore/remote-store.cc'), + join_paths(meson.source_root(), 'src/libstore/s3-binary-cache-store.cc'), + join_paths(meson.source_root(), 'src/libstore/sqlite.cc'), + join_paths(meson.source_root(), 'src/libstore/ssh.cc'), + join_paths(meson.source_root(), 'src/libstore/ssh-store.cc'), + join_paths(meson.source_root(), 'src/libstore/store-api.cc'), + join_paths(meson.source_root(), 'src/libstore/builtins/buildenv.cc'), + join_paths(meson.source_root(), 'src/libstore/builtins/fetchurl.cc')) + +libstore_headers = files( + join_paths(meson.source_root(), 'src/libstore/binary-cache-store.hh'), + join_paths(meson.source_root(), 'src/libstore/builtins.hh'), + join_paths(meson.source_root(), 'src/libstore/crypto.hh'), + join_paths(meson.source_root(), 'src/libstore/derivations.hh'), + join_paths(meson.source_root(), 'src/libstore/download.hh'), + join_paths(meson.source_root(), 'src/libstore/fs-accessor.hh'), + join_paths(meson.source_root(), 'src/libstore/globals.hh'), + join_paths(meson.source_root(), 'src/libstore/local-store.hh'), + join_paths(meson.source_root(), 'src/libstore/machines.hh'), + join_paths(meson.source_root(), 'src/libstore/nar-accessor.hh'), + join_paths(meson.source_root(), 'src/libstore/nar-info-disk-cache.hh'), + join_paths(meson.source_root(), 'src/libstore/nar-info.hh'), + join_paths(meson.source_root(), 'src/libstore/parsed-derivations.hh'), + join_paths(meson.source_root(), 'src/libstore/pathlocks.hh'), + join_paths(meson.source_root(), 'src/libstore/profiles.hh'), + join_paths(meson.source_root(), 'src/libstore/references.hh'), + join_paths(meson.source_root(), 'src/libstore/remote-fs-accessor.hh'), + join_paths(meson.source_root(), 'src/libstore/remote-store.hh'), + join_paths(meson.source_root(), 'src/libstore/s3-binary-cache-store.hh'), + join_paths(meson.source_root(), 'src/libstore/s3.hh'), + join_paths(meson.source_root(), 'src/libstore/serve-protocol.hh'), + join_paths(meson.source_root(), 'src/libstore/sqlite.hh'), + join_paths(meson.source_root(), 'src/libstore/ssh.hh'), + join_paths(meson.source_root(), 'src/libstore/store-api.hh'), + join_paths(meson.source_root(), 'src/libstore/worker-protocol.hh')) + +libstore_data = files( + join_paths(meson.source_root(), 'src/libstore/sandbox-defaults.sb'), + join_paths(meson.source_root(), 'src/libstore/sandbox-minimal.sb'), + join_paths(meson.source_root(), 'src/libstore/sandbox-network.sb')) + +# dependancies +#============================================================================ + +libstore_dep_list = [ + libbz2_dep, + libcurl_dep, + libdl_dep, + pthread_dep, + sqlite3_dep, + libsodium_dep +] + +if sys_name.contains('linux') + libstore_dep_list += libseccomp_dep +endif + +if sys_name.contains('freebsd') + libstore_dep_list += libdl_dep +endif + + + + +# Link args +#============================================================================ + +libstore_link_list = [ + libutil_lib] + +libstore_link_args = [] + + + + +# compiler args +#============================================================================ + +libstore_cxx_args = [ + '-DNIX_PREFIX="@0@" '.format(prefix), + '-DNIX_STORE_DIR="@0@" '.format(nixstoredir), + '-DNIX_DATA_DIR="@0@" '.format(datadir), + '-DNIX_STATE_DIR="@0@" '.format(join_paths(localstatedir, 'nix')), + '-DNIX_LOG_DIR="@0@" '.format(join_paths(localstatedir, 'log/nix')), + '-DNIX_CONF_DIR="@0@" '.format(join_paths(sysconfdir, 'nix')), + '-DNIX_LIBEXEC_DIR="@0@" '.format(libexecdir), + '-DNIX_BIN_DIR="@0@" '.format(bindir), + '-DNIX_MAN_DIR="@0@" '.format(mandir), + '-DSANDBOX_SHELL="@0@" '.format(get_option('sandbox_shell')), + '-DLSOF="@0@" '.format(lsof)] + + + + +# targets +#============================================================================ + +gen_header = ''' + echo 'R"foo(' >> "$1" + cat @INPUT@ >> "$1" + echo ')foo"' >> "$1" +''' + +libstore_src += custom_target( + 'schema.sql.gen.hh', + output : 'schema.sql.gen.hh', + input : 'schema.sql', + command : [bash, '-c', gen_header, 'sh', '@OUTPUT@']) + + + + +# build +#============================================================================ + +libstore_lib = library( + 'nixstore', + install : true, + install_mode : 'rwxr-xr-x', + install_dir : libdir, + include_directories : src_inc, + link_with : libstore_link_list, + sources : libstore_src, + cpp_args : libstore_cxx_args, + link_args : libstore_link_args, + dependencies : libstore_dep_list) + +install_headers( + libstore_headers, + install_dir : join_paths(includedir, 'nix')) + +install_data( + libstore_data, + install_dir : join_paths(datadir, 'nix/sandbox')) diff --git a/third_party/nix/src/libstore/remote-store.cc b/third_party/nix/src/libstore/remote-store.cc index f34369d8fe0a..e21f3449b0ef 100644 --- a/third_party/nix/src/libstore/remote-store.cc +++ b/third_party/nix/src/libstore/remote-store.cc @@ -229,7 +229,7 @@ struct ConnectionHandle ~ConnectionHandle() { - if (!daemonException && std::uncaught_exception()) { + if (!daemonException && std::uncaught_exceptions()) { handle.markBad(); debug("closing daemon connection because of an exception"); } -- cgit 1.4.1