diff --git a/meson.build b/meson.build index e71d2ca2b..5368765c5 100644 --- a/meson.build +++ b/meson.build @@ -191,6 +191,9 @@ add_project_arguments( ) subdir('src/libutil') -# Load-bearing order. libstore depends on libutil (includes). +# Load-bearing order. libstore depends on libutil. subdir('src/libstore') +# libfetchers depends on libstore. subdir('src/libfetchers') +# libexpr depends on libfetchers. +subdir('src/libexpr') diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build new file mode 100644 index 000000000..21e883b67 --- /dev/null +++ b/src/libexpr/meson.build @@ -0,0 +1,84 @@ +bison = find_program('bison') +flex = find_program('flex') + +parser_tab = custom_target( + input : 'parser.y', + output : [ + 'parser-tab.cc', + 'parser-tab.hh', + ], + command : [ + 'bison', + '-v', + '-o', + '@OUTPUT0@', + '@INPUT@', + '-d', + ], +) + +lexer_tab = custom_target( + input : [ + 'lexer.l', + parser_tab, + ], + output : [ + 'lexer-tab.cc', + 'lexer-tab.hh', + ], + command : [ + 'flex', + '--outfile', + '@OUTPUT0@', + '--header-file=' + '@OUTPUT1@', + '@INPUT0@', + ], +) + +libexpr_sources = files( + 'attr-path.cc', + 'attr-set.cc', + 'eval-cache.cc', + 'eval-error.cc', + 'eval-settings.cc', + 'eval.cc', + 'function-trace.cc', + 'get-drvs.cc', + 'json-to-value.cc', + 'nixexpr.cc', + 'paths.cc', + 'primops.cc', + 'print-ambiguous.cc', + 'print.cc', + 'search-path.cc', + 'value-to-json.cc', + 'value-to-xml.cc', + 'flake/config.cc', + 'flake/flake.cc', + 'flake/flakeref.cc', + 'flake/lockfile.cc', + 'primops/context.cc', + 'primops/fetchClosure.cc', + 'primops/fetchMercurial.cc', + 'primops/fetchTree.cc', + 'primops/fromTOML.cc', + 'value/context.cc', +) + +all_sources += { + 'libexpr': libexpr_sources +} + +libexpr = library( + 'nixexpr', + libexpr_sources, + parser_tab, + lexer_tab, + dependencies : [ + liblixutil, + liblixstore, + liblixfetchers, + boehm, + boost, + ], +) diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build index 650c63f45..3f82ef61f 100644 --- a/src/libfetchers/meson.build +++ b/src/libfetchers/meson.build @@ -13,7 +13,7 @@ libfetchers_sources = files( 'tarball.cc', ) -library( +libfetchers = library( 'nixfetchers', libfetchers_sources, dependencies : [ @@ -21,3 +21,8 @@ library( liblixutil, ], ) + +liblixfetchers = declare_dependency( + include_directories : include_directories('.'), + link_with : libfetchers, +) diff --git a/src/libstore/meson.build b/src/libstore/meson.build index 2590ecb0c..56f94a3da 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -1,21 +1,25 @@ -find_program('lsof') - -# Yes this is really what it does. -# FIXME: do we. really need to rely on the shell for this? -gen_script = ''' - echo 'R"foo(' >> @OUTPUT@.tmp && - cat < @INPUT@ >> @OUTPUT@.tmp && - echo ')foo"' >> @OUTPUT@.tmp && - mv @OUTPUT@.tmp @OUTPUT -'''.replace('\n', ' ') +bash = find_program('bash') schema_sql_gen = custom_target( input : 'schema.sql', output : 'schema.sql.gen.hh', command : [ - 'bash', '-c', - gen_script, + bash, + '-c', + 'echo \'R"foo(\' | cat - @INPUT@ && echo \')foo"\'', ], + capture : true, +) + +ca_specific_schema = custom_target( + input : 'ca-specific-schema.sql', + output : 'ca-specific-schema.sql.gen.hh', + command : [ + bash, + '-c', + 'echo \'R"foo(\' | cat - @INPUT@ && echo \')foo"\'', + ], + capture : true, ) libstore_sources = files( @@ -87,8 +91,8 @@ all_sources += { } cpp_str_defines = { - 'NIX_PREFIX': get_option('prefix'), 'LSOF': lsof.full_path(), + 'NIX_PREFIX': get_option('prefix'), 'NIX_STORE_DIR': get_option('store-dir'), 'NIX_DATA_DIR': get_option('prefix') / 'share', # FIXME: make separately-configurable 'NIX_STATE_DIR': get_option('prefix') / 'nix', # FIXME: same @@ -108,8 +112,9 @@ endforeach libstore = library( 'nixstore', - libstore_sources, schema_sql_gen, + ca_specific_schema, + libstore_sources, dependencies : [ libarchive, liblixutil, # Internal.