diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/deps.mk | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/core/deps.mk b/core/deps.mk index d907d24..9c2a49f 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -22,8 +22,8 @@ endif endif export ERL_LIBS -PKG_FILE ?= $(CURDIR)/.erlang.mk.packages.v2 -export PKG_FILE +PKG_FILE2 ?= $(CURDIR)/.erlang.mk.packages.v2 +export PKG_FILE2 PKG_FILE_URL ?= https://raw.githubusercontent.com/extend/erlang.mk/master/packages.v2.tsv @@ -42,25 +42,31 @@ distclean:: distclean-deps distclean-pkg # Deps related targets. -define dep_fetch_git - git clone -n -- $(2) $(DEPS_DIR)/$(1) - cd $(DEPS_DIR)/$(1) ; git checkout -q $(3) -endef - define dep_fetch - @mkdir -p $(DEPS_DIR) -ifeq (,$(dep_$(1))) - @if [ ! -f $(PKG_FILE) ]; then $(call core_http_get,$(PKG_FILE),$(PKG_FILE_URL)); fi - $(eval DEP_FETCH_PKG := $(shell awk 'BEGIN { FS = "\t" }; $$1 == "$(1)" { print $$2 " " $$3 " "$$4 }' $(PKG_FILE))) - $(call dep_fetch_$(word 1,$(DEP_FETCH_PKG)),$(1),$(word 2,$(DEP_FETCH_PKG)),$(word 3,$(DEP_FETCH_PKG))) -else - $(call dep_fetch_$(word 1,$(dep_$(1))),$(1),$(word 2,$(dep_$(1))),$(word 3,$(dep_$(1)))) -endif + if [ "$$$$VS" = "git" ]; then \ + git clone -n -- $$$$REPO $(DEPS_DIR)/$(1); \ + cd $(DEPS_DIR)/$(1) && git checkout -q $$$$COMMIT; \ + else \ + exit 78; \ + fi endef define dep_target $(DEPS_DIR)/$(1): + @mkdir -p $(DEPS_DIR) + @if [ ! -f $(PKG_FILE2) ]; then $(call core_http_get,$(PKG_FILE2),$(PKG_FILE_URL)); fi +ifeq (,$(dep_$(1))) + DEPPKG=$$$$(awk 'BEGIN { FS = "\t" }; $$$$1 == "$(1)" { print $$$$2 " " $$$$3 " " $$$$4 }' $(PKG_FILE2);) \ + VS=$$$$(echo $$$$DEPPKG | cut -d " " -f1); \ + REPO=$$$$(echo $$$$DEPPKG | cut -d " " -f2); \ + COMMIT=$$$$(echo $$$$DEPPKG | cut -d " " -f3); \ $(call dep_fetch,$(1)) +else + VS=$(word 1,$(dep_$(1))); \ + REPO=$(word 1,$(dep_$(2))); \ + COMMIT=$(word 1,$(dep_$(3))); \ + $(call dep_fetch,$(1)) +endif endef $(foreach dep,$(DEPS),$(eval $(call dep_target,$(dep)))) @@ -70,19 +76,19 @@ distclean-deps: # Packages related targets. -$(PKG_FILE): - $(call core_http_get,$(PKG_FILE),$(PKG_FILE_URL)) +$(PKG_FILE2): + $(call core_http_get,$(PKG_FILE2),$(PKG_FILE_URL)) -pkg-list: $(PKG_FILE) - @cat $(PKG_FILE) | awk 'BEGIN { FS = "\t" }; { print \ +pkg-list: $(PKG_FILE2) + @cat $(PKG_FILE2) | awk 'BEGIN { FS = "\t" }; { print \ "Name:\t\t" $$1 "\n" \ "Repository:\t" $$3 "\n" \ "Website:\t" $$5 "\n" \ "Description:\t" $$6 "\n" }' ifdef q -pkg-search: $(PKG_FILE) - @cat $(PKG_FILE) | grep -i ${q} | awk 'BEGIN { FS = "\t" }; { print \ +pkg-search: $(PKG_FILE2) + @cat $(PKG_FILE2) | grep -i ${q} | awk 'BEGIN { FS = "\t" }; { print \ "Name:\t\t" $$1 "\n" \ "Repository:\t" $$3 "\n" \ "Website:\t" $$5 "\n" \ @@ -93,7 +99,7 @@ pkg-search: endif distclean-pkg: - $(gen_verbose) rm -f $(PKG_FILE) + $(gen_verbose) rm -f $(PKG_FILE2) help:: @printf "%s\n" "" \ |