+define DownloadMethod/github_archive
+ $(call wrap_mirror,$(1),$(2), \
+ $(SCRIPT_DIR)/dl_github_archive.py \
+ --dl-dir="$(DL_DIR)" \
+ --url="$(URL)" \
+ --version="$(VERSION)" \
+ --subdir="$(SUBDIR)" \
+ --source="$(FILE)" \
+ --hash="$(MIRROR_HASH)" \
+ || ( $(call DownloadMethod/rawgit) ); \
+ )
+endef
+
+# Only intends to be called as a submethod from other DownloadMethod
+define DownloadMethod/rawgit
+ echo "Checking out files from the git repository..."; \
+ mkdir -p $(TMP_DIR)/dl && \
+ cd $(TMP_DIR)/dl && \
+ rm -rf $(SUBDIR) && \
+ [ \! -d $(SUBDIR) ] && \
+ git clone $(OPTS) $(URL) $(SUBDIR) && \
+ (cd $(SUBDIR) && git checkout $(VERSION) && \
+ git submodule update --init --recursive) && \
+ echo "Packing checkout..." && \
+ export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \
+ rm -rf $(SUBDIR)/.git && \
+ $(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
+ mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
+ rm -rf $(SUBDIR);
+endef
+