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