From a0f533460bcb41a04d592345303348575f2e23e2 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Sun, 11 Apr 2010 02:14:56 +0200 Subject: auto-generate package/Config.in The algorithm in package/pkgmaker works as follows: 1) for all package/*/Makefile a) parse PKG_NAME and PKG_SECTION b) skip if PKG_SECTION is 'kernel' (special ones) c) check if Config.in{,.lib,.manual} contain something d) fetch the first word of the first prompt from any result from c) e) fetch the verbose section name from package/SECTIONS.list based on PKG_SECTION, or just 'libs' if it's about Config.in.lib f) write results to package/package_section_list, in the form: ' ' 2) sort package/package_section_list first by , next by 3) create package/Config.in.auto using the result from 2) --- .gitignore | 1 + Config.in | 23 ++++++++++++++- package/SECTIONS.list | 52 ++++++++++++++++++++++++++++++++++ package/pkgmaker | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 152 insertions(+), 2 deletions(-) create mode 100644 package/SECTIONS.list diff --git a/.gitignore b/.gitignore index 3c58ed468..1e46f0c60 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ config/*.o config/lxdialog/*.o make.log dl/ +package/Config.in.auto package/*/info.mk package/*/Config.in package/*/Config.in.lib diff --git a/Config.in b/Config.in index 64915d678..fae83c140 100644 --- a/Config.in +++ b/Config.in @@ -136,4 +136,25 @@ endchoice endmenu source "target/Config.in" -source "package/Config.in" + +menu "Package selection" + +config ADK_ENABLE_IPV6 + prompt "enable IPv6 globally" + boolean + default y + # FIXME: selecting stuff here is ugly, better fix package flavours to + # support a symbol-value-based default (i.e., "default y if IPV6") + select ADK_PACKAGE_NFS_UTILS_WITH_TIRPC if ADK_PACKAGE_NFS_UTILS != n + help + This enables IPv6 support in all related applications. Basically this + just means passing --enable-ipv6 to the configure script, but the + exception proves the rule. ;) + +source "package/Config.in.auto" +endmenu + +menu "Kernel configuration" +source "target/linux/Config.in" +source "package/rtsp/Config.in" +endmenu diff --git a/package/SECTIONS.list b/package/SECTIONS.list new file mode 100644 index 000000000..05f3931f7 --- /dev/null +++ b/package/SECTIONS.list @@ -0,0 +1,52 @@ +admin System Administration +archive Compression and Archivers +base Base System +bluetooth Bluetooth +browser Browser / Editor / Pager +editor Browser / Editor / Pager +pager Browser / Editor / Pager +chat IRC / ICQ / JABBER +comp Computing +console Console Utilities +crypto Cryptography +db Databases +debug Debugging / Analyzing +dns DNS / DHCP +dhcp DNS / DHCP +firewall Firewall / Routing / Bridging +route Firewall / Routing / Bridging +bridge Firewall / Routing / Bridging +fs Filesystem / Blockdevice utilities +ipv6 IPv6 +lang Programming Languages +libs Libraries +mail Mail +misc Misc +multimedia Multimedia +net Networking +net/fs Network Filesystems +net/misc Networking Misc +net/security Network Security +none Unclassified +ntp NTP +p2p P2P +phone Telephony +ppp PPP / PPTP / RADIUS +proxy Proxy +scm SCM +serial Serial communications & terminal emulation +shells Shells +sound Sound +sys System +text Text +utils Utilities +video Video +web World Wide Web +www HTTP / FTP +wifi Wireless +x11 Xorg +x11/apps X applications +x11/drivers X server and drivers +x11/server X server and drivers +x11/libs X libraries +x11/fonts X fonts diff --git a/package/pkgmaker b/package/pkgmaker index ea89424e7..bb91dbe37 100644 --- a/package/pkgmaker +++ b/package/pkgmaker @@ -71,7 +71,7 @@ for dn in */Makefile; do typeset -u dnu=${dn//-/_} dnu=${dnu//+/X} - ( # fd 4 = Config.in; fd 5 = Config.in.lib + ( # fd 4 = Config.in; fd 5 = Config.in.lib; fd 6 = Config.in.kmod g5=0 # Handle master package (directory) @@ -264,3 +264,79 @@ EOF ) 4>Config.in 5>Config.in.lib 6>Config.in.kmod cd .. done + +# return good if given file exists and is non-empty +function non_empty_file() { + [[ -f "$1" ]] || return 1 + [[ -n "$(cat "$1")" ]] || return 1 + return 0 +} + +# print the verbose section name for a given section tag +function lookup_section_string() { + str="$(grep ^$1\ SECTIONS.list | cut -d ' ' -f '2-')" + [[ -n $str ]] && { echo $str; return; } + echo $1 +} + +# print the first prompt's first word's value in a given Config.in file +function get_first_prompt() { + prompt="$(grep -m 1 "prompt " $1 | sed -n 's/.*"\([^ \.]*\)[ \.].*"/\1/p')" + [[ -n $prompt ]] && echo $prompt +} + +# collect packages along with their section and +# create a list of '
' for later sorting +rm -f package_section_list +for dn in */Makefile; do + dn=${dn%/*} + pbar="Pass 3: $dn ..." + print -nu2 "$pbar\r" + + cd $dn + eval $($GMAKE dump="PKG_NAME PKG_SECTION") + cd .. + + # ignore section kernel, these are included inside target/config + [[ $PKG_SECTION = kernel ]] && continue + + PKG_SECTION=${PKG_SECTION:-none} + + has_config_in=false + if non_empty_file $dn/Config.in; then + prompt="$(get_first_prompt $dn/Config.in)" + prompt="${prompt:-$PKG_NAME}" + echo "$prompt $dn/Config.in $(lookup_section_string $PKG_SECTION)" + has_config_in=true + fi + if non_empty_file $dn/Config.in.lib; then + prompt="$(get_first_prompt $dn/Config.in.lib)" + prompt="${prompt:-$PKG_NAME}" + echo "$prompt $dn/Config.in.lib $(lookup_section_string libs)" + has_config_in=true + fi + if non_empty_file $dn/Config.in.manual; then + prompt="$(get_first_prompt $dn/Config.in.manual)" + prompt="${prompt:-$PKG_NAME}" + echo "$prompt $dn/Config.in.manual $(lookup_section_string $PKG_SECTION)" + has_config_in=true + fi + $has_config_in || print -u2 "$dn: No Config.in file found?!" +done >package_section_list + +# create the Config.in.auto from the sorted list from above +cursec="" +sort -k 3 -k 1 -f package_section_list | while read name file section; do + pbar="Pass 4: $name ..." + print -nu2 "$pbar\r" + + if [[ $cursec != $section ]]; then + [[ -n $cursec ]] && print "endmenu\n" + + print "menu \"$section\"" + cursec="$section" + fi + print "source \"package/$file\"" +done >Config.in.auto +print "endmenu\n" >>Config.in.auto +rm -f package_section_list -- cgit v1.2.3