]> git.sesse.net Git - vlc/blobdiff - toolbox
Due credits
[vlc] / toolbox
diff --git a/toolbox b/toolbox
index 8658372b9f6b9b0775b04352a0c4eaf79eee663a..711c18b1f0ed7458d752600547b25974f79e8088 100755 (executable)
--- a/toolbox
+++ b/toolbox
@@ -3,7 +3,10 @@
 ##  toolbox for the VLC media player
 ##  $Id$
 ##
+##  Copyright (C) 2005  the VideoLAN team
+##
 ##  Authors: Samuel Hocevar <sam@zoy.org>
+##           RĂ©mi Denis-Courmont <rem # videolan.org>
 
 ###
 ###  Get a sane environment, just in case
@@ -25,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
@@ -68,6 +72,9 @@ case "$1" in
   --update-includes)
     action=includes
     ;;
+  --update-version)
+    action=version
+    ;;
   --update-flexml)
     action=flexml
     ;;
@@ -135,7 +142,8 @@ then
   fi
 
   #  The evil ^M. printf '\r' does not work in Cygwin.
-  M='\r'
+  M='
+'
 
   #  Variables we get from configure.ac
   LIBVLC_VERSION=`sed -ne '/AC_INIT/s/.*,\(.*\))/\1/p' < configure.ac`
@@ -367,27 +375,9 @@ fi
 if test "${action}" = "po"
 then
   # find out the source files
-  rm -f po/POTFILES.in
-  echo "# automatically created by toolbox --update-po" > po/POTFILES.in
-  echo "" >> po/POTFILES.in
-  echo "# main sources" >> po/POTFILES.in
-  find include src -name '*.[chm]' -o -name '*.[ch]pp' \
-    | grep -v '\(vlc_symbols\|misc/modules_\)' \
-    | sort >> po/POTFILES.in
-  echo "" >> po/POTFILES.in
-  echo "# modules" >> po/POTFILES.in
-  find modules -name '*.[chm]' -o -name '*.[ch]pp' \
-    | grep -v '\(\.moc\.\|gui/gtk2/\)' \
-    | sort >> po/POTFILES.in
-  # clean old potfiles
-  cd po
-  rm -f vlc.pot
-  # update
-  make vlc.pot || exit 1
-  make update-po || exit 1
-  cd ..
-
-  exit 0
+  echo "WARNING: you should run \"make update-po\" instead!" >&2
+  make update-po
+  exit $?
 fi
 
 ##
@@ -439,6 +429,48 @@ 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
+
+  VLC_COMPILE_TIME=`LC_ALL=C LANG=C date`
+  VLC_COMPILE_BY=`whoami`
+  VLC_COMPILE_HOST=`hostname`
+  VLC_COMPILE_DOMAIN=`dnsdomainname 2>/dev/null || domainname 2>/dev/null || echo unknown`
+  VLC_COMPILER=`$CC -v 2>&1 | tail -n 1`
+  if which svnversion 2>&1 >/dev/null; then
+    VLC_CHANGESET=`svnversion $srcdir`
+  else
+    VLC_CHANGESET='exported'
+  fi
+
+  cat >| src/misc/version.c << EOF
+/* DO NOT EDIT THIS FILE - IT IS REGENERATED AT EVERY COMPILE -
+ * IT GIVES BETTER TRACKING OFF VLC STABLE AND DEVELOPMENT VERSIONS
+ * WETHER THEY ARE BUILD BY OTHERS OR DURING DEVELOPMENT OR FOR THE
+ * OFFICIAL VLC STABLE RELEASES.
+ */
+const char psz_vlc_compile_time[] = "${VLC_COMPILE_TIME}";
+const char psz_vlc_compile_by[] = "${VLC_COMPILE_BY}";
+const char psz_vlc_compile_host[] = "${VLC_COMPILE_HOST}";
+const char psz_vlc_compile_domain[] = "${VLC_COMPILE_DOMAIN}";
+const char psz_vlc_compiler[] = "${VLC_COMPILER}";
+const char psz_vlc_changeset[] = "${VLC_CHANGESET}";
+
+EOF
+fi
+
 ##
 ##  Fix glade-generated files
 ##
@@ -537,12 +569,12 @@ then
   # a naive sanity check to make sure we are in a VLC tree
   test -f vlc.spec.mdk -a -f debian/rules || exit 1
   # let's rock!
-  find . -type f '(' -name '*.[oa]' -o -name '*.so' -o -name '*.sl' -o -name '*.dylib' -o -name '*.dll' -o -name .dirstamp -o -name Makefile.in -o -name 'stamp-h*' -o -name '*~' -o -name '*.bak' -o -name '*.moc.cpp' ')' -exec rm -f '{}' ';'
+  find . -type f '(' -name '*.[oa]' -o -name '*.so' -o -name '*.sl' -o -name '*.dylib' -o -name '*.dll' -o -name .dirstamp -o '(' '(' ! -path '\./doc/developer/Makefile\.in' ')' -a -name Makefile.in ')' -o -name 'stamp-h*' -o -name '*~' -o -name '*.bak' -o -name '*.moc.cpp' ')' -exec rm -f '{}' ';'
   (cd autotools && find . -name '[a-z]*' -maxdepth 1 -exec rm -f '{}' ';')
-  (cd debian && find . -type d -name '[a-z]*' -maxdepth 1 -exec rm -Rf '{}' ';')
+  (cd debian && find . -type d '(' -name '[a-z]*' ! -name 'patches' ')' -maxdepth 1 -exec rm -Rf '{}' ';')
   find msvc -type f -name '*.dsp' -exec rm -f '{}' ';'
   find evc -type f -name '*.vcp' -exec rm -f '{}' ';'
-  #find . -type d -name '.deps' -exec rm -Rf '{}' ';'
+  find . -type d -name '.deps' -exec rm -Rf '{}' ';'
   # there's some more cruft all around
   rm -f config.h config.log config.status
   rm -f vlc vlc-config Makefile Modules.am