[PATCH util-macros] XORG_GIT_MODULE_VERSION: writes module version in xorg-git-version.h

Julien Cristau jcristau at debian.org
Mon Apr 19 14:00:08 PDT 2010


On Mon, Apr 19, 2010 at 14:52:55 -0400, Gaetan Nadon wrote:

> Generates the git module version according to the "git describe HEAD"
> If the git module has pending changes, it appends "-dirty" to the version tag
> 
> Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
> ---
>  xorg-macros.m4.in |   18 ++++++++++++++++++
>  1 files changed, 18 insertions(+), 0 deletions(-)
> 
> diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
> index 916b472..efb2e53 100644
> --- a/xorg-macros.m4.in
> +++ b/xorg-macros.m4.in
> @@ -1009,3 +1009,21 @@ mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
>  echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)"
>  AC_SUBST([INSTALL_CMD])
>  ]) # XORG_INSTALL
> +
> +# XORG_GIT_MODULE_VERSION()
> +# -------------------------
> +# Minimum version: 1.8.0
> +#
> +# Generates the git module version according to the "git describe HEAD"
> +# If the git module has pending changes, it appends "-dirty" to the version tag
> +#
> +AC_DEFUN([XORG_GIT_MODULE_VERSION], [
> +GIT_MODULE_VERSION_CMD="VER=\`GIT_DIR=\$(top_srcdir)/.git git describe HEAD 2>/dev/null\`; \
> +DVER=\`GIT_DIR=\$(top_srcdir)/.git git diff-index HEAD 2>/dev/null\`; \
> +OUTSTR=\"\#undef XORG_GIT_VERSION\" ; \
> +OUTFILE=\"xorg-git-version.h\"; \
> +test -n \"\$\$VER\" && OUTSTR=\"\#define XORG_GIT_VERSION \$\$VER\" && test -n \"\$\$DVER\" && OUTSTR=\"\#define XORG_GIT_VERSION \$\$VER-dirty\"; \
> +test -e \"\$\$OUTFILE\" || echo \"\$\$OUTSTR\" > \"\$\$OUTFILE\"; \
> +CONTENT=\`cat \$\$OUTFILE\` && test \"\$\$CONTENT\" = \"\$\$OUTSTR\" || echo \$\$OUTSTR > \$\$OUTFILE;"
> +AC_SUBST([GIT_MODULE_VERSION_CMD])
> +]) # XORG_GIT_MODULE_VERSION

As I said in reply to the initial patch by Peter I'd like a way to
disable this, because packages might be built from a git tree, which
might be unrelated to the xorg one, or outside of any git tree.  What's
the output like if not building from git?  Does 'make
GIT_MODULE_VERSION_CMD=:' work to disable it (I guess not, because
anything trying to include xorg-git-version.h will be unhappy)?

Other than that, I guess it looks about as nasty as an automake macro
usually looks...  I wish it was more readable, still, there are too many
\s here for my liking...

Cheers,
Julien


More information about the xorg-devel mailing list