Add missing ulogd dependencies
[openwrt.git] / openwrt / scripts / gen_busybox_menuconfig.pl
1 #!/usr/bin/perl
2 use strict;
3 my $PATH = $ARGV[0];
4 ($PATH and -d $PATH) or die 'invalid path';
5 my $DEFCONFIG = $ARGV[1];
6 ($DEFCONFIG and -f $DEFCONFIG) or die 'invalid config file';
7
8 my %config;
9
10 open CONFIG, $DEFCONFIG or die 'cannot open config file';
11 while (<CONFIG>) {
12 /^([\w_]+)=([ym])/ and $config{$1} = $2;
13 /^([\w_]+)=(\d+)/ and $config{$1} = $2;
14 /^([\w_]+)=(".+")/ and $config{$1} = $2;
15 }
16 close CONFIG;
17
18 open FIND, "find \"$PATH\" -name Config.in |";
19 while (<FIND>) {
20 chomp;
21 my $input = $_;
22 s/^$PATH\///g;
23 s/sysdeps\/linux\///g;
24 my $output = $_;
25 print STDERR "$input => $output\n";
26 $output =~ /^(.+)\/[^\/]+$/ and system("mkdir -p $1");
27
28 open INPUT, $input;
29 open OUTPUT, ">$output";
30 my ($cur, $default_set, $line);
31 while ($line = <INPUT>) {
32 next if $line =~ /^\s*mainmenu/;
33
34 # FIXME: make this dynamic
35 $line =~ s/default CONFIG_FEATURE_BUFFERS_USE_MALLOC/default CONFIG_FEATURE_BUFFERS_GO_ON_STACK/;
36 $line =~ s/default BUSYBOX_CONFIG_FEATURE_SH_IS_NONE/default BUSYBOX_CONFIG_FEATURE_SH_IS_ASH/;
37
38 if ($line =~ /^\s*config\s*([\w_]+)/) {
39 $cur = $1;
40 undef $default_set;
41 }
42 if ($line =~ /^\s*(menu|choice|end|source)/) {
43 undef $cur;
44 undef $default_set;
45 }
46 $line =~ s/^(\s*source\s+)/$1package\/busybox\/config\//;
47
48 $line =~ s/(\s+)((CONFIG|FDISK|USING|CROSS|EXTRA|PREFIX|FEATURE|HAVE|BUSYBOX)[\w_]*)/$1BUSYBOX_$2/g;
49
50 if ($cur) {
51 ($cur !~ /^CONFIG/ or $cur eq 'CONFIG_LFS') and do {
52 $line =~ s/^(\s*(bool|tristate|string))\s*".+"$/$1/;
53 };
54 if ($line =~ /^\s*default/) {
55 my $c;
56 $default_set = 1;
57 $c = $config{$cur} or $c = 'n';
58
59 $line =~ s/^(\s*default\s*)(\w+|"[^"]*")(.*)/$1$c$3/;
60 }
61 }
62
63 print OUTPUT $line;
64 }
65 close OUTPUT;
66 close INPUT;
67
68 }
69 close FIND;
This page took 0.053773 seconds and 5 git commands to generate.