build: make git sub-modules to fetch configurable
[openwrt/openwrt.git] / include / download.mk
index 9ab0b6c08fca7b737b62f7db9ad817b438b8b66e..e261b140354c6062af50fcb750fbde5045abbb1c 100644 (file)
@@ -209,6 +209,7 @@ define DownloadMethod/github_archive
                        --subdir="$(SUBDIR)" \
                        --source="$(FILE)" \
                        --hash="$(MIRROR_HASH)" \
+                       --submodules $(SUBMODULES) \
                || ( $(call DownloadMethod/rawgit) ); \
        )
 endef
@@ -222,7 +223,7 @@ define DownloadMethod/rawgit
        [ \! -d $(SUBDIR) ] && \
        git clone $(OPTS) $(URL) $(SUBDIR) && \
        (cd $(SUBDIR) && git checkout $(VERSION) && \
-       git submodule update --init --recursive) && \
+       $(if $(filter skip,$(SUBMODULES)),true,git submodule update --init --recursive -- $(SUBMODULES))) && \
        echo "Packing checkout..." && \
        export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \
        rm -rf $(SUBDIR)/.git && \
@@ -301,6 +302,7 @@ define Download/Defaults
   MIRROR_MD5SUM:=x
   VERSION:=
   OPTS:=
+  SUBMODULES:=
 endef
 
 define Download/default
@@ -309,6 +311,7 @@ define Download/default
   URL_FILE:=$(PKG_SOURCE_URL_FILE)
   SUBDIR:=$(PKG_SOURCE_SUBDIR)
   PROTO:=$(PKG_SOURCE_PROTO)
+  SUBMODULES:=$(PKG_SOURCE_SUBMODULES)
   $(if $(PKG_SOURCE_MIRROR),MIRROR:=$(filter 1,$(PKG_MIRROR)))
   $(if $(PKG_MIRROR_MD5SUM),MIRROR_MD5SUM:=$(PKG_MIRROR_MD5SUM))
   $(if $(PKG_MIRROR_HASH),MIRROR_HASH:=$(PKG_MIRROR_HASH))