source: trunk/version.sh @ 265

Last change on this file since 265 was 265, checked in by titer, 16 years ago

Split and moved makefiles into a seperate folder, fixes and speed-up to
the retrieving of the SVN revision, OS X packages now show the revision
if this isn't a release build

  • Property svn:executable set to *
  • Property svn:keywords set to Date Rev Author Id
File size: 1.0 KB
Line 
1#! /bin/sh
2#
3# $Id: version.sh 265 2006-05-31 12:54:53Z titer $
4
5# Get current SVN revision from Ids in all source files
6REVMAX=0
7for pattern in '*.[chm]' '*.cpp' '*.po' '*.mk'; do
8  for f in `find . -name "$pattern"` Makefile configure; do 
9    REV=`sed -e '/\$Id:/!d; s/.*\$Id: version.sh 265 2006-05-31 12:54:53Z titer $f`
10    if [ -n "$REV" ]; then
11      if [ "$REV" -gt "$REVMAX" ]; then
12        REVMAX="$REV"
13      fi
14    fi
15  done
16done
17
18# Generate files to be included: only overwrite them if changed so make
19# won't rebuild everything unless necessary
20replace_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.mk
30cp -f mk/version.mk.in mk/version.mk.new
31echo "VERSION_REVISION = $REVMAX" >> mk/version.mk.new
32replace_if_differs mk/version.mk.new mk/version.mk
33
34# Generate version.h from version.mk
35grep "^VER" mk/version.mk | sed -e 's/^/#define /g' -e 's/= //g' \
36    -e 's/\(VERSION_STRING[ ]*\)\(.*\)/\1"\2"/' > \
37    libtransmission/version.h.new
38replace_if_differs libtransmission/version.h.new libtransmission/version.h
39
40exit 0
Note: See TracBrowser for help on using the repository browser.