source: trunk/update-version-h.sh @ 8572

Last change on this file since 8572 was 8572, checked in by charles, 13 years ago

(trunk) yet another stab at building version.h portably

  • Property svn:executable set to *
File size: 1.1 KB
Line 
1user_agent_prefix=`grep m4_define configure.ac | sed "s/[][)(]/,/g" | grep user_agent_prefix  | cut -d , -f 6`
2
3peer_id_prefix=`grep m4_define configure.ac | sed "s/[][)(]/,/g" | grep peer_id_prefix  | cut -d , -f 6`
4
5if [ -d .svn ]; then
6    svn_revision=`svnversion | sed -r 's/([0-9]+).*/\1/' `
7else
8    svn_revision=`grep -oh '\$Id: [^ ]\+ [0-9]\+' */*\.cc */*\.cpp */*\.[chm] | cut -d ' ' -f 3 | sort | tail -n 1 -`
9fi
10
11cat > libtransmission/version.h.new << EOF
12#define PEERID_PREFIX         "${peer_id_prefix}"
13#define USERAGENT_PREFIX      "${user_agent_prefix}"
14#define SVN_REVISION          "${svn_revision}"
15#define SVN_REVISION_NUM      ${svn_revision}
16#define SHORT_VERSION_STRING  "${user_agent_prefix}"
17#define LONG_VERSION_STRING   "${user_agent_prefix} (${svn_revision})"
18EOF
19
20cmp -s libtransmission/version.h.new libtransmission/version.h
21cat libtransmission/version.h.new
22if [ $? -eq 0 ] # test exit status of "cmp" command.
23then
24  echo "no update needed to version.h"
25  rm libtransmission/version.h.new
26else 
27  echo "updated version.h"
28  mv libtransmission/version.h.new libtransmission/version.h
29fi
Note: See TracBrowser for help on using the repository browser.