Skip to content

Commit

Permalink
kconfig: new configuration interface (nconfig)
Browse files Browse the repository at this point in the history
This patch was inspired by the kernel projects page, where an ncurses
replacement for menuconfig was mentioned (by Sam Ravnborg).

Building on menuconfig, this patch implements a more modern look
interface using ncurses and ncurses' satellite libraries (menu, panel,
form). The implementation does not depend on lxdialog, which is
currently distributed with the kernel.

Signed-off-by: Nir Tzachar <nir.tzachar@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
  • Loading branch information
tzachar authored and michal42 committed Feb 2, 2010
1 parent c64152b commit 692d97c
Show file tree
Hide file tree
Showing 10 changed files with 2,314 additions and 20 deletions.
16 changes: 14 additions & 2 deletions scripts/kconfig/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ menuconfig: $(obj)/mconf
config: $(obj)/conf
$< $(Kconfig)

nconfig: $(obj)/nconf
$< $(Kconfig)

oldconfig: $(obj)/conf
$< -o $(Kconfig)

Expand Down Expand Up @@ -110,6 +113,7 @@ endif
# Help text used by make help
help:
@echo ' config - Update current config utilising a line-oriented program'
@echo ' nconfig - Update current config utilising a ncurses menu based program'
@echo ' menuconfig - Update current config utilising a menu based program'
@echo ' xconfig - Update current config utilising a QT based front-end'
@echo ' gconfig - Update current config utilising a GTK based front-end'
Expand Down Expand Up @@ -137,6 +141,8 @@ HOST_EXTRACFLAGS += -DLOCALE
# ===========================================================================
# Shared Makefile for the various kconfig executables:
# conf: Used for defconfig, oldconfig and related targets
# nconf: Used for the nconfig target.
# Utilizes ncurses
# mconf: Used for the menuconfig target
# Utilizes the lxdialog package
# qconf: Used for the xconfig target
Expand All @@ -149,11 +155,16 @@ lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o
lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o

conf-objs := conf.o zconf.tab.o
mconf-objs := mconf.o zconf.tab.o $(lxdialog)
mconf-objs := mconf.o zconf.tab.o $(lxdialog)
nconf-objs := nconf.o zconf.tab.o nconf.gui.o
kxgettext-objs := kxgettext.o zconf.tab.o

hostprogs-y := conf qconf gconf kxgettext

ifeq ($(MAKECMDGOALS),nconfig)
hostprogs-y += nconf
endif

ifeq ($(MAKECMDGOALS),menuconfig)
hostprogs-y += mconf
endif
Expand All @@ -177,7 +188,7 @@ endif

clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \
.tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h
clean-files += mconf qconf gconf
clean-files += mconf qconf gconf nconf
clean-files += config.pot linux.pot

# Check that we have the required ncurses stuff installed for lxdialog (menuconfig)
Expand All @@ -202,6 +213,7 @@ HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
-D LKC_DIRECT_LINK

HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses
$(obj)/qconf.o: $(obj)/.tmp_qtcheck

ifeq ($(qconf-target),1)
Expand Down
2 changes: 1 addition & 1 deletion scripts/kconfig/lkc.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void conf_set_all_new_symbols(enum conf_def_mode mode);
void kconfig_load(void);

/* menu.c */
void menu_init(void);
void _menu_init(void);
void menu_warn(struct menu *menu, const char *fmt, ...);
struct menu *menu_add_menu(void);
void menu_end_menu(void);
Expand Down
3 changes: 2 additions & 1 deletion scripts/kconfig/lkc_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ P(menu_get_root_menu,struct menu *,(struct menu *menu));
P(menu_get_parent_menu,struct menu *,(struct menu *menu));
P(menu_has_help,bool,(struct menu *menu));
P(menu_get_help,const char *,(struct menu *menu));
P(get_symbol_str,void,(struct gstr *r, struct symbol *sym));
P(get_symbol_str, void, (struct gstr *r, struct symbol *sym));
P(get_relations_str, struct gstr, (struct symbol **sym_arr));
P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help));

/* symbol.c */
Expand Down
13 changes: 0 additions & 13 deletions scripts/kconfig/mconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,19 +282,6 @@ static void show_textbox(const char *title, const char *text, int r, int c);
static void show_helptext(const char *title, const char *text);
static void show_help(struct menu *menu);

static struct gstr get_relations_str(struct symbol **sym_arr)
{
struct symbol *sym;
struct gstr res = str_new();
int i;

for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
get_symbol_str(&res, sym);
if (!i)
str_append(&res, _("No matches found.\n"));
return res;
}

static char filename[PATH_MAX+1];
static void set_config_filename(const char *config_filename)
{
Expand Down
16 changes: 15 additions & 1 deletion scripts/kconfig/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ static void prop_warn(struct property *prop, const char *fmt, ...)
va_end(ap);
}

void menu_init(void)
void _menu_init(void)
{
current_entry = current_menu = &rootmenu;
last_entry_ptr = &rootmenu.list;
Expand Down Expand Up @@ -515,6 +515,20 @@ void get_symbol_str(struct gstr *r, struct symbol *sym)
str_append(r, "\n\n");
}

struct gstr get_relations_str(struct symbol **sym_arr)
{
struct symbol *sym;
struct gstr res = str_new();
int i;

for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
get_symbol_str(&res, sym);
if (!i)
str_append(&res, _("No matches found.\n"));
return res;
}


void menu_get_ext_help(struct menu *menu, struct gstr *help)
{
struct symbol *sym = menu->sym;
Expand Down
Loading

0 comments on commit 692d97c

Please sign in to comment.