aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/package-metadata.pl
diff options
context:
space:
mode:
authorEneas U de Queiroz <cote2004-github@yahoo.com>2019-04-24 22:29:43 +0000
committerChristian Lamparter <chunkeey@gmail.com>2019-05-31 11:21:22 +0200
commita41f474d17fef8aa94fdd6a8aa9b9a4bd2e5fa0f (patch)
treeab184ba6645884c94829d495eb2df20af03338fa /scripts/package-metadata.pl
parentf22ef1f1de8816201c6d8551e1bb3f3fc58c4328 (diff)
downloadupstream-a41f474d17fef8aa94fdd6a8aa9b9a4bd2e5fa0f.tar.gz
upstream-a41f474d17fef8aa94fdd6a8aa9b9a4bd2e5fa0f.tar.bz2
upstream-a41f474d17fef8aa94fdd6a8aa9b9a4bd2e5fa0f.zip
build: add support to && in DEPENDS
Adds support to && operand in DEPENDS. Also, fixes generation of || dependencies by scripts/package-metadata.pl. The precedence order from higher to lower is && then ||. Use of parentheses to change the order is not supported. As before, they are silently ignored. Use them for readability only. Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com> Signed-off-by: Christian Lamparter <chunkeey@gmail.com> [DMARC removal]
Diffstat (limited to 'scripts/package-metadata.pl')
-rwxr-xr-xscripts/package-metadata.pl20
1 files changed, 18 insertions, 2 deletions
diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl
index e0cdff1e81..76b09a56eb 100755
--- a/scripts/package-metadata.pl
+++ b/scripts/package-metadata.pl
@@ -358,14 +358,30 @@ sub gen_package_config() {
print_package_overrides();
}
+sub and_condition($) {
+ my $condition = shift;
+ my @spl_and = split('\&\&', $condition);
+ if (@spl_and == 1) {
+ return "\$(CONFIG_$spl_and[0])";
+ }
+ return "\$(and " . join (',', map("\$(CONFIG_$_)", @spl_and)) . ")";
+}
+
+sub gen_condition ($) {
+ my $condition = shift;
+ # remove '!()', just as include/package-ipkg.mk does
+ $condition =~ s/[()!]//g;
+ return join("", map(and_condition($_), split('\|\|', $condition)));
+}
+
sub get_conditional_dep($$) {
my $condition = shift;
my $depstr = shift;
if ($condition) {
if ($condition =~ /^!(.+)/) {
- return "\$(if \$(CONFIG_$1),,$depstr)";
+ return "\$(if " . gen_condition($1) . ",,$depstr)";
} else {
- return "\$(if \$(CONFIG_$condition),$depstr)";
+ return "\$(if " . gen_condition($condition) . ",$depstr)";
}
} else {
return $depstr;