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
, \
29 # code for creating tarballs from cvs/svn/git/bzr/hg checkouts - useful for mirror support
30 dl_pack
/bz2
=$(TAR
) cfj
$(1) $(2)
31 dl_pack
/gz
=$(TAR
) cfz
$(1) $(2)
32 dl_pack
/unknown
=echo
"ERROR: Unknown pack format for file $(1)"; false
34 $(if
$(dl_pack
/$(call ext
,$(1))),$(dl_pack
/$(call ext
,$(1))),$(dl_pack
/unknown
))
37 define DownloadMethod
/unknown
38 @echo
"ERROR: No download method available"; false
41 define DownloadMethod
/default
42 $(SCRIPT_DIR
)/download.pl
"$(DL_DIR)" "$(FILE)" "$(MD5SUM)" $(URL
)
46 $(if
$(MIRROR
),@
$(SCRIPT_DIR
)/download.pl
"$(DL_DIR)" "$(FILE)" "x" ||
( $(1) ),$(1))
49 define DownloadMethod
/cvs
51 echo
"Checking out files from the cvs repository..."; \
52 mkdir
-p
$(TMP_DIR
)/dl
&& \
55 [ \
! -d
$(SUBDIR
) ] && \
56 cvs
-d
$(URL
) co $(VERSION
) $(SUBDIR
) && \
57 find
$(SUBDIR
) -name CVS | xargs
rm -rf
&& \
58 echo
"Packing checkout..." && \
59 $(call dl_pack
,$(TMP_DIR
)/dl
/$(FILE
),$(SUBDIR
)) && \
60 mv
$(TMP_DIR
)/dl
/$(FILE
) $(DL_DIR
)/; \
64 define DownloadMethod
/svn
66 echo
"Checking out files from the svn repository..."; \
67 mkdir
-p
$(TMP_DIR
)/dl
&& \
70 [ \
! -d
$(SUBDIR
) ] && \
71 svn
co --non-interactive
-r
$(VERSION
) $(URL
) $(SUBDIR
) && \
72 find
$(SUBDIR
) -name .svn | xargs
rm -rf
&& \
73 echo
"Packing checkout..." && \
74 $(call dl_pack
,$(TMP_DIR
)/dl
/$(FILE
),$(SUBDIR
)) && \
75 mv
$(TMP_DIR
)/dl
/$(FILE
) $(DL_DIR
)/; \
79 define DownloadMethod
/git
81 echo
"Checking out files from the git repository..."; \
82 mkdir
-p
$(TMP_DIR
)/dl
&& \
85 [ \
! -d
$(SUBDIR
) ] && \
86 git clone
$(URL
) $(SUBDIR
) && \
87 (cd
$(SUBDIR
) && git checkout
$(VERSION
)) && \
88 echo
"Packing checkout..." && \
89 rm -rf
$(SUBDIR
)/.git
&& \
90 $(call dl_pack
,$(TMP_DIR
)/dl
/$(FILE
),$(SUBDIR
)) && \
91 mv
$(TMP_DIR
)/dl
/$(FILE
) $(DL_DIR
)/; \
95 define DownloadMethod
/bzr
97 echo
"Checking out files from the bzr repository..."; \
98 mkdir
-p
$(TMP_DIR
)/dl
&& \
100 rm -rf
$(SUBDIR
) && \
101 [ \
! -d
$(SUBDIR
) ] && \
102 bzr
co --lightweight
-r
$(VERSION
) $(URL
) $(SUBDIR
) && \
103 find
$(SUBDIR
) -name .bzr | xargs
rm -rf
&& \
104 echo
"Packing checkout..." && \
105 $(call dl_pack
,$(TMP_DIR
)/dl
/$(FILE
),$(SUBDIR
)) && \
106 mv
$(TMP_DIR
)/dl
/$(FILE
) $(DL_DIR
)/; \
110 define DownloadMethod
/hg
111 $(call wrap_mirror
, \
112 echo
"Checking out files from the hg repository..."; \
113 mkdir
-p
$(TMP_DIR
)/dl
&& \
114 cd
$(TMP_DIR
)/dl
&& \
115 rm -rf
$(SUBDIR
) && \
116 [ \
! -d
$(SUBDIR
) ] && \
117 hg clone
-r
$(VERSION
) $(URL
) $(SUBDIR
) && \
118 find
$(SUBDIR
) -name .hg | xargs
rm -rf
&& \
119 echo
"Packing checkout..." && \
120 $(call dl_pack
,$(TMP_DIR
)/dl
/$(FILE
),$(SUBDIR
)) && \
121 mv
$(TMP_DIR
)/dl
/$(FILE
) $(DL_DIR
)/; \
125 Validate
/cvs
=VERSION SUBDIR
126 Validate
/svn
=VERSION SUBDIR
127 Validate
/git
=VERSION SUBDIR
128 Validate
/bzr
=VERSION SUBDIR
129 Validate
/hg
=VERSION SUBDIR
131 define Download
/Defaults
142 $(eval
$(Download
/Defaults
))
143 $(eval
$(Download
/$(1)))
144 $(foreach FIELD
,URL FILE
$(Validate
/$(call dl_method
,$(URL
),$(PROTO
))),
146 $$(error Download
/$(1) is missing the
$(FIELD
) field.
)
150 $(foreach dep
,$(DOWNLOAD_RDEP
),
151 $(dep
): $(DL_DIR
)/$(FILE
)
153 download
: $(DL_DIR
)/$(FILE
)
157 $(if
$(DownloadMethod
/$(call dl_method
,$(URL
),$(PROTO
))),$(DownloadMethod
/$(call dl_method
,$(URL
),$(PROTO
))),$(DownloadMethod
/unknown
))
This page took 0.047625 seconds and 5 git commands to generate.