source: trunk/version.sh @ 620

Last change on this file since 620 was 620, checked in by titer, 15 years ago

Revert [619]

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