build: reimplement package build directory override
[openwrt/openwrt.git] / include / download.mk
index fd197ea2167766ff6de9ee017141e944bf25c0b9..cc4ffb0cfb544131704d7d0ffca3f11c0d8ef33b 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2010 OpenWrt.org
+# Copyright (C) 2006-2012 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -29,8 +29,9 @@ $(strip \
 endef
 
 # code for creating tarballs from cvs/svn/git/bzr/hg/darcs checkouts - useful for mirror support
-dl_pack/bz2=$(TAR) cfj $(1) $(2)
-dl_pack/gz=$(TAR) cfz $(1) $(2)
+dl_pack/bz2=$(TAR) cjf $(1) $(2)
+dl_pack/gz=$(TAR) czf $(1) $(2)
+dl_pack/xz=$(TAR) c $(2) | xz -zc > $(1)
 dl_pack/unknown=echo "ERROR: Unknown pack format for file $(1)"; false
 define dl_pack
        $(if $(dl_pack/$(call ext,$(1))),$(dl_pack/$(call ext,$(1))),$(dl_pack/unknown))
@@ -45,7 +46,7 @@ define DownloadMethod/default
 endef
 
 define wrap_mirror
-       $(if $(MIRROR),@$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "x" || ( $(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
@@ -87,8 +88,8 @@ define DownloadMethod/git
                cd $(TMP_DIR)/dl && \
                rm -rf $(SUBDIR) && \
                [ \! -d $(SUBDIR) ] && \
-               git clone $(URL) $(SUBDIR) && \
-               (cd $(SUBDIR) && git checkout $(VERSION)) && \
+               git clone $(URL) $(SUBDIR) --recursive && \
+               (cd $(SUBDIR) && git checkout $(VERSION) && git submodule update) && \
                echo "Packing checkout..." && \
                rm -rf $(SUBDIR)/.git && \
                $(call dl_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
@@ -158,6 +159,7 @@ define Download/Defaults
   MD5SUM:=
   SUBDIR:=
   MIRROR:=1
+  MIRROR_MD5SUM:=x
   VERSION:=
 endef