File: mkversionheader.sh

package info (click to toggle)
gap 4r8p6-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 33,476 kB
  • ctags: 7,663
  • sloc: ansic: 108,841; xml: 47,807; sh: 3,628; perl: 2,342; makefile: 796; asm: 62; awk: 6
file content (29 lines) | stat: -rwxr-xr-x 664 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh -ex

TMP="$1".tmp
DST="$1"

# Determine build version and date
GAP_BUILD_VERSION="4.8.6, 12-Nov-2016, build"
if command -v git >/dev/null 2>&1 ; then
  if test -d .git ; then
    GAP_BUILD_VERSION=`git describe --tags --dirty || echo`
  fi
fi
GAP_BUILD_DATE=`env LANG=C TZ=UTC date -d"@$SOURCE_DATE_EPOCH"  +"%Y-%m-%d %H:%M:%S (%Z)"`

# Generate the file
cat > "$TMP" <<EOF
#ifndef GAP_BUILD_VERSION
#define GAP_BUILD_VERSION  "$GAP_BUILD_VERSION"
#define GAP_BUILD_DATETIME "$GAP_BUILD_DATE"
#endif
EOF

# Only copy the header over if there were any changes, to
# avoid pointless recompiles.
if ! cmp -s $TMP $DST ; then
  cp "$TMP" "$DST"
fi;

rm $TMP