forked from STJr/SRB2-Public
-
Notifications
You must be signed in to change notification settings - Fork 0
/
comptime.sh
executable file
·50 lines (42 loc) · 902 Bytes
/
comptime.sh
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh -e
path="."
if [ x"$1" != x ]; then
path="$1"
fi
versiongit() {
gitversion=`git svn log HEAD --limit=1 --oneline | cut -f 1 -d " "`
cat <<EOF > $path/comptime.h
// Do not edit! This file was autogenerated
// by the $0 script with git svn
//
const char* comprevision = "$gitversion";
EOF
exit 0
}
versionsvn() {
svnrevision=`svnversion -n $1`
cat <<EOF > $path/comptime.h
// Do not edit! This file was autogenerated
// by the $0 script with subversion
//
const char* comprevision = "r$svnrevision";
EOF
exit 0
}
versionfake() {
cat <<EOF > $path/comptime.h
// Do not edit! This file was autogenerated
// by the $0 script with an unknown or nonexist SCM
//
const char* comprevision = "illegal";
EOF
}
compversion() {
touch $path/comptime.c
versionfake
test -d $path/.svn && versionsvn
test -d $path/../.git && versiongit
exit 1
}
test -f $path/comptime.c && compversion
exit 2