1 | #! /bin/sh |
---|
2 | # |
---|
3 | # $Id: version.sh 3625 2007-10-28 23:49:49Z livings124 $ |
---|
4 | |
---|
5 | # convention: -TR MAJOR MINOR MAINT BETA - (each a single char) |
---|
6 | # BETA: "Z" for beta, "0" for stable |
---|
7 | # these should be the only two lines you need to change |
---|
8 | PEERID_PREFIX="-TR0910-" |
---|
9 | USERAGENT_PREFIX="0.91" |
---|
10 | |
---|
11 | |
---|
12 | SVN_REVISION=`find ./ -name "*\.[ch]" -o -name "*\.cpp" -o -name "*\.po" | \ |
---|
13 | xargs grep "\$Id:" | \ |
---|
14 | grep -v third-party | \ |
---|
15 | cut -d"$Id:" -f3 | cut -d" " -f3 | sort -n | tail -n 1` |
---|
16 | |
---|
17 | if test "x${PEERID_PREFIX//Z/}" = "x$PEERID_PREFIX"; |
---|
18 | then |
---|
19 | STABLE_RELEASE=yes |
---|
20 | else |
---|
21 | STABLE_RELEASE=no |
---|
22 | fi |
---|
23 | |
---|
24 | # Generate files to be included: only overwrite them if changed so make |
---|
25 | # won't rebuild everything unless necessary |
---|
26 | replace_if_differs () |
---|
27 | { |
---|
28 | if cmp $1 $2 > /dev/null 2>&1; then |
---|
29 | rm -f $1 |
---|
30 | else |
---|
31 | mv -f $1 $2 |
---|
32 | fi |
---|
33 | } |
---|
34 | |
---|
35 | # Generate version.mk |
---|
36 | cat > macosx/version.mk.new << EOF |
---|
37 | VERSION_REVISION = "$SVN_REVISION" |
---|
38 | VERSION_STRING = "$USERAGENT_PREFIX ($SVN_REVISION)" |
---|
39 | STABLE_RELEASE = "$STABLE_RELEASE" |
---|
40 | EOF |
---|
41 | replace_if_differs macosx/version.mk.new macosx/version.mk |
---|
42 | |
---|
43 | # Generate version.h |
---|
44 | cat > libtransmission/version.h.new << EOF |
---|
45 | #define PEERID_PREFIX "$PEERID_PREFIX" |
---|
46 | #define USERAGENT_PREFIX "$USERAGENT_PREFIX" |
---|
47 | #define SVN_REVISION "$SVN_REVISION" |
---|
48 | #define SHORT_VERSION_STRING "$USERAGENT_PREFIX" |
---|
49 | #define LONG_VERSION_STRING "$USERAGENT_PREFIX ($SVN_REVISION)" |
---|
50 | EOF |
---|
51 | replace_if_differs libtransmission/version.h.new libtransmission/version.h |
---|
52 | |
---|
53 | # Generate Info.plist from Info.plist.in |
---|
54 | sed -e "s/%%BUNDLE_VERSION%%/$SVN_REVISION/" -e "s/%%SHORT_VERSION_STRING%%/$USERAGENT_PREFIX/" \ |
---|
55 | < macosx/Info.plist.in > macosx/Info.plist.new |
---|
56 | replace_if_differs macosx/Info.plist.new macosx/Info.plist |
---|
57 | |
---|
58 | exit 0 |
---|