meson: we can now build libexpr!

Change-Id: I937a217fdcb5bd33491cc20f04a734e9d732d5e5
This commit is contained in:
Qyriad 2024-03-13 20:53:51 -06:00
parent 1af43a19a2
commit e30dac46fe
4 changed files with 113 additions and 16 deletions

View file

@ -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')

84
src/libexpr/meson.build Normal file
View file

@ -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,
],
)

View file

@ -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,
)

View file

@ -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.