source: trunk/version.sh @ 2409

Last change on this file since 2409 was 2409, checked in by charles, 15 years ago

more backpedaling

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#! /bin/sh
2#
3# $Id$
4
5# constraint: strlen(MAJOR MINOR MAINT BETA) must be 4
6# convention: BETA: "Z" for a beta, "0" for a stable
7MAJOR="0"
8MINOR="7"
9MAINT="2"
10BETA="Z"
11STRING=0.80-svn
12
13# Get current SVN revision from Ids in all source files
14REV=`( find . '(' -name '*.[chm]' -o -name '*.cpp' -o -name '*.po' \
15            -o -name '*.mk' -o -name '*.in' -o -name 'Makefile' \
16            -o -name 'configure' ')' -exec cat '{}' ';' ) | \
17          sed -e '/\$Id:/!d' -e \
18            's/.*\$Id: [^ ]* \([0-9]*\) .*/\1/' |
19          awk 'BEGIN { REV=0 }
20                     { if ( $1 > REV ) REV=$1 }
21               END   { print REV }'`
22 
23# Generate files to be included: only overwrite them if changed so make
24# won't rebuild everything unless necessary
25replace_if_differs ()
26{
27    if cmp $1 $2 > /dev/null 2>&1; then
28      rm -f $1
29    else
30      mv -f $1 $2
31    fi
32}
33
34# Generate version.mk
35cat > mk/version.mk.new << EOF
36VERSION_MAJOR       = "$MAJOR"
37VERSION_MINOR       = "$MINOR"
38VERSION_MAINTENANCE = "$MAINT"
39VERSION_REVISION    = "$REV"
40VERSION_STRING      = "$MAJOR.$MINOR$MAINT$BETA (r$REV)"
41EOF
42replace_if_differs mk/version.mk.new mk/version.mk
43
44# Generate version.h
45cat > libtransmission/version.h.new << EOF
46#define VERSION_MAJOR        "$MAJOR"
47#define VERSION_MINOR        "$MINOR"
48#define VERSION_MAINTENANCE  "$MAINT"
49#define VERSION_REVISION     "$REV"
50#define VERSION_BETA         "$BETA"
51#define SHORT_VERSION_STRING "$MAJOR.$MINOR$MAINT$BETA"
52#define LONG_VERSION_STRING  "$MAJOR.$MINOR$MAINT$BETA (r$REV)"
53EOF
54replace_if_differs libtransmission/version.h.new libtransmission/version.h
55
56# Generate Info.plist from Info.plist.in
57sed -e "s/%%BUNDLE_VERSION%%/$REV/" -e "s/%%SHORT_VERSION_STRING%%/$STRING/" \
58        < macosx/Info.plist.in > macosx/Info.plist.new
59replace_if_differs macosx/Info.plist.new macosx/Info.plist
60
61exit 0
Note: See TracBrowser for help on using the repository browser.