buildroot: improve git submodule handling for packages
[openwrt/openwrt.git] / include / download.mk
index 8a1205df00ff5eb5b2b88ef9d0ed07122d9a0af8..63af9081145c84f2f41eca8222d7b3ace9fa53dd 100644 (file)
@@ -13,7 +13,7 @@ DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED)
 define dl_method
 $(strip \
   $(if $(2),$(2), \
-    $(if $(filter @GNOME/% @GNU/% @KERNEL/% @SF/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \
+    $(if $(filter @APACHE/% @GNOME/% @GNU/% @KERNEL/% @SF/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \
       $(if $(filter git://%,$(1)),git, \
         $(if $(filter svn://%,$(1)),svn, \
           $(if $(filter cvs://%,$(1)),cvs, \
@@ -48,7 +48,7 @@ define DownloadMethod/default
 endef
 
 define wrap_mirror
-       $(if $(if $(MIRROR),$(filter-out x,$(MIRROR_MD5SUM))),@$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "" "$(MIRROR_MD5SUM)" || ( $(1) ),$(1))
+$(if $(if $(MIRROR),$(filter-out x,$(MIRROR_MD5SUM))),$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MIRROR_MD5SUM)" "" || ( $(1) ),$(1))
 endef
 
 define DownloadMethod/cvs
@@ -90,8 +90,9 @@ define DownloadMethod/git
                cd $(TMP_DIR)/dl && \
                rm -rf $(SUBDIR) && \
                [ \! -d $(SUBDIR) ] && \
-               git clone $(URL) $(SUBDIR) --recursive && \
-               (cd $(SUBDIR) && git checkout $(VERSION) && git submodule update) && \
+               git clone $(URL) $(SUBDIR) && \
+               (cd $(SUBDIR) && git checkout $(VERSION) && \
+               git submodule update --init --recursive) && \
                echo "Packing checkout..." && \
                rm -rf $(SUBDIR)/.git && \
                $(call dl_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
@@ -182,6 +183,6 @@ define Download
 
   $(DL_DIR)/$(FILE):
        mkdir -p $(DL_DIR)
-       $(if $(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$(DownloadMethod/unknown))
+       $(call locked,$(if $(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$(DownloadMethod/$(call dl_method,$(URL),$(PROTO))),$(DownloadMethod/unknown)),$(FILE))
 
 endef