Files
asterisk/build_tools/make_version_c
T

71 lines
1.3 KiB
Bash
Raw Normal View History

#!/bin/sh
2015-10-30 23:57:58 -04:00
GREP=${GREP:-grep}
if test ! -f include/asterisk/buildopts.h ; then
echo "include/asterisk/buildopts.h is missing"
exit 1
fi
2009-12-14 21:13:18 +00:00
if test ! -f .flavor ; then
EXTRA=""
2009-12-14 21:13:18 +00:00
elif test ! -f .version ; then
aadkflavor=`cat .flavor`
EXTRA=" (${aadkflavor})"
else
2009-06-11 12:15:09 +00:00
aadkver=`cat .version`
aadkflavor=`cat .flavor`
EXTRA=" (${aadkflavor} ${aadkver})"
fi
2015-10-30 23:57:58 -04:00
if ${GREP} "AST_DEVMODE" makeopts | ${GREP} -q "yes"
then
BUILDOPTS="AST_DEVMODE"
fi
BUILDOPTS=$(sed -n -r -e 's/#define\s+AST_BUILDOPTS\s+"([^"]+)"/\1/gp' \
include/asterisk/buildopts.h )
BUILDOPTS_ALL=$(sed -n -r -e 's/#define\s+AST_BUILDOPTS_ALL\s+"([^"]+)"/\1/gp' \
include/asterisk/buildopts.h )
2015-10-30 23:57:58 -04:00
cat << END
/*
* version.c
* Automatically generated
*/
#include "asterisk.h"
#include "asterisk/ast_version.h"
static const char asterisk_version[] = "${ASTERISKVERSION}${EXTRA}";
static const char asterisk_version_num[] = "${ASTERISKVERSIONNUM}";
2015-10-30 23:57:58 -04:00
static const char asterisk_build_opts[] = "${BUILDOPTS}";
static const char asterisk_build_opts_all[] = "${BUILDOPTS_ALL}";
const char *ast_get_version(void)
{
return asterisk_version;
}
const char *ast_get_version_num(void)
{
return asterisk_version_num;
}
2015-10-30 23:57:58 -04:00
const char *ast_get_build_opts(void)
{
return asterisk_build_opts;
}
const char *ast_get_build_opts_all(void)
{
return asterisk_build_opts_all;
}
END