Now that the version.h file was getting properly regenerated every time the svn

revision changed, every module that used the version was getting rebuilt after
every svn update.  This severly annoyed me pretty quickly, so I have improved
the situation.

Now, instead of generating version.h, main/version.c is generated.  version.c
includes the version information, as well as a couple of API calls for modules
to retrieve the version.  So now, only version.c will get rebuilt, and the main
asterisk binary relinked, which is must faster than rebuilding http.c, manager.c,
asterisk.c, relinking the asterisk binary, chan_sip.c, func_version.c, res_agi ...

The only minor change in behavior here is that the version information reported by
chan_sip, for example, is the version of the Asterisk core, and not necessarily the
Asterisk version that the chan_sip module came from.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@96717 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2008-01-05 22:09:06 +00:00
parent 3e28c57081
commit 54bc2c20b6
11 changed files with 108 additions and 52 deletions

View File

@@ -34,39 +34,35 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/version.h"
#include "asterisk/build.h"
#define STRING_IT(vernum) STRING_IT2(vernum)
#define STRING_IT2(vernum) #vernum
static int acf_version_exec(struct ast_channel *chan, const char *cmd,
char *parse, char *buffer, size_t buflen)
{
char *response_char = ASTERISK_VERSION;
const char *response_char = ast_get_version();
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(info);
AST_APP_ARG(info);
);
AST_STANDARD_APP_ARGS(args, parse);
if (!ast_strlen_zero(args.info) ) {
if (strcasecmp(args.info,"ASTERISK_VERSION_NUM") == 0)
response_char = STRING_IT(ASTERISK_VERSION_NUM);
else if (strcasecmp(args.info,"BUILD_USER") == 0)
if (!strcasecmp(args.info,"ASTERISK_VERSION_NUM"))
response_char = ast_get_version_num();
else if (!strcasecmp(args.info,"BUILD_USER"))
response_char = BUILD_USER;
else if (strcasecmp(args.info,"BUILD_HOSTNAME") == 0)
else if (!strcasecmp(args.info,"BUILD_HOSTNAME"))
response_char = BUILD_HOSTNAME;
else if (strcasecmp(args.info,"BUILD_MACHINE") == 0)
else if (!strcasecmp(args.info,"BUILD_MACHINE"))
response_char = BUILD_MACHINE;
else if (strcasecmp(args.info,"BUILD_KERNEL") == 0)
else if (!strcasecmp(args.info,"BUILD_KERNEL"))
response_char = BUILD_KERNEL;
else if (strcasecmp(args.info,"BUILD_OS") == 0)
else if (!strcasecmp(args.info,"BUILD_OS"))
response_char = BUILD_OS;
else if (strcasecmp(args.info,"BUILD_DATE") == 0)
else if (!strcasecmp(args.info,"BUILD_DATE"))
response_char = BUILD_DATE;
}
ast_debug(1, "VERSION returns %s result, given %s argument\n", response_char, args.info);
snprintf(buffer, buflen, "%s", response_char);
return 0;