]> git.sesse.net Git - vlc/blobdiff - toolbox
* new Korean translation by Han HoJoong <0demon0@paran.com>
[vlc] / toolbox
diff --git a/toolbox b/toolbox
index 5911747227232a1d23c83e89ed9803bedd847dd2..5fc742046613c2ec41859de316dd06e929d1c05b 100755 (executable)
--- a/toolbox
+++ b/toolbox
@@ -28,6 +28,7 @@ recognized flags are:
   --update-vc             update Microsoft Visual Studio files
   --update-po             update translation files
   --update-includes       generate various include files
+  --update-version        generate src/misc/version.c
   --update-glade          generate and fix Glade code
   --update-glade2         generate and fix Glade 2 code
   --update-flexml         generate and fix flexml and flex code
@@ -71,6 +72,9 @@ case "$1" in
   --update-includes)
     action=includes
     ;;
+  --update-version)
+    action=version
+    ;;
   --update-flexml)
     action=flexml
     ;;
@@ -138,8 +142,7 @@ then
   fi
 
   #  The evil ^M. printf '\r' does not work in Cygwin.
-  M='
-'
+  M='\r'
 
   #  Variables we get from configure.ac
   LIBVLC_VERSION=`sed -ne '/AC_INIT/s/.*,\(.*\))/\1/p' < configure.ac`
@@ -425,6 +428,49 @@ then
   exit 0
 fi
 
+##
+##  Create version file
+##
+if test "${action}" = "version"
+then
+  if test -z "${srcdir}"; then
+    srcdir="`sed -ne 's/^srcdir *= *//p' < Makefile`"
+  fi
+  if test -z "${builddir}"; then
+    builddir="`sed -ne 's/^top_builddir *= *//p' < Makefile`"
+  fi
+  if test -z "${CC}"; then
+    CC="`sed -ne 's/^CC *= *//p' < Makefile`"
+  fi
+
+  file="${builddir}/src/misc/version.c"
+  if which svnversion 2>&1 >/dev/null; then
+    VLC_CHANGESET=`svnversion $srcdir`
+  else
+    VLC_CHANGESET='exported'
+  fi
+
+  rm -f ${file}.tmp
+  cat > ${file}.tmp << EOF
+/* DO NOT EDIT THIS FILE - IT IS REGENERATED AT EVERY COMPILE -
+ * IT GIVES BETTER TRACKING OF VLC STABLE AND DEVELOPMENT VERSIONS
+ * WHETHER THEY ARE BUILT BY OTHERS OR DURING DEVELOPMENT OR FOR THE
+ * OFFICIAL VLC STABLE RELEASES.
+ */
+const char psz_vlc_changeset[] = "${VLC_CHANGESET}";
+
+EOF
+  if diff >/dev/null 2>&1 ${file} ${file}.tmp
+  then
+    rm -f ${file}.tmp
+  else
+    echo "creating new ${file}"
+    mv -f ${file}.tmp ${file}
+  fi
+
+  exit 0
+fi
+
 ##
 ##  Fix glade-generated files
 ##