[Mesa-dev] [PATCH mesa] build systems: uniformize git_sha1.h generation

Eric Engestrom eric at engestrom.ch
Tue Jun 27 17:23:36 UTC 2017


On 27 June 2017 18:11:14 BST, Matt Turner <mattst88 at gmail.com> wrote:
> On Tue, Jun 27, 2017 at 5:47 AM, Eric Engestrom
> <eric.engestrom at imgtec.com> wrote:
> > Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
> > ---
> > Note: Autotools and SCons are tested, but Android isn't.
> > ---
> >  git_sha1_gen.sh                      | 13 +++++++++++++
> >  src/Makefile.am                      | 13 +------------
> >  src/SConscript                       | 28
> ++++++++--------------------
> >  src/mesa/Android.libmesa_git_sha1.mk |  7 +------
> >  4 files changed, 23 insertions(+), 38 deletions(-)
> >  create mode 100755 git_sha1_gen.sh
> >
> > diff --git a/git_sha1_gen.sh b/git_sha1_gen.sh
> > new file mode 100755
> > index 0000000000..9630067be0
> > --- /dev/null
> > +++ b/git_sha1_gen.sh
> > @@ -0,0 +1,13 @@
> > +#!/usr/bin/env bash
> > +set -eu
> > +
> > +# run git from the sources directory
> > +cd "$(dirname "${BASH_SOURCE[0]}")"
> > +
> > +# don't print anything if git fails
> > +if ! git_sha1=$(git rev-parse --short=10 HEAD)
> > +then
> > +  exit
> > +fi
> > +
> > +printf '#define MESA_GIT_SHA1 "git-%s"\n' "$git_sha1"
> > diff --git a/src/Makefile.am b/src/Makefile.am
> > index df912c442a..e49b3bd9cf 100644
> > --- a/src/Makefile.am
> > +++ b/src/Makefile.am
> > @@ -21,18 +21,7 @@
> >
> >  .PHONY: git_sha1.h.tmp
> >  git_sha1.h.tmp:
> > -       @# Don't assume that $(top_srcdir)/.git is a directory. It
> may be
> > -       @# a gitlink file if $(top_srcdir) is a submodule checkout
> or a linked
> > -       @# worktree.
> > -       @# If we are building from a release tarball copy the
> bundled header.
> > -       @touch git_sha1.h.tmp
> > -       @if test -e $(top_srcdir)/.git; then \
> > -               if which git > /dev/null; then \
> > -                       printf '#define MESA_GIT_SHA1 "git-%s"\n' \
> > -                       `git --git-dir=$(top_srcdir)/.git rev-parse
> --short=10 HEAD` \
> > -                       > git_sha1.h.tmp ; \
> > -               fi \
> > -       fi
> 
> The purpose of the .tmp file is to prevent unnecessary rebuilds (and
> relinks) when the SHA1 doesn't change.
> 
> It looks like you're removing that?

It's still there, you just snipped the quote one line too soon :)

> > + @bash $(top_srcdir)/git_sha1_gen.sh > $@


More information about the mesa-dev mailing list