Commit 2851705c authored by Christophe Massiot's avatar Christophe Massiot

* Makefile.am: New file version.c, generated at each 'make' command.

 * 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.
parent 60665748
...@@ -48,6 +48,7 @@ AUTOMAKE_OPTIONS = dist-bzip2 subdir-objects ...@@ -48,6 +48,7 @@ AUTOMAKE_OPTIONS = dist-bzip2 subdir-objects
BUILT_SOURCES += \ BUILT_SOURCES += \
stamp-api \ stamp-api \
src/misc/modules_builtin.h \ src/misc/modules_builtin.h \
src/misc/version.c \
$(NULL) $(NULL)
pkgincludedir = $(includedir)/vlc pkgincludedir = $(includedir)/vlc
...@@ -131,6 +132,9 @@ src/misc/modules_builtin.h: Makefile src/misc/modules_builtin.h.in vlc-config ...@@ -131,6 +132,9 @@ src/misc/modules_builtin.h: Makefile src/misc/modules_builtin.h.in vlc-config
srcdir=$(srcdir) $(srcdir)/toolbox --update-includes srcdir=$(srcdir) $(srcdir)/toolbox --update-includes
touch $@ touch $@
src/misc/version.c: FORCE
srcdir=$(srcdir) $(srcdir)/toolbox --update-version
# These dependencies are mandatory # These dependencies are mandatory
$(SOURCES_libvlc): src/misc/modules_builtin.h $(LIB_intl) $(SOURCES_libvlc): src/misc/modules_builtin.h $(LIB_intl)
...@@ -412,6 +416,7 @@ SOURCES_libvlc_common = \ ...@@ -412,6 +416,7 @@ SOURCES_libvlc_common = \
src/misc/getaddrinfo.c \ src/misc/getaddrinfo.c \
src/misc/vlm.c \ src/misc/vlm.c \
src/misc/xml.c \ src/misc/xml.c \
src/misc/version.c \
src/extras/libc.c \ src/extras/libc.c \
src/control/core.c \ src/control/core.c \
src/control/util.c \ src/control/util.c \
......
...@@ -152,7 +152,8 @@ struct vlc_list_t ...@@ -152,7 +152,8 @@ struct vlc_list_t
/***************************************************************************** /*****************************************************************************
* Exported libvlc API * Exported libvlc API
*****************************************************************************/ *****************************************************************************/
#if !defined( __VLC__ )
/* Otherwise they are declared and exported in vlc_common.h */
/** /**
* Retrieve libvlc version * Retrieve libvlc version
* *
...@@ -160,6 +161,48 @@ struct vlc_list_t ...@@ -160,6 +161,48 @@ struct vlc_list_t
*/ */
char const * VLC_Version ( void ); 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 * Return an error string
* *
...@@ -168,6 +211,8 @@ char const * VLC_Version ( void ); ...@@ -168,6 +211,8 @@ char const * VLC_Version ( void );
*/ */
char const * VLC_Error ( int i_err ); char const * VLC_Error ( int i_err );
#endif /* __VLC__ */
/** /**
* Initialize libvlc * Initialize libvlc
* *
......
...@@ -1086,6 +1086,18 @@ VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) ); ...@@ -1086,6 +1086,18 @@ VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) );
# define N_(String) ((char*)(String)) # define N_(String) ((char*)(String))
#endif #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 * Additional vlc stuff
*****************************************************************************/ *****************************************************************************/
......
...@@ -408,6 +408,14 @@ struct module_symbols_t ...@@ -408,6 +408,14 @@ struct module_symbols_t
void *__osd_VolumeUp_deprecated; void *__osd_VolumeUp_deprecated;
void (*__osd_MenuActivate_inner) (vlc_object_t *); void (*__osd_MenuActivate_inner) (vlc_object_t *);
void (*__osd_Volume_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__) # if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner # define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
...@@ -798,6 +806,14 @@ struct module_symbols_t ...@@ -798,6 +806,14 @@ struct module_symbols_t
# define __osd_MenuPrev (p_symbols)->__osd_MenuPrev_inner # define __osd_MenuPrev (p_symbols)->__osd_MenuPrev_inner
# define __osd_MenuActivate (p_symbols)->__osd_MenuActivate_inner # define __osd_MenuActivate (p_symbols)->__osd_MenuActivate_inner
# define __osd_Volume (p_symbols)->__osd_Volume_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__) # elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/****************************************************************** /******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access. * STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
...@@ -1191,6 +1207,14 @@ struct module_symbols_t ...@@ -1191,6 +1207,14 @@ struct module_symbols_t
((p_symbols)->__osd_MenuPrev_inner) = __osd_MenuPrev; \ ((p_symbols)->__osd_MenuPrev_inner) = __osd_MenuPrev; \
((p_symbols)->__osd_MenuActivate_inner) = __osd_MenuActivate; \ ((p_symbols)->__osd_MenuActivate_inner) = __osd_MenuActivate; \
((p_symbols)->__osd_Volume_inner) = __osd_Volume; \ ((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)->net_ConvertIPv4_deprecated = NULL; \
(p_symbols)->vlc_fix_readdir_charset_deprecated = NULL; \ (p_symbols)->vlc_fix_readdir_charset_deprecated = NULL; \
(p_symbols)->__osd_VolumeDown_deprecated = NULL; \ (p_symbols)->__osd_VolumeDown_deprecated = NULL; \
......
...@@ -3043,10 +3043,20 @@ static int HttpCallback( httpd_file_sys_t *p_args, ...@@ -3043,10 +3043,20 @@ static int HttpCallback( httpd_file_sys_t *p_args,
sprintf( volume , "%d" , (int)i_volume ); sprintf( volume , "%d" , (int)i_volume );
p_args->vars = mvar_New( "variables", "" ); 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, "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, "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_position", position );
mvar_AppendNewVar( p_args->vars, "stream_time", time ); mvar_AppendNewVar( p_args->vars, "stream_time", time );
mvar_AppendNewVar( p_args->vars, "stream_length", length ); mvar_AppendNewVar( p_args->vars, "stream_length", length );
......
...@@ -138,6 +138,24 @@ char const * VLC_Version( void ) ...@@ -138,6 +138,24 @@ char const * VLC_Version( void )
return VERSION_MESSAGE; 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 * VLC_Error: strerror() equivalent
***************************************************************************** *****************************************************************************
...@@ -2360,7 +2378,13 @@ static void Version( void ) ...@@ -2360,7 +2378,13 @@ static void Version( void )
ShowConsole(); ShowConsole();
#endif #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, fprintf( stdout,
_("This program comes with NO WARRANTY, to the extent permitted by " _("This program comes with NO WARRANTY, to the extent permitted by "
"law.\nYou may redistribute it under the terms of the GNU General " "law.\nYou may redistribute it under the terms of the GNU General "
......
...@@ -28,6 +28,7 @@ recognized flags are: ...@@ -28,6 +28,7 @@ recognized flags are:
--update-vc update Microsoft Visual Studio files --update-vc update Microsoft Visual Studio files
--update-po update translation files --update-po update translation files
--update-includes generate various include files --update-includes generate various include files
--update-version generate src/misc/version.c
--update-glade generate and fix Glade code --update-glade generate and fix Glade code
--update-glade2 generate and fix Glade 2 code --update-glade2 generate and fix Glade 2 code
--update-flexml generate and fix flexml and flex code --update-flexml generate and fix flexml and flex code
...@@ -71,6 +72,9 @@ case "$1" in ...@@ -71,6 +72,9 @@ case "$1" in
--update-includes) --update-includes)
action=includes action=includes
;; ;;
--update-version)
action=version
;;
--update-flexml) --update-flexml)
action=flexml action=flexml
;; ;;
...@@ -425,6 +429,48 @@ then ...@@ -425,6 +429,48 @@ then
exit 0 exit 0
fi 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 ## Fix glade-generated files
## ##
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment