build: add defaults for PKG_SOURCE, PKG_SOURCE_SUBDIR, PKG_VERSION
This makes it easier to unify versioning of git based package downloads. PKG_SOURCE_DATE along with an 8-character abbreviation of the git hash is used as PKG_VERSION, PKG_RELEASE should be used like normal packages. Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
24e58c3f72
commit
ffb0181a87
4 changed files with 12 additions and 2 deletions
|
@ -9,6 +9,12 @@
|
||||||
OPENWRT_GIT = http://git.openwrt.org
|
OPENWRT_GIT = http://git.openwrt.org
|
||||||
LEDE_GIT = https://git.lede-project.org
|
LEDE_GIT = https://git.lede-project.org
|
||||||
|
|
||||||
|
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
|
||||||
|
endif
|
||||||
|
|
||||||
DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED)
|
DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED)
|
||||||
|
|
||||||
# Try to guess the download method from the URL
|
# Try to guess the download method from the URL
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/download.mk
|
||||||
|
|
||||||
HOST_BUILD_DIR ?= $(BUILD_DIR_HOST)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
|
HOST_BUILD_DIR ?= $(BUILD_DIR_HOST)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
|
||||||
HOST_INSTALL_DIR ?= $(HOST_BUILD_DIR)/host-install
|
HOST_INSTALL_DIR ?= $(HOST_BUILD_DIR)/host-install
|
||||||
HOST_BUILD_PARALLEL ?=
|
HOST_BUILD_PARALLEL ?=
|
||||||
|
@ -35,7 +37,6 @@ HOST_STAMP_INSTALLED:=$(HOST_BUILD_PREFIX)/stamp/.$(PKG_NAME)_installed
|
||||||
|
|
||||||
override MAKEFLAGS=
|
override MAKEFLAGS=
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/download.mk
|
|
||||||
include $(INCLUDE_DIR)/quilt.mk
|
include $(INCLUDE_DIR)/quilt.mk
|
||||||
include $(INCLUDE_DIR)/autotools.mk
|
include $(INCLUDE_DIR)/autotools.mk
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ __package_mk:=1
|
||||||
|
|
||||||
all: $(if $(DUMP),dumpinfo,$(if $(CHECK),check,compile))
|
all: $(if $(DUMP),dumpinfo,$(if $(CHECK),check,compile))
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/download.mk
|
||||||
|
|
||||||
PKG_BUILD_DIR ?= $(BUILD_DIR)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
|
PKG_BUILD_DIR ?= $(BUILD_DIR)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
|
||||||
PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
|
PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
|
||||||
PKG_BUILD_PARALLEL ?=
|
PKG_BUILD_PARALLEL ?=
|
||||||
|
@ -92,7 +94,6 @@ endif
|
||||||
|
|
||||||
PKG_INSTALL_STAMP:=$(PKG_INFO_DIR)/$(PKG_DIR_NAME).$(if $(BUILD_VARIANT),$(BUILD_VARIANT),default).install
|
PKG_INSTALL_STAMP:=$(PKG_INFO_DIR)/$(PKG_DIR_NAME).$(if $(BUILD_VARIANT),$(BUILD_VARIANT),default).install
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/download.mk
|
|
||||||
include $(INCLUDE_DIR)/quilt.mk
|
include $(INCLUDE_DIR)/quilt.mk
|
||||||
include $(INCLUDE_DIR)/package-defaults.mk
|
include $(INCLUDE_DIR)/package-defaults.mk
|
||||||
include $(INCLUDE_DIR)/package-dumpinfo.mk
|
include $(INCLUDE_DIR)/package-dumpinfo.mk
|
||||||
|
|
2
rules.mk
2
rules.mk
|
@ -55,6 +55,8 @@ __tr_template = $(__tr_head)$$(1)$(__tr_tail)
|
||||||
$(eval toupper = $(call __tr_template,$(chars_lower),$(chars_upper)))
|
$(eval toupper = $(call __tr_template,$(chars_lower),$(chars_upper)))
|
||||||
$(eval tolower = $(call __tr_template,$(chars_upper),$(chars_lower)))
|
$(eval tolower = $(call __tr_template,$(chars_upper),$(chars_lower)))
|
||||||
|
|
||||||
|
version_abbrev = $(if $(if $(CHECK),,$(DUMP)),$(1),$(shell printf '%.8s' $(1)))
|
||||||
|
|
||||||
_SINGLE=export MAKEFLAGS=$(space);
|
_SINGLE=export MAKEFLAGS=$(space);
|
||||||
CFLAGS:=
|
CFLAGS:=
|
||||||
ARCH:=$(subst i486,i386,$(subst i586,i386,$(subst i686,i386,$(call qstrip,$(CONFIG_ARCH)))))
|
ARCH:=$(subst i486,i386,$(subst i586,i386,$(subst i686,i386,$(call qstrip,$(CONFIG_ARCH)))))
|
||||||
|
|
Loading…
Reference in a new issue