Bug 487993 - Alignment error when using Eigen with Valgrind and -m32
[valgrind.git] / auxprogs / make_or_upd_vgversion_h
blobea6f068989fcc848857f7ffd691eb06ec6aefb95
1 #!/bin/sh
3 extract_git_version()
5 PREVPWD="$PWD"
6 cd "$1"
7 if [ -d ./.git ] || git rev-parse --is-inside-work-tree > /dev/null 2> /dev/null
8 then
9 REV=$(git show --format=%H#%ci -s $(git rev-parse HEAD) |
10 sed -e 's/ .*//' -e 's/[0-9a-f]\{30\}#/#/' -e 's/-//g' \
11 -e 's/#/-/')
12 X=$(git status -s -uno | sed -e 's/.*/X/' | uniq)
13 echo $REV$X
14 else
15 echo "unknown"
17 cd "$PREVPWD"
20 srcdir="${1:-.}"
22 if [ -e "$srcdir"/include/vgversion_dist.h ]
23 then
24 cp "$srcdir"/include/vgversion_dist.h include/vgversion.h.tmp
25 else
26 cat > include/vgversion.h.tmp <<EOF
27 /* Do not edit: file generated by auxprogs/make_or_upd_vgversion_h.
28 This file defines VGGIT, used to report GIT revision
29 when using command line options: -v --version
30 The produced VGGIT format is
31 hhhhhhhhhh-YYYYMMDDX
32 where hhhhhhhhhh is the first 10 characters of the HEAD commit
33 YYYYMMDD is the commit date
34 Trailing X is present if there are any (non untracked) modified files.
36 #define VGGIT "$(extract_git_version .)"
37 EOF
40 if [ -f include/vgversion.h ]
41 then
42 # There is already a vgversion.h.
43 # Update it only if we found a different and real git version
44 if grep -q unknown include/vgversion.h.tmp ||
45 cmp -s include/vgversion.h include/vgversion.h.tmp
46 then
47 rm -f include/vgversion.h.tmp
48 else
49 mv include/vgversion.h.tmp include/vgversion.h
51 else
52 # There is no vgversion.h. Use the one just generated, whatever it is.
53 mv include/vgversion.h.tmp include/vgversion.h