我有一个介子项目,有几个步骤:
- 下载并解压 tarball
cd
进入它,./configure
- 这会在上游存档目录中生成某个文件- 调整存档目录中的文件
- 更多构建步骤
我遇到的问题是如何设置输入/输出文件和依赖项。到目前为止,我有:
src_archive = 'extracted-dir' # this is what comes out of the upstream archive
# wget and untar a tarball (produces the 'extracted-dir' dir in the build directory)
dl_tgt = custom_target('download',
command : [files('scripts/download.sh')],
output : src_archive
)
# cd to the directory, .configure
# when this is complete, a file 'extracted-dir/docs/Doxyfile' will exist
upstream_doxyfile = 'Doxyfile' # can't set a path on this file
conf_tgt = custom_target('configure_src',
input : dl_tgt,
command : [files('scripts/configure.sh'), '@INPUT@'],
output : doxy_out
)
# Modify the upstream Doxyfile (copy it and append some settings to the copy)
mod_doxyfile = 'Doxyfile.mod'
mod_doxy_tgt = custom_target('configure_doxy',
build_by_default : true,
input : conf_tgt,
command : [files('scripts/configure-doxy.sh'), '@INPUT@'],
output : mod_doxyfile
)
# ... and so on to run more steps as needed (in reality, some of these steps might be combined)
如果允许 Meson 避免重复下载(例如,如果文件已下载),则有单独步骤的原因。
如果您尝试运行它,它将无法找到Doxyfile
s(因为它们位于子目录中)。
如果您使用路径指定它们,则会出现错误:
ERROR: Output 'extracted-dir/docs/Doxyfile' must not contain a path segment.
我也可以通过手动指定脚本中的路径来做到这一点,但是介子构建基本上只是一个过于复杂的 shell 脚本,没有任何依赖管理。
如何像这样链接构建目录中文件的依赖关系?