]> granicus.if.org Git - transmission/commitdiff
(trunk) yet another stab at building version.h portably
authorCharles Kerr <charles@transmissionbt.com>
Sun, 31 May 2009 20:22:47 +0000 (20:22 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Sun, 31 May 2009 20:22:47 +0000 (20:22 +0000)
autogen.sh
configure.ac
libtransmission/version.h.in [deleted file]
update-version-h.sh [new file with mode: 0755]

index 3b2c1a476cb8cb427d9a14161d5583b513d651d2..943a8380c365deb6dcb562f7915537efe7e017b4 100755 (executable)
@@ -22,6 +22,8 @@ then
 fi
 export LIBTOOLIZE
 
+update-version-h.sh
+
 autoreconf -fi -I m4
 
 if test "$GETTEXTIZE"; then
index 404af0e3650b6ab34914b9299877db568a5096af..7bf88b212254e4cb73d056d492549110ad77c923 100644 (file)
@@ -5,14 +5,12 @@ dnl         "0" for stable, supported releases
 dnl these should be the only two lines you need to change
 m4_define([user_agent_prefix],[1.61+])
 m4_define([peer_id_prefix],[-TR161Z-])
-m4_define([svn_revision], esyscmd([sh -c "svnversion | sed -r 's/([0-9]+).*/\1/'"]))
 
 AC_INIT([transmission],
         [user_agent_prefix],
         [http://trac.transmissionbt.com/newticket])
 AC_SUBST(USERAGENT_PREFIX,[user_agent_prefix])
 AC_SUBST(PEERID_PREFIX,[peer_id_prefix])
-AC_SUBST(SVN_REVISION,[svn_revision])
 
 AC_CONFIG_MACRO_DIR([m4])
 
@@ -357,7 +355,6 @@ AC_CONFIG_FILES([Makefile
                  daemon/Makefile
                  doc/Makefile
                  libtransmission/Makefile
-                 libtransmission/version.h
                  third-party/Makefile
                  third-party/miniupnp/Makefile
                  third-party/libnatpmp/Makefile
diff --git a/libtransmission/version.h.in b/libtransmission/version.h.in
deleted file mode 100644 (file)
index 5a2f10a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#define PEERID_PREFIX         "@PEERID_PREFIX@'"
-#define USERAGENT_PREFIX      "@USERAGENT_PREFIX@'"
-#define SVN_REVISION          "@SVN_REVISION@"
-#define SVN_REVISION_NUM      @SVN_REVISION@
-#define SHORT_VERSION_STRING  "@USERAGENT_PREFIX@"
-#define LONG_VERSION_STRING   "@USERAGENT_PREFIX@ (@SVN_REVISION@)"
diff --git a/update-version-h.sh b/update-version-h.sh
new file mode 100755 (executable)
index 0000000..c85e61f
--- /dev/null
@@ -0,0 +1,29 @@
+user_agent_prefix=`grep m4_define configure.ac | sed "s/[][)(]/,/g" | grep user_agent_prefix  | cut -d , -f 6`
+
+peer_id_prefix=`grep m4_define configure.ac | sed "s/[][)(]/,/g" | grep peer_id_prefix  | cut -d , -f 6`
+
+if [ -d .svn ]; then
+    svn_revision=`svnversion | sed -r 's/([0-9]+).*/\1/' `
+else
+    svn_revision=`grep -oh '\$Id: [^ ]\+ [0-9]\+' */*\.cc */*\.cpp */*\.[chm] | cut -d ' ' -f 3 | sort | tail -n 1 -`
+fi
+
+cat > libtransmission/version.h.new << EOF
+#define PEERID_PREFIX         "${peer_id_prefix}"
+#define USERAGENT_PREFIX      "${user_agent_prefix}"
+#define SVN_REVISION          "${svn_revision}"
+#define SVN_REVISION_NUM      ${svn_revision}
+#define SHORT_VERSION_STRING  "${user_agent_prefix}"
+#define LONG_VERSION_STRING   "${user_agent_prefix} (${svn_revision})"
+EOF
+
+cmp -s libtransmission/version.h.new libtransmission/version.h
+cat libtransmission/version.h.new
+if [ $? -eq 0 ] # test exit status of "cmp" command.
+then
+  echo "no update needed to version.h"
+  rm libtransmission/version.h.new
+else  
+  echo "updated version.h"
+  mv libtransmission/version.h.new libtransmission/version.h
+fi