mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-27 20:29:41 +02:00
build system: introduce a new feature called build variants.
it allows building a package multiple times in one pass with different build dirs, based on the same build settings. replaces templating hacks like the one used in the hostapd package git-svn-id: svn://svn.openwrt.org/openwrt/trunk@18357 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
3b3a36db38
commit
bc624321e8
@ -37,6 +37,7 @@ define Package/Default
|
|||||||
KCONFIG:=
|
KCONFIG:=
|
||||||
BUILDONLY:=
|
BUILDONLY:=
|
||||||
URL:=
|
URL:=
|
||||||
|
VARIANT:=
|
||||||
endef
|
endef
|
||||||
|
|
||||||
Build/Patch:=$(Build/Patch/Default)
|
Build/Patch:=$(Build/Patch/Default)
|
||||||
|
@ -32,7 +32,8 @@ $(if $(MENU),Menu: $(MENU)
|
|||||||
)Version: $(VERSION)
|
)Version: $(VERSION)
|
||||||
Depends: $(DEPENDS)
|
Depends: $(DEPENDS)
|
||||||
Provides: $(PROVIDES)
|
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 $(HOST_BUILD_DEPENDS),Build-Depends/host: $(HOST_BUILD_DEPENDS)
|
||||||
)$(if $(BUILD_TYPES),Build-Types: $(BUILD_TYPES)
|
)$(if $(BUILD_TYPES),Build-Types: $(BUILD_TYPES)
|
||||||
)Section: $(SECTION)
|
)Section: $(SECTION)
|
||||||
|
@ -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))))
|
$(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),@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))
|
$$(if $(call debug,$(1)/$(bd),v),,.SILENT: $(1)/$(bd)/$(target))
|
||||||
|
|
||||||
# legacy targets
|
# legacy targets
|
||||||
|
@ -620,6 +620,9 @@ sub gen_package_mk() {
|
|||||||
if ($config) {
|
if ($config) {
|
||||||
$pkg->{buildonly} and $config = "";
|
$pkg->{buildonly} and $config = "";
|
||||||
print "package-$config += $pkg->{subdir}$pkg->{src}\n";
|
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";
|
$pkg->{prereq} and print "prereq-$config += $pkg->{subdir}$pkg->{src}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +112,7 @@ sub parse_package_metadata($) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
/^Depends: \s*(.+)\s*$/ and $pkg->{depends} = [ split /\s+/, $1 ];
|
/^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-Only: \s*(.+)\s*$/ and $pkg->{buildonly} = 1;
|
||||||
/^Build-Depends: \s*(.+)\s*$/ and $pkg->{builddepends} = [ split /\s+/, $1 ];
|
/^Build-Depends: \s*(.+)\s*$/ and $pkg->{builddepends} = [ split /\s+/, $1 ];
|
||||||
/^Build-Depends\/(\w+): \s*(.+)\s*$/ and $pkg->{"builddepends/$1"} = [ split /\s+/, $2 ];
|
/^Build-Depends\/(\w+): \s*(.+)\s*$/ and $pkg->{"builddepends/$1"} = [ split /\s+/, $2 ];
|
||||||
|
Loading…
Reference in New Issue
Block a user