source: trunk/version.sh @ 1036

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

Tweaked version.sh (much faster on BeOS)

  • 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 1036 2006-10-28 16:51:28Z titer $
4
5# Get current SVN revision from Ids in all source files
6REVMAX=`( find . '(' -name '*.[chm]' -o -name '*.cpp' -o -name '*.po' \
7            -o -name '*.mk' -o -name '*.in' -o -name 'Makefile' \
8            -o -name 'configure' ')' -exec cat '{}' ';' ) | \
9          sed -e '/\$Id:/!d' -e \
10            's/.*\$Id: [^ ]* \([0-9]*\) .*/\1/' |
11          awk 'BEGIN { REV=0 }
12               //    { if ( $1 > REV ) REV=$1 }
13               END   { print REV }'`
14 
15# Generate files to be included: only overwrite them if changed so make
16# won't rebuild everything unless necessary
17replace_if_differs ()
18{
19    if cmp $1 $2 > /dev/null 2>&1; then
20      rm -f $1
21    else
22      mv -f $1 $2
23    fi
24}
25
26# Generate version.mk
27cp -f mk/version.mk.in mk/version.mk.new
28echo "VERSION_REVISION = $REVMAX" >> mk/version.mk.new
29replace_if_differs mk/version.mk.new mk/version.mk
30
31# Generate version.h from version.mk
32grep "^VER" mk/version.mk | sed -e 's/^/#define /g' -e 's/= //g' \
33    -e 's/\(VERSION_STRING[ ]*\)\(.*\)/\1"\2"/' > \
34    libtransmission/version.h.new
35replace_if_differs libtransmission/version.h.new libtransmission/version.h
36
37exit 0
Note: See TracBrowser for help on using the repository browser.