meson: custom_target does not finish command properly
This comes from the wip meson port of libqmi
and has also been commented in meson’s google groups.
I want to concatenate a series of generated files, along with an existing one, into a new file, which is then used to generate documentation by using gtkdoc
. I’m just using cat
to concatenate files in a custom_target
. However, looks like cat
stops halfway and this makes the documentation generation to fail because the resulting file doesn’t contain the whole data.
This procedure is done in the following way:
doc_module = 'libqmi-glib'
name = doc_module + '-sections.txt'
sections_txt = custom_target(
name,
input: ['libqmi-glib-common.sections'] + gen_sections,
output: name,
capture: true,
command: [find_program('cat'), '@INPUT@'],
)
gen_sections
is a set of generated files by using a previous custom_target
and libqmi-glib-common.sections
is an existing file which is also concatenated into a file called libqmi-glib-sections.txt
.
gnome.gtkdoc(
doc_module,
main_xml: doc_module + '-docs.xml',
src_dir: src_dirs,
ignore_headers: private_headers,
include_directories: top_inc,
dependencies: libqmi_glib_dep,
namespace: 'qmi',
scan_args: scan_args,
fixxref_args: fixxref_args,
content_files: [sections_txt, version_xml],
install: true,
)
The sections_txt
target seems to stop at some point after/when gtkdoc
is executed. The resulting file should be 306492 bytes
but is only 240095 bytes
. If I execute the libqmi-glib-sections.txt
target alone, the resulting file size is correct, 306492 bytes
and if gtkdoc
documentation generation is executed after, then the process ends properly.
I have also tried using the console
parameter instead of the capture
parameter, because its documentation says the following:
console (added 0.48) keyword argument conflicts with capture, and **is meant for commands that are resource-intensive and take a long time to finish**. With the Ninja backend, setting this will add this target to Ninja's console pool, which has special properties such as not buffering stdout and serializing all targets in this pool.
This was just in case the command was killed due to the spent on the command, but it also doesn’t work.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 19 (19 by maintainers)
Running
ninja libqmi-glib-doc
builds the docs fine, BTW. Then meson install tries to build them a second time for reasons I completely fail to comprehend, and the command which builds or rebuilds the docs also checks if MESON_INSTALL_PREFIX is set in order to then run the install bits too.This is the kind of design I don’t want to publicly describe.
I’ve thought for quite some time that some modules do way too much on their own, outside of any proper structure. Another example is the i18n module. 😦
Modules should never, ever, ever, ever be allowed to do build work during meson install. This is the entire problem here.