]> git.sesse.net Git - vlc/commitdiff
* Makefile.am: New file version.c, generated at each 'make' command.
authorChristophe Massiot <massiot@videolan.org>
Wed, 17 Aug 2005 14:39:07 +0000 (14:39 +0000)
committerChristophe Massiot <massiot@videolan.org>
Wed, 17 Aug 2005 14:39:07 +0000 (14:39 +0000)
 * toolbox: New --update-version switch, which builds the version.c file
   from current date, user/hostname/domainname, compiler version and
   svn changeset.
 * src/libvlc.c: Exported API to access data from version.c.
 * modules/control/http.c: New variables vlc_compile_time, vlc_compile_by,
   vlc_compile_host, vlc_compile_domain, vlc_compiler and vlc_changeset.

Makefile.am
include/vlc/vlc.h
include/vlc_common.h
include/vlc_symbols.h
modules/control/http.c
src/libvlc.c
toolbox

index af099dbf4bb2ef9388672ebe85494883c7db37ec..5fd40827e072d3ece95330d81fcfb5ce9d2264f1 100644 (file)
@@ -48,6 +48,7 @@ AUTOMAKE_OPTIONS = dist-bzip2 subdir-objects
 BUILT_SOURCES += \
        stamp-api \
        src/misc/modules_builtin.h \
+       src/misc/version.c \
        $(NULL)
 
 pkgincludedir = $(includedir)/vlc
@@ -131,6 +132,9 @@ src/misc/modules_builtin.h: Makefile src/misc/modules_builtin.h.in vlc-config
        srcdir=$(srcdir) $(srcdir)/toolbox --update-includes
        touch $@
 
+src/misc/version.c: FORCE
+       srcdir=$(srcdir) $(srcdir)/toolbox --update-version
+
 # These dependencies are mandatory
 $(SOURCES_libvlc): src/misc/modules_builtin.h $(LIB_intl)
 
@@ -412,6 +416,7 @@ SOURCES_libvlc_common = \
        src/misc/getaddrinfo.c \
        src/misc/vlm.c \
        src/misc/xml.c \
+       src/misc/version.c \
        src/extras/libc.c \
        src/control/core.c \
        src/control/util.c \
index d85c27fe00997bf3574c4ee5c5985f0498ed258e..3b8483be03b7a18ed6f7d1e2fad6fc1e9a490cf6 100644 (file)
@@ -152,7 +152,8 @@ struct vlc_list_t
 /*****************************************************************************
  * Exported libvlc API
  *****************************************************************************/
-
+#if !defined( __VLC__ )
+/* Otherwise they are declared and exported in vlc_common.h */
 /**
  * Retrieve libvlc version
  *
@@ -160,6 +161,48 @@ struct vlc_list_t
  */
 char const * VLC_Version ( void );
 
+/**
+ * Retrieve libvlc compile time
+ *
+ * \return a string containing the libvlc compile time
+ */
+char const * VLC_CompileTime ( void );
+
+/**
+ * Retrieve the username of the libvlc builder
+ *
+ * \return a string containing the username of the libvlc builder
+ */
+char const * VLC_CompileBy ( void );
+
+/**
+ * Retrieve the host of the libvlc builder
+ *
+ * \return a string containing the host of the libvlc builder
+ */
+char const * VLC_CompileHost ( void );
+
+/**
+ * Retrieve the domain name of the host of the libvlc builder
+ *
+ * \return a string containing the domain name of the host of the libvlc builder
+ */
+char const * VLC_CompileDomain ( void );
+
+/**
+ * Retrieve libvlc compiler version
+ *
+ * \return a string containing the libvlc compiler version
+ */
+char const * VLC_Compiler ( void );
+
+/**
+ * Retrieve libvlc changeset
+ *
+ * \return a string containing the libvlc subversion changeset
+ */
+char const * VLC_Changeset ( void );
+
 /**
  * Return an error string
  *
@@ -168,6 +211,8 @@ char const * VLC_Version ( void );
  */
 char const * VLC_Error ( int i_err );
 
+#endif /* __VLC__ */
+
 /**
  * Initialize libvlc
  *
index 7460b957545c40bf205d6784255ca3fa42beb4e1..798dd13406d1c8af4c29609c58183c1c9583cfa0 100644 (file)
@@ -1086,6 +1086,18 @@ VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) );
 #   define N_(String) ((char*)(String))
 #endif
 
+/*****************************************************************************
+ * libvlc features
+ *****************************************************************************/
+VLC_EXPORT( const char *, VLC_Version, ( void ) );
+VLC_EXPORT( const char *, VLC_CompileTime, ( void ) );
+VLC_EXPORT( const char *, VLC_CompileBy, ( void ) );
+VLC_EXPORT( const char *, VLC_CompileHost, ( void ) );
+VLC_EXPORT( const char *, VLC_CompileDomain, ( void ) );
+VLC_EXPORT( const char *, VLC_Compiler, ( void ) );
+VLC_EXPORT( const char *, VLC_Changeset, ( void ) );
+VLC_EXPORT( const char *, VLC_Error, ( int ) );
+
 /*****************************************************************************
  * Additional vlc stuff
  *****************************************************************************/
index f6e3060dc9330540cd1af56d5004eab0ba5b2667..8f6616afac3428548c32797071268844f26337e7 100644 (file)
@@ -408,6 +408,14 @@ struct module_symbols_t
     void *__osd_VolumeUp_deprecated;
     void (*__osd_MenuActivate_inner) (vlc_object_t *);
     void (*__osd_Volume_inner) (vlc_object_t *);
+    const char * (*VLC_Compiler_inner) (void);
+    const char * (*VLC_Error_inner) (int);
+    const char * (*VLC_Changeset_inner) (void);
+    const char * (*VLC_CompileBy_inner) (void);
+    const char * (*VLC_CompileDomain_inner) (void);
+    const char * (*VLC_CompileHost_inner) (void);
+    const char * (*VLC_Version_inner) (void);
+    const char * (*VLC_CompileTime_inner) (void);
 };
 # if defined (__PLUGIN__)
 #  define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
@@ -798,6 +806,14 @@ struct module_symbols_t
 #  define __osd_MenuPrev (p_symbols)->__osd_MenuPrev_inner
 #  define __osd_MenuActivate (p_symbols)->__osd_MenuActivate_inner
 #  define __osd_Volume (p_symbols)->__osd_Volume_inner
+#  define VLC_Compiler (p_symbols)->VLC_Compiler_inner
+#  define VLC_Error (p_symbols)->VLC_Error_inner
+#  define VLC_Changeset (p_symbols)->VLC_Changeset_inner
+#  define VLC_CompileBy (p_symbols)->VLC_CompileBy_inner
+#  define VLC_CompileDomain (p_symbols)->VLC_CompileDomain_inner
+#  define VLC_CompileHost (p_symbols)->VLC_CompileHost_inner
+#  define VLC_Version (p_symbols)->VLC_Version_inner
+#  define VLC_CompileTime (p_symbols)->VLC_CompileTime_inner
 # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
 /******************************************************************
  * STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
@@ -1191,6 +1207,14 @@ struct module_symbols_t
     ((p_symbols)->__osd_MenuPrev_inner) = __osd_MenuPrev; \
     ((p_symbols)->__osd_MenuActivate_inner) = __osd_MenuActivate; \
     ((p_symbols)->__osd_Volume_inner) = __osd_Volume; \
+    ((p_symbols)->VLC_Compiler_inner) = VLC_Compiler; \
+    ((p_symbols)->VLC_Error_inner) = VLC_Error; \
+    ((p_symbols)->VLC_Changeset_inner) = VLC_Changeset; \
+    ((p_symbols)->VLC_CompileBy_inner) = VLC_CompileBy; \
+    ((p_symbols)->VLC_CompileDomain_inner) = VLC_CompileDomain; \
+    ((p_symbols)->VLC_CompileHost_inner) = VLC_CompileHost; \
+    ((p_symbols)->VLC_Version_inner) = VLC_Version; \
+    ((p_symbols)->VLC_CompileTime_inner) = VLC_CompileTime; \
     (p_symbols)->net_ConvertIPv4_deprecated = NULL; \
     (p_symbols)->vlc_fix_readdir_charset_deprecated = NULL; \
     (p_symbols)->__osd_VolumeDown_deprecated = NULL; \
index ee4a58915a2d26a5f1fef434404d6497cf7a3597..e849e1493490a408e7f331f14aff9abd5d06b9d0 100644 (file)
@@ -3043,10 +3043,20 @@ static int  HttpCallback( httpd_file_sys_t *p_args,
         sprintf( volume , "%d" , (int)i_volume );
 
         p_args->vars = mvar_New( "variables", "" );
-        mvar_AppendNewVar( p_args->vars, "url_param", i_request > 0 ? "1" : "0" );
+        mvar_AppendNewVar( p_args->vars, "url_param",
+                           i_request > 0 ? "1" : "0" );
         mvar_AppendNewVar( p_args->vars, "url_value", p_request );
-        mvar_AppendNewVar( p_args->vars, "version",   VERSION_MESSAGE );
+        mvar_AppendNewVar( p_args->vars, "version", VLC_Version() );
         mvar_AppendNewVar( p_args->vars, "copyright", COPYRIGHT_MESSAGE );
+        mvar_AppendNewVar( p_args->vars, "vlc_compile_time",
+                           VLC_CompileTime() );
+        mvar_AppendNewVar( p_args->vars, "vlc_compile_by", VLC_CompileBy() );
+        mvar_AppendNewVar( p_args->vars, "vlc_compile_host",
+                           VLC_CompileHost() );
+        mvar_AppendNewVar( p_args->vars, "vlc_compile_domain",
+                           VLC_CompileDomain() );
+        mvar_AppendNewVar( p_args->vars, "vlc_compiler", VLC_Compiler() );
+        mvar_AppendNewVar( p_args->vars, "vlc_changeset", VLC_Changeset() );
         mvar_AppendNewVar( p_args->vars, "stream_position", position );
         mvar_AppendNewVar( p_args->vars, "stream_time", time );
         mvar_AppendNewVar( p_args->vars, "stream_length", length );
index ac72cfa551991cfa0faf3a6e6728a2108e66ba41..80a1f9b42f7f42981bebb618aaf16684ec5777c7 100644 (file)
@@ -138,6 +138,24 @@ char const * VLC_Version( void )
     return VERSION_MESSAGE;
 }
 
+/*****************************************************************************
+ * VLC_CompileTime, VLC_CompileBy, VLC_CompileHost, VLC_CompileDomain,
+ * VLC_Compiler, VLC_Changeset
+ *****************************************************************************/
+#define DECLARE_VLC_VERSION( func, var )                                    \
+extern const char psz_vlc_##var [];                                         \
+char const * VLC_##func ( void )                                            \
+{                                                                           \
+    return psz_vlc_##var ;                                                  \
+}
+
+DECLARE_VLC_VERSION( CompileTime, compile_time );
+DECLARE_VLC_VERSION( CompileBy, compile_by );
+DECLARE_VLC_VERSION( CompileHost, compile_host );
+DECLARE_VLC_VERSION( CompileDomain, compile_domain );
+DECLARE_VLC_VERSION( Compiler, compiler );
+DECLARE_VLC_VERSION( Changeset, changeset );
+
 /*****************************************************************************
  * VLC_Error: strerror() equivalent
  *****************************************************************************
@@ -2360,7 +2378,13 @@ static void Version( void )
     ShowConsole();
 #endif
 
-    fprintf( stdout, VERSION_MESSAGE "\n" );
+    fprintf( stdout, _("VLC version %s\n"), VLC_Version() );
+    fprintf( stdout, _("Compiled on %s by %s@%s.%s\n"), VLC_CompileTime(),
+             VLC_CompileBy(), VLC_CompileHost(), VLC_CompileDomain() );
+    fprintf( stdout, _("Compiler: %s\n"), VLC_Compiler() );
+    if( *VLC_Changeset() )
+        fprintf( stdout, _("Based upon svn changeset [%s]\n"),
+                 VLC_Changeset() );
     fprintf( stdout,
       _("This program comes with NO WARRANTY, to the extent permitted by "
         "law.\nYou may redistribute it under the terms of the GNU General "
diff --git a/toolbox b/toolbox
index 5911747227232a1d23c83e89ed9803bedd847dd2..9eb52f15c0f8d95b8c682a12c5eb67b31bff17ba 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
     ;;
@@ -425,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`
+  if which dnsdomainname 2>&1 >/dev/null; then
+    VLC_COMPILE_DOMAIN=`dnsdomainname`
+  elif which domainname 2>&1 >/dev/null; then
+    VLC_COMPILE_DOMAIN=`domainname`
+  else
+    VLC_COMPILE_DOMAIN=unknown
+  fi
+  VLC_COMPILER=`$CC -v 2>&1 | tail -n 1`
+  if which svnversion 2>&1 >/dev/null; then
+    VLC_CHANGESET=`svnversion $srcdir`
+  else
+    VLC_CHANGESET=''
+  fi
+
+  cat >| src/misc/version.c << EOF
+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
 ##