[Buildroot] [RFC] iputils (meson build system) has git version from buildroot instead of iputils
Fabrice Fontaine
fontaine.fabrice at gmail.com
Tue May 10 21:47:27 UTC 2022
Hi Petr,
Le mar. 10 mai 2022 à 22:16, Petr Vorel <petr.vorel at gmail.com> a écrit :
>
> Hi all,
>
> meson.build [1] uses git-version.h.meson [2] to produce BUILD_DIRECTORY/git-version.h.
>
> Building from sources (not in Buildroot) it works:
> $ head -1 builddir/git-version.h
> #define PACKAGE_VERSION "20211215-15-g309f285"
>
> But building in Buildroot it gets git version from Buildroot:
> $ head -1 output/build/iputils-20211215/build/git-version.h
> #define PACKAGE_VERSION "2022.02-876-g3ef096786a"
>
> Is it a bug in iputils or in Buildroot meson?
This issue is raised because, in the context of buildroot, iputils is
retrieved as a tarball, not a git clone.
So meson's vcs_tag will retrieve the git information from buildroot
and will not use its fallback (i.e. meson.project_version()).
To fix it, there is three "simple" options:
- allow buildroot to configure the version (as already done in
open62541 package)
- don't use vcs_tag and always set package_version to
meson.project_version() outside of a "devel" mode as done for example
in gnome console [1]
- override the default vcs command in vcs_tag call (e.g. command:
'git --git-dir=.git describe --dirty=+')
Another option would be to patch meson so vcs_tag is always run with
"--git-dir=.git".
This is probably the more correct option as this issue is probably
affecting other packages than iputils.
However, from my experience in meson, getting something merged
upstream can take a very very long time (e.g. more than two years for
a prefer_static option [2])
I don't know if this is completely related but this issue on vcs_tag
is opened for more than one year [3] ...
> Any idea how to fix it?
>
> Kind regards,
> Petr
>
> [1] https://github.com/iputils/iputils/blob/master/meson.build#L14
> [2] https://github.com/iputils/iputils/blob/master/git-version.h.meson
Best Regards,
Fabrice
[1] https://gitlab.gnome.org/GNOME/console/-/blob/main/meson.build#L35
[2] https://github.com/mesonbuild/meson/pull/6629
[3] https://github.com/mesonbuild/meson/issues/8567
More information about the buildroot
mailing list