diff --git a/.gitignore b/.gitignore index 1affd733dd2..560a8c4d1e6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ Makefile.config perl/Makefile.config # / +/build /aclocal.m4 /autom4te.cache /precompiled-headers.h.gch @@ -11,19 +12,6 @@ perl/Makefile.config /svn-revision /libtool -# /doc/manual/ -/doc/manual/*.1 -/doc/manual/*.5 -/doc/manual/*.8 -/doc/manual/generated/* -/doc/manual/nix.json -/doc/manual/conf-file.json -/doc/manual/builtins.json -/doc/manual/src/SUMMARY.md -/doc/manual/src/command-ref/new-cli -/doc/manual/src/command-ref/conf-file.md -/doc/manual/src/expressions/builtins.md - # /scripts/ /scripts/nix-profile.sh /scripts/nix-reduce-build diff --git a/dependencies/archive/meson.build b/dependencies/archive/meson.build new file mode 100644 index 00000000000..efdfb26625b --- /dev/null +++ b/dependencies/archive/meson.build @@ -0,0 +1,7 @@ +# LibArchive Dependency File +#============================================================================ + + +# Look for libarchive, a required dependency +#-------------------------------------------------- +libarchive_dep = cpp.find_library('archive') diff --git a/dependencies/aws-sdk-cpp/meson.build b/dependencies/aws-sdk-cpp/meson.build new file mode 100644 index 00000000000..d2e199d859c --- /dev/null +++ b/dependencies/aws-sdk-cpp/meson.build @@ -0,0 +1,59 @@ +# aws s3 dependency file +#============================================================================ + + +# Look for aws-cpp-sdk, an optional dependency +#-------------------------------------------------- +aws_sdk_cpp_dep_list = [ + dependency('aws-cpp-sdk-core', required: get_option('enable_s3')), + dependency('aws-cpp-sdk-s3', required: get_option('enable_s3')), + dependency('aws-cpp-sdk-transfer', required: get_option('enable_s3')) +] + +aws_sdk_cpp_dep = declare_dependency(dependencies : aws_sdk_cpp_dep_list) + +# check if dependencies are found +#-------------------------------------------------- +check_aws_sdk_cpp = true +foreach dep : aws_sdk_cpp_dep_list + if not dep.found() + check_aws_sdk_cpp = false + endif +endforeach + + +# set config variable(s) +#-------------------------------------------------- +config_h.set( + 'ENABLE_S3', + check_aws_sdk_cpp.to_int(), + description : 'Whether to enable S3 support via aws-sdk-cpp.') + +if check_aws_sdk_cpp + check_s3client = cpp.check_header( + 'aws/s3/S3Client.h', + dependencies: aws_sdk_cpp_dep) + + if check_s3client + config_h.set( + 'HAVE_AWS_S3_S3CLIENT_H', 1, + description : 'Whether to enable S3 support via aws-sdk-cpp.') + endif + + aws_version = meson.get_compiler('cpp').get_define( + 'AWS_SDK_VERSION_STRING', + prefix : '#include ' + ).strip('"').split('.') + + config_h.set( + 'AWS_VERSION_MAJOR', aws_version[0], + description : 'Major version of aws-sdk-cpp.') + + config_h.set( + 'AWS_VERSION_MINOR', aws_version[1], + description : 'Minor version of aws-sdk-cpp.') + config_h.set( + 'AWS_VERSION_PATCH', aws_version[2], + description : 'Patch version of aws-sdk-cpp.') + +endif diff --git a/dependencies/bdw-gc/meson.build b/dependencies/bdw-gc/meson.build new file mode 100644 index 00000000000..d6e260b1842 --- /dev/null +++ b/dependencies/bdw-gc/meson.build @@ -0,0 +1,13 @@ +# Boehm-gc Dependency File +#============================================================================ + + +# Look for Boehm garbage collector, an optional dependency +#-------------------------------------------------- +gc_dep = dependency('bdw-gc', required: get_option('enable_gc')) + + +config_h.set( + 'HAVE_BOEHMGC', + gc_dep.found().to_int(), + description : 'Whether to use the Boehm garbage collector.') diff --git a/dependencies/boost/meson.build b/dependencies/boost/meson.build new file mode 100644 index 00000000000..fd091aa22b7 --- /dev/null +++ b/dependencies/boost/meson.build @@ -0,0 +1,22 @@ +# Boost Dependency File +#============================================================================ + + +# Look for boost, a required dependency +#---------------------------------------------------- +boost_mod_list = [ + 'system', + 'context', + 'thread'] + + +boost_dep = dependency( + 'boost', + modules: boost_mod_list) + + +# set config variable(s) +#-------------------------------------------------- +config_h.set( + 'HAVE_BOOST', 1, + description : 'Define if the Boost library is available.') diff --git a/dependencies/brotli/meson.build b/dependencies/brotli/meson.build new file mode 100644 index 00000000000..4dcf4af2f5a --- /dev/null +++ b/dependencies/brotli/meson.build @@ -0,0 +1,17 @@ +# LibBrotli Dependency File +#============================================================================ + + +# Look for libbrotli{enc,dec}, a required dependency +#-------------------------------------------------- +libbrotli_dep = declare_dependency( + dependencies: [ + dependency('libbrotlienc'), + dependency('libbrotlidec')]) + + +# set config variable(s) +#-------------------------------------------------- +config_h.set( + 'HAVE_BROTLI', 1, + description : 'Define if the brotli library is available.') diff --git a/dependencies/bz2/meson.build b/dependencies/bz2/meson.build new file mode 100644 index 00000000000..ed6961d4768 --- /dev/null +++ b/dependencies/bz2/meson.build @@ -0,0 +1,14 @@ +# bz2 Dependency File +#============================================================================ + + +# Look for libbz2, a required dependency +#-------------------------------------------------- +libbz2_dep = cpp.find_library('bz2') + + +# set config variable(s) +#-------------------------------------------------- +config_h.set( + 'HAVE_BZ2', 1, + description : 'Define if the libbz2 is available.') diff --git a/dependencies/cpuid/meson.build b/dependencies/cpuid/meson.build new file mode 100644 index 00000000000..40fac58267c --- /dev/null +++ b/dependencies/cpuid/meson.build @@ -0,0 +1,13 @@ +# cpuid dependency file +#============================================================================ + + +# Look for cpuid, a required dependency +#-------------------------------------------------- +libcpuid_dep = dependency('libcpuid') + +# set config variable(s) +#-------------------------------------------------- +config_h.set( + 'HAVE_LIBCPUID', 1, + description : 'Define if the CPUID is available.') diff --git a/dependencies/curl/meson.build b/dependencies/curl/meson.build new file mode 100644 index 00000000000..0759219d2e2 --- /dev/null +++ b/dependencies/curl/meson.build @@ -0,0 +1,14 @@ +# LibCurl Dependency File +#============================================================================ + + +# Look for libcurl, a required dependency +#-------------------------------------------------- +libcurl_dep = dependency('libcurl') + + +# set config variable(s) +#-------------------------------------------------- +config_h.set( + 'HAVE_CURL', 1, + description : 'Define if the curl library is available.') diff --git a/dependencies/dl/meson.build b/dependencies/dl/meson.build new file mode 100644 index 00000000000..9e0954bb61d --- /dev/null +++ b/dependencies/dl/meson.build @@ -0,0 +1,7 @@ +# libdl Dependency File +#============================================================================ + + +# Look for libdl, a required dependency +#-------------------------------------------------- +libdl_dep = cpp.find_library('dl') diff --git a/dependencies/editline/meson.build b/dependencies/editline/meson.build new file mode 100644 index 00000000000..1c745969750 --- /dev/null +++ b/dependencies/editline/meson.build @@ -0,0 +1,35 @@ +# Editline Dependency File +#============================================================================ + + +# Look for editline, a required dependency +#-------------------------------------------------- +# NOTE: The the libeditline.pc file was added only in libeditline >= 1.15.2, see +# https://github.com/troglobit/editline/commit/0a8f2ef4203c3a4a4726b9dd1336869cd0da8607, +# but e.g. Ubuntu 16.04 has an older version, so we fall back to searching for +# editline.h when the pkg-config approach fails. + +editline_dep = cpp.find_library('editline') + +if not ( + cpp.has_header( + 'editline.h', + dependencies : editline_dep)) + error('Nix requires editline.h; however the header was not found.') +endif + + +if not ( + cpp.has_function( + 'read_history', + prefix : '#include \n#include "editline.h"', + dependencies : editline_dep)) + error('Nix requires libeditline; However, required functions do not work.' +\ + 'Maybe libeditline version is too old? >= 1.14 is required.') +endif + +# set config variable(s) +#-------------------------------------------------- +config_h.set( + 'HAVE_EDITLINE_H', 1, + description : 'Define to 1 if you have the header file.') diff --git a/dependencies/functions/meson.build b/dependencies/functions/meson.build new file mode 100644 index 00000000000..32371203896 --- /dev/null +++ b/dependencies/functions/meson.build @@ -0,0 +1,40 @@ +# nix check functions +#============================================================================ + + +# check for required functions +#-------------------------------------------------- +required_functions = [ + 'lutimes', + 'lchown', + 'pipe2', + 'posix_fallocate', + 'setresuid', + 'setreuid', + 'statvfs', + 'strsignal', + 'sysconf'] + +foreach f : required_functions + if cpp.has_function(f) + config_h.set( + 'HAVE_@0@'.format(f.to_upper()), 1, + description : 'Define to 1 if you have the `@0@` function.'.format(f)) + endif +endforeach + + +# compiler check for pubsetbuff +#-------------------------------------------------- +pubsetbuff_c = ''' +#include +using namespace std; +static char buf[1024]; +void func() { +cerr.rdbuf()->pubsetbuf(buf, sizeof(buf)); +}''' + +check_pubsetbuff = meson.get_compiler('cpp').compiles(pubsetbuff_c, name : 'pubsetbuf') +config_h.set( + 'HAVE_PUBSETBUF', check_pubsetbuff.to_int(), + description : 'Define to 1 if you have the `pubsetbuf` function.') diff --git a/dependencies/gtest/meson.build b/dependencies/gtest/meson.build new file mode 100644 index 00000000000..29a41ac1549 --- /dev/null +++ b/dependencies/gtest/meson.build @@ -0,0 +1,17 @@ +# gtest Dependency File +#======================================================================== + + +# check if gtest is already installed +#--------------------------------------------------- +gtest_dep = dependency( + 'gtest', + required : false) + + +# If not, include the submodule +#--------------------------------------------------- +if not gtest_dep.found() + gtest_proj = cmake.subproject('gtest') + gtest_dep = gtest_proj.dependency('gtest') +endif diff --git a/dependencies/headers/meson.build b/dependencies/headers/meson.build new file mode 100644 index 00000000000..12111211bc6 --- /dev/null +++ b/dependencies/headers/meson.build @@ -0,0 +1,46 @@ +# nix check headers +#============================================================================ + +# check for various headers +#-------------------------------------------------- +project_header_deps = [ + 'sys/stat.h', + 'sys/types.h', + 'sys/dir.h', + 'sys/ndir.h', + 'dirent.h', + 'locale.h', + 'unistd.h', + 'stdint.h', + 'stdlib.h', + 'strings.h', + 'string.h', + 'bzlib.h', + 'inttypes.h', + 'memory.h'] + +foreach f : project_header_deps + if cpp.has_header(f) + config_h.set( + 'HAVE_@0@'.format(f.to_upper().underscorify()), 1, + description : 'Define to 1 if you have the `<@0@>` header file..'.format(f)) + endif +endforeach + + +# TODO: this was carried over from the autotools buildsystem, +# but i think it may no longer be needed. + +# compiler check for dirent.h +#-------------------------------------------------- +dirent_h_prefix = ''' + #include + #include +''' + +check_struct_dirent = meson.get_compiler('cpp').has_member( + 'struct dirent', 'd_type', prefix: dirent_h_prefix) + +if ((config_h.get('HAVE_DIRENT_H') == 1) and (check_struct_dirent)) + config_h.set('HAVE_STRUCT_DIRENT_D_TYPE', 1) +endif diff --git a/dependencies/lowdown/meson.build b/dependencies/lowdown/meson.build new file mode 100644 index 00000000000..ec964de85f6 --- /dev/null +++ b/dependencies/lowdown/meson.build @@ -0,0 +1,11 @@ +# lowdown Dependency File +#============================================================================ + + +# FIXME !! lowdown is seemingly a required dependency for building, but +# it isn't listed anywhere on documentation that i could find. dependency +# object needs to be added to meson. + +# Look for lowdown, a required dependency +#-------------------------------------------------- +liblowdown_dep = cpp.find_library('lowdown') diff --git a/dependencies/lzma/meson.build b/dependencies/lzma/meson.build new file mode 100644 index 00000000000..43a6e9df80f --- /dev/null +++ b/dependencies/lzma/meson.build @@ -0,0 +1,24 @@ +# LibLzma Dependency File +#============================================================================ + + +# Look for liblzma, a required dependency +#-------------------------------------------------- +liblzma_dep = dependency('liblzma') + + +check_lzma_mt = cpp.has_function( + 'lzma_stream_encoder_mt', + dependencies : liblzma_dep) + + +# set config variable(s) +#-------------------------------------------------- +config_h.set( + 'HAVE_LZMA', 1, + description : 'Define if the lzma library is available.') + +config_h.set( + 'HAVE_LZMA_MT', + check_lzma_mt.to_int(), + description : 'Define if lzma_stream_encoder_mt is available.') diff --git a/dependencies/meson.build b/dependencies/meson.build new file mode 100644 index 00000000000..410ca7c33b7 --- /dev/null +++ b/dependencies/meson.build @@ -0,0 +1,47 @@ +# nix dependencies build file +#============================================================================ + + +# declare dependency types +#--------------------------------------------------- +required_dep_dirs = [ + 'archive', + 'boost', + 'brotli', + 'bz2', + 'cpuid', + 'curl', + 'dl', + 'editline', + 'lzma', + 'lowdown', + 'openssl', + 'seccomp', + 'sqlite', + 'pthread', + 'zlib'] + +optional_dep_dirs = [ + 'aws-sdk-cpp', + 'bdw-gc', + 'gtest', + 'sodium'] + +check_dirs = [ + 'functions', + 'headers'] + + +# Build dependencies +#--------------------------------------------------- +foreach dir : required_dep_dirs + subdir(dir) +endforeach + +foreach dir : optional_dep_dirs + subdir(dir) +endforeach + +foreach dir : check_dirs + subdir(dir) +endforeach diff --git a/dependencies/openssl/meson.build b/dependencies/openssl/meson.build new file mode 100644 index 00000000000..128f0cb422c --- /dev/null +++ b/dependencies/openssl/meson.build @@ -0,0 +1,14 @@ +# OpenSSL Dependency File +#============================================================================ + + +# Look for OpenSSL, a required dependency +#-------------------------------------------------- +openssl_dep = dependency('openssl') + + +# set config variable(s) +#-------------------------------------------------- +config_h.set( + 'HAVE_OPENSSL', 1, + description : 'Define if the OpenSSL library is available.') diff --git a/dependencies/pthread/meson.build b/dependencies/pthread/meson.build new file mode 100644 index 00000000000..7b4f7b6c849 --- /dev/null +++ b/dependencies/pthread/meson.build @@ -0,0 +1,7 @@ +# pthread Dependency File +#============================================================================ + + +# Look for pthread, a required dependency +#-------------------------------------------------- +pthread_dep = dependency('threads') diff --git a/dependencies/seccomp/meson.build b/dependencies/seccomp/meson.build new file mode 100644 index 00000000000..e5dfcd4944f --- /dev/null +++ b/dependencies/seccomp/meson.build @@ -0,0 +1,22 @@ +# OS Specific checks +#============================================================================ + + +# Look for libsecppomp, required for Linux sandboxing +#---------------------------------------------------- +if sys_name == 'linux' + libseccomp_dep = dependency( + 'libseccomp', + version : '>= 2.3.1', + not_found_message : 'Nix requires libseccomp on a linux host system') +else + libseccomp_dep = dependency('', required: false) +endif + + +# set config variable(s) +#-------------------------------------------------- +config_h.set( + 'HAVE_SECCOMP', + libseccomp_dep.found().to_int(), + description : 'Define if the libseccomp is available.') diff --git a/dependencies/sodium/meson.build b/dependencies/sodium/meson.build new file mode 100644 index 00000000000..ee35b1a968b --- /dev/null +++ b/dependencies/sodium/meson.build @@ -0,0 +1,20 @@ +# LibSodium Dependency File +#============================================================================ + +# FIXME !! sodium is seemingly a required dependency for building, but +# it isn't listed anywhere on documentation that i could find. dependency +# object needs to be added to meson. +# +# 0df69d96e02ce4c9e17bd33333c5d78313341dd3 made it required but docs were not +# updated. + +# look for libsodium, a required dependency +#-------------------------------------------------- +libsodium_dep = cpp.find_library('sodium') + + +# set config variable(s) +#-------------------------------------------------- +config_h.set( + 'HAVE_SODIUM', 1, + description : 'Whether to use libsodium for cryptography.') diff --git a/dependencies/sqlite/meson.build b/dependencies/sqlite/meson.build new file mode 100644 index 00000000000..584f16c5a3b --- /dev/null +++ b/dependencies/sqlite/meson.build @@ -0,0 +1,16 @@ +# SQLite Dependency File +#============================================================================ + + +# Look for sqlite3, a required dependency +#-------------------------------------------------- +sqlite3_dep = declare_dependency( + dependencies: cpp.find_library('sqlite3'), + version : '>= 3.6.19') + + +# set config variable(s) +#-------------------------------------------------- +config_h.set( + 'HAVE_SQLITE', 1, + description : 'Define if the SQLite3 is available.') diff --git a/dependencies/zlib/meson.build b/dependencies/zlib/meson.build new file mode 100644 index 00000000000..a25b4ee1af7 --- /dev/null +++ b/dependencies/zlib/meson.build @@ -0,0 +1,10 @@ +# ZLib Dependency File +#============================================================================ + +# Look for zlib, a required dependency +#---------------------------------------------------- +zlib_dep = dependency('zlib') + +config_h.set( + 'HAVE_ZLIB', 1, + description : 'Define if the Zlib library is available.') diff --git a/doc/manual/meson.build b/doc/manual/meson.build new file mode 100644 index 00000000000..7801a222cbb --- /dev/null +++ b/doc/manual/meson.build @@ -0,0 +1,46 @@ +doc_manual_dir = meson.current_source_dir() + +if get_option('doc_generate') + + # Provide a dummy environment for nix, so that it will not access files outside the macOS sandbox. + dummy_env = [ + 'HOME=/dummy', + 'NIX_CONF_DIR=/dummy', + 'NIX_SSL_CERT_FILE=/dummy/no-ca-bundle.crt', + 'NIX_STATE_DIR=/dummy', + ] + + foreach dir : ['src'] + subdir(dir) + endforeach + + # generate the web version of the manual + #============================================================================ + + custom_target( + 'index.html', + input: src_markdown_files + [ + summary_dot_md, + new_cli, + conf_file_dot_md, + builtins_dot_md, + ] + files( + 'book.toml', + 'custom.css', + join_paths('theme', 'highlight.js'), + ), + output: 'manual', + command: [ + 'mdbook', + 'build', + meson.current_build_dir(), + '-d', + 'manual', + ], + env: ['RUST_LOG=warn'], + install: true, + install_dir: docdir, + build_by_default: true, + ) + +endif diff --git a/doc/manual/src/command-ref/meson.build b/doc/manual/src/command-ref/meson.build new file mode 100644 index 00000000000..4ea499a5e30 --- /dev/null +++ b/doc/manual/src/command-ref/meson.build @@ -0,0 +1,160 @@ +doc_manual_src_command_ref_src = meson.current_source_dir() + +# generate `doc/manual/src/command-ref/new-cli` +#============================================================================ + +nix_dot_json = custom_target( + 'nix.json', + output: 'nix.json', + command: [ + nix_bin, + '__dump-args', + ], + capture: true, + env: dummy_env, + install: true, + install_dir: mandir, + build_by_default: true, +) + +new_cli = custom_target( + 'new-cli', + input: [ + nix_bin, + nix_dot_json, + join_paths(doc_manual_dir, 'generate-manpage.nix'), + ], + output: 'new-cli', + command: [ + find_program( + 'write-new-cli.sh', + dirs: [join_paths(scripts_dir, 'manual')], + ), + '@INPUT@', + '@OUTPUT@', + ], + env: dummy_env, + install: true, + install_dir: mandir, + build_by_default: true, +) + +# generate `doc/manual/src/command-ref/conf-file.md` +#============================================================================ + +conf_file_dot_json = custom_target( + 'conf-file.json', + output: 'conf-file.json', + command: [ + nix_bin, + 'show-config', + '--json', + '--experimental-features', + 'nix-command', + ], + capture: true, + env: dummy_env, + install: true, + install_dir: mandir, + build_by_default: true, +) + +conf_file_dot_md = custom_target( + 'conf-file.md', + input: [ + nix_bin, + conf_file_dot_json, + join_paths(doc_manual_dir, 'generate-options.nix') + ] + files( + 'conf-file-prefix.md' + ), + output: 'conf-file.md', + command: [ + find_program( + 'write-conf-file.sh', + dirs: [join_paths(scripts_dir, 'manual')], + ), + '@INPUT@', + ], + capture: true, + install: true, + install_dir: mandir, + build_by_default: true, +) + +# man pages +#============================================================================ + +prepend_title = generator( + find_program( + 'prepend-title-to-manpage.sh', + dirs: [join_paths(scripts_dir, 'manual')], + ), + arguments: ['@BASENAME@', '@EXTRA_ARGS@', '@INPUT@'], + capture: true, + output: '@BASENAME@.tmp', +) + +man_pages = { + '1': [ + 'nix-env', + 'nix-build', + 'nix-shell', + 'nix-store', + 'nix-instantiate', + 'nix-collect-garbage', + 'nix-prefetch-url', + 'nix-channel', + 'nix-hash', + 'nix-copy-closure', + ], + '8': [ + 'nix-daemon', + ] +} + +foreach section, pages : man_pages + foreach page : pages + man_dst = '@0@.@1@'.format(page, section) + man_src = files('@0@.md'.format(page)) + + custom_target( + man_dst, + input: prepend_title.process(man_src, extra_args: [section]), + output: man_dst, + command: [ + 'lowdown', + '-sT', + 'man', + '-M section=@0@'.format(section), + '@INPUT@', + '-o', + '@OUTPUT@' + ], + install: true, + install_dir: mandir, + build_by_default: true, + ) + endforeach +endforeach + +custom_target( + 'nix.conf.5', + input: prepend_title.process( + conf_file_dot_md, + extra_args: ['5'] + ), + output: 'nix.conf.5', + command: [ + 'lowdown', + '-sT', + 'man', + '-M section=5', + '@INPUT@', + '-o', + '@OUTPUT@', + ], + install: true, + install_dir: mandir, + build_by_default: true, +) diff --git a/doc/manual/src/expressions/meson.build b/doc/manual/src/expressions/meson.build new file mode 100644 index 00000000000..8eaf159a5c9 --- /dev/null +++ b/doc/manual/src/expressions/meson.build @@ -0,0 +1,42 @@ +doc_manual_src_expressions_dir = meson.current_source_dir() + +# Generate `doc/manual/src/expressions/builtins.md` +#============================================================================ + +builtins_dot_json = custom_target( + 'builtins.json', + output: 'builtins.json', + command: [ + nix_bin, + '__dump-builtins', + ], + capture: true, + env: dummy_env + ['NIX_PATH=nix/corepkgs=corepkgs'], + install: true, + install_dir: mandir, + build_by_default: true, +) + +builtins_dot_md = custom_target( + 'builtins.md', + input: [ + nix_bin, + builtins_dot_json, + join_paths(doc_manual_dir, 'generate-builtins.nix') + ] + files( + 'builtins-prefix.md', + 'builtins-suffix.md', + ), + output: 'builtins.md', + command: [ + find_program( + 'write-builtins.sh', + dirs: [join_paths(scripts_dir, 'manual')], + ), + '@INPUT@', + ], + capture: true, + install: true, + install_dir: mandir, + build_by_default: true, +) diff --git a/doc/manual/src/meson.build b/doc/manual/src/meson.build new file mode 100644 index 00000000000..ad7872db036 --- /dev/null +++ b/doc/manual/src/meson.build @@ -0,0 +1,29 @@ +doc_manual_src_dir = meson.current_source_dir() + +foreach dir : ['command-ref', 'expressions'] + subdir(dir) +endforeach + +# generate `doc/manual/src/SUMMARY.md` +#============================================================================ + +summary_dot_md = custom_target( + 'SUMMARY.md', + input: [ + join_paths(doc_manual_dir, 'src', 'SUMMARY.md.in'), + new_cli, + ], + output: 'SUMMARY.md', + command: [ + find_program( + 'write-summary.sh', + dirs: [join_paths(scripts_dir, 'manual')], + ), + '@INPUT@', + ], + capture: true, + install: true, + install_dir: mandir, + build_by_default: true, +) + diff --git a/doc/meson.build b/doc/meson.build new file mode 100644 index 00000000000..e69de29bb2d diff --git a/flake.nix b/flake.nix index ee76d918837..f1b0511bda2 100644 --- a/flake.nix +++ b/flake.nix @@ -72,6 +72,8 @@ buildPackages.flex (lib.getBin buildPackages.lowdown) buildPackages.mdbook + buildPackages.meson + buildPackages.ninja buildPackages.autoconf-archive buildPackages.autoreconfHook buildPackages.pkgconfig @@ -616,6 +618,11 @@ PATH=$prefix/bin:$PATH unset PYTHONPATH export MANPATH=$out/share/man:$MANPATH + + # Needed for `meson` to pick up Boost. + # https://github.com/NixOS/nixpkgs/issues/86131#issuecomment-620155616 + export BOOST_INCLUDEDIR="${lib.getDev boost}/include"; + export BOOST_LIBRARYDIR="${lib.getLib boost}/lib"; ''; }); diff --git a/include/config_h/meson.build b/include/config_h/meson.build new file mode 100644 index 00000000000..d50b5a5b889 --- /dev/null +++ b/include/config_h/meson.build @@ -0,0 +1,27 @@ +# include.config_h build file +#======================================================================== + +# generate headers +#======================================================================== + +# build config.h +#--------------------------------------------------- +config_h = configure_file( + #input : 'config.h.in', + output : 'config.h', + configuration : config_h) + +add_project_arguments('-include', 'config.h', language : 'cpp') + + +# install headers +#--------------------------------------------------- +install_headers( + config_h, + install_dir : join_paths(includedir, 'nix')) + + +# include directories +#======================================================================== + +proj_inc += include_directories('.') \ No newline at end of file diff --git a/include/macros/meson.build b/include/macros/meson.build new file mode 100644 index 00000000000..fc98a71a8e1 --- /dev/null +++ b/include/macros/meson.build @@ -0,0 +1,11 @@ +# include.macros file +#======================================================================== + + +# macro used to generate R headers +#--------------------------------------------------- +gen_rheader = ''' + echo 'R"foo(' >> "$1" + cat @INPUT@ >> "$1" + echo ')foo"' >> "$1" +''' diff --git a/include/meson.build b/include/meson.build new file mode 100644 index 00000000000..b15ec3ac164 --- /dev/null +++ b/include/meson.build @@ -0,0 +1,18 @@ +# include build file +#======================================================================== + +include_dir = meson.current_source_dir() +proj_inc += include_directories('.') + +# include directories +#======================================================================== + + +include_dirs = [ + 'config_h', + 'macros'] + + +foreach dir : include_dirs + subdir(dir) +endforeach diff --git a/meson.build b/meson.build new file mode 100644 index 00000000000..ca0783ac71f --- /dev/null +++ b/meson.build @@ -0,0 +1,237 @@ +# Nix project build file +#============================================================================ + + +# init +#============================================================================ + + +# init project +#------------------------------------------------- +project( + 'nix', + 'cpp', + meson_version : '>= 0.57.0', + default_options : [ + 'cpp_std=c++17', + 'warning_level=3', + 'optimization=3', + 'debug=true' + ], + version : files('.version'), + license : 'MIT') + + +# init compiler +#------------------------------------------------- +cpp = meson.get_compiler('cpp') + +add_project_arguments(get_option('cxxflags'), language : 'cpp') +add_project_link_arguments(get_option('ldflags'), language: 'cpp') + +if(get_option('optimization') == '0') + add_project_arguments('-U_FORTIFY_SOURCE',language:['cpp','c']) + message('Disabling FORTIFY_SOURCE as optimization is set to 0') +endif + +cmake = import('cmake') +pkg = import('pkgconfig') + + +# init configuration +#------------------------------------------------- +config_h = configuration_data() + +config_h.set( + 'HAVE_CXX17', 1, + description : 'Define if the compiler supports basic C++17 syntax') + +package_name = meson.project_name() +config_h.set_quoted( + 'PACKAGE_NAME', package_name, + description : 'Define to the full name of this package.' + ) + +package_tarname = meson.project_name() +config_h.set_quoted( + 'PACKAGE_TARNAME', package_tarname, + description : 'Define to the one symbol short name of this package.') + +package_version = meson.project_version() +config_h.set_quoted( + 'PACKAGE_VERSION', package_version, + description : 'Define to the version of this package.') + +package_string = '@0@ @1@'.format(package_name, package_version) +config_h.set_quoted( + 'PACKAGE_STRING', package_string, + description : 'Define to the full name and version of this package.') + +package_url = 'https://nixos.org/nix/' +config_h.set_quoted( + 'PACKAGE_URL', package_url, + description : 'Define to the home page for this package.') + +package_bug_url = 'https://github.com/nixos/nix/issues' +config_h.set_quoted( + 'PACKAGE_BUGREPORT', package_bug_url, + description : 'Define to the address where bug reports for this package should be sent.') + + +# env +#============================================================================ + + +# set install directories +#------------------------------------------------- +prefix = get_option('prefix') +libdir = join_paths(prefix, get_option('libdir')) +bindir = join_paths(prefix, get_option('bindir')) +datadir = join_paths(prefix, get_option('datadir')) +sysconfdir = join_paths(prefix, get_option('sysconfdir')) +libexecdir = join_paths(prefix, get_option('libexecdir')) +mandir = join_paths(prefix, get_option('mandir')) +docdir = join_paths(prefix, get_option('docdir')) +includedir = join_paths(prefix, get_option('includedir')) +proj_inc = [] + +# set nix directories +#------------------------------------------------- + +# State should be stored in /nix/var, unless the user overrides it explicitly. +if get_option('normal_var') + localstatedir = '/nix/var' +else + localstatedir = join_paths(prefix, get_option('localstatedir')) +endif + +nixstoredir = get_option('nixstoredir') + +profiledir = join_paths(sysconfdir, 'profile.d') + + +# Construct a Nix system name (like "i686-linux"). +#------------------------------------------------- +machine_name = host_machine.cpu() +sys_name = host_machine.system().to_lower() + +cpu_archs = ['x86_64', 'armv6', 'armv7', ''] + +foreach cpu : cpu_archs + if host_machine.cpu().contains(cpu) + if cpu.contains('armv') + machine_name = cpu + '1' + else + machine_name = cpu + endif + break + endif +endforeach + +system= '"' + machine_name + '-' + sys_name + '"' +message('system name: ' + system) +config_h.set( + 'SYSTEM', system, + description : 'platform identifier (`cpu-os`)') + + +# required dependencies +#============================================================================ + + +# look for required programs +#-------------------------------------------------- +cat = find_program('cat', required : true) +ln = find_program('ln', required : true) +cp = find_program('cp', required : true) +rm = find_program('rm', required : true) +bash = find_program('bash', required : true) +echo = find_program('echo', required : true) +patch = find_program('patch', required : true) +flex = find_program('flex', required : true) +bison = find_program('bison', required : true) +sed = find_program('sed', required : true) +tar = find_program('tar', required : true) +bzip2 = find_program('bzip2', required : true) +gzip = find_program('gzip', required : true) +xz = find_program('xz', required : true) +dot = find_program('dot', required : false) +lsof = find_program('lsof', required : false) +tr = find_program('tr', required : true) +tr = find_program('jq', required : true) +coreutils = run_command('dirname', cat.full_path()).stdout().strip() + + +# Check whether the store optimiser can optimise symlinks. +#------------------------------------------------- +gen_header = ''' +ln -s bla tmp_link +if ln tmp_link tmp_link2 2> /dev/null; then + echo 1 +else + echo 0 +fi +''' + +run_command('sh', '-c', 'rm tmp_link*') +can_link_symlink = run_command('sh', '-c', gen_header).stdout().strip() +if can_link_symlink.to_int() == 1 + run_command('sh', '-c', 'rm tmp_link*') +endif + +config_h.set( + 'CAN_LINK_SYMLINK', can_link_symlink, + description : 'Whether link() works on symlinks') + + +# OS Specific checks +#============================================================================ + + +# freebsd requires _GNU_SOURCE flag +#--------------------------------------------------- +if sys_name == 'freebsd' + add_project_arguments('-D_GNU_SOURCE', language : 'cpp') + config_h.set('_GNU_SOURCE', 1) +endif + + +# Builing for Darwin requires XMLlint +#--------------------------------------------------- +if sys_name == 'Darwin' + xmllint = find_program('xmllint', required : true) +endif + + +# Solaris requires -lsocket -lnsl for network functions +#--------------------------------------------------- +if sys_name == 'sunos' + add_project_arguments('-lsocket', language : 'cpp') + add_project_arguments('-lnsl', language : 'cpp') +endif + + + + +# build +#============================================================================ + + +proj_inc += include_directories('.') + +# build nix +#--------------------------------------------------- +project_dirs = [ + 'dependencies', + 'include', + 'src', + 'scripts', + 'doc/manual', + #'misc', + #'tests', +] + + +foreach dir : project_dirs + subdir(dir) +endforeach diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 00000000000..da991db9e83 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,86 @@ +# Nix project build options +#============================================================================ + +# dirs +#============================================================================ + +option( + 'nixstoredir', + type : 'string', + value : '/nix/store', + description : 'path of the Nix store (defaults to /nix/store)') + + +# compiler args +#============================================================================ + +option( + 'ldflags', + type : 'array', + value : [ + '-L/usr/local/lib', + '-L/usr/lib', + '-L/lib'], + description : 'Link flags') + + +option( + 'cxxflags', + type : 'array', + value : [ + '-Wno-pedantic', + '-Wno-non-virtual-dtor', + '-Wno-unused-parameter', + '-Wno-variadic-macros', + '-Wdeprecated-declarations', + '-Wno-missing-field-initializers', + ], + description : 'C build flags') + + +# optional dependencies +#============================================================================ + +option( + 'enable_gc', + type : 'feature', + value : 'auto', + description : 'Build nix with Boehm garbage collector') + +option( + 'enable_s3', + type : 'feature', + value : 'auto', + description : 'Build nix with s3') + +option( + 'with_coreutils_bin', + type : 'string', + description : 'path of cat, mkdir, etc.') + + +# misc +#============================================================================ +option( + 'disable_doc_gen', + type : 'boolean', + value : 'false', + description : 'disable documentation generation') + +option( + 'build_shared_libs', + type : 'boolean', + value : 'false', + description : 'Build nix with shared libs') + +option( + 'sandbox_shell', + type : 'string', + value : '/usr/bin/busybox', + description : 'path of a statically-linked shell to use as /bin/sh in sandboxes') + +option( + 'normal_var', + type : 'boolean', + value : 'true', + description : 'Whether to use `/nix/var` or the user-overridable `localstatedir`.') diff --git a/misc/meson.build b/misc/meson.build new file mode 100644 index 00000000000..e69de29bb2d diff --git a/scripts/manual/prepend-title-to-manpage.sh b/scripts/manual/prepend-title-to-manpage.sh new file mode 100644 index 00000000000..78c19e402bb --- /dev/null +++ b/scripts/manual/prepend-title-to-manpage.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env sh +# This script is meant to be used by `doc/manual/meson.build` to help build the documentation. + +printf "Title: %s\n\n" "${1}.${2}" +cat $3 diff --git a/scripts/manual/write-builtins.sh b/scripts/manual/write-builtins.sh new file mode 100644 index 00000000000..140269593d5 --- /dev/null +++ b/scripts/manual/write-builtins.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env sh +# This script is meant to be used by `doc/manual/meson.build` to help build the documentation. + +nixBinary="$1" +builtinsJsonFile="$2" +generateBuiltinsNix="$3" +prefixFile="$4" +suffixFile="$5" + +cat $prefixFile + +$nixBinary eval \ + --experimental-features nix-command \ + -I nix/corepkgs=corepkgs \ + --store dummy:// \ + --impure \ + --raw \ + --expr "import $generateBuiltinsNix (builtins.fromJSON (builtins.readFile $builtinsJsonFile))" + +cat $suffixFile diff --git a/scripts/manual/write-conf-file.sh b/scripts/manual/write-conf-file.sh new file mode 100644 index 00000000000..7e8133c3077 --- /dev/null +++ b/scripts/manual/write-conf-file.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env sh +# This script is meant to be used by `doc/manual/meson.build` to help build the documentation. + +nixBinary="$1" +confJsonFile="$2" +generateOptionsNix="$3" +prefixFile="$4" + + +cat $prefixFile + +$nixBinary eval \ + --experimental-features nix-command \ + -I nix/corepkgs=corepkgs \ + --store dummy:// \ + --impure \ + --raw \ + --expr "import $generateOptionsNix (builtins.fromJSON (builtins.readFile $confJsonFile))" diff --git a/scripts/manual/write-new-cli.sh b/scripts/manual/write-new-cli.sh new file mode 100644 index 00000000000..2d9952815c0 --- /dev/null +++ b/scripts/manual/write-new-cli.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env sh +# This script is meant to be used by `doc/manual/meson.build` to help build the documentation. + +nixBinary="$1" +newCliFile="$2" +generateManPageNix="$3" +output="$4" + +# `--write-to` requires the file to *NOT* be present. +rm -Rf $output + +$nixBinary eval \ + --experimental-features nix-command \ + -I nix/corepkgs=corepkgs \ + --store dummy:// \ + --impure \ + --raw \ + --write-to $output \ + --expr "import $generateManPageNix (builtins.fromJSON (builtins.readFile $newCliFile))" diff --git a/scripts/manual/write-summary.sh b/scripts/manual/write-summary.sh new file mode 100644 index 00000000000..156efef2971 --- /dev/null +++ b/scripts/manual/write-summary.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env sh +# This script is meant to be used by `doc/manual/meson.build` to help build the documentation. + +input="$1" +newCliSummaryFile="$2/SUMMARY.md" + + +cat $input | while IFS= read line; do + if [[ $line = @manpages@ ]]; then + cat $newCliSummaryFile + else + echo "$line"; + fi; +done diff --git a/scripts/meson.build b/scripts/meson.build new file mode 100644 index 00000000000..848cbcf9167 --- /dev/null +++ b/scripts/meson.build @@ -0,0 +1,74 @@ +# Nix corepkgs build file +#============================================================================ + +scripts_dir = meson.current_source_dir() +scripts_inc = [include_directories('.')] + + +# src files +#============================================================================ + +scripts_data = files( + 'install-darwin-multi-user.sh', + 'install-multi-user.sh') + + +# targets +#============================================================================ + +nix_profile_sh = configuration_data() +nix_profile_sh.set('localstatedir', localstatedir) +nix_profile_sh.set('coreutils', coreutils) + +nix_http_export_cgi = configuration_data() +nix_http_export_cgi.set('bindir', bindir) +nix_http_export_cgi.set('localstatedir', localstatedir) +nix_http_export_cgi.set('coreutils', coreutils) +nix_http_export_cgi.set('gzip', gzip.full_path()) + +nix_reduce_build = configuration_data() +nix_reduce_build.set('bash', bash.full_path()) +nix_reduce_build.set('bindir', bindir) +nix_reduce_build.set('localstatedir', localstatedir) + + +# TODO: make these work +nix_install = configuration_data() +nix_install.set('nixVersion', package_version) +nix_install.set('binaryTarball_x86_64-linux', '') +nix_install.set('binaryTarball_i686-linux', '') +nix_install.set('binaryTarball_aarch64-linux', '') +nix_install.set('binaryTarball_x86_64-darwin', '') + + +# build +#============================================================================ + +# configure scripts +#--------------------------------------------------- +scripts_data += configure_file( + input : 'nix-profile.sh.in', + output : 'nix.sh', + configuration : nix_profile_sh) + +scripts_data += configure_file( + input : 'nix-profile-daemon.sh.in', + output : 'nix-daemon.sh', + configuration : nix_profile_sh) + +scripts_data += configure_file( + input : 'nix-http-export.cgi.in', + output : 'nix-http-export.cgi', + configuration : nix_http_export_cgi) + +scripts_data += configure_file( + input : 'nix-reduce-build.in', + output : 'nix-reduce-build', + configuration : nix_reduce_build) + +# install scripts +#--------------------------------------------------- +install_data( + scripts_data, + install_mode : 'rwxr-xr-x', + install_dir : profiledir) diff --git a/src/build-remote/meson.build b/src/build-remote/meson.build new file mode 100644 index 00000000000..14464753d24 --- /dev/null +++ b/src/build-remote/meson.build @@ -0,0 +1,13 @@ +# build-remote build file +#============================================================================ + +build_remote_inc = [include_directories('.')] + + +# src files +#============================================================================ + +build_remote_src = files( + 'build-remote.cc') + +build_remote_headers = files() diff --git a/src/cpptoml/meson.build b/src/cpptoml/meson.build new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/libcmd/meson.build b/src/libcmd/meson.build new file mode 100644 index 00000000000..2c05246dbd8 --- /dev/null +++ b/src/libcmd/meson.build @@ -0,0 +1,79 @@ +# libmain build file +#============================================================================ + +libcmd_inc = [include_directories( + '.', + join_paths('..'), +)] + + +# dependencies +#============================================================================ + +libcmd_dep_list = [ + gc_dep, + libsodium_dep, + liblowdown_dep, + openssl_dep, + pthread_dep, + + + libutil_dep, + libmain_dep, + libstore_dep, + libexpr_dep, + libfetchers_dep] + + +# src files +#============================================================================ + +libcmd_src = files( + 'command.cc', + 'installables.cc', + 'legacy.cc', + 'markdown.cc') + +libcmd_headers = files( + 'command.hh', + 'installables.hh', + 'legacy.hh', + 'markdown.hh') + +# build +#============================================================================ + +# set build args +#--------------------------------------------------- +libcmd_cxx_args = [] + +libcmd_link_args = [] + + +# build library +#--------------------------------------------------- +libcmd_lib = library( + 'nixcmd', + sources : libcmd_src, + install : true, + install_mode : 'rwxr-xr-x', + install_dir : libdir, + include_directories : [ + libcmd_inc, + proj_inc], + cpp_args : libcmd_cxx_args, + link_args : libcmd_link_args, + dependencies : libcmd_dep_list) + + +# install headers +#--------------------------------------------------- +install_headers( + libcmd_headers, + install_dir : join_paths(includedir, 'nix')) + +# declare dependency +#--------------------------------------------------- +libcmd_dep = declare_dependency( + link_with : libcmd_lib, + include_directories : libcmd_inc) diff --git a/src/libexpr/flake/meson.build b/src/libexpr/flake/meson.build new file mode 100644 index 00000000000..5b6328dc3fa --- /dev/null +++ b/src/libexpr/flake/meson.build @@ -0,0 +1,30 @@ +# Nix lib expr build file +#============================================================================ + + +libexpr_priomops_dir = meson.current_source_dir() + +# src files +#============================================================================ + +libexpr_inc += include_directories('.') + +libexpr_src += files( + 'config.cc', + 'flake.cc', + 'flakeref.cc', + 'lockfile.cc') + +libexpr_headers += files( + 'flake.hh', + 'flakeref.hh', + 'lockfile.hh') + +# targets +#============================================================================ + +libexpr_src += custom_target( + 'call-flake.nix.gen.hh', + output : 'call-flake.nix.gen.hh', + input : 'call-flake.nix', + command : [bash, '-c', gen_rheader, 'sh', '@OUTPUT@']) diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build new file mode 100644 index 00000000000..7b9e171f32f --- /dev/null +++ b/src/libexpr/meson.build @@ -0,0 +1,167 @@ +# Nix lib expr build file +#============================================================================ + +libexpr_inc = proj_inc + + +# dependencies +#============================================================================ + +libexpr_dep_list = [ + boost_dep, + libdl_dep, + libsodium_dep, + gc_dep, + + libutil_dep, + libstore_dep, + libmain_dep, + libfetchers_dep] + + +# src files +#============================================================================ + +libexpr_src = files( + 'attr-path.cc', + 'attr-set.cc', + 'common-eval-args.cc', + 'eval-cache.cc', + 'eval.cc', + 'function-trace.cc', + 'get-drvs.cc', + 'json-to-value.cc', + 'nixexpr.cc', + 'primops.cc', + 'value-to-json.cc', + 'value-to-xml.cc') + +libexpr_headers = files( + 'attr-path.hh', + 'attr-set.hh', + 'common-eval-args.hh', + 'eval-cache.hh', + 'eval.hh', + 'eval-inline.hh', + 'function-trace.hh', + 'get-drvs.hh', + 'json-to-value.hh', + 'nixexpr.hh', + 'primops.hh', + 'symbol-table.hh', + 'value.hh', + 'value-to-json.hh', + 'value-to-xml.hh') + + +# include directories +#======================================================================== + +# include current dir +#--------------------------------------------------- +libexpr_inc += include_directories('.') + + +# add subdirectories +#--------------------------------------------------- +libexpr_dirs = [ + 'flake', + 'primops'] + +foreach dir : libexpr_dirs + subdir(dir) +endforeach + + +# targets +#============================================================================ + +libexpr_src += custom_target( + 'parser_tab.[cchh]', + output : [ + 'parser-tab.cc', + 'parser-tab.hh'], + input : 'parser.y', + command : [ + bison, + '-v', + '--output=@OUTPUT0@', + '--defines=@OUTPUT1@', + '@INPUT@']) + +libexpr_src += custom_target( + 'lexer_tab.[cchh]', + output : ['lexer-tab.cc', 'lexer-tab.hh'], + input : 'lexer.l', + command : [ + flex, + '--outfile=@OUTPUT0@', + '--header-file=@OUTPUT1@', + '@INPUT@']) + +libexpr_src += custom_target( + 'imported-drv-to-derivation.nix.gen.hh', + output : 'imported-drv-to-derivation.nix.gen.hh', + input : 'imported-drv-to-derivation.nix', + command : [bash, '-c', gen_rheader, 'sh', '@OUTPUT@']) + + +libexpr_src += custom_target( + 'fetchurl.nix.gen.hh', + output : 'fetchurl.nix.gen.hh', + input : 'fetchurl.nix', + command : [bash, '-c', gen_rheader, 'sh', '@OUTPUT@']) + + +# build +#============================================================================ + +# set build args +#--------------------------------------------------- +libexpr_cxx_args = [] + +libexpr_link_args = [] + + +# build library +#--------------------------------------------------- +libexpr_lib = library( + 'nixexpr', + sources : libexpr_src, + install : true, + install_mode : 'rwxr-xr-x', + install_dir : libdir, + include_directories : [ + libexpr_inc, + proj_inc, + ], + cpp_args : libexpr_cxx_args, + link_args : libexpr_link_args, + dependencies : libexpr_dep_list) + +# install headers +#--------------------------------------------------- +install_headers( + libexpr_headers, + install_dir : join_paths(includedir, 'nix')) + + +# generate pkg-config +#--------------------------------------------------- +# libexpr_config = pkg.generate( +# libexpr_lib, +# libraries : [ +# libstore_lib], +# version : meson.project_version(), +# name : 'Nix', +# subdirs : ['nix/'], +# filebase : 'nix-expr', +# extra_cflags : '-std=c++17', +# description : 'Nix Package Manager.') + + +# declare dependency +#--------------------------------------------------- +libexpr_dep = declare_dependency( + link_with : libexpr_lib, + include_directories : include_directories('.')) diff --git a/src/libexpr/primops/meson.build b/src/libexpr/primops/meson.build new file mode 100644 index 00000000000..b895bbd2f3a --- /dev/null +++ b/src/libexpr/primops/meson.build @@ -0,0 +1,23 @@ +# Nix lib expr build file +#============================================================================ + + +# src files +#============================================================================ + +libexpr_inc += include_directories('.') + +libexpr_src += files( + 'context.cc', + 'fetchMercurial.cc', + 'fetchTree.cc', + 'fromTOML.cc') + +# targets +#============================================================================ + +libexpr_src += custom_target( + 'derivation.nix.gen.hh', + output : 'derivation.nix.gen.hh', + input : 'derivation.nix', + command : [bash, '-c', gen_rheader, 'sh', '@OUTPUT@']) diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build new file mode 100644 index 00000000000..59f5ec7fc40 --- /dev/null +++ b/src/libfetchers/meson.build @@ -0,0 +1,107 @@ +# libfetchers build file +#============================================================================ + +libfetchers_inc = [] + +# dependencies +#============================================================================ + +libfetchers_dep_list = [ + libbz2_dep, + libcurl_dep, + libdl_dep, + libseccomp_dep, + libsodium_dep, + pthread_dep, + sqlite3_dep, + + libutil_dep, + libstore_dep] + + +# src files +#============================================================================ + +libfetchers_src = files( + 'attrs.cc', + 'cache.cc', + 'fetchers.cc', + 'git.cc', + 'github.cc', + 'indirect.cc', + 'mercurial.cc', + 'path.cc', + 'registry.cc', + 'tarball.cc') + +libfetchers_headers = files( + 'attrs.hh', + 'cache.hh', + 'fetchers.hh', + 'registry.hh') + + +# include directories +#======================================================================== + +# include current dir +#--------------------------------------------------- +libfetchers_inc += include_directories('.') + + +# targets +#============================================================================ + + +# build +#============================================================================ + +# set build args +#--------------------------------------------------- +libfetchers_cxx_args = [] + +libfetchers_link_args = [] + + +# build library +#--------------------------------------------------- +libfetchers_lib = library( + 'nixfetchers', + sources : libfetchers_src, + install : true, + install_mode : 'rwxr-xr-x', + install_dir : libdir, + include_directories : [ + libfetchers_inc, + proj_inc], + cpp_args : libfetchers_cxx_args, + link_args : libfetchers_link_args, + dependencies : libfetchers_dep_list) + + +# install headers +#--------------------------------------------------- +install_headers( + libfetchers_headers, + install_dir : join_paths(includedir, 'nix')) + + +# generate pkg-config +#--------------------------------------------------- +libfetchers_config = pkg.generate( + libfetchers_lib, + libraries : [ + libfetchers_lib], + version : meson.project_version(), + name : 'Nix', + subdirs : ['nix/'], + filebase : 'nix-store', + extra_cflags : '-std=c++17', + description : 'Nix Package Manager.') + + +# declare dependency +#--------------------------------------------------- +libfetchers_dep = declare_dependency( + link_with : libfetchers_lib, + include_directories : libfetchers_inc) diff --git a/src/libmain/meson.build b/src/libmain/meson.build new file mode 100644 index 00000000000..091aa13ce88 --- /dev/null +++ b/src/libmain/meson.build @@ -0,0 +1,85 @@ +# libmain build file +#============================================================================ + +libmain_inc = [] + + +# dependencies +#============================================================================ + +libmain_dep_list = [ + pthread_dep, + openssl_dep, + libsodium_dep, + + libutil_dep, + libstore_dep] + + +# src files +#============================================================================ + +libmain_src = 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') + + +# include directories +#======================================================================== + +# include current dir +#--------------------------------------------------- +libmain_inc += include_directories('.') + + +# targets +#============================================================================ + + +# build +#============================================================================ + +# set build args +#--------------------------------------------------- +libmain_cxx_args = [] + +libmain_link_args = [] + + +# build library +#--------------------------------------------------- +libmain_lib = library( + 'nixmain', + sources : libmain_src, + install : true, + install_mode : 'rwxr-xr-x', + install_dir : libdir, + include_directories : [ + libmain_inc, + proj_inc], + cpp_args : libmain_cxx_args, + link_args : libmain_link_args, + dependencies : libmain_dep_list) + + +# install headers +#--------------------------------------------------- +install_headers( + libmain_headers, + install_dir : join_paths(includedir, 'nix')) + +# declare dependency +#--------------------------------------------------- +libmain_dep = declare_dependency( + link_with : libmain_lib, + include_directories : libmain_inc) diff --git a/src/libstore/build/meson.build b/src/libstore/build/meson.build new file mode 100644 index 00000000000..5eae4cfb9ee --- /dev/null +++ b/src/libstore/build/meson.build @@ -0,0 +1,29 @@ +# libstore.build build file +#============================================================================ + +libstore_inc += include_directories('.') + + +# src files +#============================================================================ + +libstore_src += files( + 'derivation-goal.cc', + 'drv-output-substitution-goal.cc', + 'entry-points.cc', + 'goal.cc', + 'hook-instance.cc', + 'local-derivation-goal.cc', + 'substitution-goal.cc', + 'worker.cc') + + + +libstore_headers += files( + 'derivation-goal.hh', + 'drv-output-substitution-goal.hh', + 'goal.hh', + 'hook-instance.hh', + 'local-derivation-goal.hh', + 'substitution-goal.hh', + 'worker.hh') diff --git a/src/libstore/builtins/meson.build b/src/libstore/builtins/meson.build new file mode 100644 index 00000000000..d6e68fee0ff --- /dev/null +++ b/src/libstore/builtins/meson.build @@ -0,0 +1,17 @@ +# libstore.builtins build file +#============================================================================ + +libstore_inc += include_directories('.') + + +# src files +#============================================================================ + +libstore_src += files( + 'buildenv.cc', + 'fetchurl.cc', + 'unpack-channel.cc') + + +libstore_headers += files( + 'buildenv.hh') diff --git a/src/libstore/meson.build b/src/libstore/meson.build new file mode 100644 index 00000000000..1220103d376 --- /dev/null +++ b/src/libstore/meson.build @@ -0,0 +1,215 @@ +# libstore build file +#============================================================================ + +libstore_inc = [include_directories( + '.', + join_paths('..'), +)] + +# dependencies +#============================================================================ + +libstore_dep_list = [ + aws_sdk_cpp_dep, + libbz2_dep, + libcurl_dep, + libdl_dep, + libseccomp_dep, + libsodium_dep, + pthread_dep, + sqlite3_dep, + + libutil_dep] + + +# src files +#============================================================================ + +libstore_src = files( + 'binary-cache-store.cc', + 'content-address.cc', + 'crypto.cc', + 'daemon.cc', + 'derivations.cc', + 'derived-path.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', + 'machines.cc', + 'misc.cc', + 'names.cc', + 'nar-accessor.cc', + 'nar-info.cc', + 'nar-info-disk-cache.cc', + 'optimise-store.cc', + 'parsed-derivations.cc', + 'path.cc', + 'path-info.cc', + 'pathlocks.cc', + 'path-with-outputs.cc', + 'profiles.cc', + 'realisation.cc', + 'references.cc', + 'remote-fs-accessor.cc', + 'remote-store.cc', + 's3-binary-cache-store.cc', + 'sqlite.cc', + 'ssh.cc', + 'ssh-store.cc', + 'store-api.cc', + 'uds-remote-store.cc') + +libstore_headers = files( + + 'binary-cache-store.hh', + 'builtins.hh', + 'content-address.hh', + 'crypto.hh', + 'daemon.hh', + 'derivations.hh', + 'derived-path.hh', + 'filetransfer.hh', + 'fs-accessor.hh', + 'globals.hh', + 'local-fs-store.hh', + 'local-store.hh', + 'lock.hh', + 'machines.hh', + 'names.hh', + 'nar-accessor.hh', + 'nar-info-disk-cache.hh', + 'nar-info.hh', + 'parsed-derivations.hh', + 'path.hh', + 'path-info.hh', + 'pathlocks.hh', + 'path-with-outputs.hh', + 'profiles.hh', + 'realisation.hh', + 'references.hh', + 'remote-fs-accessor.hh', + 'remote-store.hh', + 's3-binary-cache-store.hh', + 's3.hh', + 'serve-protocol.hh', + 'sqlite.hh', + 'ssh.hh', + 'store-api.hh', + 'uds-remote-store.hh', + 'worker-protocol.hh') + + +libstore_data = files( + 'sandbox-defaults.sb', + 'sandbox-minimal.sb', + 'sandbox-network.sb') + + +# include directories +#======================================================================== + +libstore_dirs = [ + 'build', + 'builtins'] + + +foreach dir : libstore_dirs + subdir(dir) +endforeach + + +# targets +#============================================================================ + +libstore_src += custom_target( + 'schema.sql.gen.hh', + output : 'schema.sql.gen.hh', + input : 'schema.sql', + command : [bash, '-c', gen_rheader, 'sh', '@OUTPUT@']) + + +libstore_src += custom_target( + 'ca-specific-schema.sql.gen.hh', + output : 'ca-specific-schema.sql.gen.hh', + input : 'ca-specific-schema.sql', + command : [bash, '-c', gen_rheader, 'sh', '@OUTPUT@']) + + +# build +#============================================================================ + +# set build 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)] + +libstore_link_args = [] + + +# build library +#--------------------------------------------------- +libstore_lib = library( + 'nixstore', + sources : libstore_src, + install : true, + install_mode : 'rwxr-xr-x', + install_dir : libdir, + include_directories : [ + libstore_inc, + proj_inc], + cpp_args : libstore_cxx_args, + link_args : libstore_link_args, + dependencies : libstore_dep_list) + + +# install headers +#--------------------------------------------------- +install_headers( + libstore_headers, + install_dir : join_paths(includedir, 'nix')) + + +# install data +#--------------------------------------------------- +install_data( + libstore_data, + install_dir : join_paths(datadir, 'nix/sandbox')) + + +# generate pkg-config +#--------------------------------------------------- +libstore_config = pkg.generate( + libstore_lib, + libraries : [ + libstore_lib], + version : meson.project_version(), + name : 'Nix', + subdirs : ['nix/'], + filebase : 'nix-store', + extra_cflags : '-std=c++17', + description : 'Nix Package Manager.') + + +# declare dependency +#--------------------------------------------------- +libstore_dep = declare_dependency( + link_with : libstore_lib, + include_directories : libstore_inc) diff --git a/src/libutil/meson.build b/src/libutil/meson.build new file mode 100644 index 00000000000..95165115188 --- /dev/null +++ b/src/libutil/meson.build @@ -0,0 +1,135 @@ +# libutil build file +#============================================================================ + +libutil_inc = [include_directories( + '.', + join_paths('..'), +)] + + +# dependencies +#============================================================================ + +libutil_dep_list = [ + aws_sdk_cpp_dep, + boost_dep, + libarchive_dep, + libbz2_dep, + libbrotli_dep, + libcpuid_dep, + liblzma_dep, + libsodium_dep, + openssl_dep, + pthread_dep, + zlib_dep, +] + + +# src files +#============================================================================ + +libutil_src = files( + 'affinity.cc', + 'archive.cc', + 'args.cc', + 'compression.cc', + 'compute-levels.cc', + 'config.cc', + 'error.cc', + 'hash.cc', + 'json.cc', + 'logging.cc', + 'rust-ffi.cc', + 'serialise.cc', + 'tarfile.cc', + 'thread-pool.cc', + 'url.cc', + 'util.cc', + 'xml-writer.cc') + + +libutil_headers = files( + 'abstract-setting-to-json.hh', + 'affinity.hh', + 'ansicolor.hh', + 'archive.hh', + 'args.hh', + 'callback.hh', + 'closure.hh', + 'comparator.hh', + 'compression.hh', + 'compute-levels.hh', + 'config.hh', + 'error.hh', + 'finally.hh', + 'fmt.hh', + 'hash.hh', + 'json.hh', + 'logging.hh', + 'lru-cache.hh', + 'monitor-fd.hh', + 'pool.hh', + 'ref.hh', + 'rust-ffi.hh', + 'serialise.hh', + 'split.hh', + 'sync.hh', + 'tarfile.hh', + 'thread-pool.hh', + 'topo-sort.hh', + 'types.hh', + 'url.hh', + 'url-parts.hh', + 'util.hh', + 'xml-writer.hh') + + +# build +#============================================================================ + +# set build args +#--------------------------------------------------- +libutil_cxx_args = [] + +libutil_link_args = [] + + +# build library +#--------------------------------------------------- +libutil_lib = library( + 'nixutil', + sources : libutil_src, + install : true, + install_mode : 'rwxr-xr-x', + install_dir : libdir, + include_directories : [ + libutil_inc, + proj_inc + ], + cpp_args : libutil_cxx_args, + link_args : libutil_link_args, + dependencies : libutil_dep_list) + + +# install headers +#--------------------------------------------------- +install_headers( + libutil_headers, + install_dir : join_paths(includedir, 'nix')) + + +# declare dependency +#--------------------------------------------------- +libutil_dep = declare_dependency( + link_with : libutil_lib, + include_directories : libutil_inc) + + +# FIXME!!! tests should not be declared inside the +# build directory, but should be moved to a seperate test +# directory. for now, we just include it here. + + +# add test dir +#--------------------------------------------------- +subdir('tests') diff --git a/src/libutil/tests/main.cc b/src/libutil/tests/main.cc new file mode 100644 index 00000000000..0aa2fdad878 --- /dev/null +++ b/src/libutil/tests/main.cc @@ -0,0 +1,12 @@ +#pragma once + +#include + +using namespace std; + +int main(int argc, char * * argv) +{ + testing::InitGoogleTest(&argc, argv); + + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/src/libutil/tests/meson.build b/src/libutil/tests/meson.build new file mode 100644 index 00000000000..4f56ee68ed3 --- /dev/null +++ b/src/libutil/tests/meson.build @@ -0,0 +1,53 @@ +# libutil.tests build file +#============================================================================ + +libutil_tests_inc = [include_directories('.')] + +# dependancies +#============================================================================ + +libutil_tests_dep_list = [ + gtest_dep, + + libutil_dep] + + +# src files +#============================================================================ + +libutil_tests_src = files( + 'closure.cc', + 'compression.cc', + 'config.cc', + 'hash.cc', + 'json.cc', + 'logging.cc', + 'lru-cache.cc', + 'main.cc', + 'pool.cc', + 'tests.cc', + 'url.cc', + 'xml-writer.cc') + +# build +#============================================================================ + +# set build args +#--------------------------------------------------- +libutil_tests_cxx_args = [] + +libutil_tests_link_args = [] + + +# build executable +#--------------------------------------------------- +libutil_tests_bin = executable( + 'libutil-tests', + sources : libutil_tests_src, + install : false, + include_directories : proj_inc, + cpp_args : libutil_tests_cxx_args, + link_args : libutil_tests_link_args, + dependencies : libutil_tests_dep_list) + +test('libutil-tests', libutil_tests_bin) diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 00000000000..0d73d38d8dc --- /dev/null +++ b/src/meson.build @@ -0,0 +1,53 @@ +# nix src build file +#============================================================================ + +src_dirs = [ + 'nlohmann', + + 'libutil', + 'libstore', + 'libmain', + 'libfetchers', + 'libexpr', + 'libcmd', + + 'build-remote', + 'nix-build', + 'nix-channel', + 'nix-collect-garbage', + 'nix-copy-closure', + 'nix-env', + 'nix-instantiate', + 'nix-store', + 'nix', +] + +if sys_name == 'Darwin' + src_dirs += 'resolve-system-dependencies' +endif + +foreach dir : src_dirs + subdir(dir) +endforeach + + +# libstore_config = pkg.generate( +# libstore_lib, +# libraries : [ +# libutil_lib], +# version : meson.project_version(), +# name : 'Nix', +# subdirs : ['nix/'], +# filebase : 'nix-store', +# extra_cflags : '-std=c++17', +# description : 'Nix Package Manager.') + + +# libmain_config = pkg.generate( +# libmain_lib, +# version : meson.project_version(), +# name : 'Nix', +# subdirs : ['nix/'], +# filebase : 'nix-main', +# extra_cflags : '-std=c++17', +# description : 'Nix Package Manager.') diff --git a/src/nix-build/meson.build b/src/nix-build/meson.build new file mode 100644 index 00000000000..dfb925a7592 --- /dev/null +++ b/src/nix-build/meson.build @@ -0,0 +1,11 @@ +# nix-build build file +#============================================================================ + +nix_build_inc = [include_directories('.')] + + +# src files +#============================================================================ + +nix_build_src = files( + 'nix-build.cc') diff --git a/src/nix-channel/meson.build b/src/nix-channel/meson.build new file mode 100644 index 00000000000..6813b80ae27 --- /dev/null +++ b/src/nix-channel/meson.build @@ -0,0 +1,20 @@ +# nix-channel channel file +#============================================================================ + +nix_channel_inc = [include_directories('.')] + + +# src files +#============================================================================ + +nix_channel_src = files( + 'nix-channel.cc') + + +# targets +#============================================================================ +nix_channel_src += custom_target( + 'unpack-channel.nix.gen.hh', + output : 'unpack-channel.nix.gen.hh', + input : 'unpack-channel.nix', + command : [bash, '-c', gen_rheader, 'sh', '@OUTPUT@']) diff --git a/src/nix-collect-garbage/meson.build b/src/nix-collect-garbage/meson.build new file mode 100644 index 00000000000..10ca61116c8 --- /dev/null +++ b/src/nix-collect-garbage/meson.build @@ -0,0 +1,11 @@ +# build-remote build file +#============================================================================ + +nix_collect_garbage_inc = [include_directories('.')] + + +# src files +#============================================================================ + +nix_collect_garbage_src = files( + 'nix-collect-garbage.cc') diff --git a/src/nix-copy-closure/meson.build b/src/nix-copy-closure/meson.build new file mode 100644 index 00000000000..c13f6151982 --- /dev/null +++ b/src/nix-copy-closure/meson.build @@ -0,0 +1,11 @@ +# nix-copy-closure build file +#============================================================================ + +nix_copy_closure_inc = [include_directories('.')] + + +# src files +#============================================================================ + +nix_copy_closure_src = files( + 'nix-copy-closure.cc') diff --git a/src/nix-env/meson.build b/src/nix-env/meson.build new file mode 100644 index 00000000000..64c92440054 --- /dev/null +++ b/src/nix-env/meson.build @@ -0,0 +1,20 @@ +# nix-env build file +#============================================================================ + +nix_env_inc = [include_directories('.')] + + +# src files +#============================================================================ + +nix_env_src = files( + 'nix-env.cc', + 'user-env.cc') + +# targets +#============================================================================ +nix_env_src += custom_target( + 'buildenv.nix.gen.hh', + output : 'buildenv.nix.gen.hh', + input : 'buildenv.nix', + command : [bash, '-c', gen_rheader, 'sh', '@OUTPUT@']) diff --git a/src/nix-instantiate/meson.build b/src/nix-instantiate/meson.build new file mode 100644 index 00000000000..5a25767150c --- /dev/null +++ b/src/nix-instantiate/meson.build @@ -0,0 +1,11 @@ +# nix-instantiate build file +#============================================================================ + +nix_instantiate_inc = [include_directories('.')] + + +# src files +#============================================================================ + +nix_instantiate_src = files( + 'nix-instantiate.cc') diff --git a/src/nix-store/meson.build b/src/nix-store/meson.build new file mode 100644 index 00000000000..fd65e3ceea8 --- /dev/null +++ b/src/nix-store/meson.build @@ -0,0 +1,13 @@ +# nix-store build file +#============================================================================ + +nix_store_inc = [include_directories('.')] + + +# src files +#============================================================================ + +nix_store_src = files( + 'dotgraph.cc', + 'graphml.cc', + 'nix-store.cc') diff --git a/src/nix/meson.build b/src/nix/meson.build new file mode 100644 index 00000000000..78cf3942df6 --- /dev/null +++ b/src/nix/meson.build @@ -0,0 +1,145 @@ +# Nix binary build file +#============================================================================ + + +nix_inc = [include_directories('.')] + +# dependancies +#============================================================================ + +nix_dep_list = [ + pthread_dep, + libdl_dep, + boost_dep, + editline_dep, + libsodium_dep, + gc_dep, + + libutil_dep, + libstore_dep, + libfetchers_dep, + libmain_dep, + libexpr_dep, + libcmd_dep, +] + + +# src files +#============================================================================ + +nix_src = files( + 'add-to-store.cc', + 'app.cc', + 'build.cc', + 'bundle.cc', + 'cat.cc', + 'copy.cc', + 'daemon.cc', + 'describe-stores.cc', + 'develop.cc', + 'diff-closures.cc', + 'doctor.cc', + 'dump-path.cc', + 'edit.cc', + 'eval.cc', + 'flake.cc', + 'hash.cc', + 'log.cc', + 'ls.cc', + 'main.cc', + 'make-content-addressable.cc', + 'nar.cc', + 'optimise-store.cc', + 'path-info.cc', + 'ping-store.cc', + 'prefetch.cc', + 'profile.cc', + 'realisation.cc', + 'registry.cc', + 'repl.cc', + 'run.cc', + 'search.cc', + 'show-config.cc', + 'show-derivation.cc', + 'sigs.cc', + 'store.cc', + 'store-delete.cc', + 'store-gc.cc', + 'store-repair.cc', + 'upgrade-nix.cc', + 'verify.cc', + 'why-depends.cc') + + +src_markdown_files = files( + 'flake-lock.md', 'store-repair.md', 'nix.md', 'why-depends.md', 'registry-list.md', 'store-dump-path.md', + 'nar.md', 'edit.md', 'nar-ls.md', 'store-delete.md', 'nar-cat.md', 'upgrade-nix.md', 'show-derivation.md', + 'copy.md', 'bundle.md', 'registry.md', 'search.md', 'optimise-store.md', 'key-convert-secret-to-public.md', + 'profile-install.md', 'run.md', 'nar-dump-path.md', 'flake-archive.md', 'profile.md', 'flake-check.md', + 'daemon.md', 'repl.md', 'store-prefetch-file.md', 'profile-upgrade.md', 'add-path.md', 'flake-new.md', + 'profile-history.md', 'profile-diff-closures.md', 'help.md', 'diff-closures.md', 'key-generate-secret.md', + 'store-gc.md', 'registry-add.md', 'profile-remove.md', 'shell.md', 'path-info.md', 'ping-store.md', + 'flake.md', 'flake-update.md', 'flake-clone.md', 'eval.md', 'flake-metadata.md', 'profile-list.md', + 'flake-init.md', 'make-content-addressable.md', 'registry-pin.md', 'verify.md', 'develop.md', + 'flake-prefetch.md', 'store-ls.md', 'add-file.md', 'flake-show.md', 'build.md', 'registry-remove.md', + 'print-dev-env.md', 'store-cat.md', 'log.md', join_paths('realisation', 'info.md'), +) + + +# nix_ln_src = [ +# [ bindir, 'nix-build' ], +# [ bindir, 'nix-channel' ], +# [ bindir, 'nix-collect-garbage' ], +# [ bindir, 'nix-copy-closure' ], +# [ bindir, 'nix-daemon' ], +# [ bindir, 'nix-env' ], +# [ bindir, 'nix-hash' ], +# [ bindir, 'nix-instantiate' ], +# [ bindir, 'nix-prefetch-url' ], +# [ bindir, 'nix-shell' ], +# [ bindir, 'nix-store' ], +# [ join_paths(libexecdir, 'nix'), 'build-remote' ], +#] + + +# targets +#============================================================================ +nix_src += custom_target( + 'get-env.sh.gen.hh', + output : 'get-env.sh.gen.hh', + input : 'get-env.sh', + command : [bash, '-c', gen_rheader, 'sh', '@OUTPUT@']) + + +# build +#============================================================================ + +# set build args +#--------------------------------------------------- +nix_cxx_args = [] + +nix_link_args = [] + +# build executable +#--------------------------------------------------- +nix_bin = executable( + 'nix', + sources : [ + nix_src, + build_remote_src, + nix_build_src, + nix_channel_src, + nix_collect_garbage_src, + nix_copy_closure_src, + # nix_daemon_src, + nix_env_src, + nix_instantiate_src, + nix_store_src, + ], + install : true, + install_mode : 'rwxr-xr-x', + install_dir : bindir, + include_directories : proj_inc, + cpp_args : nix_cxx_args, + link_args : nix_link_args, + dependencies : nix_dep_list) diff --git a/src/nlohmann/meson.build b/src/nlohmann/meson.build new file mode 100644 index 00000000000..d66ac324f33 --- /dev/null +++ b/src/nlohmann/meson.build @@ -0,0 +1,10 @@ +nlohmann_dir = meson.current_source_dir() + +nlohmann_headers = files( + 'json.hpp', + 'json_fwd.hpp', +) + +install_headers( + nlohmann_headers, + install_dir : join_paths(includedir, 'nix')) diff --git a/src/resolve-system-dependencies/meson.build b/src/resolve-system-dependencies/meson.build new file mode 100644 index 00000000000..ef118827a55 --- /dev/null +++ b/src/resolve-system-dependencies/meson.build @@ -0,0 +1,39 @@ +# resolve-system-dependencies build file +#============================================================================ + +resolvesysdeps_inc = [include_directories('.')] + +# dependancies +#============================================================================ + +resolvesysdeps_dep_list = [] + + +# src files +#============================================================================ + +resolvesysdeps_src = files( + 'resolve-system-dependencies.cc') + + +# build +#============================================================================ + +# set build args +#--------------------------------------------------- +resolvesysdeps_cxx_args = [] + +resolvesysdeps_link_args = [] + +# build executable +#--------------------------------------------------- +resolvesysdeps_bin = executable( + 'resolve-system-dependencies', + sources : resolvesysdeps_src, + install : true, + install_mode : 'rwxr-xr-x', + install_dir : bindir, + include_directories : proj_inc, + cpp_args : resolvesysdeps_cxx_args, + link_args : resolvesysdeps_link_args, + dependencies : resolvesysdeps_dep_list)