meson: install missing/generated headers

one headers (args/root.hh) was simply missing, and the generated headers
were not installed. not all of them *should* be installed either, only a
select few (and sadly this needs a custom target for each one, it seems)

Change-Id: I37b25517895d0e5e521abc1202fa65624de57ed1
This commit is contained in:
eldritch horrors 2024-03-29 02:37:14 +01:00
parent 69bfd21e20
commit 6e5db5e4a2
5 changed files with 39 additions and 16 deletions

View file

@ -244,13 +244,12 @@ bison = find_program('bison')
flex = find_program('flex') flex = find_program('flex')
# This is how Nix does generated headers... # This is how Nix does generated headers...
# other instances of header generation use a very similar command.
# FIXME(Qyriad): do we really need to use the shell for this? # FIXME(Qyriad): do we really need to use the shell for this?
gen_header_sh = 'echo \'R"__NIX_STR(\' | cat - @INPUT@ && echo \')__NIX_STR"\''
gen_header = generator( gen_header = generator(
bash, bash,
arguments : [ arguments : [ '-c', gen_header_sh ],
'-c',
'echo \'R"__NIX_STR(\' | cat - @INPUT@ && echo \')__NIX_STR"\'',
],
capture : true, capture : true,
output : '@PLAINNAME@.gen.hh', output : '@PLAINNAME@.gen.hh',
) )

View file

@ -0,0 +1,8 @@
libexpr_generated_headers += custom_target(
command : [ 'bash', '-c', 'echo \'R"__NIX_STR(\' | cat - @INPUT@ && echo \')__NIX_STR"\'' ],
input : 'call-flake.nix',
output : '@PLAINNAME@.gen.hh',
capture : true,
install : true,
install_dir : includedir / 'nix/flake',
)

View file

@ -49,10 +49,20 @@ meson.add_install_script(
'@0@'.format(includedir), '@0@'.format(includedir),
) )
imported_drv_to_derivation_gen = gen_header.process('imported-drv-to-derivation.nix') libexpr_generated_headers = [
fetchurl_gen = gen_header.process('fetchurl.nix') gen_header.process('primops/derivation.nix', preserve_path_from : meson.current_source_dir()),
derivation_gen = gen_header.process('primops/derivation.nix', preserve_path_from : meson.current_source_dir()) ]
call_flake_gen = gen_header.process('flake/call-flake.nix') foreach header : [ 'imported-drv-to-derivation.nix', 'fetchurl.nix' ]
libexpr_generated_headers += custom_target(
command : [ 'bash', '-c', 'echo \'R"__NIX_STR(\' | cat - @INPUT@ && echo \')__NIX_STR"\'' ],
input : header,
output : '@PLAINNAME@.gen.hh',
capture : true,
install : true,
install_dir : includedir / 'nix',
)
endforeach
subdir('flake')
libexpr_sources = files( libexpr_sources = files(
'attr-path.cc', 'attr-path.cc',
@ -121,10 +131,7 @@ libexpr = library(
libexpr_sources, libexpr_sources,
parser_tab, parser_tab,
lexer_tab, lexer_tab,
imported_drv_to_derivation_gen, libexpr_generated_headers,
fetchurl_gen,
derivation_gen,
call_flake_gen,
dependencies : [ dependencies : [
liblixutil, liblixutil,
liblixstore, liblixstore,

View file

@ -1,5 +1,14 @@
schema_sql_gen = gen_header.process('schema.sql') libstore_generated_headers = []
ca_specific_schema_gen = gen_header.process('ca-specific-schema.sql') foreach header : [ 'schema.sql', 'ca-specific-schema.sql' ]
libstore_generated_headers += custom_target(
command : [ 'bash', '-c', 'echo \'R"__NIX_STR(\' | cat - @INPUT@ && echo \')__NIX_STR"\'' ],
input : header,
output : '@PLAINNAME@.gen.hh',
capture : true,
install : true,
install_dir : includedir / 'nix',
)
endforeach
libstore_sources = files( libstore_sources = files(
'binary-cache-store.cc', 'binary-cache-store.cc',
@ -157,8 +166,7 @@ endforeach
libstore = library( libstore = library(
'nixstore', 'nixstore',
schema_sql_gen, libstore_generated_headers,
ca_specific_schema_gen,
libstore_sources, libstore_sources,
dependencies : [ dependencies : [
libarchive, libarchive,

View file

@ -35,6 +35,7 @@ libutil_headers = files(
'abstract-setting-to-json.hh', 'abstract-setting-to-json.hh',
'ansicolor.hh', 'ansicolor.hh',
'archive.hh', 'archive.hh',
'args/root.hh',
'args.hh', 'args.hh',
'box_ptr.hh', 'box_ptr.hh',
'callback.hh', 'callback.hh',