unix build system: generate_svn_version

- generate version string from plain git repositories, too (from Oliver)
- define SVN_REPOSITORY (URL) and SVN_REVISION (numerical) separately
so these could be used in proprocessor directives

svn path=/trunk/boinc/; revision=22905
This commit is contained in:
Bernd Machenschalk 2011-01-14 14:06:09 +00:00
parent a64d88aaa5
commit 6a1c7cf4ac
2 changed files with 18 additions and 3 deletions

View File

@ -144,3 +144,11 @@ Rom 13 Jan 2010
clientgui/
sg_DlgMessages.cpp
sg_DlgPreferences.cpp
Bernd 14 Jan 2011
- unix build system: generate_svn_version
- generate version string from plain git repositories, too
- define SVN_REPOSITORY (URL) and SVN_REVISION (numerical) separately
so these could be used in proprocessor directives
generate_svn_version.sh

View File

@ -7,19 +7,26 @@ echo "#ifndef SVN_VERSION_H" > $TMPFILE
echo "#define SVN_VERSION_H" >> $TMPFILE
echo "" >> $TMPFILE
if [ -d .git ]; then
if [ -d .git/svn ]; then
CMD="git svn info"
elif [ -d .git ]; then
GIT_LOG=`git log -n1 --pretty="format:%H"`
HOST=`hostname`
elif [ -d .svn ]; then
CMD="svn info"
else
CMD=""
fi
if [ "x$CMD" != "x" ]; then
if [ "x$GIT_LOG" != "x" ]; then
echo "#define SVN_VERSION \"$GIT_LOG ($HOST:$PWD)\"" >> $TMPFILE
elif [ "x$CMD" != "x" ]; then
LANG=C $CMD | awk '/^URL/ { url = $2; }; \
/^Rev/ { rev = $2; }; \
END { print "#define SVN_VERSION \"Repository: " url \
" Revision: " rev "\""; };' \
" Revision: " rev "\"";
print "#define SVN_REPOSITORY \"" url "\""; \
print "#define SVN_REVISION " rev; };' \
>> $TMPFILE
else
echo "#include \"version.h\"" >> $TMPFILE