build: add elecom-product-header for ELECOM devices
[openwrt/openwrt.git] / scripts / package-metadata.pl
index 76b09a56ebfedbeb3634880ff505a5220c7acd4d..5abc1bdef3f70e1c4cbe3f97ecfd6ea925ad88ed 100755 (executable)
@@ -191,9 +191,9 @@ sub mconf_depends {
                                $depend = shift @vdeps;
 
                                if (@vdeps > 1) {
-                                       $condition = ($condition ? "$condition && " : '') . '!('.join("||", map { "PACKAGE_".$_ } @vdeps).')';
+                                       $condition = ($condition ? "$condition && " : '') . join("&&", map { "PACKAGE_$_<PACKAGE_$pkgname" } @vdeps);
                                } elsif (@vdeps > 0) {
-                                       $condition = ($condition ? "$condition && " : '') . '!PACKAGE_'.$vdeps[0];
+                                       $condition = ($condition ? "$condition && " : '') . "PACKAGE_${vdeps[0]}<PACKAGE_$pkgname";
                                }
                        }
 
@@ -547,6 +547,18 @@ sub gen_package_auxiliary() {
                                print "Package/$n/abiversion = $abiv\n";
                        }
                }
+               my %depends;
+               foreach my $dep (@{$pkg->{depends} || []}) {
+                       if ($dep =~ m!^\+?(?:[^:]+:)?([^@]+)$!) {
+                               $depends{$1}++;
+                       }
+               }
+               my @depends = sort keys %depends;
+               if (@depends > 0) {
+                       foreach my $n (@{$pkg->{provides}}) {
+                               print "Package/$n/depends = @depends\n";
+                       }
+               }
        }
 }