2020-09-22 02:48:37 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
2010-02-20 04:48:07 +00:00
|
|
|
#
|
2012-03-17 21:33:13 +00:00
|
|
|
# Copyright (C) 2006-2012 OpenWrt.org
|
2016-04-03 20:02:46 +00:00
|
|
|
# Copyright (C) 2016 LEDE project
|
2007-09-29 00:05:48 +00:00
|
|
|
|
2018-01-05 09:43:55 +00:00
|
|
|
PROJECT_GIT = https://git.openwrt.org
|
|
|
|
|
|
|
|
OPENWRT_GIT = $(PROJECT_GIT)
|
|
|
|
LEDE_GIT = $(PROJECT_GIT)
|
2016-01-04 15:11:43 +00:00
|
|
|
|
2016-12-21 15:39:56 +00:00
|
|
|
ifdef PKG_SOURCE_VERSION
|
2020-10-06 11:39:58 +00:00
|
|
|
ifndef PKG_VERSION
|
2024-03-17 17:43:10 +00:00
|
|
|
PKG_VERSION := $(if $(PKG_SOURCE_DATE),$(subst -,.,$(PKG_SOURCE_DATE)),0)~$(call version_abbrev,$(PKG_SOURCE_VERSION))
|
2020-10-06 11:39:58 +00:00
|
|
|
endif
|
|
|
|
PKG_SOURCE_SUBDIR ?= $(PKG_NAME)-$(PKG_VERSION)
|
2024-03-25 08:56:18 +00:00
|
|
|
PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.zst
|
2016-12-21 15:39:56 +00:00
|
|
|
endif
|
|
|
|
|
2009-03-17 02:37:10 +00:00
|
|
|
DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED)
|
2007-09-29 00:05:48 +00:00
|
|
|
|
2022-10-03 22:30:21 +00:00
|
|
|
# Export options for download.pl
|
|
|
|
export DOWNLOAD_CHECK_CERTIFICATE:=$(CONFIG_DOWNLOAD_CHECK_CERTIFICATE)
|
2022-09-30 23:36:48 +00:00
|
|
|
export DOWNLOAD_TOOL_CUSTOM:=$(CONFIG_DOWNLOAD_TOOL_CUSTOM)
|
2022-10-03 22:30:21 +00:00
|
|
|
|
2018-06-29 06:40:46 +00:00
|
|
|
define dl_method_git
|
|
|
|
$(if $(filter https://github.com/% git://github.com/%,$(1)),github_archive,git)
|
|
|
|
endef
|
|
|
|
|
2007-09-29 00:05:48 +00:00
|
|
|
# Try to guess the download method from the URL
|
2010-02-20 04:48:07 +00:00
|
|
|
define dl_method
|
2018-06-29 05:49:34 +00:00
|
|
|
$(strip \
|
2018-06-29 06:40:46 +00:00
|
|
|
$(if $(filter git,$(2)),$(call dl_method_git,$(1),$(2)),
|
|
|
|
$(if $(2),$(2), \
|
2021-02-20 20:17:26 +00:00
|
|
|
$(if $(filter @OPENWRT @APACHE/% @DEBIAN/% @GITHUB/% @GNOME/% @GNU/% @KERNEL/% @SF/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \
|
2018-06-29 06:40:46 +00:00
|
|
|
$(if $(filter git://%,$(1)),$(call dl_method_git,$(1),$(2)), \
|
|
|
|
$(if $(filter svn://%,$(1)),svn, \
|
|
|
|
$(if $(filter cvs://%,$(1)),cvs, \
|
|
|
|
$(if $(filter hg://%,$(1)),hg, \
|
|
|
|
$(if $(filter sftp://%,$(1)),bzr, \
|
|
|
|
unknown \
|
|
|
|
) \
|
2018-06-29 05:49:34 +00:00
|
|
|
) \
|
|
|
|
) \
|
|
|
|
) \
|
|
|
|
) \
|
|
|
|
) \
|
|
|
|
) \
|
|
|
|
) \
|
|
|
|
)
|
2007-09-29 00:05:48 +00:00
|
|
|
endef
|
|
|
|
|
2010-10-24 12:36:44 +00:00
|
|
|
# code for creating tarballs from cvs/svn/git/bzr/hg/darcs checkouts - useful for mirror support
|
2016-12-12 10:42:14 +00:00
|
|
|
dl_pack/bz2=bzip2 -c > $(1)
|
|
|
|
dl_pack/gz=gzip -nc > $(1)
|
|
|
|
dl_pack/xz=xz -zc -7e > $(1)
|
2020-05-17 11:18:10 +00:00
|
|
|
dl_pack/zst=zstd -T0 --ultra -20 -c > $(1)
|
2016-12-12 10:37:23 +00:00
|
|
|
dl_pack/unknown=$(error ERROR: Unknown pack format for file $(1))
|
2007-09-29 00:05:48 +00:00
|
|
|
define dl_pack
|
|
|
|
$(if $(dl_pack/$(call ext,$(1))),$(dl_pack/$(call ext,$(1))),$(dl_pack/unknown))
|
|
|
|
endef
|
2016-12-12 10:42:14 +00:00
|
|
|
define dl_tar_pack
|
2019-03-28 16:58:07 +00:00
|
|
|
$(TAR) --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name \
|
|
|
|
$$$${TAR_TIMESTAMP:+--mtime="$$$$TAR_TIMESTAMP"} -c $(2) | $(call dl_pack,$(1))
|
2016-12-12 10:42:14 +00:00
|
|
|
endef
|
2007-09-29 00:05:48 +00:00
|
|
|
|
2021-08-19 21:14:22 +00:00
|
|
|
gen_sha256sum = $(shell $(MKHASH) sha256 $(DL_DIR)/$(1))
|
|
|
|
|
|
|
|
# Used in Build/CoreTargets and HostBuild/Core as an integrity check for
|
|
|
|
# downloaded files. It will add a FORCE rule if the sha256 hash does not
|
|
|
|
# match, so that the download can be more thoroughly handled by download.pl.
|
|
|
|
define check_download_integrity
|
|
|
|
expected_hash:=$(strip $(if $(filter-out x,$(HASH)),$(HASH),$(MIRROR_HASH)))
|
|
|
|
$$(if $$(and $(FILE),$$(wildcard $(DL_DIR)/$(FILE)), \
|
|
|
|
$$(filter undefined,$$(flavor DownloadChecked/$(FILE)))), \
|
|
|
|
$$(eval DownloadChecked/$(FILE):=1) \
|
|
|
|
$$(if $$(filter-out $$(call gen_sha256sum,$(FILE)),$$(expected_hash)), \
|
|
|
|
$(DL_DIR)/$(FILE): FORCE) \
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2016-12-14 14:36:39 +00:00
|
|
|
ifdef CHECK
|
|
|
|
check_escape=$(subst ','\'',$(1))
|
|
|
|
#')
|
2016-12-16 12:34:37 +00:00
|
|
|
|
2018-02-11 09:42:22 +00:00
|
|
|
# $(1): suffix of the F_, C_ variables, e.g. hash_deprecated, hash_mismatch, etc.
|
|
|
|
# $(2): filename
|
|
|
|
# $(3): expected hash value
|
2018-07-03 08:15:35 +00:00
|
|
|
# $(4): var name of the the form: {PKG_,Download/<name>:}{,MIRROR_}{HASH,MIRROR_HASH}
|
2016-12-16 12:34:37 +00:00
|
|
|
check_warn_nofix = $(info $(shell printf "$(_R)WARNING: %s$(_N)" '$(call check_escape,$(call C_$(1),$(2),$(3),$(4)))'))
|
|
|
|
ifndef FIXUP
|
|
|
|
check_warn = $(check_warn_nofix)
|
|
|
|
else
|
|
|
|
check_warn = $(if $(filter-out undefined,$(origin F_$(1))),$(filter ,$(shell $(call F_$(1),$(2),$(3),$(4)) >&2)),$(check_warn_nofix))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef FIXUP
|
|
|
|
F_hash_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile fix-hash $(3) $(call gen_sha256sum,$(1)) $(2)
|
|
|
|
F_hash_mismatch = $(F_hash_deprecated)
|
|
|
|
F_hash_missing = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile add-hash $(3) $(call gen_sha256sum,$(1))
|
|
|
|
endif
|
|
|
|
|
2018-02-11 09:42:22 +00:00
|
|
|
# $(1): filename
|
|
|
|
# $(2): expected hash value
|
2018-07-03 08:15:35 +00:00
|
|
|
# $(3): var name of the the form: {PKG_,Download/<name>:}{,MIRROR_}{HASH,MIRROR_HASH}
|
2016-12-14 14:36:39 +00:00
|
|
|
C_download_missing = $(1) is missing, please run make download before re-running this check
|
|
|
|
C_hash_mismatch = $(3) does not match $(1) hash $(call gen_sha256sum,$(1))
|
|
|
|
C_hash_deprecated = $(3) uses deprecated hash, set to $(call gen_sha256sum,$(1))
|
|
|
|
C_hash_missing = $(3) is missing, set to $(call gen_sha256sum,$(1))
|
|
|
|
|
2018-07-03 08:15:35 +00:00
|
|
|
# $(1): filename
|
|
|
|
# $(2): expected hash value
|
|
|
|
# $(3): var name of the the form: {PKG_,Download/<name>:}{,MIRROR_}{HASH,MIRROR_HASH}
|
2016-12-14 14:36:39 +00:00
|
|
|
check_hash = \
|
|
|
|
$(if $(wildcard $(DL_DIR)/$(1)), \
|
|
|
|
$(if $(filter-out x,$(2)), \
|
|
|
|
$(if $(filter 64,$(shell printf '%s' '$(2)' | wc -c)), \
|
|
|
|
$(if $(filter $(2),$(call gen_sha256sum,$(1))),, \
|
|
|
|
$(call check_warn,hash_mismatch,$(1),$(2),$(3)) \
|
|
|
|
), \
|
|
|
|
$(call check_warn,hash_deprecated,$(1),$(2),$(3)), \
|
|
|
|
), \
|
|
|
|
$(call check_warn,hash_missing,$(1),$(2),$(3)) \
|
|
|
|
), \
|
|
|
|
$(call check_warn,download_missing,$(1),$(2),$(3)) \
|
|
|
|
)
|
|
|
|
|
2016-12-16 12:34:37 +00:00
|
|
|
ifdef FIXUP
|
|
|
|
F_md5_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile rename-var $(2) $(3)
|
|
|
|
endif
|
|
|
|
|
2016-12-14 14:36:39 +00:00
|
|
|
C_md5_deprecated = Use of $(2) is deprecated, switch to $(3)
|
|
|
|
|
|
|
|
check_md5 = \
|
|
|
|
$(if $(filter-out x,$(1)), \
|
|
|
|
$(call check_warn,md5_deprecated,$(1),$(2),$(3)) \
|
|
|
|
)
|
|
|
|
|
|
|
|
hash_var = $(if $(filter-out x,$(1)),MD5SUM,HASH)
|
|
|
|
endif
|
|
|
|
|
2007-09-29 00:05:48 +00:00
|
|
|
define DownloadMethod/unknown
|
2017-09-19 21:17:09 +00:00
|
|
|
echo "ERROR: No download method available"; false
|
2007-09-29 00:05:48 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define DownloadMethod/default
|
2016-12-14 14:36:39 +00:00
|
|
|
$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(HASH)" "$(URL_FILE)" $(foreach url,$(URL),"$(url)") \
|
|
|
|
$(if $(filter check,$(1)), \
|
|
|
|
$(call check_hash,$(FILE),$(HASH),$(2)$(call hash_var,$(MD5SUM))) \
|
|
|
|
$(call check_md5,$(MD5SUM),$(2)MD5SUM,$(2)HASH) \
|
|
|
|
)
|
2007-09-29 00:05:48 +00:00
|
|
|
endef
|
|
|
|
|
2018-02-11 09:42:22 +00:00
|
|
|
# $(1): "check"
|
|
|
|
# $(2): "PKG_" if <name> as in Download/<name> is "default", otherwise "Download/<name>:"
|
|
|
|
# $(3): shell command sequence to do the download
|
2007-09-29 00:05:48 +00:00
|
|
|
define wrap_mirror
|
2016-12-14 14:36:39 +00:00
|
|
|
$(if $(if $(MIRROR),$(filter-out x,$(MIRROR_HASH))),$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MIRROR_HASH)" "" || ( $(3) ),$(3)) \
|
|
|
|
$(if $(filter check,$(1)), \
|
|
|
|
$(call check_hash,$(FILE),$(MIRROR_HASH),$(2)MIRROR_$(call hash_var,$(MIRROR_MD5SUM))) \
|
|
|
|
$(call check_md5,$(MIRROR_MD5SUM),$(2)MIRROR_MD5SUM,$(2)MIRROR_HASH) \
|
|
|
|
)
|
2007-09-29 00:05:48 +00:00
|
|
|
endef
|
|
|
|
|
2008-01-02 15:14:31 +00:00
|
|
|
define DownloadMethod/cvs
|
2016-12-14 14:36:39 +00:00
|
|
|
$(call wrap_mirror,$(1),$(2), \
|
2008-01-02 15:14:31 +00:00
|
|
|
echo "Checking out files from the cvs repository..."; \
|
2010-02-20 04:48:07 +00:00
|
|
|
mkdir -p $(TMP_DIR)/dl && \
|
|
|
|
cd $(TMP_DIR)/dl && \
|
|
|
|
rm -rf $(SUBDIR) && \
|
|
|
|
[ \! -d $(SUBDIR) ] && \
|
2024-04-17 05:07:41 +00:00
|
|
|
cvs -d $(URL) export $(SOURCE_VERSION) $(SUBDIR) && \
|
2010-02-20 04:48:07 +00:00
|
|
|
echo "Packing checkout..." && \
|
2016-12-12 10:42:14 +00:00
|
|
|
$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
|
2010-03-14 21:55:11 +00:00
|
|
|
mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
|
|
|
|
rm -rf $(SUBDIR); \
|
2010-02-20 04:48:07 +00:00
|
|
|
)
|
2008-01-02 15:14:31 +00:00
|
|
|
endef
|
|
|
|
|
2007-09-29 00:05:48 +00:00
|
|
|
define DownloadMethod/svn
|
2016-12-14 14:36:39 +00:00
|
|
|
$(call wrap_mirror,$(1),$(2), \
|
2007-11-16 03:10:40 +00:00
|
|
|
echo "Checking out files from the svn repository..."; \
|
2007-09-29 00:05:48 +00:00
|
|
|
mkdir -p $(TMP_DIR)/dl && \
|
|
|
|
cd $(TMP_DIR)/dl && \
|
|
|
|
rm -rf $(SUBDIR) && \
|
|
|
|
[ \! -d $(SUBDIR) ] && \
|
2010-03-23 01:21:50 +00:00
|
|
|
( svn help export | grep -q trust-server-cert && \
|
2024-04-17 05:07:41 +00:00
|
|
|
svn export --non-interactive --trust-server-cert -r$(SOURCE_VERSION) $(URL) $(SUBDIR) || \
|
|
|
|
svn export --non-interactive -r$(SOURCE_VERSION) $(URL) $(SUBDIR) ) && \
|
2007-09-29 00:05:48 +00:00
|
|
|
echo "Packing checkout..." && \
|
2024-04-17 05:07:41 +00:00
|
|
|
export TAR_TIMESTAMP="`svn info -r$(SOURCE_VERSION) --show-item last-changed-date $(URL)`" && \
|
2016-12-12 10:42:14 +00:00
|
|
|
$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
|
2010-03-14 21:55:11 +00:00
|
|
|
mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
|
|
|
|
rm -rf $(SUBDIR); \
|
2007-09-29 00:05:48 +00:00
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2007-11-16 03:10:40 +00:00
|
|
|
define DownloadMethod/git
|
2016-12-14 14:36:39 +00:00
|
|
|
$(call wrap_mirror,$(1),$(2), \
|
2018-06-28 10:27:27 +00:00
|
|
|
$(call DownloadMethod/rawgit) \
|
2007-11-16 03:10:40 +00:00
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2018-06-28 10:27:27 +00:00
|
|
|
define DownloadMethod/github_archive
|
2018-02-11 09:42:22 +00:00
|
|
|
$(call wrap_mirror,$(1),$(2), \
|
2018-06-28 10:27:27 +00:00
|
|
|
$(SCRIPT_DIR)/dl_github_archive.py \
|
2018-02-11 09:42:22 +00:00
|
|
|
--dl-dir="$(DL_DIR)" \
|
2018-06-28 10:27:27 +00:00
|
|
|
--url="$(URL)" \
|
2024-04-17 05:07:41 +00:00
|
|
|
--version="$(SOURCE_VERSION)" \
|
2018-02-11 09:42:22 +00:00
|
|
|
--subdir="$(SUBDIR)" \
|
|
|
|
--source="$(FILE)" \
|
2018-06-28 10:27:27 +00:00
|
|
|
--hash="$(MIRROR_HASH)" \
|
2023-03-16 01:17:26 +00:00
|
|
|
--submodules $(SUBMODULES) \
|
2018-06-28 10:27:27 +00:00
|
|
|
|| ( $(call DownloadMethod/rawgit) ); \
|
2018-02-11 09:42:22 +00:00
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Only intends to be called as a submethod from other DownloadMethod
|
2024-04-05 12:22:18 +00:00
|
|
|
#
|
|
|
|
# We first clone, checkout and then we generate a tar using the
|
|
|
|
# git archive command to apply any rules of .gitattributes
|
|
|
|
# To keep consistency with github generated tar archive, we default
|
|
|
|
# the short hash to 8 (default is 7). (for git log related usage)
|
2018-06-28 10:27:27 +00:00
|
|
|
define DownloadMethod/rawgit
|
2018-02-11 09:42:22 +00:00
|
|
|
echo "Checking out files from the git repository..."; \
|
|
|
|
mkdir -p $(TMP_DIR)/dl && \
|
|
|
|
cd $(TMP_DIR)/dl && \
|
|
|
|
rm -rf $(SUBDIR) && \
|
|
|
|
[ \! -d $(SUBDIR) ] && \
|
|
|
|
git clone $(OPTS) $(URL) $(SUBDIR) && \
|
2024-04-17 05:07:41 +00:00
|
|
|
(cd $(SUBDIR) && git checkout $(SOURCE_VERSION)) && \
|
2018-02-11 09:42:22 +00:00
|
|
|
export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \
|
2024-04-05 12:22:18 +00:00
|
|
|
echo "Generating formal git archive (apply .gitattributes rules)" && \
|
|
|
|
(cd $(SUBDIR) && git config core.abbrev 8 && \
|
|
|
|
git archive --format=tar HEAD --output=../$(SUBDIR).tar.git) && \
|
|
|
|
$(if $(filter skip,$(SUBMODULES)),true,$(TAR) --ignore-failed-read -C $(SUBDIR) -f $(SUBDIR).tar.git -r .git .gitmodules 2>/dev/null) && \
|
|
|
|
rm -rf $(SUBDIR) && mkdir $(SUBDIR) && \
|
|
|
|
$(TAR) -C $(SUBDIR) -xf $(SUBDIR).tar.git && \
|
|
|
|
(cd $(SUBDIR) && $(if $(filter skip,$(SUBMODULES)),true,git submodule update --init --recursive -- $(SUBMODULES) && \
|
|
|
|
rm -rf .git .gitmodules)) && \
|
|
|
|
echo "Packing checkout..." && \
|
2018-02-11 09:42:22 +00:00
|
|
|
$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
|
|
|
|
mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
|
|
|
|
rm -rf $(SUBDIR);
|
|
|
|
endef
|
|
|
|
|
2010-02-20 04:48:07 +00:00
|
|
|
define DownloadMethod/bzr
|
2016-12-14 14:36:39 +00:00
|
|
|
$(call wrap_mirror,$(1),$(2), \
|
2010-02-20 04:48:07 +00:00
|
|
|
echo "Checking out files from the bzr repository..."; \
|
|
|
|
mkdir -p $(TMP_DIR)/dl && \
|
|
|
|
cd $(TMP_DIR)/dl && \
|
|
|
|
rm -rf $(SUBDIR) && \
|
|
|
|
[ \! -d $(SUBDIR) ] && \
|
2024-04-17 05:07:41 +00:00
|
|
|
bzr export --per-file-timestamps -r$(SOURCE_VERSION) $(SUBDIR) $(URL) && \
|
2010-02-20 04:48:07 +00:00
|
|
|
echo "Packing checkout..." && \
|
2016-10-04 16:33:55 +00:00
|
|
|
export TAR_TIMESTAMP="" && \
|
2016-12-12 10:42:14 +00:00
|
|
|
$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
|
2010-03-29 13:06:19 +00:00
|
|
|
mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
|
2010-03-14 21:55:11 +00:00
|
|
|
rm -rf $(SUBDIR); \
|
2010-02-20 04:48:07 +00:00
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2008-08-29 13:02:05 +00:00
|
|
|
define DownloadMethod/hg
|
2016-12-14 14:36:39 +00:00
|
|
|
$(call wrap_mirror,$(1),$(2), \
|
2008-08-29 13:02:05 +00:00
|
|
|
echo "Checking out files from the hg repository..."; \
|
|
|
|
mkdir -p $(TMP_DIR)/dl && \
|
|
|
|
cd $(TMP_DIR)/dl && \
|
|
|
|
rm -rf $(SUBDIR) && \
|
|
|
|
[ \! -d $(SUBDIR) ] && \
|
2024-04-17 05:07:41 +00:00
|
|
|
hg clone -r $(SOURCE_VERSION) $(URL) $(SUBDIR) && \
|
2016-10-04 16:33:55 +00:00
|
|
|
export TAR_TIMESTAMP=`cd $(SUBDIR) && hg log --template '@{date}' -l 1` && \
|
2008-08-29 13:02:05 +00:00
|
|
|
find $(SUBDIR) -name .hg | xargs rm -rf && \
|
|
|
|
echo "Packing checkout..." && \
|
2016-12-12 10:42:14 +00:00
|
|
|
$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
|
2010-03-14 21:55:11 +00:00
|
|
|
mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
|
|
|
|
rm -rf $(SUBDIR); \
|
2008-08-29 13:02:05 +00:00
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2010-10-24 12:36:44 +00:00
|
|
|
define DownloadMethod/darcs
|
2016-12-14 14:36:39 +00:00
|
|
|
$(call wrap_mirror, $(1), $(2), \
|
2010-10-24 12:36:44 +00:00
|
|
|
echo "Checking out files from the darcs repository..."; \
|
|
|
|
mkdir -p $(TMP_DIR)/dl && \
|
|
|
|
cd $(TMP_DIR)/dl && \
|
|
|
|
rm -rf $(SUBDIR) && \
|
|
|
|
[ \! -d $(SUBDIR) ] && \
|
2024-04-17 05:07:41 +00:00
|
|
|
darcs get -t $(SOURCE_VERSION) $(URL) $(SUBDIR) && \
|
2016-10-04 16:33:55 +00:00
|
|
|
export TAR_TIMESTAMP=`cd $(SUBDIR) && LC_ALL=C darcs log --last 1 | sed -ne 's!^Date: \+!!p'` && \
|
2010-10-24 12:36:44 +00:00
|
|
|
find $(SUBDIR) -name _darcs | xargs rm -rf && \
|
|
|
|
echo "Packing checkout..." && \
|
2016-12-12 10:42:14 +00:00
|
|
|
$(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \
|
2010-10-24 12:36:44 +00:00
|
|
|
mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \
|
|
|
|
rm -rf $(SUBDIR); \
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2024-04-17 05:07:41 +00:00
|
|
|
Validate/cvs=SOURCE_VERSION SUBDIR
|
|
|
|
Validate/svn=SOURCE_VERSION SUBDIR
|
|
|
|
Validate/git=SOURCE_VERSION SUBDIR
|
|
|
|
Validate/bzr=SOURCE_VERSION SUBDIR
|
|
|
|
Validate/hg=SOURCE_VERSION SUBDIR
|
|
|
|
Validate/darcs=SOURCE_VERSION SUBDIR
|
2007-09-29 00:05:48 +00:00
|
|
|
|
|
|
|
define Download/Defaults
|
|
|
|
URL:=
|
|
|
|
FILE:=
|
2015-11-22 19:06:33 +00:00
|
|
|
URL_FILE:=
|
2007-09-29 00:05:48 +00:00
|
|
|
PROTO:=
|
2016-12-14 16:11:03 +00:00
|
|
|
HASH=$$(MD5SUM)
|
2016-12-16 14:29:36 +00:00
|
|
|
MD5SUM:=x
|
2007-09-29 00:05:48 +00:00
|
|
|
SUBDIR:=
|
2008-07-31 02:43:33 +00:00
|
|
|
MIRROR:=1
|
2016-12-14 16:11:03 +00:00
|
|
|
MIRROR_HASH=$$(MIRROR_MD5SUM)
|
2011-03-21 23:02:06 +00:00
|
|
|
MIRROR_MD5SUM:=x
|
2024-04-17 05:07:41 +00:00
|
|
|
SOURCE_VERSION:=
|
2016-11-09 17:34:17 +00:00
|
|
|
OPTS:=
|
2023-03-16 01:17:26 +00:00
|
|
|
SUBMODULES:=
|
2007-09-29 00:05:48 +00:00
|
|
|
endef
|
|
|
|
|
2016-12-16 14:26:22 +00:00
|
|
|
define Download/default
|
|
|
|
FILE:=$(PKG_SOURCE)
|
|
|
|
URL:=$(PKG_SOURCE_URL)
|
2018-07-05 19:40:19 +00:00
|
|
|
URL_FILE:=$(PKG_SOURCE_URL_FILE)
|
2016-12-16 14:26:22 +00:00
|
|
|
SUBDIR:=$(PKG_SOURCE_SUBDIR)
|
|
|
|
PROTO:=$(PKG_SOURCE_PROTO)
|
2023-03-16 01:17:26 +00:00
|
|
|
SUBMODULES:=$(PKG_SOURCE_SUBMODULES)
|
2016-12-16 14:26:22 +00:00
|
|
|
$(if $(PKG_SOURCE_MIRROR),MIRROR:=$(filter 1,$(PKG_MIRROR)))
|
|
|
|
$(if $(PKG_MIRROR_MD5SUM),MIRROR_MD5SUM:=$(PKG_MIRROR_MD5SUM))
|
|
|
|
$(if $(PKG_MIRROR_HASH),MIRROR_HASH:=$(PKG_MIRROR_HASH))
|
2024-04-17 05:07:41 +00:00
|
|
|
SOURCE_VERSION:=$(PKG_SOURCE_VERSION)
|
2016-12-16 14:26:22 +00:00
|
|
|
$(if $(PKG_MD5SUM),MD5SUM:=$(PKG_MD5SUM))
|
|
|
|
$(if $(PKG_HASH),HASH:=$(PKG_HASH))
|
|
|
|
endef
|
|
|
|
|
2007-09-29 00:05:48 +00:00
|
|
|
define Download
|
|
|
|
$(eval $(Download/Defaults))
|
|
|
|
$(eval $(Download/$(1)))
|
|
|
|
$(foreach FIELD,URL FILE $(Validate/$(call dl_method,$(URL),$(PROTO))),
|
|
|
|
ifeq ($($(FIELD)),)
|
|
|
|
$$(error Download/$(1) is missing the $(FIELD) field.)
|
|
|
|
endif
|
|
|
|
)
|
|
|
|
|
2009-03-17 02:37:10 +00:00
|
|
|
$(foreach dep,$(DOWNLOAD_RDEP),
|
|
|
|
$(dep): $(DL_DIR)/$(FILE)
|
|
|
|
)
|
2007-09-29 00:05:48 +00:00
|
|
|
download: $(DL_DIR)/$(FILE)
|
|
|
|
|
|
|
|
$(DL_DIR)/$(FILE):
|
|
|
|
mkdir -p $(DL_DIR)
|
2016-12-14 14:36:39 +00:00
|
|
|
$(call locked, \
|
|
|
|
$(if $(DownloadMethod/$(call dl_method,$(URL),$(PROTO))), \
|
|
|
|
$(call DownloadMethod/$(call dl_method,$(URL),$(PROTO)),check,$(if $(filter default,$(1)),PKG_,Download/$(1):)), \
|
|
|
|
$(DownloadMethod/unknown) \
|
|
|
|
),\
|
|
|
|
$(FILE))
|
2007-09-29 00:05:48 +00:00
|
|
|
|
|
|
|
endef
|