[openwrt/openwrt] build: prevent excessive re-evaluation of PKG_VERSION

LEDE Commits lede-commits at lists.infradead.org
Fri Oct 16 15:39:20 EDT 2020


nbd pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/14bad2001f3f205af6d029ee8b55a0f6c4f0f4d0

commit 14bad2001f3f205af6d029ee8b55a0f6c4f0f4d0
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Tue Oct 6 13:39:58 2020 +0200

    build: prevent excessive re-evaluation of PKG_VERSION
    
    version_abbrev uses $(shell) and the ?= is causing make to run the command
    over and over again, causing a significant build slowdown
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 include/download.mk | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/download.mk b/include/download.mk
index 9c8ada052b..d393bf3907 100644
--- a/include/download.mk
+++ b/include/download.mk
@@ -12,9 +12,11 @@ OPENWRT_GIT = $(PROJECT_GIT)
 LEDE_GIT = $(PROJECT_GIT)
 
 ifdef PKG_SOURCE_VERSION
-PKG_VERSION ?= $(if $(PKG_SOURCE_DATE),$(PKG_SOURCE_DATE)-)$(call version_abbrev,$(PKG_SOURCE_VERSION))
-PKG_SOURCE_SUBDIR ?= $(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.xz
+  ifndef PKG_VERSION
+    PKG_VERSION := $(if $(PKG_SOURCE_DATE),$(PKG_SOURCE_DATE)-)$(call version_abbrev,$(PKG_SOURCE_VERSION))
+  endif
+  PKG_SOURCE_SUBDIR ?= $(PKG_NAME)-$(PKG_VERSION)
+  PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.xz
 endif
 
 DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED)



More information about the lede-commits mailing list