build: allow packages with build variants to explicitly select a default variant
authorFelix Fietkau <nbd@openwrt.org>
Tue, 23 Sep 2014 10:41:15 +0000 (10:41 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 23 Sep 2014 10:41:15 +0000 (10:41 +0000)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 42654

include/package-defaults.mk
include/package-dumpinfo.mk
scripts/metadata.pl
scripts/metadata.pm

index 051cde5020a545cd23f95a662885eafe5c1d1fd2..19f2a16045ec7ccb0c950297f9f44d0c6fb5b2ab 100644 (file)
@@ -53,6 +53,7 @@ define Package/Default
   HIDDEN:=
   URL:=
   VARIANT:=
+  DEFAULT_VARIANT:=
   USERID:=
 endef
 
index 024158052294e77f667e692c690d0232d8066ea5..5d1d76fee5730e63ad298db175e7be7ea82dccd8 100644 (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)
index 79f930c5ea49bdb0e660436c851ff48c92e5ecee..4014613de60e3a42711d314971c1b6f0118f6445 100755 (executable)
@@ -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"
index 0e55c8ebedc00a365ef7a84276c96ec943a92640..ab5abc0363671ca93470948d9b68275d6079e8ca 100644 (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 ];