]> git.ipfire.org Git - thirdparty/systemd.git/commit - meson.build
meson: generate version tag from git
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 20 Dec 2018 19:35:25 +0000 (20:35 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 21 Dec 2018 12:43:20 +0000 (13:43 +0100)
commit681bd2c524ed71ac04045c90884ba8d55eee7b66
treef50b21fb487cead9833a04a307f0e4d7b54d7a8d
parentb9da6a098b08d4eafec239fc05e0fd2073115504
meson: generate version tag from git

$ build/systemctl --version
systemd 239-3555-g6178cbb5b5
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid
$ git tag v240 -m 'v240'
$ ninja -C build
ninja: Entering directory `build'
[76/76] Linking target fuzz-unit-file.
$ build/systemctl --version
systemd 240
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid

This is very useful during development, because a precise version string is
embedded in the build product and displayed during boot, so we don't have to
guess answers for questions like "did I just boot the latest version or the one
from before?".

This change creates an overhead for "noop" builds. On my laptop, 'ninja -C
build' that does nothing goes from 0.1 to 0.5 s. It would be nice to avoid
this, but I think that <1 s is still acceptable.

Fixes #7183.

PACKAGE_VERSION is renamed to GIT_VERSION, to make it obvious that this is the
more dynamically changing version string.

Why save to a file? It would be easy to generate the version tag using
run_command(), but we want to go through a file so that stuff gets rebuilt when
this file changes. If we just defined an variable in meson, ninja wouldn't know
it needs to rebuild things.
19 files changed:
meson.build
src/analyze/analyze.c
src/basic/build.h
src/basic/meson.build
src/basic/util.c
src/basic/version.h.in [new file with mode: 0644]
src/boot/efi/boot.c
src/boot/efi/meson.build
src/boot/efi/stub.c
src/core/dbus-manager.c
src/core/main.c
src/import/curl-util.c
src/journal-remote/journal-upload.c
src/test/test-libudev.c
src/test/test-udev.c
src/udev/scsi_id/scsi_id.c
src/udev/udevadm.h
src/udev/udevd.c
tools/meson-vcs-tag.sh [new file with mode: 0755]