1 | #!/bin/sh
|
---|
2 | # Meant to be called as: sh ./generate-vers-cpp.sh "$$VERSION"
|
---|
3 | # from libmyth.pro
|
---|
4 |
|
---|
5 | VERSION="Release $1"
|
---|
6 |
|
---|
7 | #
|
---|
8 | # svnversion ../.. would be must more precise, but much slower
|
---|
9 | # svn info tell revision checked out in THIS directory
|
---|
10 | # svnversion checks the whole repository, detects mixed
|
---|
11 | # check-outs, etc.
|
---|
12 | #
|
---|
13 | # On my machine, svn info takes 0.065 seconds (first time),
|
---|
14 | # svnversion 8.045 seconds (first time). Subsequent runs are much
|
---|
15 | # faster due to caching (0.010 and 0.283, respectively), but I do not
|
---|
16 | # believe represent the common case.
|
---|
17 | #
|
---|
18 | # In any case, here's the alternative to the line below if we want to
|
---|
19 | # use svnversion (could, in theory, make this a configuration option):
|
---|
20 | #SVNVERSION="`svnversion ../..`"
|
---|
21 |
|
---|
22 | SVNVERSION="`svn info . 2>/dev/null | grep Revision | awk '{print $2}'`"
|
---|
23 | if [ "$SVNVERSION" ]
|
---|
24 | then
|
---|
25 | VERSION="$VERSION, SVN Rev $SVNVERSION"
|
---|
26 | fi
|
---|
27 |
|
---|
28 | cat > vers.cpp <<EOF
|
---|
29 | #include "vers.h"
|
---|
30 |
|
---|
31 | const char *myth_source_version = "$VERSION";
|
---|
32 | EOF
|
---|
33 |
|
---|