2 # Copyright (C) 2006-2010 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
) $(HOST_STAMP_PREPARED
)
10 # Try to guess the download method from the URL
14 $(if
$(filter @GNOME
/% @GNU
/% @KERNEL
/% @SF
/% ftp
://% http
://% file
://%,$(1)),default
, \
15 $(if
$(filter git
://%,$(1)),git
, \
16 $(if
$(filter svn
://%,$(1)),svn
, \
17 $(if
$(filter cvs
://%,$(1)),cvs
, \
18 $(if
$(filter hg
://%,$(1)),hg
, \
19 $(if
$(filter sftp
://%,$(1)),bzr
, \
31 # code for creating tarballs from cvs/svn/git/bzr/hg checkouts - useful for mirror support
32 dl_pack
/bz2
=$(TAR
) cfj
$(1) $(2)
33 dl_pack
/gz
=$(TAR
) cfz
$(1) $(2)
34 dl_pack
/unknown
=echo
"ERROR: Unknown pack format for file $(1)"; false
36 $(if
$(dl_pack
/$(call ext
,$(1))),$(dl_pack
/$(call ext
,$(1))),$(dl_pack
/unknown
))
39 define DownloadMethod
/unknown
40 @echo
"ERROR: No download method available"; false
43 define DownloadMethod
/default
44 $(SCRIPT_DIR
)/download.pl
"$(DL_DIR)" "$(FILE)" "$(MD5SUM)" $(URL
)
48 $(if
$(MIRROR
),@
$(SCRIPT_DIR
)/download.pl
"$(DL_DIR)" "$(FILE)" "x" ||
( $(1) ),$(1))
51 define DownloadMethod
/cvs
53 echo
"Checking out files from the cvs repository..."; \
54 mkdir
-p
$(TMP_DIR
)/dl
&& \
57 [ \
! -d
$(SUBDIR
) ] && \
58 cvs
-d
$(URL
) export $(VERSION
) $(SUBDIR
) && \
59 echo
"Packing checkout..." && \
60 $(call dl_pack
,$(TMP_DIR
)/dl
/$(FILE
),$(SUBDIR
)) && \
61 mv
$(TMP_DIR
)/dl
/$(FILE
) $(DL_DIR
)/ && \
66 define DownloadMethod
/svn
68 echo
"Checking out files from the svn repository..."; \
69 mkdir
-p
$(TMP_DIR
)/dl
&& \
72 [ \
! -d
$(SUBDIR
) ] && \
73 svn
export --non-interactive
-r
$(VERSION
) $(URL
) $(SUBDIR
) && \
74 echo
"Packing checkout..." && \
75 $(call dl_pack
,$(TMP_DIR
)/dl
/$(FILE
),$(SUBDIR
)) && \
76 mv
$(TMP_DIR
)/dl
/$(FILE
) $(DL_DIR
)/ && \
81 define DownloadMethod
/git
83 echo
"Checking out files from the git repository..."; \
84 mkdir
-p
$(TMP_DIR
)/dl
&& \
87 [ \
! -d
$(SUBDIR
) ] && \
88 git clone
$(URL
) $(SUBDIR
) && \
89 (cd
$(SUBDIR
) && git checkout
$(VERSION
)) && \
90 echo
"Packing checkout..." && \
91 rm -rf
$(SUBDIR
)/.git
&& \
92 $(call dl_pack
,$(TMP_DIR
)/dl
/$(FILE
),$(SUBDIR
)) && \
93 mv
$(TMP_DIR
)/dl
/$(FILE
) $(DL_DIR
)/ && \
98 define DownloadMethod
/bzr
100 echo
"Checking out files from the bzr repository..."; \
101 mkdir
-p
$(TMP_DIR
)/dl
&& \
102 cd
$(TMP_DIR
)/dl
&& \
103 rm -rf
$(SUBDIR
) && \
104 [ \
! -d
$(SUBDIR
) ] && \
105 bzr
export -r
$(VERSION
) $(URL
) $(SUBDIR
) && \
106 echo
"Packing checkout..." && \
107 $(call dl_pack
,$(TMP_DIR
)/dl
/$(FILE
),$(SUBDIR
)) && \
108 mv
$(TMP_DIR
)/dl
/$(FILE
) $(DL_DIR
)/ &&
113 define DownloadMethod
/hg
114 $(call wrap_mirror
, \
115 echo
"Checking out files from the hg repository..."; \
116 mkdir
-p
$(TMP_DIR
)/dl
&& \
117 cd
$(TMP_DIR
)/dl
&& \
118 rm -rf
$(SUBDIR
) && \
119 [ \
! -d
$(SUBDIR
) ] && \
120 hg clone
-r
$(VERSION
) $(URL
) $(SUBDIR
) && \
121 find
$(SUBDIR
) -name .hg | xargs
rm -rf
&& \
122 echo
"Packing checkout..." && \
123 $(call dl_pack
,$(TMP_DIR
)/dl
/$(FILE
),$(SUBDIR
)) && \
124 mv
$(TMP_DIR
)/dl
/$(FILE
) $(DL_DIR
)/ && \
129 Validate
/cvs
=VERSION SUBDIR
130 Validate
/svn
=VERSION SUBDIR
131 Validate
/git
=VERSION SUBDIR
132 Validate
/bzr
=VERSION SUBDIR
133 Validate
/hg
=VERSION SUBDIR
135 define Download
/Defaults
146 $(eval
$(Download
/Defaults
))
147 $(eval
$(Download
/$(1)))
148 $(foreach FIELD
,URL FILE
$(Validate
/$(call dl_method
,$(URL
),$(PROTO
))),
150 $$(error Download
/$(1) is missing the
$(FIELD
) field.
)
154 $(foreach dep
,$(DOWNLOAD_RDEP
),
155 $(dep
): $(DL_DIR
)/$(FILE
)
157 download
: $(DL_DIR
)/$(FILE
)
161 $(if
$(DownloadMethod
/$(call dl_method
,$(URL
),$(PROTO
))),$(DownloadMethod
/$(call dl_method
,$(URL
),$(PROTO
))),$(DownloadMethod
/unknown
))
This page took 0.045033 seconds and 5 git commands to generate.