util/kconfig: Uprev to Linux 5.13's kconfig

This was originally several commits that had to be squashed into one
because the intermediate states weren't able to build coreboot:

 - one to remove everything that wasn't our own code, leaving only
   regex.[ch], toada.c, description.md and Makefile.inc.
 - one to copy in Linux 5.13's scripts/kconfig and adapt Makefile.inc
   to make the original Makefile work again.
 - adapt abuild to use olddefconfig, simplifying matters.
 - apply patches in util/kconfig/patches.
 - Some more adaptations to the libpayload build system.

The patches are now in util/kconfig/patches/, reverse applying them
should lead to a util/kconfig/ tree that contains exactly the Linux
version + our own 5 files.

Change-Id: Ia0e8fe4e9022b278f34ab113a433ef4d45e5c355
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/37152
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
This commit is contained in:
Patrick Georgi
2019-11-22 16:55:58 +01:00
parent 8585eabc5d
commit 53ea1d44f0
69 changed files with 6407 additions and 9476 deletions
-4
View File
@@ -55,10 +55,6 @@ command line.
- savedefconfig - Creates a defconfig file, stripping out all of the symbols
that were left as default values. This is very useful for debugging, and is
how config files should be saved.
- silentoldconfig - This evaluates the .config file the same way that the
oldconfig target does, but does not print out each question as it is
evaluated. It still stops to query the user if an option with no answer in
the .config file is found.
### Targets not typically used in coreboot
+3 -2
View File
@@ -37,7 +37,7 @@ KCONFIG_AUTOADS := $(obj)/cb-config.ads
KCONFIG_AUTOHEADER := $(obj)/config.h
KCONFIG_AUTOCONFIG := $(obj)/auto.conf
KCONFIG_DEPENDENCIES := $(obj)/auto.conf.cmd
KCONFIG_SPLITCONFIG := $(obj)/config
KCONFIG_SPLITCONFIG := $(obj)/config/
KCONFIG_TRISTATE := $(obj)/tristate.conf
KCONFIG_NEGATIVES := 1
KCONFIG_STRICT := 1
@@ -196,7 +196,8 @@ real-all: real-target
.DELETE_ON_ERROR:
$(KCONFIG_AUTOHEADER): $(KCONFIG_CONFIG) $(objutil)/kconfig/conf
+$(MAKE) oldconfig
$(MAKE) olddefconfig
$(MAKE) syncconfig
$(KCONFIG_AUTOCONFIG): $(KCONFIG_AUTOHEADER)
true
+2 -2
View File
@@ -34,7 +34,7 @@ export KCONFIG_SPLITCONFIG := $(obj)/config
export KCONFIG_TRISTATE := $(obj)/tristate.conf
export KCONFIG_CONFIG := $(CURDIR)/.config
export KCONFIG_NEGATIVES := 1
export Kconfig := Kconfig
export KBUILD_KCONFIG := Kconfig
CONFIG_SHELL := sh
KBUILD_DEFCONFIG := configs/defconfig
@@ -70,7 +70,7 @@ $(obj)/config.h:
$(shell mkdir -p $(objk)/lxdialog $(KCONFIG_SPLITCONFIG))
include $(srck)/Makefile
include $(srck)/Makefile.inc
.PHONY: $(PHONY) prepare all real-all defaultbuild
+5 -4
View File
@@ -43,10 +43,10 @@ export objk := $(objutil)/lp_kconfig
export KCONFIG_AUTOHEADER := $(obj)/config.h
export KCONFIG_AUTOCONFIG := $(obj)/auto.conf
export KCONFIG_DEPENDENCIES := $(obj)/auto.conf.cmd
export KCONFIG_SPLITCONFIG := $(obj)/config
export KCONFIG_SPLITCONFIG := $(obj)/config/
export KCONFIG_TRISTATE := $(obj)/tristate.conf
export KCONFIG_NEGATIVES := 1
export Kconfig := Kconfig
export KBUILD_KCONFIG := Kconfig
export CONFIG_ := CONFIG_LP_
# directory containing the toplevel Makefile.inc
@@ -88,7 +88,7 @@ endif
# This include must come _before_ the pattern rules below!
# Order _does_ matter for pattern rules.
include $(srck)/Makefile
include $(srck)/Makefile.inc
include $(HAVE_DOTCONFIG)
@@ -202,7 +202,8 @@ endif
.SECONDEXPANSION:
$(KCONFIG_AUTOHEADER): $(KCONFIG_CONFIG)
$(MAKE) oldconfig
$(MAKE) CONFIG_=CONFIG_LP_ olddefconfig
$(MAKE) CONFIG_=CONFIG_LP_ syncconfig
# Add a new class of source/object files to the build system
add-class= \
+1
View File
@@ -119,6 +119,7 @@ $(obj)/%.S.o: %.S $(LIBPAYLOAD_CONFIG_H) $(DEFAULT_DEPS)
LIBPAYLOAD_OPTS := obj="$(LIBPAYLOAD_OBJ)"
LIBPAYLOAD_OPTS += DOTCONFIG="$(LIBPAYLOAD_DOTCONFIG)"
LIBPAYLOAD_OPTS += CONFIG_=CONFIG_LP_
LIBPAYLOAD_OPTS += $(if $(CCACHE),CONFIG_LP_CCACHE=y)
defconfig: lp-defconfig
+2 -2
View File
@@ -169,8 +169,8 @@ $(TEST_KCONFIG_AUTOHEADER): TEST_KCONFIG_FLAGS:= DOTCONFIG=$(TEST_DOTCONFIG) \
$(TEST_KCONFIG_AUTOHEADER): $(TEST_DOTCONFIG) $(objutil)/kconfig/conf
mkdir -p $(dir $@)
+$(MAKE) $(TEST_KCONFIG_FLAGS) olddefconfig
+$(MAKE) $(TEST_KCONFIG_FLAGS) silentoldconfig
$(MAKE) $(TEST_KCONFIG_FLAGS) olddefconfig
$(MAKE) $(TEST_KCONFIG_FLAGS) syncconfig
$(TEST_KCONFIG_AUTOCONFIG): $(TEST_KCONFIG_AUTOHEADER)
true
+4 -6
View File
@@ -281,7 +281,7 @@ function update_config
# shellcheck disable=SC2059
printf "$configoptions" >> "${config_file}"
yes "" 2>/dev/null | $MAKE oldconfig "$verboseopt" "DOTCONFIG=${config_file}" "obj=${build_dir}" "objutil=$TARGET/sharedutils" &> "${build_dir}/config.log" ; \
$MAKE olddefconfig "$verboseopt" "DOTCONFIG=${config_file}" "obj=${build_dir}" "objutil=$TARGET/sharedutils" &> "${build_dir}/config.log" ; \
CONFIG_OK=$?
if [ $CONFIG_OK -eq 0 ]; then
$MAKE savedefconfig "$verboseopt" DEFCONFIG="${defconfig_file}" DOTCONFIG="${config_file}" obj="${build_dir}" objutil="$TARGET/sharedutils" &>> "${build_dir}/config.log"
@@ -316,7 +316,7 @@ function create_buildenv
echo "OBJUTIL=\$(BUILD)/sharedutils" >> "$MAKEFILE"
echo "all:" >> "$MAKEFILE"
echo " @cp -a config.h config.h.bak" >> "$MAKEFILE"
echo " @cd \$(TOP); \$(MAKE) oldconfig DOTCONFIG=\$(OBJ)/config.build objutil=\$(OBJUTIL) obj=\$(OBJ)" >> "$MAKEFILE"
echo " @cd \$(TOP); \$(MAKE) olddefconfig DOTCONFIG=\$(OBJ)/config.build objutil=\$(OBJUTIL) obj=\$(OBJ)" >> "$MAKEFILE"
echo " @tail -n+6 config.h > config.new; tail -n+6 config.h.bak > config.old" >> "$MAKEFILE"
echo " @cmp -s config.new config.old && cp -a config.h.bak config.h || echo \"Config file changed\"" >> "$MAKEFILE"
echo " @rm config.h.bak config.new config.old" >> "$MAKEFILE"
@@ -788,7 +788,7 @@ fi
# Generate a single xcompile for all boards
export xcompile="${TARGET}/xcompile"
$MAKE -C"${ROOT}" UPDATED_SUBMODULES=1 "${xcompile}" || exit 1
$MAKE -C"${ROOT}" obj="$TARGET/temp" objutil="$TARGET/sharedutils" UPDATED_SUBMODULES=1 "${xcompile}" || exit 1
customizing=$(echo "$customizing" | cut -c3-)
if [ "$customizing" = "" ]; then
@@ -838,9 +838,7 @@ build_targets()
# seed shared utils
TMPCFG=$(mktemp)
printf "%s" "$configoptions" > "$TMPCFG"
$MAKE -j "$cpus" DOTCONFIG="$TMPCFG" obj="$TARGET/temp" objutil="$TARGET/sharedutils" allnoconfig
printf "%s" "$configoptions" >> "$TMPCFG"
yes "" 2>/dev/null | $MAKE -j "$cpus" DOTCONFIG="$TMPCFG" obj="$TARGET/temp" objutil="$TARGET/sharedutils" oldconfig
$MAKE -j "$cpus" DOTCONFIG="$TMPCFG" obj="$TARGET/temp" objutil="$TARGET/sharedutils" olddefconfig 2>/dev/null
BUILDPREFIX=
if [ "$scanbuild" = "true" ]; then
scanbuild_out=$TARGET/sharedutils-scanbuild
+5
View File
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
/conf
/[gmnq]conf
/[gmnq]conf-cfg
/qconf-moc.cc
+159 -323
View File
File diff suppressed because it is too large Load Diff
+62 -5
View File
@@ -1,12 +1,69 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Early configuration of coreboot specific changes
Kconfig ?= src/Kconfig
# Early coreboot specific configuration
KBUILD_KCONFIG ?= src/Kconfig
# Include verbatim Makefile
include $(dir $(lastword $(MAKEFILE_LIST)))Makefile
export LC_ALL=C
export LANG=C
# Extend Linux kconfig build rules
# Include original Makefile, with just enough edits to work for us
$(objk)/Makefile.real: $(dir $(lastword $(MAKEFILE_LIST)))Makefile
mkdir -p $(objk)
sed \
-e "s,\$$(obj),\$$(objk),g" \
-e "s,\$$(src),\$$(srck),g" \
-e "s,^help:,help_kconfig help::," \
-e "s,^%.config:,__disable__&," \
-e "s,^savedefconfig:,__disable__&," \
-e "s,\$$(srctree)/arch/\$$(SRCARCH)/configs/\$$(KBUILD_DEFCONFIG),\$$(KBUILD_DEFCONFIG)," \
-e "s,--defconfig=arch/\$$(SRCARCH)/configs/\$$(KBUILD_DEFCONFIG),--defconfig=\$$(KBUILD_DEFCONFIG)," \
-e "/^unexport CONFIG_$$/d" \
$< > $@.tmp
mv $@.tmp $@
kecho := echo
-include $(objk)/Makefile.real
# Fill in Linux kconfig build rules to work
oldconfig: KCONFIG_STRICT=
savedefconfig: $(objk)/conf
cp $(DOTCONFIG) $(DEFCONFIG)
$< --savedefconfig=$(DEFCONFIG) $(KBUILD_KCONFIG)
FORCE:
filechk=$< > $@
$(objk)/%.o: $(srck)/%.c
$(HOSTCC) -I $(srck) -I $(objk) -c $(HOSTCFLAGS_$(notdir $@)) -o $@ $<
$(objk)/%.o: $(srck)/%.cc
$(HOSTCXX) -I $(srck) -I $(objk) -c $(HOSTCXXFLAGS_$(notdir $@)) -o $@ $<
$(objk)/%.o: $(objk)/%.c
$(HOSTCC) -I $(srck) -I $(objk) -c -o $@ $<
$(objk)/%.moc: $(srck)/%.h | $(objk)/qconf-cfg
$(call cmd_moc)
define hostprogs_template
# $1 entry in hostprogs
$(objk)/$(1): $$(foreach _o,$$($(1)-objs) $$($(1)-cxxobjs),$(objk)/$$(_o)) | $(wildcard $(objk)/$(1)-cfg)
$$(HOSTCXX) -o $$@ $$^ $$(HOSTLDLIBS_$(1))
endef
$(foreach prog,$(hostprogs),$(eval $(call hostprogs_template,$(prog))))
$(objk)/parser.tab.h: | $(objk)/parser.tab.c
$(objk)/%.tab.h: | $(objk)/%.tab.c
$(objk)/%.tab.c: $(srck)/%.y
bison -t -l --defines=$(objk)/$*.tab.h -b $(objk)/$* $<
$(objk)/%.lex.c: $(srck)/%.l
flex -L -o$@ $<
# Support mingw by shipping our own regex implementation
_OS=$(shell uname -s |cut -c-7)
-12
View File
@@ -1,12 +0,0 @@
scripts/kconfig/lxdialog/checklist.c
scripts/kconfig/lxdialog/inputbox.c
scripts/kconfig/lxdialog/menubox.c
scripts/kconfig/lxdialog/textbox.c
scripts/kconfig/lxdialog/util.c
scripts/kconfig/lxdialog/yesno.c
scripts/kconfig/mconf.c
scripts/kconfig/conf.c
scripts/kconfig/confdata.c
scripts/kconfig/gconf.c
scripts/kconfig/gconf.glade.h
scripts/kconfig/qconf.cc
-13
View File
@@ -1,13 +0,0 @@
#!/usr/bin/env sh
# Needed for systems without gettext
$* -x c -o /dev/null - > /dev/null 2>&1 << EOF
#include <libintl.h>
int main()
{
gettext("");
return 0;
}
EOF
if [ ! "$?" -eq "0" ]; then
echo -DKBUILD_NO_NLS;
fi
+425 -214
View File
File diff suppressed because it is too large Load Diff
+396 -510
View File
File diff suppressed because it is too large Load Diff
+306 -171
View File
File diff suppressed because it is too large Load Diff
+105 -20
View File
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/
#ifndef EXPR_H
@@ -29,7 +29,9 @@ typedef enum tristate {
} tristate;
enum expr_type {
E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_LIST, E_SYMBOL, E_RANGE
E_NONE, E_OR, E_AND, E_NOT,
E_EQUAL, E_UNEQUAL, E_LTH, E_LEQ, E_GTH, E_GEQ,
E_LIST, E_SYMBOL, E_RANGE
};
union expr_data {
@@ -60,7 +62,7 @@ struct symbol_value {
};
enum symbol_type {
S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER
S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING
};
/* enum values are used as index to symbol.def[] */
@@ -72,20 +74,64 @@ enum {
S_DEF_COUNT
};
/*
* Represents a configuration symbol.
*
* Choices are represented as a special kind of symbol and have the
* SYMBOL_CHOICE bit set in 'flags'.
*/
struct symbol {
/* The next symbol in the same bucket in the symbol hash table */
struct symbol *next;
/* The name of the symbol, e.g. "FOO" for 'config FOO' */
char *name;
/* S_BOOLEAN, S_TRISTATE, ... */
enum symbol_type type;
/*
* The calculated value of the symbol. The SYMBOL_VALID bit is set in
* 'flags' when this is up to date. Note that this value might differ
* from the user value set in e.g. a .config file, due to visibility.
*/
struct symbol_value curr;
/*
* Values for the symbol provided from outside. def[S_DEF_USER] holds
* the .config value.
*/
struct symbol_value def[S_DEF_COUNT];
/*
* An upper bound on the tristate value the user can set for the symbol
* if it is a boolean or tristate. Calculated from prompt dependencies,
* which also inherit dependencies from enclosing menus, choices, and
* ifs. If 'n', the user value will be ignored.
*
* Symbols lacking prompts always have visibility 'n'.
*/
tristate visible;
/* SYMBOL_* flags */
int flags;
/* List of properties. See prop_type. */
struct property *prop;
/* Dependencies from enclosing menus, choices, and ifs */
struct expr_value dir_dep;
/* Reverse dependencies through being selected by other symbols */
struct expr_value rev_dep;
/*
* "Weak" reverse dependencies through being implied by other symbols
*/
struct expr_value implied;
};
#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER)
#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next)
#define SYMBOL_CONST 0x0001 /* symbol is const */
#define SYMBOL_CHECK 0x0008 /* used during dependency checking */
@@ -95,7 +141,8 @@ struct symbol {
#define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */
#define SYMBOL_WRITE 0x0200 /* write symbol to file (KCONFIG_CONFIG) */
#define SYMBOL_CHANGED 0x0400 /* ? */
#define SYMBOL_AUTO 0x1000 /* value from environment variable */
#define SYMBOL_WRITTEN 0x0800 /* track info to avoid double-write to .config */
#define SYMBOL_NO_WRITE 0x1000 /* Symbol for internal use only; it will not be written */
#define SYMBOL_CHECKED 0x2000 /* used during dependency checking */
#define SYMBOL_WARNED 0x8000 /* warning has been issued */
@@ -109,9 +156,6 @@ struct symbol {
/* choice values need to be set before calculating this symbol value */
#define SYMBOL_NEED_SET_CHOICE_VALUES 0x100000
/* Set symbol to y if allnoconfig; used for symbols that hide others */
#define SYMBOL_ALLNOCONFIG_Y 0x200000
#define SYMBOL_MAXLENGTH 256
#define SYMBOL_HASHSIZE 9973
@@ -125,23 +169,25 @@ struct symbol {
* config BAZ
* int "BAZ Value"
* range 1..255
*
* Please, also check parser.y:print_symbol() when modifying the
* list of property types!
*/
enum prop_type {
P_UNKNOWN,
P_PROMPT, /* prompt "foo prompt" or "BAZ Value" */
P_COMMENT, /* text associated with a comment */
P_MENU, /* prompt associated with a menuconfig option */
P_MENU, /* prompt associated with a menu or menuconfig symbol */
P_DEFAULT, /* default y */
P_CHOICE, /* choice value */
P_SELECT, /* select BAR */
P_IMPLY, /* imply BAR */
P_RANGE, /* range 7..100 (for a symbol) */
P_ENV, /* value from environment variable */
P_SYMBOL, /* where a symbol is defined */
};
struct property {
struct property *next; /* next property - null if last */
struct symbol *sym; /* the symbol for which the property is associated */
enum prop_type type; /* type of property */
const char *text; /* the prompt value - P_PROMPT, P_MENU, P_COMMENT */
struct expr_value visible;
@@ -162,22 +208,67 @@ struct property {
for (st = sym->prop; st; st = st->next) \
if (st->text)
/*
* Represents a node in the menu tree, as seen in e.g. menuconfig (though used
* for all front ends). Each symbol, menu, etc. defined in the Kconfig files
* gets a node. A symbol defined in multiple locations gets one node at each
* location.
*/
struct menu {
/* The next menu node at the same level */
struct menu *next;
/* The parent menu node, corresponding to e.g. a menu or choice */
struct menu *parent;
/* The first child menu node, for e.g. menus and choices */
struct menu *list;
/*
* The symbol associated with the menu node. Choices are implemented as
* a special kind of symbol. NULL for menus, comments, and ifs.
*/
struct symbol *sym;
/*
* The prompt associated with the node. This holds the prompt for a
* symbol as well as the text for a menu or comment, along with the
* type (P_PROMPT, P_MENU, etc.)
*/
struct property *prompt;
/*
* 'visible if' dependencies. If more than one is given, they will be
* ANDed together.
*/
struct expr *visibility;
/*
* Ordinary dependencies from e.g. 'depends on' and 'if', ANDed
* together
*/
struct expr *dep;
/* MENU_* flags */
unsigned int flags;
/* Any help text associated with the node */
char *help;
/* The location where the menu node appears in the Kconfig files */
struct file *file;
int lineno;
/* For use by front ends that need to store auxiliary data */
void *data;
};
/*
* Set on a menu node when the corresponding symbol changes state in some way.
* Can be checked by front ends.
*/
#define MENU_CHANGED 0x0001
#define MENU_ROOT 0x0002
struct jump_key {
@@ -187,15 +278,12 @@ struct jump_key {
int index;
};
#define JUMP_NB 9
extern struct file *file_list;
extern struct file *current_file;
struct file *lookup_file(const char *name);
extern struct symbol symbol_yes, symbol_no, symbol_mod;
extern struct symbol *modules_sym;
extern struct symbol *sym_defconfig_list;
extern int cdebug;
struct expr *expr_alloc_symbol(struct symbol *sym);
struct expr *expr_alloc_one(enum expr_type type, struct expr *ce);
@@ -205,24 +293,21 @@ struct expr *expr_alloc_and(struct expr *e1, struct expr *e2);
struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
struct expr *expr_copy(const struct expr *org);
void expr_free(struct expr *e);
int expr_eq(struct expr *e1, struct expr *e2);
void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
int expr_eq(struct expr *e1, struct expr *e2);
tristate expr_calc_value(struct expr *e);
struct expr *expr_eliminate_yn(struct expr *e);
struct expr *expr_trans_bool(struct expr *e);
struct expr *expr_eliminate_dups(struct expr *e);
struct expr *expr_transform(struct expr *e);
int expr_contains_symbol(struct expr *dep, struct symbol *sym);
bool expr_depends_symbol(struct expr *dep, struct symbol *sym);
struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2);
struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2);
void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2);
struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2);
void expr_fprint(struct expr *e, FILE *out);
struct gstr; /* forward */
void expr_gstr_print(struct expr *e, struct gstr *gs);
void expr_gstr_print_revdep(struct expr *e, struct gstr *gs,
tristate pr_type, const char *title);
static inline int expr_is_yes(struct expr *e)
{
+30
View File
@@ -0,0 +1,30 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
PKG="gtk+-2.0 gmodule-2.0 libglade-2.0"
if [ -z "$(command -v pkg-config)" ]; then
echo >&2 "*"
echo >&2 "* 'make gconfig' requires 'pkg-config'. Please install it."
echo >&2 "*"
exit 1
fi
if ! pkg-config --exists $PKG; then
echo >&2 "*"
echo >&2 "* Unable to find the GTK+ installation. Please make sure that"
echo >&2 "* the GTK+ 2.0 development package is correctly installed."
echo >&2 "* You need $PKG"
echo >&2 "*"
exit 1
fi
if ! pkg-config --atleast-version=2.0.0 gtk+-2.0; then
echo >&2 "*"
echo >&2 "* GTK+ is present but version >= 2.0.0 is required."
echo >&2 "*"
exit 1
fi
echo cflags=\"$(pkg-config --cflags $PKG)\"
echo libs=\"$(pkg-config --libs $PKG)\"
+49 -79
View File
@@ -1,18 +1,11 @@
/* Hey EMACS -*- linux-c -*- */
// SPDX-License-Identifier: GPL-2.0
/*
*
* Copyright (C) 2002-2003 Romain Lievin <roms@tilp.info>
* Released under the terms of the GNU GPL v2.0.
*
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdlib.h>
#include "lkc.h"
#include "images.c"
#include "images.h"
#include <glade/glade.h>
#include <gtk/gtk.h>
@@ -21,13 +14,12 @@
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <time.h>
//#define DEBUG
int kconfig_warnings = 0;
enum {
SINGLE_VIEW, SPLIT_VIEW, FULL_VIEW
};
@@ -80,8 +72,8 @@ static gchar **fill_row(struct menu *menu);
static void conf_changed(void);
/* Helping/Debugging Functions */
const char *dbg_sym_flags(int val)
#ifdef DEBUG
static const char *dbg_sym_flags(int val)
{
static char buf[256];
@@ -103,16 +95,17 @@ const char *dbg_sym_flags(int val)
strcat(buf, "write/");
if (val & SYMBOL_CHANGED)
strcat(buf, "changed/");
if (val & SYMBOL_AUTO)
strcat(buf, "auto/");
if (val & SYMBOL_NO_WRITE)
strcat(buf, "no_write/");
buf[strlen(buf) - 1] = '\0';
return buf;
}
#endif
void replace_button_icon(GladeXML * xml, GdkDrawable * window,
GtkStyle * style, gchar * btn_name, gchar ** xpm)
static void replace_button_icon(GladeXML *xml, GdkDrawable *window,
GtkStyle *style, gchar *btn_name, gchar **xpm)
{
GdkPixmap *pixmap;
GdkBitmap *mask;
@@ -130,7 +123,7 @@ void replace_button_icon(GladeXML * xml, GdkDrawable * window,
}
/* Main Window Initialization */
void init_main_window(const gchar * glade_file)
static void init_main_window(const gchar *glade_file)
{
GladeXML *xml;
GtkWidget *widget;
@@ -139,7 +132,7 @@ void init_main_window(const gchar * glade_file)
xml = glade_xml_new(glade_file, "window1", NULL);
if (!xml)
g_error(_("GUI loading failed !\n"));
g_error("GUI loading failed !\n");
glade_xml_signal_autoconnect(xml);
main_wnd = glade_xml_get_widget(xml, "window1");
@@ -171,14 +164,6 @@ void init_main_window(const gchar * glade_file)
style = gtk_widget_get_style(main_wnd);
widget = glade_xml_get_widget(xml, "toolbar1");
#if 0 /* Use stock Gtk icons instead */
replace_button_icon(xml, main_wnd->window, style,
"button1", (gchar **) xpm_back);
replace_button_icon(xml, main_wnd->window, style,
"button2", (gchar **) xpm_load);
replace_button_icon(xml, main_wnd->window, style,
"button3", (gchar **) xpm_save);
#endif
replace_button_icon(xml, main_wnd->window, style,
"button4", (gchar **) xpm_single_view);
replace_button_icon(xml, main_wnd->window, style,
@@ -186,22 +171,6 @@ void init_main_window(const gchar * glade_file)
replace_button_icon(xml, main_wnd->window, style,
"button6", (gchar **) xpm_tree_view);
#if 0
switch (view_mode) {
case SINGLE_VIEW:
widget = glade_xml_get_widget(xml, "button4");
g_signal_emit_by_name(widget, "clicked");
break;
case SPLIT_VIEW:
widget = glade_xml_get_widget(xml, "button5");
g_signal_emit_by_name(widget, "clicked");
break;
case FULL_VIEW:
widget = glade_xml_get_widget(xml, "button6");
g_signal_emit_by_name(widget, "clicked");
break;
}
#endif
txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w));
tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1",
"foreground", "red",
@@ -216,7 +185,7 @@ void init_main_window(const gchar * glade_file)
gtk_widget_show(main_wnd);
}
void init_tree_model(void)
static void init_tree_model(void)
{
gint i;
@@ -246,7 +215,7 @@ void init_tree_model(void)
model1 = GTK_TREE_MODEL(tree1);
}
void init_left_tree(void)
static void init_left_tree(void)
{
GtkTreeView *view = GTK_TREE_VIEW(tree1_w);
GtkCellRenderer *renderer;
@@ -259,7 +228,7 @@ void init_left_tree(void)
column = gtk_tree_view_column_new();
gtk_tree_view_append_column(view, column);
gtk_tree_view_column_set_title(column, _("Options"));
gtk_tree_view_column_set_title(column, "Options");
renderer = gtk_cell_renderer_toggle_new();
gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
@@ -288,7 +257,7 @@ static void renderer_edited(GtkCellRendererText * cell,
const gchar * path_string,
const gchar * new_text, gpointer user_data);
void init_right_tree(void)
static void init_right_tree(void)
{
GtkTreeView *view = GTK_TREE_VIEW(tree2_w);
GtkCellRenderer *renderer;
@@ -302,7 +271,7 @@ void init_right_tree(void)
column = gtk_tree_view_column_new();
gtk_tree_view_append_column(view, column);
gtk_tree_view_column_set_title(column, _("Options"));
gtk_tree_view_column_set_title(column, "Options");
renderer = gtk_cell_renderer_pixbuf_new();
gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column),
@@ -331,7 +300,7 @@ void init_right_tree(void)
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes(view, -1,
_("Name"), renderer,
"Name", renderer,
"text", COL_NAME,
"foreground-gdk",
COL_COLOR, NULL);
@@ -355,7 +324,7 @@ void init_right_tree(void)
COL_COLOR, NULL);
renderer = gtk_cell_renderer_text_new();
gtk_tree_view_insert_column_with_attributes(view, -1,
_("Value"), renderer,
"Value", renderer,
"text", COL_VALUE,
"editable",
COL_EDIT,
@@ -394,7 +363,7 @@ static void text_insert_help(struct menu *menu)
{
GtkTextBuffer *buffer;
GtkTextIter start, end;
const char *prompt = _(menu_get_prompt(menu));
const char *prompt = menu_get_prompt(menu);
struct gstr help = str_new();
menu_get_ext_help(menu, &help);
@@ -448,7 +417,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,
if (!conf_get_changed())
return FALSE;
dialog = gtk_dialog_new_with_buttons(_("Warning !"),
dialog = gtk_dialog_new_with_buttons("Warning !",
GTK_WINDOW(main_wnd),
(GtkDialogFlags)
(GTK_DIALOG_MODAL |
@@ -462,7 +431,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event,
gtk_dialog_set_default_response(GTK_DIALOG(dialog),
GTK_RESPONSE_CANCEL);
label = gtk_label_new(_("\nSave configuration ?\n"));
label = gtk_label_new("\nSave configuration ?\n");
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label);
gtk_widget_show(label);
@@ -522,7 +491,7 @@ load_filename(GtkFileSelection * file_selector, gpointer user_data)
(user_data));
if (conf_read(fn))
text_insert_msg(_("Error"), _("Unable to load configuration !"));
text_insert_msg("Error", "Unable to load configuration !");
else
display_tree(&rootmenu);
}
@@ -531,7 +500,7 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)
{
GtkWidget *fs;
fs = gtk_file_selection_new(_("Load file..."));
fs = gtk_file_selection_new("Load file...");
g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button),
"clicked",
G_CALLBACK(load_filename), (gpointer) fs);
@@ -550,7 +519,8 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)
void on_save_activate(GtkMenuItem * menuitem, gpointer user_data)
{
if (conf_write(NULL))
text_insert_msg(_("Error"), _("Unable to save configuration !"));
text_insert_msg("Error", "Unable to save configuration !");
conf_write_autoconf(0);
}
@@ -563,7 +533,7 @@ store_filename(GtkFileSelection * file_selector, gpointer user_data)
(user_data));
if (conf_write(fn))
text_insert_msg(_("Error"), _("Unable to save configuration !"));
text_insert_msg("Error", "Unable to save configuration !");
gtk_widget_destroy(GTK_WIDGET(user_data));
}
@@ -572,7 +542,7 @@ void on_save_as1_activate(GtkMenuItem * menuitem, gpointer user_data)
{
GtkWidget *fs;
fs = gtk_file_selection_new(_("Save file as..."));
fs = gtk_file_selection_new("Save file as...");
g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button),
"clicked",
G_CALLBACK(store_filename), (gpointer) fs);
@@ -665,7 +635,7 @@ on_set_option_mode3_activate(GtkMenuItem *menuitem, gpointer user_data)
void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
{
GtkWidget *dialog;
const gchar *intro_text = _(
const gchar *intro_text =
"Welcome to gkc, the GTK+ graphical configuration tool\n"
"For each option, a blank box indicates the feature is disabled, a\n"
"check indicates it is enabled, and a dot indicates that it is to\n"
@@ -680,7 +650,7 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
"option.\n"
"\n"
"Toggling Show Debug Info under the Options menu will show \n"
"the dependencies, which you can then match by examining other options.");
"the dependencies, which you can then match by examining other options.";
dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -697,8 +667,8 @@ void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data)
{
GtkWidget *dialog;
const gchar *about_text =
_("gkc is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n"
"Based on the source code from Roman Zippel.\n");
"gkc is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n"
"Based on the source code from Roman Zippel.\n";
dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -715,9 +685,9 @@ void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data)
{
GtkWidget *dialog;
const gchar *license_text =
_("gkc is released under the terms of the GNU GPL v2.\n"
"gkc is released under the terms of the GNU GPL v2.\n"
"For more information, please see the source code or\n"
"visit http://www.fsf.org/licenses/licenses.html\n");
"visit http://www.fsf.org/licenses/licenses.html\n";
dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),
GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -940,7 +910,7 @@ on_treeview2_button_press_event(GtkWidget * widget,
current = menu;
display_tree_part();
gtk_widget_set_sensitive(back_btn, TRUE);
} else if ((col == COL_OPTION)) {
} else if (col == COL_OPTION) {
toggle_sym_value(menu);
gtk_tree_view_expand_row(view, path, TRUE);
}
@@ -1074,8 +1044,13 @@ static gchar **fill_row(struct menu *menu)
g_free(row[i]);
bzero(row, sizeof(row));
ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
row[COL_OPTION] =
g_strdup_printf("%s %s", _(menu_get_prompt(menu)),
g_strdup_printf("%s %s %s %s",
ptype == P_COMMENT ? "***" : "",
menu_get_prompt(menu),
ptype == P_COMMENT ? "***" : "",
sym && !sym_has_value(sym) ? "(NEW)" : "");
if (opt_mode == OPT_ALL && !menu_is_visible(menu))
@@ -1086,7 +1061,6 @@ static gchar **fill_row(struct menu *menu)
else
row[COL_COLOR] = g_strdup("Black");
ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN;
switch (ptype) {
case P_MENU:
row[COL_PIXBUF] = (gchar *) xpm_menu;
@@ -1128,7 +1102,7 @@ static gchar **fill_row(struct menu *menu)
if (def_menu)
row[COL_VALUE] =
g_strdup(_(menu_get_prompt(def_menu)));
g_strdup(menu_get_prompt(def_menu));
}
if (sym->flags & SYMBOL_CHOICEVAL)
row[COL_BTNRAD] = GINT_TO_POINTER(TRUE);
@@ -1237,8 +1211,8 @@ static GtkTreeIter found;
/*
* Find a menu in the GtkTree starting at parent.
*/
GtkTreeIter *gtktree_iter_find_node(GtkTreeIter * parent,
struct menu *tofind)
static GtkTreeIter *gtktree_iter_find_node(GtkTreeIter *parent,
struct menu *tofind)
{
GtkTreeIter iter;
GtkTreeIter *child = &iter;
@@ -1449,7 +1423,7 @@ static void display_list(void)
tree = tree2;
}
void fixup_rootmenu(struct menu *menu)
static void fixup_rootmenu(struct menu *menu)
{
struct menu *child;
static int menu_cnt = 0;
@@ -1473,18 +1447,11 @@ int main(int ac, char *av[])
char *env;
gchar *glade_file;
bindtextdomain(PACKAGE, LOCALEDIR);
bind_textdomain_codeset(PACKAGE, "UTF-8");
textdomain(PACKAGE);
/* GTK stuffs */
gtk_set_locale();
gtk_init(&ac, &av);
glade_init();
//add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");
//add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps");
/* Determine GUI path */
env = getenv(SRCTREE);
if (env)
@@ -1500,9 +1467,12 @@ int main(int ac, char *av[])
case 'a':
//showAll = 1;
break;
case 's':
conf_set_message_callback(NULL);
break;
case 'h':
case '?':
printf("%s <config>\n", av[0]);
printf("%s [-s] <config>\n", av[0]);
exit(0);
}
name = av[2];
+18 -16
View File
@@ -1,9 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
* Released under the terms of the GNU GPL v2.0.
*/
static const char *xpm_load[] = {
#include "images.h"
const char * const xpm_load[] = {
"22 22 5 1",
". c None",
"# c #000000",
@@ -33,7 +35,7 @@ static const char *xpm_load[] = {
"###############.......",
"......................"};
static const char *xpm_save[] = {
const char * const xpm_save[] = {
"22 22 5 1",
". c None",
"# c #000000",
@@ -63,7 +65,7 @@ static const char *xpm_save[] = {
"..##################..",
"......................"};
static const char *xpm_back[] = {
const char * const xpm_back[] = {
"22 22 3 1",
". c None",
"# c #000083",
@@ -91,7 +93,7 @@ static const char *xpm_back[] = {
"......................",
"......................"};
static const char *xpm_tree_view[] = {
const char * const xpm_tree_view[] = {
"22 22 2 1",
". c None",
"# c #000000",
@@ -118,7 +120,7 @@ static const char *xpm_tree_view[] = {
"......................",
"......................"};
static const char *xpm_single_view[] = {
const char * const xpm_single_view[] = {
"22 22 2 1",
". c None",
"# c #000000",
@@ -145,7 +147,7 @@ static const char *xpm_single_view[] = {
"......................",
"......................"};
static const char *xpm_split_view[] = {
const char * const xpm_split_view[] = {
"22 22 2 1",
". c None",
"# c #000000",
@@ -172,7 +174,7 @@ static const char *xpm_split_view[] = {
"......................",
"......................"};
static const char *xpm_symbol_no[] = {
const char * const xpm_symbol_no[] = {
"12 12 2 1",
" c white",
". c black",
@@ -189,7 +191,7 @@ static const char *xpm_symbol_no[] = {
" .......... ",
" "};
static const char *xpm_symbol_mod[] = {
const char * const xpm_symbol_mod[] = {
"12 12 2 1",
" c white",
". c black",
@@ -206,7 +208,7 @@ static const char *xpm_symbol_mod[] = {
" .......... ",
" "};
static const char *xpm_symbol_yes[] = {
const char * const xpm_symbol_yes[] = {
"12 12 2 1",
" c white",
". c black",
@@ -223,7 +225,7 @@ static const char *xpm_symbol_yes[] = {
" .......... ",
" "};
static const char *xpm_choice_no[] = {
const char * const xpm_choice_no[] = {
"12 12 2 1",
" c white",
". c black",
@@ -240,7 +242,7 @@ static const char *xpm_choice_no[] = {
" .... ",
" "};
static const char *xpm_choice_yes[] = {
const char * const xpm_choice_yes[] = {
"12 12 2 1",
" c white",
". c black",
@@ -257,7 +259,7 @@ static const char *xpm_choice_yes[] = {
" .... ",
" "};
static const char *xpm_menu[] = {
const char * const xpm_menu[] = {
"12 12 2 1",
" c white",
". c black",
@@ -274,7 +276,7 @@ static const char *xpm_menu[] = {
" .......... ",
" "};
static const char *xpm_menu_inv[] = {
const char * const xpm_menu_inv[] = {
"12 12 2 1",
" c white",
". c black",
@@ -291,7 +293,7 @@ static const char *xpm_menu_inv[] = {
" .......... ",
" "};
static const char *xpm_menuback[] = {
const char * const xpm_menuback[] = {
"12 12 2 1",
" c white",
". c black",
@@ -308,7 +310,7 @@ static const char *xpm_menuback[] = {
" .......... ",
" "};
static const char *xpm_void[] = {
const char * const xpm_void[] = {
"12 12 2 1",
" c white",
". c black",
+33
View File
@@ -0,0 +1,33 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
*/
#ifndef IMAGES_H
#define IMAGES_H
#ifdef __cplusplus
extern "C" {
#endif
extern const char * const xpm_load[];
extern const char * const xpm_save[];
extern const char * const xpm_back[];
extern const char * const xpm_tree_view[];
extern const char * const xpm_single_view[];
extern const char * const xpm_split_view[];
extern const char * const xpm_symbol_no[];
extern const char * const xpm_symbol_mod[];
extern const char * const xpm_symbol_yes[];
extern const char * const xpm_choice_no[];
extern const char * const xpm_choice_yes[];
extern const char * const xpm_menu[];
extern const char * const xpm_menu_inv[];
extern const char * const xpm_menuback[];
extern const char * const xpm_void[];
#ifdef __cplusplus
}
#endif
#endif /* IMAGES_H */

Some files were not shown because too many files have changed in this diff Show More