summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/package-defaults.mk1
-rw-r--r--include/package-dumpinfo.mk3
-rw-r--r--include/subdir.mk4
-rwxr-xr-xscripts/metadata.pl3
-rw-r--r--scripts/metadata.pm1
5 files changed, 10 insertions, 2 deletions
diff --git a/include/package-defaults.mk b/include/package-defaults.mk
index 2b5cb8671..017a86d1e 100644
--- a/include/package-defaults.mk
+++ b/include/package-defaults.mk
@@ -37,6 +37,7 @@ define Package/Default
KCONFIG:=
BUILDONLY:=
URL:=
+ VARIANT:=
endef
Build/Patch:=$(Build/Patch/Default)
diff --git a/include/package-dumpinfo.mk b/include/package-dumpinfo.mk
index f48f31507..5f9811b4f 100644
--- a/include/package-dumpinfo.mk
+++ b/include/package-dumpinfo.mk
@@ -32,7 +32,8 @@ $(if $(MENU),Menu: $(MENU)
)Version: $(VERSION)
Depends: $(DEPENDS)
Provides: $(PROVIDES)
-$(if $(PKG_BUILD_DEPENDS),Build-Depends: $(PKG_BUILD_DEPENDS)
+$(if $(VARIANT),Build-Variant: $(VARIANT)
+)$(if $(PKG_BUILD_DEPENDS),Build-Depends: $(PKG_BUILD_DEPENDS)
)$(if $(HOST_BUILD_DEPENDS),Build-Depends/host: $(HOST_BUILD_DEPENDS)
)$(if $(BUILD_TYPES),Build-Types: $(BUILD_TYPES)
)Section: $(SECTION)
diff --git a/include/subdir.mk b/include/subdir.mk
index 3c1e3f9ca..b8094afb2 100644
--- a/include/subdir.mk
+++ b/include/subdir.mk
@@ -35,7 +35,9 @@ define subdir
)
$(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(if $(QUILT),,$($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd))))
$(if $(BUILD_LOG),@mkdir -p $(BUILD_LOG_DIR)/$(1)/$(bd))
- +$(if $(BUILD_LOG),set -o pipefail;) $$(SUBMAKE) -C $(1)/$(bd) $(target) $(if $(BUILD_LOG),SILENT= 2>&1 | tee $(BUILD_LOG_DIR)/$(1)/$(bd)/$(target).txt) $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(target))), || $(call MESSAGE, ERROR: $(1)/$(bd) failed to build.))
+ $(foreach variant,$(if $(BUILD_VARIANT),$(BUILD_VARIANT),$(if $($(1)/$(bd)/variants),$($(1)/$(bd)/variants),__default)),
+ +$(if $(BUILD_LOG),set -o pipefail;) $$(SUBMAKE) -C $(1)/$(bd) $(target) BUILD_VARIANT="$(filter-out __default,$(variant))" $(if $(BUILD_LOG),SILENT= 2>&1 | tee $(BUILD_LOG_DIR)/$(1)/$(bd)/$(target).txt) $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(target))), || $(call MESSAGE, ERROR: $(1)/$(bd) failed to build$(if $(filter-out __default,$(variant)), (build variant: $(variant))).))
+ )
$$(if $(call debug,$(1)/$(bd),v),,.SILENT: $(1)/$(bd)/$(target))
# legacy targets
diff --git a/scripts/metadata.pl b/scripts/metadata.pl
index ca00fcae6..26d878cc9 100755
--- a/scripts/metadata.pl
+++ b/scripts/metadata.pl
@@ -620,6 +620,9 @@ sub gen_package_mk() {
if ($config) {
$pkg->{buildonly} and $config = "";
print "package-$config += $pkg->{subdir}$pkg->{src}\n";
+ if ($pkg->{variant}) {
+ print "\$(curdir)/$pkg->{subdir}$pkg->{src}/variants += \$(if $config,$pkg->{variant})\n"
+ }
$pkg->{prereq} and print "prereq-$config += $pkg->{subdir}$pkg->{src}\n";
}
diff --git a/scripts/metadata.pm b/scripts/metadata.pm
index 8302728be..b7a448b61 100644
--- a/scripts/metadata.pm
+++ b/scripts/metadata.pm
@@ -112,6 +112,7 @@ sub parse_package_metadata($) {
}
};
/^Depends: \s*(.+)\s*$/ and $pkg->{depends} = [ split /\s+/, $1 ];
+ /^Build-Variant: \s*(\w+)\s*/ and $pkg->{variant} = $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 ];