1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 ifneq ($(strip ${DIST_SUBDIR}),)
5 FULLDISTDIR?
= ${DL_DIR}/${DIST_SUBDIR}
7 FULLDISTDIR?
= ${DL_DIR}
10 FULLDISTFILES
= $(patsubst %,${FULLDISTDIR}/%,${DISTFILES})
15 ifneq ($(filter auto
,${FETCH_STYLE}),)
16 ${MAKE} ${FULLDISTFILES}
22 -rm -f
${FULLDISTFILES}
25 _CHECKSUM_COOKIE?
= ${WRKDIR}/.checksum_done
26 checksum
: ${_CHECKSUM_COOKIE}
27 ifeq ($(strip ${PKG_NOCHECKSUM}),)
28 ${_CHECKSUM_COOKIE}: ${FULLDISTFILES}
30 ifneq ($(ADK_DISABLE_CHECKSUM
),y
)
31 @if
[ ! -e
$(firstword ${FULLDISTFILES}).nohash
]; then \
33 allsums
="$(strip ${PKG_HASH})"; \
34 ($${SHA256} ${FULLDISTFILES}; echo exit
) | while read sum name
; do \
35 if
[[ $$sum = exit
]]; then \
36 [[ $$OK = n
]] && echo
>&2 "==> No distfile found!" ||
:; \
37 [[ $$OK = 1 ]] || exit
1; \
40 cursum
="$${allsums%% *}"; \
41 allsums
="$${allsums#* }"; \
42 if
[[ $$sum = "$$cursum" ]]; then \
43 [[ $$OK = 0 ]] || OK
=1; \
46 echo
>&2 "==> Checksum mismatch for $${name##*/} (SHA256)"; \
47 echo
>&2 ":---> should be '$$cursum'"; \
48 echo
>&2 ":---> really is '$$sum'"; \
54 touch
${_CHECKSUM_COOKIE}
57 # GNU make's poor excuse for loops
61 filename
=$$$${fullname
##*/}; \
62 mkdir
-p
"$$$${fullname%%/$$$$filename}"; \
63 cd
"$$$${fullname%%/$$$$filename}"; \
64 for url in
"${PKG_SITES}"; do case
$$$$url in \
66 rm -rf
$${PKG_NAME}-$${PKG_VERSION}; \
67 if
[ ! -z
"$${PKG_GIT}" ]; then \
68 echo
"Using git ${PKG_GIT}: $${PKG_VERSION}" $(DL_TRACE
); \
69 case
"$${PKG_GIT}" in \
71 git clone
--depth
1 --branch
$${PKG_VERSION} $(GITOPTS
) $${PKG_SITES} $${PKG_NAME}-$${PKG_VERSION} $(DL_TRACE
); \
74 git clone
$(GITOPTS
) $${PKG_SITES} $${PKG_NAME}-$${PKG_VERSION} $(DL_TRACE
); \
75 (cd
$${PKG_NAME}-$${PKG_VERSION}; git checkout
$(GITOPTS
) $${PKG_VERSION}) $(DL_TRACE
); \
79 git clone
--depth
1 $(GITOPTS
) $${PKG_SITES} $${PKG_NAME}-$${PKG_VERSION} $(DL_TRACE
); \
81 tar cJf
$${PKG_NAME}-$${PKG_VERSION}.
tar.xz
$${PKG_NAME}-$${PKG_VERSION}; \
82 touch
$$$${filename}.nohash
; \
83 rm -rf
$${PKG_NAME}-$${PKG_VERSION}; \
84 : check the size here
; \
85 [[ ! -e
$$$$filename ]] || exit
0; \
87 http
://*|https
://*|ftp
://*) \
88 for site in
$${PKG_SITES} $${MASTER_SITE_BACKUP}; do \
89 echo
"$${FETCHCMD} $$$$site$$$$filename" $(DL_TRACE
); \
90 rm -f
"$$$$filename"; \
91 if
$${FETCHCMD} $$$$filename $$$$site$$$$filename $(DL_TRACE
); then \
92 : check the size here
; \
93 [[ ! -e
$$$$filename ]] || exit
0; \
98 echo url schema not known
; \
104 $(foreach distfile
,${FULLDISTFILES},$(eval
$(call FETCH_template
,$(distfile
))))