openssl: update to 1.0.2d
[tomato.git] / release / src / router / transmission / update-version-h.sh
blobec0d42c5b8da2f26d9fc8e57b4c0f2909fa820b3
1 #!/bin/sh
3 # Generate files to be included: only overwrite them if changed so make
4 # won't rebuild everything unless necessary
5 replace_if_differs ()
7 if cmp $1 $2 > /dev/null 2>&1; then
8 rm -f $1
9 else
10 mv -f $1 $2
14 echo "creating libtransmission/version.h"
16 user_agent_prefix=`grep m4_define configure.ac | sed "s/[][)(]/,/g" | grep user_agent_prefix | cut -d , -f 6`
18 peer_id_prefix=`grep m4_define configure.ac | sed "s/[][)(]/,/g" | grep peer_id_prefix | cut -d , -f 6`
20 major_version=`echo ${user_agent_prefix} | awk -F . '{print $1}'`
21 minor_version=`echo ${user_agent_prefix} | awk -F . '{print $2 + 0}'`
23 # If this is a svn tree, and svnversion is available in PATH, use it to
24 # grab the version.
25 if [ -d ".svn" ] && type svnversion >/dev/null 2>&1; then
26 svn_revision=`svnversion -n . | cut -d: -f1 | cut -dM -f1 | cut -dS -f1`
27 else
28 # Give up and check the source files
29 svn_revision=`awk '/\\$Id: /{ if ($4>i) i=$4 } END {print i}' */*.cc */*.[chm] */*.po`
32 cat > libtransmission/version.h.new << EOF
33 #define PEERID_PREFIX "${peer_id_prefix}"
34 #define USERAGENT_PREFIX "${user_agent_prefix}"
35 #define SVN_REVISION "${svn_revision}"
36 #define SVN_REVISION_NUM ${svn_revision}
37 #define SHORT_VERSION_STRING "${user_agent_prefix}"
38 #define LONG_VERSION_STRING "${user_agent_prefix} (${svn_revision})"
39 #define VERSION_STRING_INFOPLIST ${user_agent_prefix}
40 #define MAJOR_VERSION ${major_version}
41 #define MINOR_VERSION ${minor_version}
42 EOF
44 # Add a release definition
45 case "${peer_id_prefix}" in
46 *X-) echo '#define TR_BETA_RELEASE 1' ;;
47 *Z-) echo '#define TR_NIGHTLY_RELEASE 1' ;;
48 *) echo '#define TR_STABLE_RELEASE 1' ;;
49 esac >> "libtransmission/version.h.new"
51 replace_if_differs libtransmission/version.h.new libtransmission/version.h