3 use lib "$FindBin::Bin";
11 $conf =~ tr#/\.\-/#___#;
15 sub version_to_num($) {
19 if (defined($str) && $str =~ /^\d+(?:\.\d+)+$/)
21 my @n = (split(/\./, $str), 0, 0, 0, 0);
22 $num = ($n[0] << 24) | ($n[1] << 16) | ($n[2] << 8) | $n[3];
28 sub version_filter_list(@) {
29 my $cmpver = version_to_num(shift @_);
34 if ($item =~ s/@(lt|le|gt|ge|eq|ne)(\d+(?:\.\d+)+)\b//)
37 my $symver = version_to_num($2);
39 if ($symver > 0 && $cmpver > 0)
41 next unless (($op eq 'lt' && $cmpver < $symver) ||
42 ($op eq 'le' && $cmpver <= $symver) ||
43 ($op eq 'gt' && $cmpver > $symver) ||
44 ($op eq 'ge' && $cmpver >= $symver) ||
45 ($op eq 'eq' && $cmpver == $symver) ||
46 ($op eq 'ne' && $cmpver != $symver));
56 sub parse_target_metadata() {
57 my $file = shift @ARGV;
58 my ($target, @target, $profile);
61 open FILE, "<$file" or do {
62 warn "Can't open file '$file': $!\n";
67 /^Target:\s*(.+)\s*$/ and do {
72 boardconf => confstr($name),
73 conf => confstr($name),
79 push @target, $target;
80 $target{$name} = $target;
81 if ($name =~ /([^\/]+)\/([^\/]+)/) {
82 push @{$target{$1}->{subtargets}}, $2;
83 $target->{board} = $1;
84 $target->{boardconf} = confstr($1);
85 $target->{subtarget} = 1;
86 $target->{parent} = $target{$1};
89 /^Target-Name:\s*(.+)\s*$/ and $target->{name} = $1;
90 /^Target-Path:\s*(.+)\s*$/ and $target->{path} = $1;
91 /^Target-Arch:\s*(.+)\s*$/ and $target->{arch} = $1;
92 /^Target-Arch-Packages:\s*(.+)\s*$/ and $target->{arch_packages} = $1;
93 /^Target-Features:\s*(.+)\s*$/ and $target->{features} = [ split(/\s+/, $1) ];
94 /^Target-Depends:\s*(.+)\s*$/ and $target->{depends} = [ split(/\s+/, $1) ];
95 /^Target-Description:/ and $target->{desc} = get_multiline(*FILE);
96 /^Target-Optimization:\s*(.+)\s*$/ and $target->{cflags} = $1;
97 /^CPU-Type:\s*(.+)\s*$/ and $target->{cputype} = $1;
98 /^Linux-Version:\s*(.+)\s*$/ and $target->{version} = $1;
99 /^Linux-Release:\s*(.+)\s*$/ and $target->{release} = $1;
100 /^Linux-Kernel-Arch:\s*(.+)\s*$/ and $target->{karch} = $1;
101 /^Default-Subtarget:\s*(.+)\s*$/ and $target->{def_subtarget} = $1;
102 /^Default-Packages:\s*(.+)\s*$/ and $target->{packages} = [ split(/\s+/, $1) ];
103 /^Target-Profile:\s*(.+)\s*$/ and do {
109 push @{$target->{profiles}}, $profile;
111 /^Target-Profile-Name:\s*(.+)\s*$/ and $profile->{name} = $1;
112 /^Target-Profile-Packages:\s*(.*)\s*$/ and $profile->{packages} = [ split(/\s+/, $1) ];
113 /^Target-Profile-Description:\s*(.*)\s*/ and $profile->{desc} = get_multiline(*FILE);
114 /^Target-Profile-Config:/ and $profile->{config} = get_multiline(*FILE, "\t");
115 /^Target-Profile-Kconfig:/ and $profile->{kconfig} = 1;
118 foreach my $target (@target) {
119 if (@{$target->{subtargets}} > 0) {
120 $target->{profiles} = [];
123 @{$target->{profiles}} > 0 or $target->{profiles} = [
134 sub gen_kconfig_overrides() {
138 my $pkginfo = shift @ARGV;
139 my $cfgfile = shift @ARGV;
140 my $patchver = shift @ARGV;
142 # parameter 2: build system config
143 open FILE, "<$cfgfile" or return;
145 /^(CONFIG_.+?)=(.+)$/ and $config{$1} = 1;
149 # parameter 1: package metadata
150 open FILE, "<$pkginfo" or return;
152 /^Package:\s*(.+?)\s*$/ and $package = $1;
153 /^Kernel-Config:\s*(.+?)\s*$/ and do {
154 my @config = split /\s+/, $1;
155 foreach my $config (version_filter_list($patchver, @config)) {
158 if ($config =~ /^(.+?)=(.+)$/) {
163 if ($config{"CONFIG_PACKAGE_$package"} and ($config ne 'n')) {
164 next if $kconfig{$config} eq 'y';
165 $kconfig{$config} = $val;
166 } elsif (!$override) {
167 $kconfig{$config} or $kconfig{$config} = 'n';
174 foreach my $kconfig (sort keys %kconfig) {
175 if ($kconfig{$kconfig} eq 'n') {
176 print "# $kconfig is not set\n";
178 print "$kconfig=$kconfig{$kconfig}\n";
183 sub merge_package_lists($$) {
189 foreach my $pkg (@$list1, @$list2) {
192 foreach my $pkg (keys %pkgs) {
193 push @l, $pkg unless ($pkg =~ /^-/ or $pkgs{"-$pkg"});
198 sub target_config_features(@) {
201 while ($_ = shift @_) {
202 /arm_v(\w+)/ and $ret .= "\tselect arm_v$1\n";
203 /broken/ and $ret .= "\tdepends on BROKEN\n";
204 /audio/ and $ret .= "\tselect AUDIO_SUPPORT\n";
205 /display/ and $ret .= "\tselect DISPLAY_SUPPORT\n";
206 /dt/ and $ret .= "\tselect USES_DEVICETREE\n";
207 /gpio/ and $ret .= "\tselect GPIO_SUPPORT\n";
208 /pci/ and $ret .= "\tselect PCI_SUPPORT\n";
209 /pcie/ and $ret .= "\tselect PCIE_SUPPORT\n";
210 /usb/ and $ret .= "\tselect USB_SUPPORT\n";
211 /usbgadget/ and $ret .= "\tselect USB_GADGET_SUPPORT\n";
212 /pcmcia/ and $ret .= "\tselect PCMCIA_SUPPORT\n";
213 /rtc/ and $ret .= "\tselect RTC_SUPPORT\n";
214 /squashfs/ and $ret .= "\tselect USES_SQUASHFS\n";
215 /jffs2$/ and $ret .= "\tselect USES_JFFS2\n";
216 /jffs2_nand/ and $ret .= "\tselect USES_JFFS2_NAND\n";
217 /ext4/ and $ret .= "\tselect USES_EXT4\n";
218 /targz/ and $ret .= "\tselect USES_TARGZ\n";
219 /cpiogz/ and $ret .= "\tselect USES_CPIOGZ\n";
220 /ubifs/ and $ret .= "\tselect USES_UBIFS\n";
221 /fpu/ and $ret .= "\tselect HAS_FPU\n";
222 /spe_fpu/ and $ret .= "\tselect HAS_SPE_FPU\n";
223 /ramdisk/ and $ret .= "\tselect USES_INITRAMFS\n";
224 /powerpc64/ and $ret .= "\tselect powerpc64\n";
225 /nommu/ and $ret .= "\tselect NOMMU\n";
226 /mips16/ and $ret .= "\tselect HAS_MIPS16\n";
227 /rfkill/ and $ret .= "\tselect RFKILL_SUPPORT\n";
228 /low_mem/ and $ret .= "\tselect LOW_MEMORY_FOOTPRINT\n";
229 /nand/ and $ret .= "\tselect NAND_SUPPORT\n";
236 my $parent = $target->{parent};
238 return $target->{parent}->{name}." - ".$target->{name};
240 return $target->{name};
247 if (substr($v,0,2) eq "2_") {
248 $v =~ /(\d+_\d+_\d+)(_\d+)?/ and $v = $1;
250 $v =~ /(\d+_\d+)(_\d+)?/ and $v = $1;
255 sub print_target($) {
257 my $features = target_config_features(@{$target->{features}});
258 my $help = $target->{desc};
263 if ($help =~ /\w+/) {
264 $help =~ s/^\s*/\t /mg;
265 $help = "\thelp\n$help";
270 my $v = kver($target->{version});
271 if (@{$target->{subtargets}} == 0) {
273 config TARGET_$target->{conf}
274 bool "$target->{name}"
280 config TARGET_$target->{conf}
281 bool "$target->{name}"
284 if ($target->{subtarget}) {
285 $confstr .= "\tdepends on TARGET_$target->{boardconf}\n";
287 if (@{$target->{subtargets}} > 0) {
288 $confstr .= "\tselect HAS_SUBTARGETS\n";
289 grep { /broken/ } @{$target->{features}} and $confstr .= "\tdepends on BROKEN\n";
291 $confstr .= $features;
294 if ($target->{arch} =~ /\w/) {
295 $confstr .= "\tselect $target->{arch}\n";
297 foreach my $dep (@{$target->{depends}}) {
298 my $mode = "depends on";
302 $dep =~ /^([@\+\-]+)(.+)$/;
306 next if $name =~ /:/;
307 $flags =~ /-/ and $mode = "deselect";
308 $flags =~ /\+/ and $mode = "select";
309 $flags =~ /@/ and $confstr .= "\t$mode $name\n";
311 $confstr .= "$help\n\n";
315 sub gen_target_config() {
316 my @target = parse_target_metadata();
319 my @target_sort = sort {
320 target_name($a) cmp target_name($b);
326 prompt "Target System"
327 default TARGET_ar71xx
332 foreach my $target (@target_sort) {
333 next if $target->{subtarget};
334 print_target($target);
341 prompt "Subtarget" if HAS_SUBTARGETS
343 foreach my $target (@target) {
344 next unless $target->{def_subtarget};
346 default TARGET_$target->{conf}_$target->{def_subtarget} if TARGET_$target->{conf}
352 foreach my $target (@target) {
353 next unless $target->{subtarget};
354 print_target($target);
361 prompt "Target Profile"
365 foreach my $target (@target) {
366 my $profiles = $target->{profiles};
368 foreach my $profile (@$profiles) {
370 config TARGET_$target->{conf}_$profile->{id}
371 bool "$profile->{name}"
372 depends on TARGET_$target->{conf}
375 $profile->{kconfig} and print "\tselect PROFILE_KCONFIG\n";
376 my @pkglist = merge_package_lists($target->{packages}, $profile->{packages});
377 foreach my $pkg (@pkglist) {
378 print "\tselect DEFAULT_$pkg\n";
381 my $help = $profile->{desc};
382 if ($help =~ /\w+/) {
383 $help =~ s/^\s*/\t /mg;
384 $help = "\thelp\n$help";
395 config HAS_SUBTARGETS
402 foreach my $target (@target) {
403 $target->{subtarget} or print "\t\tdefault \"".$target->{board}."\" if TARGET_".$target->{conf}."\n";
406 config TARGET_ARCH_PACKAGES
410 foreach my $target (@target) {
411 next if @{$target->{subtargets}} > 0;
412 print "\t\tdefault \"".($target->{arch_packages} || $target->{board})."\" if TARGET_".$target->{conf}."\n";
416 config DEFAULT_TARGET_OPTIMIZATION
419 foreach my $target (@target) {
420 next if @{$target->{subtargets}} > 0;
421 print "\tdefault \"".$target->{cflags}."\" if TARGET_".$target->{conf}."\n";
423 print "\tdefault \"-Os -pipe -funit-at-a-time\"\n";
429 foreach my $target (@target) {
430 next if @{$target->{subtargets}} > 0;
431 print "\tdefault \"".$target->{cputype}."\" if TARGET_".$target->{conf}."\n";
433 print "\tdefault \"\"\n";
436 foreach my $target (@target) {
437 my $v = kver($target->{version});
447 foreach my $def (sort keys %defaults) {
448 print "\tconfig DEFAULT_".$def."\n";
449 print "\t\tbool\n\n";
454 sub __find_package_dep($$) {
457 my $deps = ($pkg->{vdepends} or $pkg->{depends});
459 return 0 unless defined $deps;
460 foreach my $dep (@{$deps}) {
461 next if $dep_check{$dep};
462 $dep_check{$dep} = 1;
463 return 1 if $dep eq $name;
464 return 1 if ($package{$dep} and (__find_package_dep($package{$dep},$name) == 1));
469 # wrapper to avoid infinite recursion
470 sub find_package_dep($$) {
475 return __find_package_dep($pkg, $name);
478 sub package_depends($$) {
483 return 0 if ($a->{submenu} ne $b->{submenu});
484 if (find_package_dep($a, $b->{name}) == 1) {
486 } elsif (find_package_dep($b, $a->{name}) == 1) {
497 my $only_dep = shift;
501 my $parent_condition = shift;
507 my @depends = @$depends;
508 foreach my $depend (@depends) {
509 my $m = "depends on";
511 $depend =~ s/^([@\+]+)// and $flags = $1;
513 my $condition = $parent_condition;
515 next if $condition eq $depend;
516 next if $seen->{"$parent_condition:$depend"};
517 next if $seen->{":$depend"};
518 $seen->{"$parent_condition:$depend"} = 1;
519 if ($depend =~ /^(.+):(.+)$/) {
520 if ($1 ne "PACKAGE_$pkgname") {
522 $condition = "$condition && $1";
529 next if $package{$depend} and $package{$depend}->{buildonly};
530 if ($vdep = $package{$depend}->{vdepends}) {
531 $depend = join("||", map { "PACKAGE_".$_ } @$vdep);
533 $flags =~ /\+/ and do {
534 # Menuconfig will not treat 'select FOO' as a real dependency
535 # thus if FOO depends on other config options, these dependencies
536 # will not be checked. To fix this, we simply emit all of FOO's
537 # depends here as well.
538 $package{$depend} and push @t_depends, [ $package{$depend}->{depends}, $condition ];
543 $flags =~ /@/ or $depend = "PACKAGE_$depend";
545 if ($m =~ /select/) {
546 next if $depend eq $condition;
547 $depend = "$depend if $condition";
549 $depend = "!($condition) || $depend" unless $dep->{$condition} eq 'select';
553 $dep->{$depend} =~ /select/ or $dep->{$depend} = $m;
556 foreach my $tdep (@t_depends) {
557 mconf_depends($pkgname, $tdep->[0], 1, $dep, $seen, $tdep->[1]);
560 foreach my $depend (keys %$dep) {
561 my $m = $dep->{$depend};
562 $res .= "\t\t$m $depend\n";
567 sub mconf_conflicts {
572 foreach my $depend (@$depends) {
573 next unless $package{$depend};
574 $res .= "\t\tdepends on m || (PACKAGE_$depend != y)\n";
579 sub print_package_config_category($) {
584 return unless $category{$cat};
586 print "menu \"$cat\"\n\n";
587 my %spkg = %{$category{$cat}};
589 foreach my $spkg (sort {uc($a) cmp uc($b)} keys %spkg) {
590 foreach my $pkg (@{$spkg{$spkg}}) {
591 next if $pkg->{buildonly};
592 my $menu = $pkg->{submenu};
594 $menu_dep{$menu} or $menu_dep{$menu} = $pkg->{submenudep};
598 $menus{$menu} or $menus{$menu} = [];
599 push @{$menus{$menu}}, $pkg;
603 ($a eq 'undef' ? 1 : 0) or
604 ($b eq 'undef' ? -1 : 0) or
608 foreach my $menu (@menus) {
610 package_depends($a, $b) or
611 ($a->{name} cmp $b->{name})
613 if ($menu ne 'undef') {
614 $menu_dep{$menu} and print "if $menu_dep{$menu}\n";
615 print "menu \"$menu\"\n";
617 foreach my $pkg (@pkgs) {
618 my $title = $pkg->{name};
619 my $c = (72 - length($pkg->{name}) - length($pkg->{title}));
621 $title .= ("." x $c). " ". $pkg->{title};
623 $title = "\"$title\"";
625 $pkg->{menu} and print "menu";
626 print "config PACKAGE_".$pkg->{name}."\n";
627 $pkg->{hidden} and $title = "";
628 print "\t\t".($pkg->{tristate} ? 'tristate' : 'bool')." $title\n";
629 print "\t\tdefault y if DEFAULT_".$pkg->{name}."\n";
630 unless ($pkg->{hidden}) {
631 $pkg->{default} ||= "m if ALL";
633 if ($pkg->{default}) {
634 foreach my $default (split /\s*,\s*/, $pkg->{default}) {
635 print "\t\tdefault $default\n";
638 print mconf_depends($pkg->{name}, $pkg->{depends}, 0);
639 print mconf_depends($pkg->{name}, $pkg->{mdepends}, 0);
640 print mconf_conflicts($pkg->{name}, $pkg->{conflicts});
642 print $pkg->{description};
645 $pkg->{config} and print $pkg->{config}."\n";
647 if ($menu ne 'undef') {
649 $menu_dep{$menu} and print "endif\n";
654 undef $category{$cat};
657 sub print_package_features() {
658 keys %features > 0 or return;
659 print "menu \"Package features\"\n";
660 foreach my $n (keys %features) {
661 my @features = sort { $b->{priority} <=> $a->{priority} or $a->{title} cmp $b->{title} } @{$features{$n}};
664 prompt "$features[0]->{target_title}"
665 default FEATURE_$features[0]->{name}
668 foreach my $feature (@features) {
670 config FEATURE_$feature->{name}
671 bool "$feature->{title}"
673 $feature->{description} =~ /\w/ and do {
674 print "\t\thelp\n".$feature->{description}."\n";
682 sub print_package_overrides() {
683 keys %overrides > 0 or return;
684 print "\tconfig OVERRIDE_PKGS\n";
685 print "\t\tstring\n";
686 print "\t\tdefault \"".join(" ", keys %overrides)."\"\n\n";
689 sub gen_package_config() {
690 parse_package_metadata($ARGV[0]) or exit 1;
691 print "menuconfig IMAGEOPT\n\tbool \"Image configuration\"\n\tdefault n\n";
692 foreach my $preconfig (keys %preconfig) {
693 foreach my $cfg (keys %{$preconfig{$preconfig}}) {
694 my $conf = $preconfig{$preconfig}->{$cfg}->{id};
697 config UCI_PRECONFIG_$conf
698 string "$preconfig{$preconfig}->{$cfg}->{label}" if IMAGEOPT
699 depends on PACKAGE_$preconfig
700 default "$preconfig{$preconfig}->{$cfg}->{default}"
705 print "source \"package/*/image-config.in\"\n";
706 if (scalar glob "package/feeds/*/*/image-config.in") {
707 print "source \"package/feeds/*/*/image-config.in\"\n";
709 print_package_features();
710 print_package_config_category 'Base system';
711 foreach my $cat (sort {uc($a) cmp uc($b)} keys %category) {
712 print_package_config_category $cat;
714 print_package_overrides();
717 sub get_conditional_dep($$) {
718 my $condition = shift;
721 if ($condition =~ /^!(.+)/) {
722 return "\$(if \$(CONFIG_$1),,$depstr)";
724 return "\$(if \$(CONFIG_$condition),$depstr)";
731 sub gen_package_mk() {
737 parse_package_metadata($ARGV[0]) or exit 1;
738 foreach my $name (sort {uc($a) cmp uc($b)} keys %package) {
740 my $pkg = $package{$name};
743 next if defined $pkg->{vdepends};
745 $config = "\$(CONFIG_PACKAGE_$name)";
747 $pkg->{buildonly} and $config = "";
748 print "package-$config += $pkg->{subdir}$pkg->{src}\n";
749 if ($pkg->{variant}) {
750 if (!defined($done{$pkg->{src}}) or $pkg->{variant_default}) {
751 print "\$(curdir)/$pkg->{subdir}$pkg->{src}/default-variant := $pkg->{variant}\n";
753 print "\$(curdir)/$pkg->{subdir}$pkg->{src}/variants += \$(if $config,$pkg->{variant})\n"
755 $pkg->{prereq} and print "prereq-$config += $pkg->{subdir}$pkg->{src}\n";
758 next if $done{$pkg->{src}};
759 $done{$pkg->{src}} = 1;
761 if (@{$pkg->{buildtypes}} > 0) {
762 print "buildtypes-$pkg->{subdir}$pkg->{src} = ".join(' ', @{$pkg->{buildtypes}})."\n";
765 foreach my $spkg (@{$srcpackage{$pkg->{src}}}) {
766 foreach my $dep (@{$spkg->{depends}}, @{$spkg->{builddepends}}) {
773 foreach my $type (@{$pkg->{buildtypes}}) {
777 next unless $pkg->{"builddepends/$type"};
778 foreach my $dep (@{$pkg->{"builddepends/$type"}}) {
782 if ($dep =~ /^(.+):(.+)/) {
786 if ($dep =~ /^(.+)(\/.+)/) {
792 my $pkg_dep = $package{$dep};
793 if (defined($pkg_dep) && defined($pkg_dep->{src})) {
794 $idx = $pkg_dep->{subdir}.$pkg_dep->{src};
795 } elsif (defined($srcpackage{$dep})) {
796 $idx = $subdir{$dep}.$dep;
800 my $depstr = "\$(curdir)/$idx$suffix/compile";
801 my $depline = get_conditional_dep($condition, $depstr);
803 $deplines{$depline}++;
806 my $depline = join(" ", sort keys %deplines);
808 $line .= "\$(curdir)/".$pkg->{subdir}."$pkg->{src}/$type/compile += $depline\n";
814 foreach my $deps (@srcdeps) {
820 if ($deps =~ /^(.+):(.+)/) {
824 if ($deps =~ /^(.+)(\/.+)/) {
829 my $pkg_dep = $package{$deps};
832 if ($pkg_dep->{vdepends}) {
833 @deps = @{$pkg_dep->{vdepends}};
838 foreach my $dep (@deps) {
839 $pkg_dep = $package{$deps};
840 if (defined $pkg_dep->{src}) {
841 ($pkg->{src} ne $pkg_dep->{src}.$suffix) and $idx = $pkg_dep->{subdir}.$pkg_dep->{src};
842 } elsif (defined($srcpackage{$dep})) {
843 $idx = $subdir{$dep}.$dep;
845 undef $idx if $idx eq 'base-files';
850 next if $pkg->{src} eq $pkg_dep->{src}.$suffix;
851 next if $dep{$condition.":".$pkg->{src}."->".$idx};
852 next if $dep{$pkg->{src}."->($dep)".$idx} and $pkg_dep->{vdepends};
855 if ($pkg_dep->{vdepends}) {
856 $depstr = "\$(if \$(CONFIG_PACKAGE_$dep),\$(curdir)/$idx/compile)";
857 $dep{$pkg->{src}."->($dep)".$idx} = 1;
859 $depstr = "\$(curdir)/$idx/compile";
860 $dep{$pkg->{src}."->".$idx} = 1;
862 $depline = get_conditional_dep($condition, $depstr);
864 $deplines{$depline}++;
869 my $depline = join(" ", sort keys %deplines);
871 $line .= "\$(curdir)/".$pkg->{subdir}."$pkg->{src}/compile += $depline\n";
878 foreach my $preconfig (keys %preconfig) {
880 foreach my $cfg (keys %{$preconfig{$preconfig}}) {
881 my $conf = $preconfig{$preconfig}->{$cfg}->{id};
883 $cmds .= "\techo \"uci set '$preconfig{$preconfig}->{$cfg}->{id}=\$(subst \",,\$(CONFIG_UCI_PRECONFIG_$conf))'\"; \\\n";
888 ifndef DUMP_TARGET_DB
889 \$(TARGET_DIR)/etc/uci-defaults/$preconfig: FORCE
894 ifneq (\$(IMAGEOPT)\$(CONFIG_IMAGEOPT),)
895 package/preconfig: \$(TARGET_DIR)/etc/uci-defaults/$preconfig
903 sub gen_package_source() {
904 parse_package_metadata($ARGV[0]) or exit 1;
905 foreach my $name (sort {uc($a) cmp uc($b)} keys %package) {
906 my $pkg = $package{$name};
907 if ($pkg->{name} && $pkg->{source}) {
908 print "$pkg->{name}: ";
909 print "$pkg->{source}\n";
914 sub gen_package_feeds() {
915 parse_package_metadata($ARGV[0]) or exit 1;
916 foreach my $name (sort {uc($a) cmp uc($b)} keys %package) {
917 my $pkg = $package{$name};
918 if ($pkg->{name} && $pkg->{feed}) {
919 print "Package/$name/feed = $pkg->{feed}\n";
924 sub gen_package_license($) {
926 parse_package_metadata($ARGV[0]) or exit 1;
927 foreach my $name (sort {uc($a) cmp uc($b)} keys %package) {
928 my $pkg = $package{$name};
930 if ($pkg->{license}) {
931 print "$pkg->{name}: ";
932 print "$pkg->{license}\n";
933 if ($pkg->{licensefiles} && $level == 0) {
934 print "\tFiles: $pkg->{licensefiles}\n";
938 print "$pkg->{name}: Missing license! ";
939 print "Please fix $pkg->{makefile}\n";
946 sub gen_version_filtered_list() {
947 foreach my $item (version_filter_list(@ARGV)) {
952 sub parse_command() {
953 my $cmd = shift @ARGV;
955 /^target_config$/ and return gen_target_config();
956 /^package_mk$/ and return gen_package_mk();
957 /^package_config$/ and return gen_package_config();
958 /^kconfig/ and return gen_kconfig_overrides();
959 /^package_source$/ and return gen_package_source();
960 /^package_feeds$/ and return gen_package_feeds();
961 /^package_license$/ and return gen_package_license(0);
962 /^package_licensefull$/ and return gen_package_license(1);
963 /^version_filter$/ and return gen_version_filtered_list();
967 $0 target_config [file] Target metadata in Kconfig format
968 $0 package_mk [file] Package metadata in makefile format
969 $0 package_config [file] Package metadata in Kconfig format
970 $0 kconfig [file] [config] [patchver] Kernel config overrides
971 $0 package_source [file] Package source file information
972 $0 package_feeds [file] Package feed information in makefile format
973 $0 package_license [file] Package license information
974 $0 package_licensefull [file] Package license information (full list)
975 $0 version_filter [patchver] [list...] Filter list of version tagged strings