+ $menus{$menu} or $menus{$menu} = [];
+ push @{$menus{$menu}}, $pkg;
+ }
+ }
+ my @menus = sort {
+ ($a eq 'undef' ? 1 : 0) or
+ ($b eq 'undef' ? -1 : 0) or
+ ($a cmp $b)
+ } keys %menus;
+
+ foreach my $menu (@menus) {
+ my @pkgs = sort {
+ depends($a, $b) or
+ ($a->{name} cmp $b->{name})
+ } @{$menus{$menu}};
+ if ($menu ne 'undef') {
+ $menu_dep{$menu} and print "if $menu_dep{$menu}\n";
+ print "menu \"$menu\"\n";
+ }
+ foreach my $pkg (@pkgs) {