2016-03-22 18:26:16 +01:00
|
|
|
#
|
|
|
|
# Include this file if your Package needs to be checked out by git
|
|
|
|
#
|
|
|
|
PKG_DIR?=$(CURDIR)
|
2017-02-25 15:41:39 +01:00
|
|
|
PKG_BUILDDIR?=$(PKGDIRBASE)/$(PKG_NAME)
|
2016-03-22 18:26:16 +01:00
|
|
|
|
2018-02-01 12:20:50 +01:00
|
|
|
# allow overriding package source with local folder (useful during development)
|
|
|
|
ifneq (,$(PKG_SOURCE_LOCAL))
|
|
|
|
include $(RIOTBASE)/pkg/local.mk
|
|
|
|
else
|
|
|
|
|
2019-03-07 15:13:41 +01:00
|
|
|
.PHONY: prepare git-download clean git-ensure-version
|
2017-06-28 14:34:53 +02:00
|
|
|
|
|
|
|
prepare: git-download
|
2016-03-22 18:26:16 +01:00
|
|
|
|
2016-04-26 13:53:51 +02:00
|
|
|
ifneq (,$(wildcard $(PKG_DIR)/patches))
|
|
|
|
git-download: $(PKG_BUILDDIR)/.git-patched
|
|
|
|
else
|
2019-03-07 15:13:41 +01:00
|
|
|
git-download: git-ensure-version
|
2016-04-26 13:53:51 +02:00
|
|
|
endif
|
2016-03-23 16:38:19 +01:00
|
|
|
|
2018-09-19 11:36:05 +02:00
|
|
|
GITFLAGS ?= -c user.email=buildsystem@riot -c user.name="RIOT buildsystem"
|
2018-07-25 18:51:43 +02:00
|
|
|
GITAMFLAGS ?= --no-gpg-sign --ignore-whitespace
|
2018-04-24 21:10:24 +02:00
|
|
|
|
2016-04-26 13:53:51 +02:00
|
|
|
ifneq (,$(wildcard $(PKG_DIR)/patches))
|
2019-03-07 15:13:41 +01:00
|
|
|
$(PKG_BUILDDIR)/.git-patched: git-ensure-version $(PKG_DIR)/Makefile $(PKG_DIR)/patches/*.patch
|
2016-04-26 13:53:51 +02:00
|
|
|
git -C $(PKG_BUILDDIR) checkout -f $(PKG_VERSION)
|
2018-09-19 11:36:05 +02:00
|
|
|
git $(GITFLAGS) -C $(PKG_BUILDDIR) am $(GITAMFLAGS) "$(PKG_DIR)"/patches/*.patch
|
2016-04-26 13:53:51 +02:00
|
|
|
touch $@
|
|
|
|
endif
|
2016-03-24 23:32:34 +01:00
|
|
|
|
2019-03-07 15:13:41 +01:00
|
|
|
git-ensure-version: $(PKG_BUILDDIR)/.git-downloaded
|
|
|
|
if [ $(shell git -C $(PKG_BUILDDIR) rev-parse HEAD) != $(PKG_VERSION) ] ; then \
|
|
|
|
git -C $(PKG_BUILDDIR) clean -xdff ; \
|
|
|
|
git -C $(PKG_BUILDDIR) fetch "$(PKG_URL)" "$(PKG_VERSION)" ; \
|
|
|
|
git -C $(PKG_BUILDDIR) checkout -f $(PKG_VERSION) ; \
|
|
|
|
touch $(PKG_BUILDDIR)/.git-downloaded ; \
|
|
|
|
fi
|
|
|
|
|
2016-03-23 16:38:19 +01:00
|
|
|
$(PKG_BUILDDIR)/.git-downloaded:
|
2016-03-31 23:09:23 +02:00
|
|
|
rm -Rf $(PKG_BUILDDIR)
|
2016-03-22 18:26:16 +01:00
|
|
|
mkdir -p $(PKG_BUILDDIR)
|
|
|
|
$(GITCACHE) clone "$(PKG_URL)" "$(PKG_VERSION)" "$(PKG_BUILDDIR)"
|
2016-03-23 16:38:19 +01:00
|
|
|
touch $@
|
2016-03-22 18:26:16 +01:00
|
|
|
|
|
|
|
clean::
|
2016-03-24 23:32:34 +01:00
|
|
|
@test -d $(PKG_BUILDDIR) && { \
|
2016-04-26 13:53:51 +02:00
|
|
|
rm $(PKG_BUILDDIR)/.git-patched ; \
|
2016-03-24 23:32:34 +01:00
|
|
|
git -C $(PKG_BUILDDIR) clean -f ; \
|
|
|
|
git -C $(PKG_BUILDDIR) checkout "$(PKG_VERSION)"; \
|
2016-04-26 13:53:51 +02:00
|
|
|
make $(PKG_BUILDDIR)/.git-patched ; \
|
2016-03-24 23:32:34 +01:00
|
|
|
touch $(PKG_BUILDDIR)/.git-downloaded ; \
|
|
|
|
} > /dev/null 2>&1 || true
|
2016-03-22 18:26:16 +01:00
|
|
|
|
|
|
|
distclean::
|
|
|
|
rm -rf "$(PKG_BUILDDIR)"
|
2018-02-01 12:20:50 +01:00
|
|
|
|
|
|
|
endif
|