diff options
Diffstat (limited to 'pkgauto.mk')
-rw-r--r-- | pkgauto.mk | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/pkgauto.mk b/pkgauto.mk new file mode 100644 index 0000000..8bd0386 --- /dev/null +++ b/pkgauto.mk @@ -0,0 +1,35 @@ +ifneq ($(PKG_SOURCE_PROTO),git) +$(error Only supported protocol is git) +endif +ifndef PKG_NAME +$(error You have to define PKG_NAME before pkgauto.mk include) +endif +ifndef PKG_SOURCE_URL +$(error You have to define PKG_SOURCE_URL before pkgauto.mk include) +endif +ifndef PKG_SOURCE_BRANCH +$(error You have to define PKG_SOURCE_BRANCH before pkgauto.mk include) +endif + +TMP_REPO_PATH=/tmp/myrepo_$(PKG_NAME) + +GIT_ARGS=--git-dir='$(TMP_REPO_PATH)' --bare + +$(shell \ + if [ ! -d "$(TMP_REPO_PATH)" ]; then \ + git clone --bare "$(PKG_SOURCE_URL)" "$(TMP_REPO_PATH)"; \ + else \ + git $(GIT_ARGS) fetch "$(PKG_SOURCE_URL)"; \ + fi \ +) + +PKG_SOURCE_VERSION:=$(shell git $(GIT_ARGS) rev-parse $(PKG_SOURCE_BRANCH)) +PKG_VERSION:=$(shell git $(GIT_ARGS) describe --abbrev=0 --tags $(PKG_SOURCE_BRANCH) | sed 's/^v//') +PKG_RELEASE:=$(shell git $(GIT_ARGS) rev-list --count v$(PKG_VERSION)..$(PKG_SOURCE_VERSION)) + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz +PKG_SOURCE_SUBDIR:=$(PKG_NAME) +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME) + +# TODO drop TMP_REPO_PATH $GIT_ARGS |