From: Paul Spooren Date: Tue, 9 Mar 2021 22:46:40 +0000 (-1000) Subject: build: add noarch support X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=refs%2Fheads%2Fnoarch;p=openwrt%2Fstaging%2Faparcar.git build: add noarch support This allows to store all architecture independent packages in a single folder instead of storing duplicates in each architecture folder. As a result nearly 3000 less packages are build per architecture and instead a single *noarch* job creates packages usable by all architectures. Built images will have an extended `distfeeds.conf` containing the feeds separated in arch specific and *noarch*. As this will increase the time needed for an `opkg update`, future commits could disable the option `PER_FEED_REPO` as all default feeds are OpenWrt maintained and build at the same time anyway. A new *No-Arch* field in the package metadata allows the tools `./scripts/feeds` to sort on arch dependent and independent packages via later commits. Signed-off-by: Paul Spooren --- diff --git a/include/feeds.mk b/include/feeds.mk index 98e315bceb..27c3b8bf4c 100644 --- a/include/feeds.mk +++ b/include/feeds.mk @@ -11,7 +11,9 @@ FEEDS_AVAILABLE:=$(sort $(FEEDS_INSTALLED) $(shell $(SCRIPT_DIR)/feeds list -n 2 PACKAGE_SUBDIRS=$(PACKAGE_DIR) ifneq ($(CONFIG_PER_FEED_REPO),) PACKAGE_SUBDIRS += $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/base + PACKAGE_SUBDIRS += $(OUTPUT_DIR)/packages/noarch/base PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_AVAILABLE),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED)) + PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_AVAILABLE),$(OUTPUT_DIR)/packages/noarch/$(FEED)) endif opkg_package_files = $(wildcard \ @@ -19,10 +21,13 @@ opkg_package_files = $(wildcard \ $(foreach pkg,$(1), $(dir)/$(pkg)_*.ipk))) # 1: package name +# 2: package arch define FeedPackageDir $(strip $(if $(CONFIG_PER_FEED_REPO), \ $(if $(Package/$(1)/subdir), \ - $(abspath $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(Package/$(1)/subdir)), \ + $(if $(filter all,$(2)), \ + $(abspath $(OUTPUT_DIR)/packages/noarch/$(Package/$(1)/subdir)), \ + $(abspath $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(Package/$(1)/subdir))), \ $(PACKAGE_DIR)), \ $(PACKAGE_DIR))) endef @@ -37,6 +42,7 @@ define FeedSourcesAppend echo 'src/gz %d_kmods %U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)';) \ $(foreach feed,$(FEEDS_AVAILABLE), \ $(if $(CONFIG_FEED_$(feed)), \ + echo '$(if $(filter m,$(CONFIG_FEED_$(feed))),# )src/gz %d_$(feed)_noarch %U/packages/noarch/$(feed)'; \ echo '$(if $(filter m,$(CONFIG_FEED_$(feed))),# )src/gz %d_$(feed) %U/packages/%A/$(feed)';)))) \ ) >> $(1) endef diff --git a/include/package-dumpinfo.mk b/include/package-dumpinfo.mk index 597452e4b9..3545ba249f 100644 --- a/include/package-dumpinfo.mk +++ b/include/package-dumpinfo.mk @@ -25,7 +25,8 @@ Depends: $(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS)) Conflicts: $(CONFLICTS) Menu-Depends: $(MDEPENDS) Provides: $(PROVIDES) -$(if $(VARIANT),Build-Variant: $(VARIANT) +$(if $(filter $(PKGARCH),all),No-Arch: 1 +)$(if $(VARIANT),Build-Variant: $(VARIANT) $(if $(DEFAULT_VARIANT),Default-Variant: $(VARIANT) ))Section: $(SECTION) Category: $(CATEGORY) diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk index c2017cd220..cc17d9b87d 100644 --- a/include/package-ipkg.mk +++ b/include/package-ipkg.mk @@ -100,7 +100,7 @@ _endef=endef ifeq ($(DUMP),) define BuildTarget/ipkg ABIV_$(1):=$(if $(filter-out kmod-%,$(1)),$(ABI_VERSION)) - PDIR_$(1):=$(call FeedPackageDir,$(1)) + PDIR_$(1):=$(call FeedPackageDir,$(1),$(PKGARCH)) IPKG_$(1):=$$(PDIR_$(1))/$(1)$$(ABIV_$(1))_$(VERSION)_$(PKGARCH).ipk IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1) KEEP_$(1):=$(strip $(call Package/$(1)/conffiles)) diff --git a/scripts/metadata.pm b/scripts/metadata.pm index 5fbb77a36c..cdc69aeed3 100644 --- a/scripts/metadata.pm +++ b/scripts/metadata.pm @@ -237,6 +237,7 @@ sub parse_package_metadata($) { $pkg->{mdepends} = []; $pkg->{provides} = [$1]; $pkg->{tristate} = 1; + $pkg->{noarch} = 0; $pkg->{override} = $override; $package{$1} = $pkg; push @{$src->{packages}}, $pkg; @@ -251,6 +252,7 @@ sub parse_package_metadata($) { /^Version: \s*(.+)\s*$/ and $pkg->{version} = $1; /^Title: \s*(.+)\s*$/ and $pkg->{title} = $1; /^Menu: \s*(.+)\s*$/ and $pkg->{menu} = $1; + /^No-Arch: \s*(.+)\s*$/ and $pkg->{noarch} = 1; /^Submenu: \s*(.+)\s*$/ and $pkg->{submenu} = $1; /^Submenu-Depends: \s*(.+)\s*$/ and $pkg->{submenudep} = $1; /^Source: \s*(.+)\s*$/ and $pkg->{source} = $1;