From 32f0a3d52a45e1c59274e271a83722cafbf5f231 Mon Sep 17 00:00:00 2001 From: George Joseph Date: Sat, 12 Mar 2016 15:02:20 -0700 Subject: build_system: Split COMPILE_DOUBLE from DONT_OPTIMIZE I can't ever recall actually needing the intermediate files or the checking that a double compile produces. What I CAN remember is every DONT_OPTIMIZE build needing 3 invocations of gcc instead of 1 just to do the checks and produce those intermediate files. Having said that, Richard pointed out that the reason for the double compile was that there were cases in the past where a submitted patch failed to compile because the submitter never tried it with the optimizations turned on. To get the best of both worlds, COMPILE_DOUBLE has been split into its own option. If DONT_OPTIMIZE is turned on, COMPILE_DOUBLE will also be selected BUT you can then turn it off if all you need are the debugging symbols. This way you have to make an informed decision about disabling COMPILE_DOUBLE. To allow COMPILE_DOUBLE to be both auto-selected and turned off, a new feature was added to menuselect. The element can now contain an "autoselect" attribute which will turn the used member on but not create a hard dependency. The cflags.xml implementation for COMPILE_DOUBLE looks like this... COMPILE_DOUBLE core + COMPILE_DOUBLE + core + + + DONT_OPTIMIZE core diff --git a/menuselect/menuselect.c b/menuselect/menuselect.c index f4a826b84..6136135aa 100644 --- a/menuselect/menuselect.c +++ b/menuselect/menuselect.c @@ -357,6 +357,10 @@ static int process_xml_ref_node(xmlNode *node, struct member *mem, struct refere } } + if ((tmp = (const char *) xmlGetProp(node, BAD_CAST "autoselect"))) { + ref->autoselect = !strcasecmp(tmp, "yes"); + } + tmp = (const char *) xmlNodeGetContent(node); if (tmp && !strlen_zero(tmp)) { @@ -1154,8 +1158,16 @@ unsigned int enable_member(struct member *mem) } if ((mem->enabled = can_enable)) { + struct reference *use; + print_debug("Just set %s enabled to %d\n", mem->name, mem->enabled); while (calc_dep_failures(1, 0) || calc_conflict_failures(1, 0)); + + AST_LIST_TRAVERSE(&mem->uses, use, list) { + if (use->member && use->autoselect && !use->member->enabled) { + enable_member(use->member); + } + } } return can_enable; diff --git a/menuselect/menuselect.h b/menuselect/menuselect.h index b1d22dd75..112f1c88c 100644 --- a/menuselect/menuselect.h +++ b/menuselect/menuselect.h @@ -43,6 +43,8 @@ struct reference { struct member *member; /*! if this package was found */ unsigned char met:1; + /*! if this package should be autoselected */ + unsigned char autoselect:1; /*! for linking */ AST_LIST_ENTRY(reference) list; }; diff --git a/menuselect/menuselect_curses.c b/menuselect/menuselect_curses.c index 5afa99661..00645927a 100644 --- a/menuselect/menuselect_curses.c +++ b/menuselect/menuselect_curses.c @@ -158,6 +158,12 @@ static int really_quit(WINDOW *win) return c; } +#define MENU_HELP_LEFT_ADJ 16 +#define MAIN_MENU_LEFT_ADJ 20 +#define CAT_MENU_LEFT_ADJ 20 +#define SCROLL_DOWN_LEFT_ADJ 15 +#define MEMBER_INFO_LEFT_ADJ 25 + static void draw_main_menu(WINDOW *menu, int curopt) { struct category *cat; @@ -167,42 +173,67 @@ static void draw_main_menu(WINDOW *menu, int curopt) wclear(menu); AST_LIST_TRAVERSE(&categories, cat, list) { - wmove(menu, i++, max_x / 2 - 10); - snprintf(buf, sizeof(buf), " %s", strlen_zero(cat->displayname) ? cat->name : cat->displayname); + wmove(menu, i++, max_x / 2 - MAIN_MENU_LEFT_ADJ); + snprintf(buf, sizeof(buf), "%s", strlen_zero(cat->displayname) ? cat->name : cat->displayname); waddstr(menu, buf); } - wmove(menu, curopt, (max_x / 2) - 15); + wmove(menu, curopt, (max_x / 2) - MAIN_MENU_LEFT_ADJ - 5); waddstr(menu, "--->"); - wmove(menu, 0, 0); + wmove(menu, curopt, (max_x / 2) - MAIN_MENU_LEFT_ADJ); wrefresh(menu); } -static 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_y, int end) { char buf[64]; struct reference *dep; struct reference *con; struct reference *use; + int start_x = (max_x / 2 - MEMBER_INFO_LEFT_ADJ); + int maxlen = (max_x - start_x); - wmove(menu, end - start + 2, max_x / 2 - 16); + wmove(menu, end - start_y + 1, start_x); + wclrtoeol(menu); + wmove(menu, end - start_y + 2, start_x); wclrtoeol(menu); - wmove(menu, end - start + 3, max_x / 2 - 16); + wmove(menu, end - start_y + 3, start_x); wclrtoeol(menu); - wmove(menu, end - start + 4, max_x / 2 - 16); + wmove(menu, end - start_y + 4, start_x); wclrtoeol(menu); - wmove(menu, end - start + 5, max_x / 2 - 16); + wmove(menu, end - start_y + 5, start_x); wclrtoeol(menu); - wmove(menu, end - start + 6, max_x / 2 - 16); + wmove(menu, end - start_y + 6, start_x); wclrtoeol(menu); if (mem->displayname) { - wmove(menu, end - start + 2, max_x / 2 - 16); - waddstr(menu, (char *) mem->displayname); + int name_len = strlen(mem->displayname); + + wmove(menu, end - start_y + 1, start_x); + if (name_len > maxlen) { + char *last_space; + char *line_1 = strdup(mem->displayname); + + if (line_1) { + line_1[maxlen] = '\0'; + last_space = strrchr(line_1, ' '); + if (last_space) { + *last_space = '\0'; + } + waddstr(menu, line_1); + wmove(menu, end - start_y + 2, start_x); + waddstr(menu, &mem->displayname[last_space - line_1]); + free(line_1); + } else { + waddstr(menu, (char *) mem->displayname); + } + } else { + waddstr(menu, (char *) mem->displayname); + } } if (!AST_LIST_EMPTY(&mem->deps)) { - wmove(menu, end - start + 3, max_x / 2 - 16); + wmove(menu, end - start_y + 3, start_x); strcpy(buf, "Depends on: "); AST_LIST_TRAVERSE(&mem->deps, dep, list) { strncat(buf, dep->displayname, sizeof(buf) - strlen(buf) - 1); @@ -213,7 +244,7 @@ static void display_mem_info(WINDOW *menu, struct member *mem, int start, int en waddstr(menu, buf); } if (!AST_LIST_EMPTY(&mem->uses)) { - wmove(menu, end - start + 4, max_x / 2 - 16); + wmove(menu, end - start_y + 4, start_x); strcpy(buf, "Can use: "); AST_LIST_TRAVERSE(&mem->uses, use, list) { strncat(buf, use->displayname, sizeof(buf) - strlen(buf) - 1); @@ -224,7 +255,7 @@ static void display_mem_info(WINDOW *menu, struct member *mem, int start, int en waddstr(menu, buf); } if (!AST_LIST_EMPTY(&mem->conflicts)) { - wmove(menu, end - start + 5, max_x / 2 - 16); + wmove(menu, end - start_y + 5, start_x); strcpy(buf, "Conflicts with: "); AST_LIST_TRAVERSE(&mem->conflicts, con, list) { strncat(buf, con->displayname, sizeof(buf) - strlen(buf) - 1); @@ -237,7 +268,7 @@ static void display_mem_info(WINDOW *menu, struct member *mem, int start, int en if (!mem->is_separator) { /* Separators lack support levels */ { /* support level */ - wmove(menu, end - start + 6, max_x / 2 - 16); + wmove(menu, end - start_y + 6, start_x); snprintf(buf, sizeof(buf), "Support Level: %s", mem->support_level); if (mem->replacement && *mem->replacement) { char buf2[64]; @@ -266,7 +297,7 @@ static void draw_category_menu(WINDOW *menu, struct category *cat, int start, in break; } } - wmove(menu, curopt - start, max_x / 2 - 9); + wmove(menu, curopt - start, (max_x / 2) - (CAT_MENU_LEFT_ADJ - 1)); wrefresh(menu); return; } @@ -279,7 +310,7 @@ static void draw_category_menu(WINDOW *menu, struct category *cat, int start, in i++; continue; } - wmove(menu, j++, max_x / 2 - 10); + wmove(menu, j++, max_x / 2 - CAT_MENU_LEFT_ADJ); i++; if ((mem->depsfailed == HARD_FAILURE) || (mem->conflictsfailed == HARD_FAILURE)) { snprintf(buf, sizeof(buf), "XXX %s", mem->name); @@ -302,11 +333,11 @@ static void draw_category_menu(WINDOW *menu, struct category *cat, int start, in } if (flags & SCROLL_DOWN) { - wmove(menu, j, max_x / 2 - sizeof(SCROLL_DOWN_INDICATOR) / 2); + wmove(menu, j, max_x / 2 - SCROLL_DOWN_LEFT_ADJ); waddstr(menu, SCROLL_DOWN_INDICATOR); } - wmove(menu, curopt - start, max_x / 2 - 9); + wmove(menu, curopt - start, (max_x / 2) - (CAT_MENU_LEFT_ADJ - 1)); wrefresh(menu); } @@ -465,7 +496,7 @@ static void draw_title_window(WINDOW *title) waddstr(title, (char *) menu_name); wmove(title, 3, (max_x / 2) - (strlen(titlebar) / 2)); waddstr(title, titlebar); - wmove(title, 5, (max_x / 2) - (strlen(MENU_HELP) / 2)); + wmove(title, 5, (max_x / 2) - MENU_HELP_LEFT_ADJ); waddstr(title, MENU_HELP); wrefresh(title); } -- cgit v1.2.3