3 # Copyright (C) 2006 OpenWrt.org
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
11 ($PATH and -d
$PATH) or die 'invalid path';
12 my $DEFCONFIG = $ARGV[1];
13 ($DEFCONFIG and -f
$DEFCONFIG) or die 'invalid config file';
17 open CONFIG
, $DEFCONFIG or die 'cannot open config file';
19 /^CONFIG_([\w_]+)=([ym])/ and $config{$1} = $2;
20 /^CONFIG_([\w_]+)=(\d+)/ and $config{$1} = $2;
21 /^CONFIG_([\w_]+)=(".+")/ and $config{$1} = $2;
25 open FIND
, "find \"$PATH\" -name Config.in |";
30 s/sysdeps\/linux\///g;
32 print STDERR
"$input => $output\n";
33 $output =~ /^(.+)\/[^\
/]+$/ and system("mkdir -p $1");
36 open OUTPUT
, ">$output";
37 my ($cur, $default_set, $line);
38 while ($line = <INPUT
>) {
39 next if $line =~ /^\s*mainmenu/;
41 # FIXME: make this dynamic
42 $line =~ s/default FEATURE_BUFFERS_USE_MALLOC/default FEATURE_BUFFERS_GO_ON_STACK/;
43 $line =~ s/default FEATURE_SH_IS_NONE/default FEATURE_SH_IS_ASH/;
45 if ($line =~ /^\s*config\s*([\w_]+)/) {
49 if ($line =~ /^\s*(menu|choice|end|source)/) {
53 $line =~ s/^(\s*source\s+)/$1package\/busybox\
/config\//;
55 $line =~ s/^(\s*(prompt "[^"]+" if|config|depends|depends on|select|default|default \w if)\s+\!?)([A-Z_])/$1BUSYBOX_CONFIG_$3/g;
56 $line =~ s/(( \|\| | \&\& | \( )!?)([A-Z_])/$1BUSYBOX_CONFIG_$3/g;
57 $line =~ s/(\( ?!?)([A-Z_]+ (\|\||&&))/$1BUSYBOX_CONFIG_$2/g;
60 ($cur eq 'LFS') and do {
61 $line =~ s/^(\s*(bool|tristate|string))\s*".+"$/$1/;
63 if ($line =~ /^\s*default/) {
66 $c = $config{$cur} or $c = 'n';
68 $line =~ s/^(\s*default\s*)(\w+|"[^"]*")(.*)/$1$c$3/;
This page took 0.055443 seconds and 5 git commands to generate.