summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/markdown/snippets/vcs_tag.md4
-rw-r--r--docs/yaml/functions/vcs_tag.yaml31
-rw-r--r--mesonbuild/interpreter/interpreter.py15
-rw-r--r--test cases/common/66 vcstag/meson.build4
-rw-r--r--test cases/common/66 vcstag/test.json8
5 files changed, 61 insertions, 1 deletions
diff --git a/docs/markdown/snippets/vcs_tag.md b/docs/markdown/snippets/vcs_tag.md
new file mode 100644
index 000000000..c60996a2e
--- /dev/null
+++ b/docs/markdown/snippets/vcs_tag.md
@@ -0,0 +1,4 @@
+## Install vcs_tag() output
+
+[[vcs_tag]] now has `install`, `install_dir`, `install_tag` and `install_mode`
+keyword arguments to install the generated file.
diff --git a/docs/yaml/functions/vcs_tag.yaml b/docs/yaml/functions/vcs_tag.yaml
index b4aad12c6..3a3568429 100644
--- a/docs/yaml/functions/vcs_tag.yaml
+++ b/docs/yaml/functions/vcs_tag.yaml
@@ -55,3 +55,34 @@ kwargs:
type: str
default: "'@VCS_TAG@'"
description: String in the input file to substitute with the commit information.
+
+ install:
+ type: bool
+ default: false
+ since: 1.7.0
+ description: |
+ When true, this generated file is installed during
+ the install step, and `install_dir` must be set and not empty.
+
+ install_dir:
+ type: str
+ since: 1.7.0
+ description: |
+ The subdirectory to install the generated file to (e.g. `share/myproject`).
+
+ install_mode:
+ type: list[str | int]
+ since: 1.7.0
+ description: |
+ Specify the file mode in symbolic format
+ and optionally the owner/uid and group/gid for the installed files.
+
+ See the `install_mode` kwarg of [[install_data]] for more information.
+
+ install_tag:
+ type: str
+ since: 1.7.0
+ description: |
+ A string used by the `meson install --tags` command
+ to install only a subset of the files. By default the file has no install
+ tag which means it is not being installed when `--tags` argument is specified.
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index 7bb233742..99530a8c8 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -1954,6 +1954,10 @@ class Interpreter(InterpreterBase, HoldableObject):
),
KwargInfo('fallback', (str, NoneType)),
KwargInfo('replace_string', str, default='@VCS_TAG@'),
+ INSTALL_KW.evolve(since='1.7.0'),
+ INSTALL_DIR_KW.evolve(since='1.7.0'),
+ INSTALL_TAG_KW.evolve(since='1.7.0'),
+ INSTALL_MODE_KW.evolve(since='1.7.0'),
)
def func_vcs_tag(self, node: mparser.BaseNode, args: T.List['TYPE_var'], kwargs: 'kwtypes.VcsTag') -> build.CustomTarget:
if kwargs['fallback'] is None:
@@ -1994,6 +1998,13 @@ class Interpreter(InterpreterBase, HoldableObject):
replace_string,
regex_selector] + vcs_cmd
+ install = kwargs['install']
+ install_mode = self._warn_kwarg_install_mode_sticky(kwargs['install_mode'])
+ install_dir = [] if kwargs['install_dir'] is None else [kwargs['install_dir']]
+ install_tag = [] if kwargs['install_tag'] is None else [kwargs['install_tag']]
+ if install and not install_dir:
+ raise InvalidArguments('vcs_tag: "install_dir" keyword argument must be set when "install" is true.')
+
tg = build.CustomTarget(
kwargs['output'][0],
self.subdir,
@@ -2004,6 +2015,10 @@ class Interpreter(InterpreterBase, HoldableObject):
kwargs['output'],
build_by_default=True,
build_always_stale=True,
+ install=install,
+ install_dir=install_dir,
+ install_mode=install_mode,
+ install_tag=install_tag,
)
self.add_target(tg.name, tg)
return tg
diff --git a/test cases/common/66 vcstag/meson.build b/test cases/common/66 vcstag/meson.build
index 38fa59038..53f90d857 100644
--- a/test cases/common/66 vcstag/meson.build
+++ b/test cases/common/66 vcstag/meson.build
@@ -32,7 +32,9 @@ tagprog = executable('tagprog', 'tagprog.c', version_src)
version_src_executable = vcs_tag(input : 'vcstag.c.in',
output : 'vcstag-executable.c',
-command : [tagprog])
+command : [tagprog],
+install: true,
+install_dir: get_option('includedir'))
executable('tagprog-custom', 'tagprog.c', version_src_custom)
executable('tagprog-fallback', 'tagprog.c', version_src_fallback)
diff --git a/test cases/common/66 vcstag/test.json b/test cases/common/66 vcstag/test.json
new file mode 100644
index 000000000..4c9e3a197
--- /dev/null
+++ b/test cases/common/66 vcstag/test.json
@@ -0,0 +1,8 @@
+{
+ "installed": [
+ {
+ "type": "file",
+ "file": "usr/include/vcstag-executable.c"
+ }
+ ]
+}