[asterisk-commits] branch oej/metermaids-trunk r34914 - /team/oej/metermaids-trunk/build_tools/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Jun 19 13:39:58 MST 2006


Author: oej
Date: Mon Jun 19 15:39:57 2006
New Revision: 34914

URL: http://svn.digium.com/view/asterisk?rev=34914&view=rev
Log:
Update to trunk

Modified:
    team/oej/metermaids-trunk/build_tools/Makefile
    team/oej/metermaids-trunk/build_tools/cflags.xml
    team/oej/metermaids-trunk/build_tools/menuselect.c
    team/oej/metermaids-trunk/build_tools/menuselect.h
    team/oej/metermaids-trunk/build_tools/menuselect_curses.c
    team/oej/metermaids-trunk/build_tools/prep_moduledeps

Modified: team/oej/metermaids-trunk/build_tools/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/build_tools/Makefile?rev=34914&r1=34913&r2=34914&view=diff
==============================================================================
--- team/oej/metermaids-trunk/build_tools/Makefile (original)
+++ team/oej/metermaids-trunk/build_tools/Makefile Mon Jun 19 15:39:57 2006
@@ -15,13 +15,13 @@
 endif
 
 menuselect: $(MENUSELECT_OBJS)
-	$(CC) -g -o $@ $(MENUSELECT_OBJS) $(MENUSELECT_LIBS)
+	$(CC) -g -Wall -o $@ $(MENUSELECT_OBJS) $(MENUSELECT_LIBS)
 
 menuselect.o: menuselect.c menuselect.h
-	$(CC) -o $@ $(MENUSELECT_CFLAGS) $<
+	$(CC) -Wall -o $@ $(MENUSELECT_CFLAGS) $<
 
 menuselect_curses.o: menuselect_curses.c menuselect.h
-	$(CC) -o $@ $(MENUSELECT_CFLAGS) $(MENUSELECT_INCLUDE) $<
+	$(CC) -Wall -o $@ $(MENUSELECT_CFLAGS) $(MENUSELECT_INCLUDE) $<
 
 clean:
 	rm -f menuselect *.o

Modified: team/oej/metermaids-trunk/build_tools/cflags.xml
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/build_tools/cflags.xml?rev=34914&r1=34913&r2=34914&view=diff
==============================================================================
--- team/oej/metermaids-trunk/build_tools/cflags.xml (original)
+++ team/oej/metermaids-trunk/build_tools/cflags.xml Mon Jun 19 15:39:57 2006
@@ -1,4 +1,4 @@
-	<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes" force_clean_on_change="yes">
+	<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes" remove_on_change=".lastclean">
 		<member name="DEBUG_CHANNEL_LOCKS" displayname="Debug Channel Locking">
 		</member>
 		<member name="DEBUG_SCHEDULER" displayname="Enable Scheduler Debugging Output">

Modified: team/oej/metermaids-trunk/build_tools/menuselect.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/build_tools/menuselect.c?rev=34914&r1=34913&r2=34914&view=diff
==============================================================================
--- team/oej/metermaids-trunk/build_tools/menuselect.c (original)
+++ team/oej/metermaids-trunk/build_tools/menuselect.c Mon Jun 19 15:39:57 2006
@@ -35,6 +35,7 @@
 #include "menuselect.h"
 
 #include "asterisk/linkedlists.h"
+#include "asterisk/utils.h"
 
 #undef MENUSELECT_DEBUG
 
@@ -70,21 +71,6 @@
 /*! This is set when the --check-deps argument is provided. */
 static int check_deps = 0;
 
-/*! Force a clean of the source tree */
-static int force_clean = 0;
-
-static int add_category(struct category *cat);
-static int add_member(struct member *mem, struct category *cat);
-static int parse_makeopts_xml(const char *makeopts_xml);
-static int process_deps(void);
-static int build_member_list(void);
-static void mark_as_present(const char *member, const char *category);
-static void process_prev_failed_deps(char *buf);
-static int parse_existing_config(const char *infile);
-static int generate_makeopts_file(void);
-static void free_member_list(void);
-static void free_trees(void);
-
 /*! \brief return a pointer to the first non-whitespace character */
 static inline char *skip_blanks(char *str)
 {
@@ -127,6 +113,19 @@
 	AST_LIST_INSERT_TAIL(&cat->members, mem, list);
 
 	return 0;
+}
+
+/*! \brief Free a member structure and all of its members */
+static void free_member(struct member *mem)
+{
+	struct depend *dep;
+	struct conflict *cnf;
+
+	while ((dep = AST_LIST_REMOVE_HEAD(&mem->deps, list)))
+		free(dep);
+	while ((cnf = AST_LIST_REMOVE_HEAD(&mem->conflicts, list)))
+		free(cnf);
+	free(mem);
 }
 
 /*! \brief Parse an input makeopts file */
@@ -174,8 +173,7 @@
 		cat->displayname = mxmlElementGetAttr(cur, "displayname");
 		if ((tmp = mxmlElementGetAttr(cur, "positive_output")))
 			cat->positive_output = !strcasecmp(tmp, "yes");
-		if ((tmp = mxmlElementGetAttr(cur, "force_clean_on_change")))
-			cat->force_clean_on_change = !strcasecmp(tmp, "yes");
+		cat->remove_on_change = mxmlElementGetAttr(cur, "remove_on_change");
 
 		if (add_category(cat)) {
 			free(cat);
@@ -192,8 +190,10 @@
 			mem->name = mxmlElementGetAttr(cur2, "name");
 			mem->displayname = mxmlElementGetAttr(cur2, "displayname");
 		
+			mem->remove_on_change = mxmlElementGetAttr(cur2, "remove_on_change");
+
 			if (!cat->positive_output)
-				mem->enabled = 1;
+				mem->was_enabled = mem->enabled = 1;
 	
 			cur3 = mxmlFindElement(cur2, cur2, "defaultenabled", NULL, NULL, MXML_DESCEND);
 			if (cur3 && cur3->child)
@@ -203,8 +203,10 @@
 			     cur3 && cur3->child;
 			     cur3 = mxmlFindElement(cur3, cur2, "depend", NULL, NULL, MXML_DESCEND))
 			{
-				if (!(dep = calloc(1, sizeof(*dep))))
+				if (!(dep = calloc(1, sizeof(*dep)))) {
+					free_member(mem);
 					return -1;
+				}
 				if (!strlen_zero(cur3->child->value.opaque)) {
 					dep->name = cur3->child->value.opaque;
 					AST_LIST_INSERT_HEAD(&mem->deps, dep, list);
@@ -216,8 +218,10 @@
 			     cur3 && cur3->child;
 			     cur3 = mxmlFindElement(cur3, cur2, "conflict", NULL, NULL, MXML_DESCEND))
 			{
-				if (!(cnf = calloc(1, sizeof(*cnf))))
+				if (!(cnf = calloc(1, sizeof(*cnf)))) {
+					free_member(mem);
 					return -1;
+				}
 				if (!strlen_zero(cur3->child->value.opaque)) {
 					cnf->name = cur3->child->value.opaque;
 					AST_LIST_INSERT_HEAD(&mem->conflicts, cnf, list);
@@ -226,7 +230,7 @@
 			}
 
 			if (add_member(mem, cat))
-				free(mem);
+				free_member(mem);
 		}
 	}
 
@@ -343,7 +347,7 @@
 			continue;
 		AST_LIST_TRAVERSE(&cat->members, mem, list) {
 			if (!strcmp(member, mem->name)) {
-				mem->enabled = cat->positive_output;
+				mem->was_enabled = mem->enabled = cat->positive_output;
 				break;
 			}
 		}
@@ -369,8 +373,6 @@
 
 	if (mem && !(mem->depsfailed || mem->conflictsfailed)) {
 		mem->enabled = !mem->enabled;
-		if (cat->force_clean_on_change)
-			force_clean = 1;
 	}
 }
 
@@ -502,6 +504,34 @@
 
 	fclose(f);
 
+	/* Traverse all categories and members and remove any files that are supposed
+	   to be removed when an item has been changed */
+	AST_LIST_TRAVERSE(&categories, cat, list) {
+		unsigned int had_changes = 0;
+		char *file, *buf;
+
+		AST_LIST_TRAVERSE(&cat->members, mem, list) {
+			if (mem->enabled == mem->was_enabled)
+				continue;
+
+			had_changes = 1;
+
+			if (mem->remove_on_change) {
+				for (buf = ast_strdupa(mem->remove_on_change), file = strsep(&buf, " ");
+				     file;
+				     file = strsep(&buf, " "))
+					unlink(file);
+			}
+		}
+
+		if (cat->remove_on_change && had_changes) {
+			for (buf = ast_strdupa(cat->remove_on_change), file = strsep(&buf, " ");
+			     file;
+			     file = strsep(&buf, " "))
+				unlink(file);
+		}
+	}
+
 	return 0;
 }
 
@@ -517,7 +547,8 @@
 	AST_LIST_TRAVERSE(&categories, cat, list) {
 		fprintf(stderr, "Category: '%s'\n", cat->name);
 		AST_LIST_TRAVERSE(&cat->members, mem, list) {
-			fprintf(stderr, "   ==>> Member: '%s'  (%s)\n", mem->name, mem->enabled ? "Enabled" : "Disabled");
+			fprintf(stderr, "   ==>> Member: '%s'  (%s)", mem->name, mem->enabled ? "Enabled" : "Disabled");
+			fprintf(stderr, "        Was %s\n", mem->was_enabled ? "Enabled" : "Disabled");
 			AST_LIST_TRAVERSE(&mem->deps, dep, list)
 				fprintf(stderr, "      --> Depends on: '%s'\n", dep->name);
 			if (!AST_LIST_EMPTY(&mem->deps))
@@ -696,11 +727,5 @@
 	free_trees();
 	free_member_list();
 
-	/* In some cases, such as modifying the CFLAGS for the build,
-	 * a "make clean" needs to be forced.  Removing the .lastclean 
-	 * file does this. */
-	if (force_clean)
-		unlink(".lastclean");
-
 	exit(res);
 }

Modified: team/oej/metermaids-trunk/build_tools/menuselect.h
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/build_tools/menuselect.h?rev=34914&r1=34913&r2=34914&view=diff
==============================================================================
--- team/oej/metermaids-trunk/build_tools/menuselect.h (original)
+++ team/oej/metermaids-trunk/build_tools/menuselect.h Mon Jun 19 15:39:57 2006
@@ -52,8 +52,12 @@
 	const char *displayname;
 	/*! Default setting */
 	const char *defaultenabled;
+	/*! Delete these file(s) if this member changes */
+	const char *remove_on_change;
 	/*! This module is currently selected */
 	unsigned int enabled:1;
+	/*! This module was enabled when the config was loaded */
+	unsigned int was_enabled:1;
 	/*! This module has failed dependencies */
 	unsigned int depsfailed:1;
 	/*! This module has failed conflicts */
@@ -71,10 +75,10 @@
 	const char *name;
 	/*! the name displayed in the menu */
 	const char *displayname;
-	/*! Display what is selected, as opposed to not selected */
+	/*! Delete these file(s) if anything in this category changes */
+	const char *remove_on_change;
+	/*! Output what is selected, as opposed to not selected */
 	unsigned int positive_output:1;
-	/*! Force a clean of the source tree if anything in this category changes */
-	unsigned int force_clean_on_change:1;
 	/*! the list of possible values to be set in this variable */
 	AST_LIST_HEAD_NOLOCK(, member) members;
 	/*! for linking */

Modified: team/oej/metermaids-trunk/build_tools/menuselect_curses.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/build_tools/menuselect_curses.c?rev=34914&r1=34913&r2=34914&view=diff
==============================================================================
--- team/oej/metermaids-trunk/build_tools/menuselect_curses.c (original)
+++ team/oej/metermaids-trunk/build_tools/menuselect_curses.c Mon Jun 19 15:39:57 2006
@@ -48,11 +48,11 @@
 
 
 /*! Maximum number of characters horizontally */
-int max_x = 0;
+static int max_x = 0;
 /*! Maximum number of characters vertically */
-int max_y = 0;
-
-const char * const help_info[] = {
+static int max_y = 0;
+
+static const char * const help_info[] = {
 	"scroll        => up/down arrows",
 	"(de)select    => Enter",
 	"select all    => F8",
@@ -64,16 +64,8 @@
 	"XXX means dependencies have not been met"
 };
 
-void winch_handler(int sig);
-void show_help(WINDOW *win);
-void draw_main_menu(WINDOW *menu, int curopt);
-void draw_category_menu(WINDOW *menu, struct category *cat, int start, int end, int curopt, int changed);
-int run_category_menu(WINDOW *menu, int cat_num);
-int run_category_menu(WINDOW *menu, int cat_num);
-void draw_title_window(WINDOW *title);
-
 /*! \brief Handle a window resize in xterm */
-void winch_handler(int sig)
+static void winch_handler(int sig)
 {
 	getmaxyx(stdscr, max_y, max_x);
 
@@ -85,7 +77,7 @@
 }
 
 /*! \brief Display help information */
-void show_help(WINDOW *win)
+static void show_help(WINDOW *win)
 {
 	int i;
 
@@ -98,7 +90,7 @@
 	getch(); /* display the help until the user hits a key */
 }
 
-void draw_main_menu(WINDOW *menu, int curopt)
+static void draw_main_menu(WINDOW *menu, int curopt)
 {
 	struct category *cat;
 	char buf[64];
@@ -122,7 +114,7 @@
 	wrefresh(menu);
 }
 
-void display_mem_info(WINDOW *menu, struct member *mem, int start, int end)
+static void display_mem_info(WINDOW *menu, struct member *mem, int start, int end)
 {
 	char buf[64];
 	struct depend *dep;
@@ -162,13 +154,12 @@
 
 }
 
-void draw_category_menu(WINDOW *menu, struct category *cat, int start, int end, int curopt, int changed)
+static void draw_category_menu(WINDOW *menu, struct category *cat, int start, int end, int curopt, int changed)
 {
 	int i = 0;
 	int j = 0;
 	struct member *mem;
 	char buf[64];
-	const char *desc = NULL;
 
 	if (!changed) {
 		/* If all we have to do is move the cursor, 
@@ -212,7 +203,7 @@
 	wrefresh(menu);
 }
 
-int run_category_menu(WINDOW *menu, int cat_num)
+static int run_category_menu(WINDOW *menu, int cat_num)
 {
 	struct category *cat;
 	int i = 0;
@@ -298,7 +289,7 @@
 	return c;
 }
 
-void draw_title_window(WINDOW *title)
+static void draw_title_window(WINDOW *title)
 {
 	wmove(title, 1, (max_x / 2) - (strlen(MENU_TITLE1) / 2));
 	waddstr(title, MENU_TITLE1);

Modified: team/oej/metermaids-trunk/build_tools/prep_moduledeps
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids-trunk/build_tools/prep_moduledeps?rev=34914&r1=34913&r2=34914&view=diff
==============================================================================
--- team/oej/metermaids-trunk/build_tools/prep_moduledeps (original)
+++ team/oej/metermaids-trunk/build_tools/prep_moduledeps Mon Jun 19 15:39:57 2006
@@ -38,16 +38,22 @@
 		fname=${file##${dir}/}
 		get_description ${file}
 		desc=${TDESC}
-		echo -e "\t\t<member name=\"${fname%%.c}\" displayname=\"${desc}\">"
-		awk -f build_tools/get_moduledeps ${file}
+		echo -e "\t\t<member name=\"${fname%%.c}\" displayname=\"${desc}\" remove_on_change=\"${dir}/${fname%%.c}.o ${dir}/${fname%%.c}.so\">"
+		awk -f build_tools/get_moduleinfo ${file}
 		echo -e "\t\t</member>"
 	done
 	echo -e "\t</category>"
+
+	for file in ${dir}/${prefix}*.c
+	do
+		awk -f build_tools/get_makeopts ${file} >> .makeoptstmp
+	done
 }
 
 echo "<?xml version="1.0"?>"
 echo
 echo "<menu>"
+rm -f .makeoptstmp
 process_dir apps app APPS Applications
 process_dir cdr cdr CDR "Call Detail Recording"
 process_dir channels chan CHANNELS "Channel Drivers"
@@ -58,4 +64,6 @@
 process_dir res res RES "Resource Modules"
 cat build_tools/cflags.xml
 cat sounds/sounds.xml
+cat .makeoptstmp
+rm -f .makeoptstmp
 echo "</menu>"



More information about the asterisk-commits mailing list