aboutsummaryrefslogtreecommitdiffstats
path: root/package/utils/busybox/convert_menuconfig.pl
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-01-31 13:50:16 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-01-31 13:50:16 +0000
commitcc7b3e2465f57c92879e39690021b3276d4c61aa (patch)
tree441b554f3f955f9051e08a14220d799fd635d303 /package/utils/busybox/convert_menuconfig.pl
parentc85705ce8dee363f2ff5c4b0e8f82416a8c4416f (diff)
downloadupstream-cc7b3e2465f57c92879e39690021b3276d4c61aa.tar.gz
upstream-cc7b3e2465f57c92879e39690021b3276d4c61aa.tar.bz2
upstream-cc7b3e2465f57c92879e39690021b3276d4c61aa.zip
busybox: add a reworked implementation of menuconfig support, this time with a guard option that keeps all symbols at default values until an extra option is activated
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 39435
Diffstat (limited to 'package/utils/busybox/convert_menuconfig.pl')
-rwxr-xr-xpackage/utils/busybox/convert_menuconfig.pl67
1 files changed, 67 insertions, 0 deletions
diff --git a/package/utils/busybox/convert_menuconfig.pl b/package/utils/busybox/convert_menuconfig.pl
new file mode 100755
index 0000000000..cc4802a61c
--- /dev/null
+++ b/package/utils/busybox/convert_menuconfig.pl
@@ -0,0 +1,67 @@
+#!/usr/bin/perl
+#
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+use strict;
+my $PATH = $ARGV[0];
+($PATH and -d $PATH) or die 'invalid path';
+
+my %config;
+
+open FIND, "find \"$PATH\" -name Config.in |";
+while (<FIND>) {
+ chomp;
+ my $input = $_;
+ s/^$PATH\///g;
+ s/sysdeps\/linux\///g;
+ my $output = $_;
+ print STDERR "$input => $output\n";
+ $output =~ /^(.+)\/[^\/]+$/ and system("mkdir -p $1");
+
+ open INPUT, $input;
+ open OUTPUT, ">$output";
+ my ($cur, $default_set, $line);
+ while ($line = <INPUT>) {
+ next if $line =~ /^\s*mainmenu/;
+
+ # FIXME: make this dynamic
+ $line =~ s/default FEATURE_BUFFERS_USE_MALLOC/default FEATURE_BUFFERS_GO_ON_STACK/;
+ $line =~ s/default FEATURE_SH_IS_NONE/default FEATURE_SH_IS_ASH/;
+
+ if ($line =~ /^\s*config\s*([\w_]+)/) {
+ $cur = $1;
+ undef $default_set;
+ }
+ if ($line =~ /^\s*(menu|choice|end|source)/) {
+ undef $cur;
+ undef $default_set;
+ }
+ $line =~ s/^(\s*source\s+)/$1package\/utils\/busybox\/config\//;
+
+ $line =~ s/^(\s*(prompt "[^"]+" if|config|depends|depends on|select|default|default \w if)\s+\!?)([A-Z_])/$1BUSYBOX_CONFIG_$3/g;
+ $line =~ s/(( \|\| | \&\& | \( )!?)([A-Z_])/$1BUSYBOX_CONFIG_$3/g;
+ $line =~ s/(\( ?!?)([A-Z_]+ (\|\||&&))/$1BUSYBOX_CONFIG_$2/g;
+
+ if ($cur) {
+ ($cur eq 'LFS') and do {
+ $line =~ s/^(\s*(bool|tristate|string))\s*".+"$/$1/;
+ };
+ if ($line =~ /^\s*default/) {
+ my $c;
+ $default_set = 1;
+ $c = "BUSYBOX_DEFAULT_$cur";
+
+ $line =~ s/^(\s*default\s*)(\w+|"[^"]*")(.*)/$1$c$3/;
+ }
+ }
+
+ print OUTPUT $line;
+ }
+ close OUTPUT;
+ close INPUT;
+}
+close FIND;