Set various EPICS_VERSION_* environment variables

These are set at the same time as the ARCH variable.
Had to add EPICS_VERSION_SHORT and EPICS_VERSION_FULL to epicsVersion.h.

This uses more uniform names, should we change epicsVersion.h names?
We would continue to support the old names in parallel for some time.
This commit is contained in:
Andrew Johnson
2016-04-28 18:58:07 -05:00
parent 0e5dc2a21c
commit 5a605fa0c3
2 changed files with 24 additions and 1 deletions

View File

@@ -8,6 +8,7 @@
\*************************************************************************/
#include "envDefs.h"
#include "epicsVersion.h"
#include "iocsh.h"
#include "libComRegister.h"
@@ -22,15 +23,29 @@
#include "registryIocRegister.h"
#include "rsrvIocRegister.h"
#define quote(v) #v
#define str(v) quote(v)
void iocshRegisterCommon(void)
{
iocshPpdbbase = &pdbbase;
const char *targetArch = envGetConfigParamPtr(&EPICS_BUILD_TARGET_ARCH);
/* This uses a config param so the user can override it */
if (targetArch) {
epicsEnvSet("ARCH", targetArch);
}
/* Base build version variables */
epicsEnvSet("EPICS_VERSION_MAJOR", str(EPICS_VERSION));
epicsEnvSet("EPICS_VERSION_MIDDLE", str(EPICS_REVISION));
epicsEnvSet("EPICS_VERSION_MINOR", str(EPICS_MODIFICATION));
epicsEnvSet("EPICS_VERSION_PATCH", str(EPICS_PATCH_LEVEL));
epicsEnvSet("EPICS_VERSION_SNAPSHOT", EPICS_DEV_SNAPSHOT);
epicsEnvSet("EPICS_VERSION_SITE", EPICS_SITE_VERSION);
epicsEnvSet("EPICS_VERSION_SHORT", EPICS_VERSION_SHORT);
epicsEnvSet("EPICS_VERSION_FULL", EPICS_VERSION_FULL);
dbStaticIocRegister();
registryIocRegister();
dbIocRegister();

View File

@@ -47,8 +47,11 @@ map {
die "$tool: Variable missing from $infile" unless defined $_;
} $ver, $rev, $mod, $patch, $snapshot, $commit_date;
$commit_date =~ s/^\$\$Date$\$$/\1/;
my $ver_str = "$ver.$rev.$mod";
$ver_str .= ".$patch" if $patch > 0;
my $ver_short = $ver_str;
$ver_str .= $snapshot if $snapshot ne '';
$ver_str .= "-$opt_v" if $opt_v;
@@ -71,10 +74,15 @@ print $OUT <<"END";
#define EPICS_PATCH_LEVEL $patch
#define EPICS_DEV_SNAPSHOT "$snapshot"
#define EPICS_SITE_VERSION "$opt_v"
#define EPICS_VERSION_SHORT "$ver_short"
#define EPICS_VERSION_FULL "$ver_str"
#define EPICS_VERSION_STRING "EPICS $ver_str"
#define epicsReleaseVersion "EPICS R$ver_str $commit_date"
#define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P))
#ifndef VERSION_INT
# define VERSION_INT(V,R,M,P) ( ((V)<<24) | ((R)<<16) | ((M)<<8) | (P))
#endif
#define EPICS_VERSION_INT VERSION_INT($ver, $rev, $mod, $patch)
#endif /* INC_${obase}_H */