[Buildroot] How to get the (GIT) Version string into the source code
Christian Stewart
christian at paral.in
Thu Oct 10 16:59:50 UTC 2019
Hi Wolfgang,
On Thu, Oct 10, 2019, 6:54 AM Wolfgang Grandegger <wg at grandegger.com> wrote:
> I'm looking for a simple method to get the package version string used
> by buildroot into the source code of that package. Unfortunately, the
> GIT version information is stripped off. For the moment, I use the name
> of the build directory and pass it to the code via Makefile, but maybe
> there is a more elegant version.
>
See package/docker-engine/docker-engine.mk for an example. Here is a
permalink;
DOCKER_ENGINE_LDFLAGS = \
-X main.GitCommit=$(DOCKER_ENGINE_VERSION) \
-X main.Version=$(DOCKER_ENGINE_VERSION)
You should use the $(MY_PACKAGE_VERSION) string as your version string.
If you want more details from "git describe" then unfortunately it's not as
easy as code often comes from a tarball exported from the source repo
rather than a full clone.
Best,
Christian Stewart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20191010/3aec3e2b/attachment.html>
More information about the buildroot
mailing list