mirror of
https://github.com/transmission/transmission
synced 2025-03-16 08:49:47 +00:00
get both build systems (hand-written configure, and autoconf) to generate equivalent version.h headers
This commit is contained in:
parent
9542f7fe9e
commit
a9fc478955
4 changed files with 27 additions and 50 deletions
36
configure.ac
36
configure.ac
|
@ -1,6 +1,9 @@
|
|||
AC_INIT([Transmission],[0.72Z],[http://bugzilla.gnome.org/enter_bug.cgi?product=Pan])
|
||||
AC_INIT([Transmission],[0.72Z],[http://transmission.m0k.org/trac/newticket])
|
||||
PEERID_PREFIX="-TR072Z-"
|
||||
USERAGENT_PREFIX="0.72+"
|
||||
|
||||
AC_PREREQ(2.54)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
dnl AM_CONFIG_HEADER(config.h)
|
||||
AC_CONFIG_SRCDIR(libtransmission/transmission.h)
|
||||
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION)
|
||||
AM_MAINTAINER_MODE
|
||||
|
@ -183,29 +186,12 @@ dnl Version files
|
|||
|
||||
dnl constraint: strlen(MAJOR MINOR MAINT BETA) must be 4
|
||||
dnl convention: BETA: "Z" for a beta, "0" for a stable
|
||||
MAJOR="0"
|
||||
MINOR="7"
|
||||
MAINT="2"
|
||||
BETA="Z"
|
||||
STRING=0.80-svn
|
||||
REV=`svnversion -n`
|
||||
AC_SUBST(VERSION_MAJOR,[$MAJOR])
|
||||
AC_SUBST(VERSION_MINOR,[$MINOR])
|
||||
AC_SUBST(VERSION_MAINTENANCE,[$MAINT])
|
||||
AC_SUBST(VERSION_REVISION,[$REV])
|
||||
AC_SUBST(VERSION_BETA,[$BETA])
|
||||
AC_SUBST(VERSION_STRING,[$MAJOR.$MINOR$MAINT$BETA])
|
||||
AC_SUBST(VERSION_STRING_LONG,[$MAJOR.$MINOR$MAINT$BETA-r$REV])
|
||||
|
||||
dnl for macosx
|
||||
AC_SUBST(BUNDLE_VERSION,[$REV])
|
||||
dnl if it's a beta version, include the svn revision number
|
||||
if test x${BETA} = "xZ"; then
|
||||
AC_SUBST(VERSION_PACKAGE,$MAJOR.$MINOR$MAINT$BETA-r$REV)
|
||||
else
|
||||
AC_SUBST(VERSION_PACKAGE,$MAJOR.$MINOR$MAINT$BETA)
|
||||
fi
|
||||
AC_SUBST(VERSION_PACKAGE)
|
||||
SVN_REVISION=`svn info . | sed -ne "s/^Revision: \(.*\:\)\{0,1\}\(.*\)$/\2/p"`
|
||||
AC_SUBST(PEERID_PREFIX,[$PEERID_PREFIX])
|
||||
AC_SUBST(USERAGENT_PREFIX,[$USERAGENT_PREFIX])
|
||||
AC_SUBST(SVN_REVISION,[$SVN_REVISION])
|
||||
AC_SUBST(BUNDLE_VERSION,[$SVN_REVISION])
|
||||
AC_SUBST(VERSION_PACKAGE,$USERAGENT_PREFIX-r$SVN_REVISION)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,8 @@ tr_peerIdNew ( char * buf, int buflen )
|
|||
{
|
||||
int i;
|
||||
assert( buflen == TR_ID_LEN + 1 );
|
||||
snprintf( buf, TR_ID_LEN, "-TR" VERSION_MAJOR VERSION_MINOR VERSION_MAINTENANCE VERSION_BETA "-" );
|
||||
|
||||
snprintf( buf, TR_ID_LEN, "%s", PEERID_PREFIX );
|
||||
assert( strlen(buf) == 8 );
|
||||
for( i=8; i<TR_ID_LEN; ++i ) {
|
||||
const int r = tr_rand( 36 );
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#define VERSION_MAJOR "@VERSION_MAJOR@"
|
||||
#define VERSION_MINOR "@VERSION_MINOR@"
|
||||
#define VERSION_MAINTENANCE "@VERSION_MAINTENANCE@"
|
||||
#define VERSION_REVISION "@VERSION_REVISION@"
|
||||
#define VERSION_BETA "@VERSION_BETA@"
|
||||
#define SHORT_VERSION_STRING "@VERSION_STRING@"
|
||||
#define LONG_VERSION_STRING "@VERSION_STRING_LONG@"
|
||||
#define PEERID_PREFIX "@PEERID_PREFIX@"
|
||||
#define USERAGENT_PREFIX "@USERAGENT_PREFIX@"
|
||||
#define SVN_REVISION "@SVN_REVISION@"
|
||||
#define SHORT_VERSION_STRING "@USERAGENT_PREFIX@"
|
||||
#define LONG_VERSION_STRING "@USERAGENT_PREFIX@ r(@SVN_REVISION@)"
|
||||
|
|
26
version.sh
26
version.sh
|
@ -10,15 +10,9 @@ MAINT="2"
|
|||
BETA="Z"
|
||||
STRING=0.72+
|
||||
|
||||
# Get current SVN revision from Ids in all source files
|
||||
REV=`( find . '(' -name '*.[chm]' -o -name '*.cpp' -o -name '*.po' \
|
||||
-o -name '*.mk' -o -name '*.in' -o -name 'Makefile' \
|
||||
-o -name 'configure' ')' -exec cat '{}' ';' ) | \
|
||||
sed -e '/\$Id:/!d' -e \
|
||||
's/.*\$Id: [^ ]* \([0-9]*\) .*/\1/' |
|
||||
awk 'BEGIN { REV=0 }
|
||||
{ if ( $1 > REV ) REV=$1 }
|
||||
END { print REV }'`
|
||||
PEERID_PREFIX="-TR072Z-"
|
||||
USERAGENT_PREFIX="0.72+"
|
||||
SVN_REVISION=`svn info . | sed -ne "s/^Revision: \(.*\:\)\{0,1\}\(.*\)$/\2/p"`
|
||||
|
||||
# Generate files to be included: only overwrite them if changed so make
|
||||
# won't rebuild everything unless necessary
|
||||
|
@ -43,18 +37,16 @@ replace_if_differs mk/version.mk.new mk/version.mk
|
|||
|
||||
# Generate version.h
|
||||
cat > libtransmission/version.h.new << EOF
|
||||
#define VERSION_MAJOR "$MAJOR"
|
||||
#define VERSION_MINOR "$MINOR"
|
||||
#define VERSION_MAINTENANCE "$MAINT"
|
||||
#define VERSION_REVISION "$REV"
|
||||
#define VERSION_BETA "$BETA"
|
||||
#define SHORT_VERSION_STRING "$STRING"
|
||||
#define LONG_VERSION_STRING "$STRING ($REV)"
|
||||
#define PEERID_PREFIX "$PEERID_PREFIX"
|
||||
#define USERAGENT_PREFIX "$USERAGENT_PREFIX"
|
||||
#define SVN_REVISION "$SVN_REVISION"
|
||||
#define SHORT_VERSION_STRING "$USERAGENT_PREFIX"
|
||||
#define LONG_VERSION_STRING "$USERAGENT_PREFIX r($SVN_REVISION)"
|
||||
EOF
|
||||
replace_if_differs libtransmission/version.h.new libtransmission/version.h
|
||||
|
||||
# Generate Info.plist from Info.plist.in
|
||||
sed -e "s/%%BUNDLE_VERSION%%/$REV/" -e "s/%%SHORT_VERSION_STRING%%/$STRING/" \
|
||||
sed -e "s/%%BUNDLE_VERSION%%/$SVN_REVISION/" -e "s/%%SHORT_VERSION_STRING%%/$USERAGENT_PREFIX/" \
|
||||
< macosx/Info.plist.in > macosx/Info.plist.new
|
||||
replace_if_differs macosx/Info.plist.new macosx/Info.plist
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue