Skip to content

Commit

Permalink
build: scripts/config - update to kconfig-v5.14
Browse files Browse the repository at this point in the history
Functional Changes
---------- -------
- make 'imply' not impose any restrictions: allow symbols implied by y
  to become m
- change "modules" from sub-option to first-level attribute

Bugfixes
--------
- nconf: fix core dump when searching in empty menu
- nconf: stop endless search loops
- xconfig: fix content of the main widget
- xconfig: fix support for the split view mode

Other Changes
----- -------
- highlight xconfig 'comment' lines with '***'
- xconfig: navigate menus on hyperlinks
- xconfig: drop support for Qt4
- improve host ncurses detection

Update the 'option modules' usage to just 'modules' in Config.in.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
  • Loading branch information
cotequeiroz authored and ynezz committed Feb 19, 2022
1 parent 73ea763 commit 009293c
Show file tree
Hide file tree
Showing 30 changed files with 3,221 additions and 3,934 deletions.
2 changes: 1 addition & 1 deletion Config.in
Expand Up @@ -5,7 +5,7 @@
mainmenu "OpenWrt Configuration"

config MODULES
option modules
modules
bool
default y

Expand Down
30 changes: 12 additions & 18 deletions scripts/config/.gitignore
@@ -1,22 +1,16 @@
#
# Generated files
#
*.moc
*conf-cfg
mconf_check
# SPDX-License-Identifier: GPL-2.0-only
/conf
/[gmnq]conf
/[gmnq]conf-cfg
/qconf-moc.cc

# From linux kconfig parent directories
.*

#
# configuration programs
#
conf
mconf
nconf
qconf
gconf
# OpenWrt-generated files
mconf_check

#
# temporary files from older version. Should be removed
#
# Temporary files from older versions. They should be removed after the
# end of support for OpenWrt 19.07.
zconf.???.c
zconf.hash.c
.tmp_qtcheck
62 changes: 38 additions & 24 deletions scripts/config/Makefile
Expand Up @@ -5,11 +5,11 @@
.PHONY: clean all
all: conf mconf
clean:
rm -f *.o lxdialog/*.o *.moc $(clean-files) conf mconf qconf nconf
rm -f *.o lxdialog/*.o *.moc .*.cmd $(clean-files)

# This clean-files definition is here to ensure that temporary files from the
# previous version are removed by make config-clean.
# It should be removed or emptied when this Makefile get updated again.
# It should be emptied after the end of support for OpenWrt 19.07.
clean-files := zconf.tab.c zconf.lex.c zconf.hash.c .tmp_qtcheck

# ===========================================================================
Expand All @@ -24,9 +24,11 @@ src:=.
obj:=.
Q:=$(if $V,,@)
cmd = $(cmd_$(1))
dot-target = $(dir $@).$(notdir $@)

# taken from ../Kbuild.include
# some definitions taken from ../Kbuild.include
dot-target = $(dir $@).$(notdir $@)
squote := '
escsq = $(subst $(squote),'\$(squote)',$1)
define filechk
$(Q)set -e; \
mkdir -p $(dir $@); \
Expand All @@ -37,23 +39,29 @@ define filechk
mv -f $(dot-target).tmp $@; \
fi
endef
cmd-check = $(if $(strip $(cmd_$@)),,1)
make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1)))))
newer-prereqs = $(filter-out $(PHONY),$?)
if_changed = $(if $(newer-prereqs)$(cmd-check), \
$(cmd); \
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)

### Stripped down upstream Makefile follows:
# ===========================================================================
# object files used by all kconfig flavours
common-objs := confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o \
symbol.o util.o
common-objs := confdata.o expr.o lexer.lex.o menu.o parser.tab.o \
preprocess.o symbol.o util.o

$(obj)/lexer.lex.o: $(obj)/parser.tab.h
HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src)
HOSTCFLAGS_parser.tab.o := -I $(srctree)/$(src)

# conf: Used for defconfig, oldconfig and related targets
hostprogs-y += conf
hostprogs += conf
conf-objs := conf.o $(common-objs)

# nconf: Used for the nconfig target based on ncurses
hostprogs-y += nconf
hostprogs += nconf
nconf-objs := nconf.o nconf.gui.o $(common-objs)

HOSTLDLIBS_nconf = $(shell . $(obj)/nconf-cfg && echo $$libs)
Expand All @@ -63,7 +71,7 @@ HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/nconf-cfg && echo $$cflags)
$(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/nconf-cfg

# mconf: Used for the menuconfig target based on lxdialog
hostprogs-y += mconf
hostprogs += mconf
lxdialog := $(addprefix lxdialog/, \
checklist.o inputbox.o menubox.o textbox.o util.o yesno.o)
mconf-objs := mconf.o $(lxdialog) $(common-objs)
Expand All @@ -75,20 +83,23 @@ $(foreach f, mconf.o $(lxdialog), \
$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/mconf-cfg

# qconf: Used for the xconfig target based on Qt
hostprogs-y += qconf
qconf-cxxobjs := qconf.o
hostprogs += qconf
qconf-cxxobjs := qconf.o qconf-moc.o
qconf-objs := images.o $(common-objs)

HOSTLDLIBS_qconf = $(shell . $(obj)/qconf-cfg && echo $$libs)
HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/qconf-cfg && echo $$cflags)
HOSTCXXFLAGS_qconf-moc.o = $(shell . $(obj)/qconf-cfg && echo $$cflags)

$(obj)/qconf.o: $(obj)/qconf-cfg $(obj)/qconf.moc
$(obj)/qconf.o: $(obj)/qconf-cfg

quiet_cmd_moc = MOC $@
cmd_moc = $(shell . $(obj)/qconf-cfg && echo $$moc) -i $< -o $@
cmd_moc = $(shell . $(obj)/qconf-cfg && echo $$moc) $< -o $@

$(obj)/qconf-moc.cc: $(src)/qconf.h $(obj)/qconf-cfg FORCE
$(call if_changed,moc)

$(obj)/%.moc: $(src)/%.h $(obj)/qconf-cfg
$(call cmd,moc)
targets += qconf-moc.cc

# check if necessary packages are available, and configure build flags
filechk_conf_cfg = $(CONFIG_SHELL) $<
Expand All @@ -102,6 +113,8 @@ clean-files += *conf-cfg
# OpenWrt rules and final adjustments that need to be made after reading the
# full upstream Makefile

clean-files += $(targets) $(hostprogs)

FORCE:

ifdef BUILD_SHIPPED_FILES
Expand All @@ -117,24 +130,25 @@ clean-files += $(shipped-files)
flex -L -o$@ $<
endif

$(foreach f, mconf.o $(lxdialog), \
$(eval $f: CFLAGS+=$$(HOSTCFLAGS_$f)))
$(foreach f,$(conf-objs) $(filter-out $(common-objs),$(mconf-objs) \
$(qconf-objs) \
$(nconf-objs)), \
$(eval $(obj)/$f: CFLAGS+=$$(HOSTCFLAGS_$f)))

$(obj)/lexer.lex.o: CFLAGS += $(HOSTCFLAGS_lexer.lex.o)
$(obj)/parser.tab.o: CFLAGS += $(HOSTCFLAGS_parser.tab.o)
$(obj)/qconf.o: CXXFLAGS+=$(HOSTCXXFLAGS_qconf.o)
$(foreach f,$(qconf-cxxobjs), \
$(eval $(obj)/$f: CXXFLAGS+=$$(HOSTCXXFLAGS_$f)))

conf: $(conf-objs)
$(obj)/conf: $(addprefix $(obj)/,$(conf-objs))

# The *conf-cfg file is used (then filtered out) as the first prerequisite to
# avoid sourcing it before the script is built, when trying to compute CFLAGS
# for the actual first prerequisite. This avoids errors like:
# '/bin/sh: ./mconf-cfg: No such file or directory'
mconf: mconf-cfg $(mconf-objs)
$(obj)/mconf: mconf-cfg $(addprefix $(obj)/,$(mconf-objs))
$(CC) -o $@ $(filter-out mconf-cfg,$^) $(HOSTLDLIBS_mconf)

nconf: nconf-cfg $(nconf-objs)
$(obj)/nconf: nconf-cfg $(addprefix $(obj)/,$(nconf-objs))
$(CC) -o $@ $(filter-out nconf-cfg,$^) $(HOSTLDLIBS_nconf)

qconf: qconf-cfg $(qconf-cxxobjs) $(qconf-objs)
$(obj)/qconf: qconf-cfg $(addprefix $(obj)/,$(qconf-cxxobjs) $(qconf-objs))
$(CXX) -o $@ $(filter-out qconf-cfg,$^) $(HOSTLDLIBS_qconf)
9 changes: 4 additions & 5 deletions scripts/config/README
@@ -1,7 +1,6 @@
These files were taken from the Linux Kernel Configuration System at commit
089b7d890f972f6b649fedc9259f6b93a18fb970 (Feb 4, 2020) and modified for the
OpenWrt Buildroot:
- Removed gconf, tests and kernel configuration targets.
These files were taken from the Linux 5.14 Kernel Configuration System and
modified for the OpenWrt Buildroot:
- Removed nconf, gconf, tests and kernel configuration targets.
- Adjusted the Makefile to compile outside the kernel.
- Always use default file when running make all{no,mod,yes}config.
- Added a 'reset' command to reset config when the target changes.
Expand All @@ -24,4 +23,4 @@ OpenWrt Buildroot:
BUILD_SHIPPED_FILES defined

For a full list of changes, see the repository at:
https://github.com/cotequeiroz/linux/commits/openwrt/scripts/kconfig
https://github.com/cotequeiroz/linux/commits/openwrt-5.14/scripts/kconfig

0 comments on commit 009293c

Please sign in to comment.