Get revision at build time

This commit is contained in:
Eric Petit 2006-05-29 21:58:22 +00:00
parent dcf162259c
commit cab7c2a50a
6 changed files with 36 additions and 8 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
/.depend
/Makefile.config
/Makefile.version
Transmission.xcodeproj/*.mode1
Transmission.xcodeproj/*.pbxuser
beos/.depend

View File

@ -1,12 +1,13 @@
# $Id$
-include Makefile.config
include Makefile.common
ifndef CONFIGURE_RUN
$(error You must run ./configure first)
endif
-include Makefile.version
include Makefile.common
ifneq ($(SYSTEM),Darwin)
TARGETS = .cli
@ -19,7 +20,7 @@ endif
all: $(TARGETS)
.lib:
.lib: .version
@echo "* Building libtransmission"
@$(MAKE) -C libtransmission
@ -59,7 +60,7 @@ endif
else
all:
all: .version
@$(MAKE) -C macosx
@xcodebuild -alltargets -activeconfiguration | grep -v "^$$"
@ -97,3 +98,9 @@ package-release:
$(PACKAGE_RULE2)
endif
Makefile.version: .version
.version:
@echo "Checking SVN revision..."
@./version.sh

View File

@ -1,6 +1,7 @@
# $Id$
include ../Makefile.config
include ../Makefile.version
include ../Makefile.common
SRCS = transmissioncli.c

3
configure vendored
View File

@ -18,8 +18,6 @@ CXX="${CXX-c++}"
CXXFLAGS="${CXXFLAGS}"
LDFLAGS="${LDFLAGS}"
SVNREV="`echo '$Rev$' | sed 's/[^0-9]*//g'`"
#
# Functions
#
@ -291,7 +289,6 @@ lrintf_test
rm -f Makefile.config
cat > Makefile.config << EOF
CONFIGURE_RUN = yes
SVN_REVISION = $SVNREV
SYSTEM = $SYSTEM
PREFIX = $PREFIX
LOCALEDIR = $LOCALEDIR

View File

@ -1,9 +1,10 @@
# $Id$
include ../Makefile.config
include ../Makefile.version
include ../Makefile.common
Info.plist: Info.plist.in ../Makefile.common
Info.plist: Info.plist.in ../Makefile.version ../Makefile.common
$(RM) $@
sed "s/%%VERSION%%/$(VERSION_STRING)/g" < $< > $@

21
version.sh Executable file
View File

@ -0,0 +1,21 @@
#! /bin/sh
#
# $Id$
REVMAX=0
for pattern in '*.[chm]' '*.cpp' '*.po' 'Makefile*' 'configure' 'version.sh'; do
for f in `find . -name "$pattern"`; do
REV=`grep '\$Id:' $f | sed 's/.*\$Id: [^ ]* \([0-9]*\) .*/\1/'`
if [ -n "$REV" ]; then
if [ "$REV" -gt "$REVMAX" ]; then
REVMAX="$REV"
fi
fi
done
done
rm -f Makefile.version
echo "SVN_REVISION = $REVMAX" > Makefile.version
exit 0