[Asterisk-code-review] Fix cli display of build options. (asterisk[master])

Joshua Colp asteriskteam at digium.com
Wed Nov 4 14:24:47 CST 2015


Joshua Colp has submitted this change and it was merged.

Change subject: Fix cli display of build options.
......................................................................


Fix cli display of build options.

A previous commit reduced the AST_BUILDOPTS compiler define to
only include options that affected ABI.  This included some options
that were previously displayed by cli "core show settings".  This
change corrects the CLI display while still restricting buildopts.h
to ABI effecting options only.

ASTERISK-25434 #close
Reported by: Rusty Newton

Change-Id: Id07af6bedd1d7d325878023e403fbd9d3607e325
---
M Makefile
M build_tools/make_version_c
M include/asterisk/ast_version.h
M main/asterisk.c
4 files changed, 30 insertions(+), 2 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved



diff --git a/Makefile b/Makefile
index 5bc6570..4b1c57b 100644
--- a/Makefile
+++ b/Makefile
@@ -399,7 +399,7 @@
 	@cmp -s $@.tmp $@ || mv $@.tmp $@
 	@rm -f $@.tmp
 
-main/version.c: FORCE .lastclean
+main/version.c: FORCE menuselect.makeopts .lastclean
 	@build_tools/make_version_c > $@.tmp
 	@cmp -s $@.tmp $@ || mv $@.tmp $@
 	@rm -f $@.tmp
diff --git a/build_tools/make_version_c b/build_tools/make_version_c
index 3fea6ce..fcbd94e 100755
--- a/build_tools/make_version_c
+++ b/build_tools/make_version_c
@@ -1,4 +1,7 @@
 #!/bin/sh
+
+GREP=${GREP:-grep}
+
 if test ! -f .flavor ; then
     EXTRA=""
 elif test ! -f .version ; then
@@ -9,6 +12,21 @@
     aadkflavor=`cat .flavor`
     EXTRA=" (${aadkflavor} ${aadkver})"
 fi
+
+if ${GREP} "AST_DEVMODE" makeopts | ${GREP} -q "yes"
+then
+	BUILDOPTS="AST_DEVMODE"
+fi
+
+TMP=`${GREP} -e "^MENUSELECT_CFLAGS" menuselect.makeopts | sed 's/MENUSELECT_CFLAGS\=//g' | sed 's/-D//g'`
+for x in ${TMP}; do
+	if test "x${BUILDOPTS}" != "x" ; then
+		BUILDOPTS="${BUILDOPTS}, ${x}"
+	else
+		BUILDOPTS="${x}"
+	fi
+done
+
 cat << END
 /*
  * version.c
@@ -23,6 +41,8 @@
 
 static const char asterisk_version_num[] = "${ASTERISKVERSIONNUM}";
 
+static const char asterisk_build_opts[] = "${BUILDOPTS}";
+
 const char *ast_get_version(void)
 {
 	return asterisk_version;
@@ -33,4 +53,9 @@
 	return asterisk_version_num;
 }
 
+const char *ast_get_build_opts(void)
+{
+	return asterisk_build_opts;
+}
+
 END
diff --git a/include/asterisk/ast_version.h b/include/asterisk/ast_version.h
index 51ff481..1ceac30 100644
--- a/include/asterisk/ast_version.h
+++ b/include/asterisk/ast_version.h
@@ -41,4 +41,7 @@
  */
 const char *ast_get_version_num(void);
 
+/*! Retreive the Asterisk build options */
+const char *ast_get_build_opts(void);
+
 #endif /* __AST_VERSION_H */
diff --git a/main/asterisk.c b/main/asterisk.c
index 4660bf9..e0a87d6 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -601,7 +601,7 @@
 	ast_cli(a->fd, "\nPBX Core settings\n");
 	ast_cli(a->fd, "-----------------\n");
 	ast_cli(a->fd, "  Version:                     %s\n", ast_get_version());
-	ast_cli(a->fd, "  Build Options:               %s\n", S_OR(AST_BUILDOPTS, "(none)"));
+	ast_cli(a->fd, "  Build Options:               %s\n", S_OR(ast_get_build_opts(), "(none)"));
 	if (ast_option_maxcalls)
 		ast_cli(a->fd, "  Maximum calls:               %d (Current %d)\n", ast_option_maxcalls, ast_active_channels());
 	else

-- 
To view, visit https://gerrit.asterisk.org/1563
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id07af6bedd1d7d325878023e403fbd9d3607e325
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list