2 # Copyright (C) 2007 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 DOWNLOAD_RDEP
:=$(STAMP_PREPARED
)
10 # Try to guess the download method from the URL
14 $(if
$(filter @GNU
/% @KERNEL
/% @SF
/% ftp
://% http
://%,$(1)),default
, \
15 $(if
$(filter git
://%,$(1)),git
, \
16 $(if
$(filter svn
://%,$(1)),svn
, \
25 # code for creating tarballs from svn/git checkouts - useful for mirror support
26 dl_pack
/bz2
=$(TAR
) cfj
$(1) $(2)
27 dl_pack
/gz
=$(TAR
) cfz
$(1) $(2)
28 dl_pack
/unknown
=echo
"ERROR: Unknown pack format for file $(1)"; false
30 $(if
$(dl_pack
/$(call ext
,$(1))),$(dl_pack
/$(call ext
,$(1))),$(dl_pack
/unknown
))
33 define DownloadMethod
/unknown
34 @echo
"ERROR: No download method available"; false
37 define DownloadMethod
/default
38 $(SCRIPT_DIR
)/download.pl
"$(DL_DIR)" "$(FILE)" "$(MD5SUM)" $(URL
)
42 @
$(SCRIPT_DIR
)/download.pl
"$(DL_DIR)" "$(FILE)" "x" ||
( $(1) )
45 define DownloadMethod
/svn
47 echo
"Checking out files from the svn repository..."; \
48 mkdir
-p
$(TMP_DIR
)/dl
&& \
51 [ \
! -d
$(SUBDIR
) ] && \
52 svn
co -r
$(VERSION
) $(URL
) $(SUBDIR
) && \
53 find
$(SUBDIR
) -name .svn | xargs
rm -rf
&& \
54 echo
"Packing checkout..." && \
55 $(call dl_pack
,$(TMP_DIR
)/dl
/$(FILE
),$(SUBDIR
)) && \
56 mv
$(TMP_DIR
)/dl
/$(FILE
) $(DL_DIR
)/; \
60 define DownloadMethod
/git
62 echo
"Checking out files from the git repository..."; \
63 mkdir
-p
$(TMP_DIR
)/dl
&& \
66 [ \
! -d
$(SUBDIR
) ] && \
67 git-clone
$(URL
) $(SUBDIR
) && \
68 (cd
$(SUBDIR
) && git-checkout
$(VERSION
)) && \
69 echo
"Packing checkout..." && \
70 rm -rf
$(SUBDIR
)/.git
&& \
71 $(call dl_pack
,$(TMP_DIR
)/dl
/$(FILE
),$(SUBDIR
)) && \
72 mv
$(TMP_DIR
)/dl
/$(FILE
) $(DL_DIR
)/; \
76 Validate
/svn
=VERSION SUBDIR
77 Validate
/git
=VERSION SUBDIR
79 define Download
/Defaults
89 $(eval
$(Download
/Defaults
))
90 $(eval
$(Download
/$(1)))
91 $(foreach FIELD
,URL FILE
$(Validate
/$(call dl_method
,$(URL
),$(PROTO
))),
93 $$(error Download
/$(1) is missing the
$(FIELD
) field.
)
97 $(if
$(DOWNLOAD_RDEP
),$(DOWNLOAD_RDEP
): $(DL_DIR
)/$(FILE
))
98 download
: $(DL_DIR
)/$(FILE
)
102 $(if
$(DownloadMethod
/$(call dl_method
,$(URL
),$(PROTO
))),$(DownloadMethod
/$(call dl_method
,$(URL
),$(PROTO
))),$(DownloadMethod
/unknown
))
This page took 0.044499 seconds and 5 git commands to generate.