2009-09-17 17:56:59 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
2009-09-18 19:26:34 +00:00
|
|
|
HEADER="svn_version.h"
|
|
|
|
TMPFILE="$HEADER.tmp"
|
|
|
|
|
|
|
|
echo "#ifndef SVN_VERSION_H" > $TMPFILE
|
|
|
|
echo "#define SVN_VERSION_H" >> $TMPFILE
|
|
|
|
echo "" >> $TMPFILE
|
2009-09-17 17:56:59 +00:00
|
|
|
|
2011-01-14 14:06:09 +00:00
|
|
|
if [ -d .git/svn ]; then
|
2009-09-17 17:56:59 +00:00
|
|
|
CMD="git svn info"
|
2011-01-14 14:06:09 +00:00
|
|
|
elif [ -d .git ]; then
|
|
|
|
GIT_LOG=`git log -n1 --pretty="format:%H"`
|
|
|
|
HOST=`hostname`
|
2009-09-17 17:56:59 +00:00
|
|
|
elif [ -d .svn ]; then
|
|
|
|
CMD="svn info"
|
|
|
|
else
|
|
|
|
CMD=""
|
|
|
|
fi
|
|
|
|
|
2011-01-14 14:06:09 +00:00
|
|
|
if [ "x$GIT_LOG" != "x" ]; then
|
|
|
|
echo "#define SVN_VERSION \"$GIT_LOG ($HOST:$PWD)\"" >> $TMPFILE
|
|
|
|
elif [ "x$CMD" != "x" ]; then
|
2010-11-09 18:14:15 +00:00
|
|
|
LANG=C $CMD | awk '/^URL/ { url = $2; }; \
|
2009-09-17 17:56:59 +00:00
|
|
|
/^Rev/ { rev = $2; }; \
|
|
|
|
END { print "#define SVN_VERSION \"Repository: " url \
|
2011-01-14 14:06:09 +00:00
|
|
|
" Revision: " rev "\"";
|
|
|
|
print "#define SVN_REPOSITORY \"" url "\""; \
|
|
|
|
print "#define SVN_REVISION " rev; };' \
|
2009-09-18 19:26:34 +00:00
|
|
|
>> $TMPFILE
|
2009-09-17 17:56:59 +00:00
|
|
|
else
|
2009-09-18 19:26:34 +00:00
|
|
|
echo "#include \"version.h\"" >> $TMPFILE
|
|
|
|
echo "#define SVN_VERSION BOINC_VERSION_STRING" >> $TMPFILE
|
2009-09-17 17:56:59 +00:00
|
|
|
fi
|
|
|
|
|
2009-09-18 19:26:34 +00:00
|
|
|
echo "" >> $TMPFILE
|
|
|
|
echo "#endif" >> $TMPFILE
|
|
|
|
|
|
|
|
if cmp "$HEADER" "$TMPFILE" >/dev/null 2>&1; then
|
|
|
|
rm -f "$TMPFILE"
|
|
|
|
else
|
|
|
|
mv "$TMPFILE" "$HEADER"
|
|
|
|
fi
|