Changeset 18056


Ignore:
Timestamp:
2009-10-18T00:11:21+02:00 (8 years ago)
Author:
nbd
Message:

add experimental support for a new menuconfig submenu "Package features".
allows selection between multiple packages providing the same feature, which affects dependencies of other packages.
will be used e.g. for choosing between DirectFB and X.org for libraries like GTK2

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/package-dumpinfo.mk

    r14905 r18056  
    2323endef 
    2424 
    25 define Dumpinfo 
     25define Dumpinfo/Package 
    2626$(info Package: $(1) 
    2727$(if $(MENU),Menu: $(MENU) 
     
    5252)$(foreach pc,$(preconfig_$(1)), 
    5353$(Preconfig/$(pc)))) 
    54   endef 
     54endef 
     55 
     56define Feature/Default 
     57  TARGET_NAME:= 
     58  TARGET_TITLE:= 
     59  PRIORITY:= 
     60  NAME:= 
     61endef 
     62 
     63define Feature 
     64  $(eval $(Feature/Default)) 
     65  $(eval $(Feature/$(1))) 
     66  $(if $(DUMP),$(call Dumpinfo/Feature,$(1))) 
     67endef 
     68 
     69define Dumpinfo/Feature 
     70$(info Feature: $(TARGET_NAME)_$(1) 
     71Target-Name: $(TARGET_NAME) 
     72Target-Title: $(TARGET_TITLE) 
     73Feature-Name: $(NAME) 
     74$(if $(PRIORITY),Feature-Priority: $(PRIORITY) 
     75)Feature-Description: 
     76$(Feature/$(1)/description) 
     77@@ 
     78) 
     79endef 
     80 
    5581endif 
  • trunk/include/package.mk

    r17445 r18056  
    177177 
    178178  $(if $(DUMP), \ 
    179     $(Dumpinfo), \ 
     179    $(Dumpinfo/Package), \ 
    180180    $(foreach target, \ 
    181181      $(if $(Package/$(1)/targets),$(Package/$(1)/targets), \ 
  • trunk/scripts/metadata.pl

    r17840 r18056  
    534534} 
    535535 
     536sub print_package_features() { 
     537        keys %features > 0 or return; 
     538        print "menu \"Package features\"\n"; 
     539        foreach my $n (keys %features) { 
     540                my @features = sort { $b->{priority} <=> $a->{priority} or $a->{title} cmp $b->{title} } @{$features{$n}}; 
     541                print <<EOF; 
     542choice 
     543        prompt "$features[0]->{target_title}" 
     544        default FEATURE_$features[0]->{name} 
     545EOF 
     546 
     547                foreach my $feature (@features) { 
     548                        print <<EOF; 
     549        config FEATURE_$feature->{name} 
     550                bool "$feature->{title}" 
     551                help 
     552$feature->{description} 
     553EOF 
     554                } 
     555                print "endchoice\n" 
     556        } 
     557        print "endmenu\n\n"; 
     558} 
     559 
    536560sub gen_package_config() { 
    537561        parse_package_metadata($ARGV[0]) or exit 1; 
     
    550574                } 
    551575        } 
     576        print_package_features(); 
    552577        print_package_config_category 'Base system'; 
    553578        foreach my $cat (keys %category) { 
  • trunk/scripts/metadata.pm

    r17827 r18056  
    33use strict; 
    44use warnings; 
    5 our @EXPORT = qw(%package %srcpackage %category %subdir %preconfig clear_packages parse_package_metadata get_multiline); 
     5our @EXPORT = qw(%package %srcpackage %category %subdir %preconfig %features clear_packages parse_package_metadata get_multiline); 
    66 
    77our %package; 
     
    1010our %category; 
    1111our %subdir; 
     12our %features; 
    1213 
    1314sub get_multiline { 
     
    2930        %srcpackage = (); 
    3031        %category = (); 
     32        %features = (); 
    3133} 
    3234 
     
    3436        my $file = shift; 
    3537        my $pkg; 
     38        my $feature; 
    3639        my $makefile; 
    3740        my $preconfig; 
     
    5659                next unless $src; 
    5760                /^Package:\s*(.+?)\s*$/ and do { 
     61                        undef $feature; 
    5862                        $pkg = {}; 
    5963                        $pkg->{src} = $src; 
     
    7074                        push @{$srcpackage{$src}}, $pkg; 
    7175                }; 
     76                /^Feature:\s*(.+?)\s*$/ and do { 
     77                        undef $pkg; 
     78                        $feature = {}; 
     79                        $feature->{name} = $1; 
     80                        $feature->{priority} = 0; 
     81                }; 
     82                $feature and do { 
     83                        /^Target-Name:\s*(.+?)\s*$/ and do { 
     84                                $features{$1} or $features{$1} = []; 
     85                                push @{$features{$1}}, $feature; 
     86                        }; 
     87                        /^Target-Title:\s*(.+?)\s*$/ and $feature->{target_title} = $1; 
     88                        /^Feature-Priority:\s*(\d+)\s*$/ and $feature->{priority} = $1; 
     89                        /^Feature-Name:\s*(.+?)\s*$/ and $feature->{title} = $1; 
     90                        /^Feature-Description:/ and $feature->{description} = get_multiline(\*FILE, "\t\t\t"); 
     91                        next; 
     92                }; 
     93                next unless $pkg; 
    7294                /^Version: \s*(.+)\s*$/ and $pkg->{version} = $1; 
    7395                /^Title: \s*(.+)\s*$/ and $pkg->{title} = $1; 
Note: See TracChangeset for help on using the changeset viewer.