summaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2024-02-23 11:07:56 +0100
committerGitHub <noreply@github.com>2024-02-23 11:07:56 +0100
commit0ace2560eaaf459246ee39f70afe712443e1068a (patch)
treefdfbc096686e0adc21cccb236f5db4d33ffb4a53 /meson.build
parentsd-dhcp,sd-ndisc: drop mistakenly set copyright (diff)
parentmeson: Decouple the version tag from the vcs tag (diff)
downloadsystemd-0ace2560eaaf459246ee39f70afe712443e1068a.tar.xz
systemd-0ace2560eaaf459246ee39f70afe712443e1068a.zip
Merge pull request #31352 from DaanDeMeyer/versioning
Rework meson-vcs-tag.sh
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build28
1 files changed, 21 insertions, 7 deletions
diff --git a/meson.build b/meson.build
index 7b6f0716fe..d49f046014 100644
--- a/meson.build
+++ b/meson.build
@@ -1853,13 +1853,27 @@ xml_helper_py = find_program('tools/xml_helper.py')
#####################################################################
version_tag = get_option('version-tag')
-version_h = vcs_tag(
- input : 'src/version/version.h.in',
- output : 'version.h',
- command: [project_source_root / 'tools/meson-vcs-tag.sh',
- project_source_root,
- version_tag,
- ])
+if version_tag == ''
+ version_tag = meson.project_version()
+endif
+
+conf.set_quoted('VERSION_TAG', version_tag)
+
+vcs_tag = get_option('vcs-tag')
+if vcs_tag and fs.is_dir(project_source_root / '.git')
+ version_h = vcs_tag(
+ input : 'src/version/version.h.in',
+ output : 'version.h',
+ fallback : '',
+ command : ['sh', '-c', 'echo "-g$(git -C . describe --abbrev=7 --match="" --always --dirty=^)"'],
+ )
+else
+ version_h = configure_file(
+ input : 'src/version/version.h.in',
+ output : 'version.h',
+ configuration : configuration_data({'VCS_TAG' : ''}),
+ )
+endif
shared_lib_tag = get_option('shared-lib-tag')
if shared_lib_tag == ''