1 | #! /bin/sh |
---|
2 | # |
---|
3 | # $Id: version.sh 7890 2009-02-13 22:48:46Z livings124 $ |
---|
4 | |
---|
5 | # convention: -TR MAJOR MINOR MAINT STATUS - (each a single char) |
---|
6 | # STATUS: "X" for prerelease beta builds, |
---|
7 | # "Z" for unsupported trunk builds, |
---|
8 | # "0" for stable, supported releases |
---|
9 | # these should be the only two lines you need to change |
---|
10 | PEERID_PREFIX="-TR150Z-" |
---|
11 | USERAGENT_PREFIX="1.50+" |
---|
12 | |
---|
13 | SVN_REVISION=`find -E ./libtransmission ./macosx \ |
---|
14 | -regex ".*\.([chmp]|cpp|po|sh)" \ |
---|
15 | -exec grep -oh '\$Id: [^ ]\+ [0-9]\+' {} + \ |
---|
16 | | awk '{ if ($3 > max) max = $3} END { print max }'` |
---|
17 | |
---|
18 | # Generate files to be included: only overwrite them if changed so make |
---|
19 | # won't rebuild everything unless necessary |
---|
20 | replace_if_differs () |
---|
21 | { |
---|
22 | if cmp $1 $2 > /dev/null 2>&1; then |
---|
23 | rm -f $1 |
---|
24 | else |
---|
25 | mv -f $1 $2 |
---|
26 | fi |
---|
27 | } |
---|
28 | |
---|
29 | # Generate version.h |
---|
30 | cat > libtransmission/version.h.new << EOF |
---|
31 | #define PEERID_PREFIX "$PEERID_PREFIX" |
---|
32 | #define USERAGENT_PREFIX "$USERAGENT_PREFIX" |
---|
33 | #define SVN_REVISION "$SVN_REVISION" |
---|
34 | #define SHORT_VERSION_STRING "$USERAGENT_PREFIX" |
---|
35 | #define LONG_VERSION_STRING "$USERAGENT_PREFIX ($SVN_REVISION)" |
---|
36 | |
---|
37 | #define VERSION_STRING_INFOPLIST $USERAGENT_PREFIX |
---|
38 | #define BUNDLE_VERSION_INFOPLIST $SVN_REVISION |
---|
39 | EOF |
---|
40 | |
---|
41 | # Add a release definition |
---|
42 | if [ ${PEERID_PREFIX:6:1} = X ]; then |
---|
43 | line='#define TR_BETA_RELEASE "BETA"' |
---|
44 | elif [ ${PEERID_PREFIX:6:1} = Z ]; then |
---|
45 | line='#define TR_NIGHTLY_RELEASE "NIGHTLY"' |
---|
46 | else |
---|
47 | line='#define TR_STABLE_RELEASE "STABLE"' |
---|
48 | fi |
---|
49 | echo $line >> libtransmission/version.h.new |
---|
50 | |
---|
51 | replace_if_differs libtransmission/version.h.new libtransmission/version.h |
---|
52 | |
---|
53 | exit 0 |
---|