summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2009-03-17 02:20:34 +0000
committerFelix Fietkau <nbd@openwrt.org>2009-03-17 02:20:34 +0000
commitddcfaeb1e516d569436c3d4d453a9573655ca375 (patch)
tree94b1169c72a68b9ef6ce9ab92aea68eb8764358a /scripts
parent7ef6b7451973d0d3fd09014871e7859b6a83fb19 (diff)
downloadmtk-20170518-ddcfaeb1e516d569436c3d4d453a9573655ca375.zip
mtk-20170518-ddcfaeb1e516d569436c3d4d453a9573655ca375.tar.gz
mtk-20170518-ddcfaeb1e516d569436c3d4d453a9573655ca375.tar.bz2
move host build in packages into a separate namespace: package/<name>/host/<target> this allows dependencies between host and target packages, and saves unnecessary host builds for packages that contain both variants
SVN-Revision: 14905
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/feeds3
-rwxr-xr-xscripts/metadata.pl75
-rw-r--r--scripts/metadata.pm3
3 files changed, 69 insertions, 12 deletions
diff --git a/scripts/feeds b/scripts/feeds
index deafaca..e51b17c 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -327,10 +327,11 @@ sub install_package {
# install all dependencies
foreach my $vpkg (@{$srcpackage{$src}}, $pkg) {
- foreach my $dep (@{$vpkg->{depends}}, @{$vpkg->{builddepends}}) {
+ foreach my $dep (@{$vpkg->{depends}}, @{$vpkg->{builddepends}}, @{$vpkg->{"builddepends/host"}}) {
next if $dep =~ /@/;
$dep =~ s/^\+//;
$dep =~ s/^.+://;
+ $dep =~ s/\/.+$//;
next unless $dep;
install_package($feed, $dep) == 0 or $ret = 1;
}
diff --git a/scripts/metadata.pl b/scripts/metadata.pl
index 4002559..3d9d68a 100755
--- a/scripts/metadata.pl
+++ b/scripts/metadata.pl
@@ -551,6 +551,20 @@ EOF
}
}
+sub get_conditional_dep($$) {
+ my $condition = shift;
+ my $depstr = shift;
+ if ($condition) {
+ if ($condition =~ /^!(.+)/) {
+ return "\$(if \$(CONFIG_$1),,$depstr)";
+ } else {
+ return "\$(if \$(CONFIG_$condition),$depstr)";
+ }
+ } else {
+ return $depstr;
+ }
+}
+
sub gen_package_mk() {
my %conf;
my %dep;
@@ -582,6 +596,10 @@ sub gen_package_mk() {
next if $done{$pkg->{src}};
$done{$pkg->{src}} = 1;
+ if (@{$pkg->{buildtypes}} > 0) {
+ print "buildtypes-$pkg->{subdir}$pkg->{src} = ".join(' ', @{$pkg->{buildtypes}})."\n";
+ }
+
foreach my $spkg (@{$srcpackage{$pkg->{src}}}) {
foreach my $dep (@{$spkg->{depends}}, @{$spkg->{builddepends}}) {
$dep =~ /@/ or do {
@@ -590,17 +608,60 @@ sub gen_package_mk() {
};
}
}
+ foreach my $type (@{$pkg->{buildtypes}}) {
+ my @extra_deps;
+ my %deplines;
+
+ next unless $pkg->{"builddepends/$type"};
+ foreach my $dep (@{$pkg->{"builddepends/$type"}}) {
+ my $suffix = "";
+ my $condition;
+
+ if ($dep =~ /^(.+):(.+)/) {
+ $condition = $1;
+ $dep = $2;
+ }
+ if ($dep =~ /^(.+)(\/.+)/) {
+ $dep = $1;
+ $suffix = $2;
+ }
+ my $pkg_dep = $package{$dep};
+ next unless $pkg_dep;
+
+ my $idx = "";
+ if (defined $pkg_dep->{src}) {
+ $idx = $pkg_dep->{subdir}.$pkg_dep->{src};
+ } elsif (defined($srcpackage{$dep})) {
+ $idx = $subdir{$dep}.$dep;
+ }
+ my $depstr = "\$(curdir)/$idx$suffix/compile";
+ my $depline = get_conditional_dep($condition, $depstr);
+ if ($depline) {
+ $deplines{$dep} = $depline;
+ }
+ }
+ my $depline = join(" ", values %deplines);
+ if ($depline) {
+ $line .= "\$(curdir)/".$pkg->{subdir}."$pkg->{src}/$type/compile += $depline\n";
+ }
+ }
my $hasdeps = 0;
my %deplines;
foreach my $deps (@srcdeps) {
my $idx;
my $condition;
+ my $prefix = "";
+ my $suffix = "";
if ($deps =~ /^(.+):(.+)/) {
$condition = $1;
$deps = $2;
}
+ if ($deps =~ /^(.+)(\/.+)/) {
+ $deps = $1;
+ $suffix = $2;
+ }
my $pkg_dep = $package{$deps};
my @deps;
@@ -627,21 +688,13 @@ sub gen_package_mk() {
my $depstr;
if ($pkg_dep->{vdepends}) {
- $depstr = "\$(if \$(CONFIG_PACKAGE_$dep),\$(curdir)/$idx/compile)";
+ $depstr = "\$(if \$(CONFIG_PACKAGE_$dep),\$(curdir)/$idx$suffix/compile)";
$dep{$pkg->{src}."->($dep)".$idx} = 1;
} else {
- $depstr = "\$(curdir)/$idx/compile";
+ $depstr = "\$(curdir)/$idx$suffix/compile";
$dep{$pkg->{src}."->".$idx} = 1;
}
- if ($condition) {
- if ($condition =~ /^!(.+)/) {
- $depline = "\$(if \$(CONFIG_$1),,$depstr)";
- } else {
- $depline = "\$(if \$(CONFIG_$condition),$depstr)";
- }
- } else {
- $depline = $depstr;
- }
+ $depline = get_conditional_dep($condition, $depstr);
if ($depline) {
$deplines{$idx.$dep} = $depline;
}
diff --git a/scripts/metadata.pm b/scripts/metadata.pm
index defa7b9..8ce4ea8 100644
--- a/scripts/metadata.pm
+++ b/scripts/metadata.pm
@@ -63,6 +63,7 @@ sub parse_package_metadata($) {
$pkg->{default} = "m if ALL";
$pkg->{depends} = [];
$pkg->{builddepends} = [];
+ $pkg->{buildtypes} = [];
$pkg->{subdir} = $subdir;
$pkg->{tristate} = 1;
$package{$1} = $pkg;
@@ -91,6 +92,8 @@ sub parse_package_metadata($) {
/^Depends: \s*(.+)\s*$/ and $pkg->{depends} = [ split /\s+/, $1 ];
/^Build-Only: \s*(.+)\s*$/ and $pkg->{buildonly} = 1;
/^Build-Depends: \s*(.+)\s*$/ and $pkg->{builddepends} = [ split /\s+/, $1 ];
+ /^Build-Depends\/(\w+): \s*(.+)\s*$/ and $pkg->{"builddepends/$1"} = [ split /\s+/, $2 ];
+ /^Build-Types:\s*(.+)\s*$/ and $pkg->{buildtypes} = [ split /\s+/, $1 ];
/^Category: \s*(.+)\s*$/ and do {
$pkg->{category} = $1;
defined $category{$1} or $category{$1} = {};