build: allow packages with build variants to explicitly select a default variant

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 42654
This commit is contained in:
Felix Fietkau 2014-09-23 10:41:15 +00:00
parent 38a8f5ae63
commit a62f0d02ec
4 changed files with 5 additions and 2 deletions

View file

@ -53,6 +53,7 @@ define Package/Default
HIDDEN:=
URL:=
VARIANT:=
DEFAULT_VARIANT:=
USERID:=
endef

View file

@ -34,7 +34,8 @@ Depends: $(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS))
Menu-Depends: $(MDEPENDS)
Provides: $(PROVIDES)
$(if $(VARIANT),Build-Variant: $(VARIANT)
)$(if $(PKG_BUILD_DEPENDS),Build-Depends: $(PKG_BUILD_DEPENDS)
$(if $(DEFAULT_VARIANT),Default-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)

View file

@ -684,7 +684,7 @@ sub gen_package_mk() {
$pkg->{buildonly} and $config = "";
print "package-$config += $pkg->{subdir}$pkg->{src}\n";
if ($pkg->{variant}) {
if (!defined($done{$pkg->{src}})) {
if (!defined($done{$pkg->{src}}) or $pkg->{variant_default}) {
print "\$(curdir)/$pkg->{subdir}$pkg->{src}/default-variant := $pkg->{variant}\n";
}
print "\$(curdir)/$pkg->{subdir}$pkg->{src}/variants += \$(if $config,$pkg->{variant})\n"

View file

@ -115,6 +115,7 @@ sub parse_package_metadata($) {
/^Depends: \s*(.+)\s*$/ and $pkg->{depends} = [ split /\s+/, $1 ];
/^Hidden: \s*(.+)\s*$/ and $pkg->{hidden} = 1;
/^Build-Variant: \s*([\w\-]+)\s*/ and $pkg->{variant} = $1;
/^Default-Variant: .*/ and $pkg->{variant_default} = 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 ];