DOWNLOAD: change $1=DIRECTORY_URL, $2=FILE_NAME to $1=FULL_FILE_URL, $2=FILE_NAME

This modifies the definition of DOWNLOAD to receive two arguments:
the first one is the full URL of the file to download, whereas the second
(and optional) is the name the file will have once downloaded.

Same thing with the SOURCE_CHECK_WGET and SCP functions.

All calls to these functions have been changed to the shortest form of
the new API, except for toolchains acquisition. Since there is quite a
number of different toolchains this call to DOWNLOAD is better set to the
generic one.

Signed-off-by: Alvaro G. M <alvaro.gamez@hazent.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tested-by: Stephan Hoffmann <sho@relinux.de>
Downloading Microblaze LE toolchain works on a clean install
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
This commit is contained in:
Alvaro G. M 2012-03-16 14:42:53 +01:00 committed by Peter Korsgaard
parent 6372f4e646
commit 0a4856ce27
20 changed files with 32 additions and 28 deletions

View File

@ -22,7 +22,7 @@ existing manual makefiles and to help understand how they work.*
11: LIBFOO_TARGET_BINARY = usr/bin/foo 11: LIBFOO_TARGET_BINARY = usr/bin/foo
12: 12:
13: $(DL_DIR)/$(LIBFOO_SOURCE): 13: $(DL_DIR)/$(LIBFOO_SOURCE):
14: $(call DOWNLOAD,$(LIBFOO_SITE),$(LIBFOO_SOURCE)) 14: $(call DOWNLOAD,$(LIBFOO_SITE)/$(LIBFOO_SOURCE))
15: 15:
16: $(LIBFOO_DIR)/.source: $(DL_DIR)/$(LIBFOO_SOURCE) 16: $(LIBFOO_DIR)/.source: $(DL_DIR)/$(LIBFOO_SOURCE)
17: $(ZCAT) $(DL_DIR)/$(LIBFOO_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - 17: $(ZCAT) $(DL_DIR)/$(LIBFOO_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -

View File

@ -98,7 +98,7 @@ define LINUX_DOWNLOAD_PATCHES
$(if $(LINUX_PATCHES), $(if $(LINUX_PATCHES),
@$(call MESSAGE,"Download additional patches")) @$(call MESSAGE,"Download additional patches"))
$(foreach patch,$(filter ftp://% http://%,$(LINUX_PATCHES)),\ $(foreach patch,$(filter ftp://% http://%,$(LINUX_PATCHES)),\
$(call DOWNLOAD,$(dir $(patch)),$(notdir $(patch)))$(sep)) $(call DOWNLOAD,$(patch))$(sep))
endef endef
LINUX_POST_DOWNLOAD_HOOKS += LINUX_DOWNLOAD_PATCHES LINUX_POST_DOWNLOAD_HOOKS += LINUX_DOWNLOAD_PATCHES

View File

@ -203,11 +203,11 @@ endef
# to prepend the path with a slash: scp://[user@]host:/absolutepath # to prepend the path with a slash: scp://[user@]host:/absolutepath
define DOWNLOAD_SCP define DOWNLOAD_SCP
test -e $(DL_DIR)/$(2) || \ test -e $(DL_DIR)/$(2) || \
$(SCP) $(call stripurischeme,$(call qstrip,$(1)))/$(2) $(DL_DIR) $(SCP) '$(call stripurischeme,$(call qstrip,$(1)))' $(DL_DIR)/$(2)
endef endef
define SOURCE_CHECK_SCP define SOURCE_CHECK_SCP
$(SSH) $(call domain,$(1),:) ls $(call notdomain,$(1)/$(2),:) > /dev/null $(SSH) $(call domain,$(1),:) ls '$(call notdomain,$(1),:)' > /dev/null
endef endef
define SHOW_EXTERNAL_DEPS_SCP define SHOW_EXTERNAL_DEPS_SCP
@ -241,12 +241,12 @@ endef
# download fails). # download fails).
define DOWNLOAD_WGET define DOWNLOAD_WGET
test -e $(DL_DIR)/$(2) || \ test -e $(DL_DIR)/$(2) || \
$(WGET) -O $(DL_DIR)/$(2) $(call qstrip,$(1))/$(2) || \ $(WGET) -O $(DL_DIR)/$(2) '$(call qstrip,$(1))' || \
(rm -f $(DL_DIR)/$(2) ; exit 1) (rm -f $(DL_DIR)/$(2) ; exit 1)
endef endef
define SOURCE_CHECK_WGET define SOURCE_CHECK_WGET
$(WGET) --spider $(call qstrip,$(1))/$(2) $(WGET) --spider '$(call qstrip,$(1))'
endef endef
define SHOW_EXTERNAL_DEPS_WGET define SHOW_EXTERNAL_DEPS_WGET
@ -280,6 +280,10 @@ endef
################################################################################ ################################################################################
define DOWNLOAD define DOWNLOAD
$(call DOWNLOAD_INNER,$(1),$(if $(2),$(2),$(notdir $(1))))
endef
define DOWNLOAD_INNER
$(Q)if test -n "$(call qstrip,$(BR2_PRIMARY_SITE))" ; then \ $(Q)if test -n "$(call qstrip,$(BR2_PRIMARY_SITE))" ; then \
case "$(call geturischeme,$(BR2_PRIMARY_SITE))" in \ case "$(call geturischeme,$(BR2_PRIMARY_SITE))" in \
scp) $(call $(DL_MODE)_SCP,$(BR2_PRIMARY_SITE),$(2)) && exit ;; \ scp) $(call $(DL_MODE)_SCP,$(BR2_PRIMARY_SITE),$(2)) && exit ;; \
@ -298,7 +302,7 @@ define DOWNLOAD
esac ; \ esac ; \
fi ; \ fi ; \
if test -n "$(call qstrip,$(BR2_BACKUP_SITE))" ; then \ if test -n "$(call qstrip,$(BR2_BACKUP_SITE))" ; then \
$(call $(DL_MODE)_WGET,$(BR2_BACKUP_SITE),$(2)) && exit ; \ $(call $(DL_MODE)_WGET,$(BR2_BACKUP_SITE)/$(2),$(2)) && exit ; \
fi ; \ fi ; \
exit 1 exit 1
endef endef
@ -322,8 +326,8 @@ ifeq ($(DL_MODE),DOWNLOAD)
(test -z $($(PKG)_PATCH) || test -e $(DL_DIR)$($(PKG)_PATCH))) || \ (test -z $($(PKG)_PATCH) || test -e $(DL_DIR)$($(PKG)_PATCH))) || \
$(call MESSAGE,"Downloading") $(call MESSAGE,"Downloading")
endif endif
$(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE),$($(PKG)_SOURCE))) $(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE)/$($(PKG)_SOURCE)))
$(if $($(PKG)_PATCH),$(call DOWNLOAD,$($(PKG)_SITE),$($(PKG)_PATCH))) $(if $($(PKG)_PATCH),$(call DOWNLOAD,$($(PKG)_SITE)/$($(PKG)_PATCH)))
$(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep)) $(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
ifeq ($(DL_MODE),DOWNLOAD) ifeq ($(DL_MODE),DOWNLOAD)
$(Q)mkdir -p $(@D) $(Q)mkdir -p $(@D)

View File

@ -65,7 +65,7 @@ else
endif endif
$(DL_DIR)/$(CUPS_SOURCE): $(DL_DIR)/$(CUPS_SOURCE):
$(call DOWNLOAD,$(CUPS_SITE),$(CUPS_SOURCE)) $(call DOWNLOAD,$(CUPS_SITE)/$(CUPS_SOURCE))
$(CUPS_DIR)/.unpacked: $(DL_DIR)/$(CUPS_SOURCE) $(CUPS_DIR)/.unpacked: $(DL_DIR)/$(CUPS_SOURCE)
$(CUPS_CAT) $(DL_DIR)/$(CUPS_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - $(CUPS_CAT) $(DL_DIR)/$(CUPS_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -

View File

@ -11,7 +11,7 @@ FIS_BINARY:=fis
FIS_TARGET_BINARY:=sbin/fis FIS_TARGET_BINARY:=sbin/fis
$(DL_DIR)/$(FIS_SOURCE): $(DL_DIR)/$(FIS_SOURCE):
$(call DOWNLOAD,$(FIS_SITE),$(FIS_SOURCE)) $(call DOWNLOAD,$(FIS_SITE)/$(FIS_SOURCE))
fis-source: $(DL_DIR)/$(FIS_SOURCE) fis-source: $(DL_DIR)/$(FIS_SOURCE)

View File

@ -10,7 +10,7 @@ DOOM_WAD_SITE = ftp://ftp.idsoftware.com/idstuff/doom/
DOOM_WAD_DIR=$(BUILD_DIR)/doom-wad-$(DOOM_WAD_VERSION) DOOM_WAD_DIR=$(BUILD_DIR)/doom-wad-$(DOOM_WAD_VERSION)
$(DL_DIR)/$(DOOM_WAD_SOURCE): $(DL_DIR)/$(DOOM_WAD_SOURCE):
$(call DOWNLOAD,$(DOOM_WAD_SITE),$(DOOM_WAD_SOURCE)) $(call DOWNLOAD,$(DOOM_WAD_SITE)/$(DOOM_WAD_SOURCE))
doom-wad-source: $(DL_DIR)/$(DOOM_WAD_SOURCE) doom-wad-source: $(DL_DIR)/$(DOOM_WAD_SOURCE)

View File

@ -18,7 +18,7 @@ LIBINTL_TARGET_BINARY:=usr/lib/libintl.so
endif endif
$(DL_DIR)/$(GETTEXT_SOURCE): $(DL_DIR)/$(GETTEXT_SOURCE):
$(call DOWNLOAD,$(GETTEXT_SITE),$(GETTEXT_SOURCE)) $(call DOWNLOAD,$(GETTEXT_SITE)/$(GETTEXT_SOURCE))
gettext-source: $(DL_DIR)/$(GETTEXT_SOURCE) gettext-source: $(DL_DIR)/$(GETTEXT_SOURCE)

View File

@ -12,7 +12,7 @@ NETKITBASE_BINARY:=inetd/inetd
NETKITBASE_TARGET_BINARY:=usr/sbin/inetd NETKITBASE_TARGET_BINARY:=usr/sbin/inetd
$(DL_DIR)/$(NETKITBASE_SOURCE): $(DL_DIR)/$(NETKITBASE_SOURCE):
$(call DOWNLOAD,$(NETKITBASE_SITE),$(NETKITBASE_SOURCE)) $(call DOWNLOAD,$(NETKITBASE_SITE)/$(NETKITBASE_SOURCE))
netkitbase-source: $(DL_DIR)/$(NETKITBASE_SOURCE) netkitbase-source: $(DL_DIR)/$(NETKITBASE_SOURCE)

View File

@ -12,7 +12,7 @@ NETKITTELNET_BINARY:=telnetd/telnetd
NETKITTELNET_TARGET_BINARY:=usr/sbin/telnetd NETKITTELNET_TARGET_BINARY:=usr/sbin/telnetd
$(DL_DIR)/$(NETKITTELNET_SOURCE): $(DL_DIR)/$(NETKITTELNET_SOURCE):
$(call DOWNLOAD,$(NETKITTELNET_SITE),$(NETKITTELNET_SOURCE)) $(call DOWNLOAD,$(NETKITTELNET_SITE)/$(NETKITTELNET_SOURCE))
netkittelnet-source: $(DL_DIR)/$(NETKITTELNET_SOURCE) netkittelnet-source: $(DL_DIR)/$(NETKITTELNET_SOURCE)

View File

@ -11,7 +11,7 @@ NEWT_VERSION=0.51.0
NEWT_CFLAGS=-Os -g -fPIC NEWT_CFLAGS=-Os -g -fPIC
$(DL_DIR)/$(NEWT_SOURCE): $(DL_DIR)/$(NEWT_SOURCE):
$(call DOWNLOAD,$(NEWT_SITE),$(NEWT_SOURCE)) $(call DOWNLOAD,$(NEWT_SITE)/$(NEWT_SOURCE))
$(NEWT_DIR)/.source: $(DL_DIR)/$(NEWT_SOURCE) $(NEWT_DIR)/.source: $(DL_DIR)/$(NEWT_SOURCE)
$(NEWT_CAT) $(DL_DIR)/$(NEWT_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - $(NEWT_CAT) $(DL_DIR)/$(NEWT_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -

View File

@ -12,7 +12,7 @@ TINYHTTPD_BINARY:=httpd
TINYHTTPD_TARGET_BINARY:=usr/sbin/tinyhttpd TINYHTTPD_TARGET_BINARY:=usr/sbin/tinyhttpd
$(DL_DIR)/$(TINYHTTPD_SOURCE): $(DL_DIR)/$(TINYHTTPD_SOURCE):
$(call DOWNLOAD,$(TINYHTTPD_SITE),$(TINYHTTPD_SOURCE)) $(call DOWNLOAD,$(TINYHTTPD_SITE)/$(TINYHTTPD_SOURCE))
tinyhttpd-source: $(DL_DIR)/$(TINYHTTPD_SOURCE) tinyhttpd-source: $(DL_DIR)/$(TINYHTTPD_SOURCE)

View File

@ -10,7 +10,7 @@ TTCP_SOURCE=ttcp$(TTCP_VERSION).c
TTCP_DIR=$(BUILD_DIR)/ttcp$(TTCP_VERSION) TTCP_DIR=$(BUILD_DIR)/ttcp$(TTCP_VERSION)
$(DL_DIR)/$(TTCP_SOURCE): $(DL_DIR)/$(TTCP_SOURCE):
$(call DOWNLOAD,$(TTCP_SOURCE_URL),$(TTCP_SOURCE)) $(call DOWNLOAD,$(TTCP_SOURCE_URL)/$(TTCP_SOURCE))
$(TTCP_DIR)/.unpacked: $(DL_DIR)/$(TTCP_SOURCE) $(TTCP_DIR)/.unpacked: $(DL_DIR)/$(TTCP_SOURCE)
-mkdir $(TTCP_DIR) -mkdir $(TTCP_DIR)

View File

@ -12,7 +12,7 @@ UEMACS_BINARY:=em
UEMACS_TARGET_BINARY:=usr/bin/emacs UEMACS_TARGET_BINARY:=usr/bin/emacs
$(DL_DIR)/$(UEMACS_SOURCE): $(DL_DIR)/$(UEMACS_SOURCE):
$(call DOWNLOAD,$(UEMACS_SITE),$(UEMACS_SOURCE)) $(call DOWNLOAD,$(UEMACS_SITE)/$(UEMACS_SOURCE))
uemacs-source: $(DL_DIR)/$(UEMACS_SOURCE) uemacs-source: $(DL_DIR)/$(UEMACS_SOURCE)

View File

@ -15,7 +15,7 @@ VPNC_TARGET_BINARY:=$(VPNC_DEST_DIR)/vpnc
VPNC_TARGET_SCRIPT:=$(TARGET_DIR)/etc/vpnc/default.conf VPNC_TARGET_SCRIPT:=$(TARGET_DIR)/etc/vpnc/default.conf
$(DL_DIR)/$(VPNC_SOURCE): $(DL_DIR)/$(VPNC_SOURCE):
$(call DOWNLOAD,$(VPNC_SITE),$(VPNC_SOURCE)) $(call DOWNLOAD,$(VPNC_SITE)/$(VPNC_SOURCE))
$(VPNC_DIR)/.unpacked: $(DL_DIR)/$(VPNC_SOURCE) $(VPNC_DIR)/.unpacked: $(DL_DIR)/$(VPNC_SOURCE)
$(VPNC_CAT) $(DL_DIR)/$(VPNC_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - $(VPNC_CAT) $(DL_DIR)/$(VPNC_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -

View File

@ -18,7 +18,7 @@ XFSPROGS_STRIP_LIBDEP:= \
repair/xfs_repair quota/xfs_quota repair/xfs_repair quota/xfs_quota
$(DL_DIR)/$(XFSPROGS_SOURCE): $(DL_DIR)/$(XFSPROGS_SOURCE):
$(call DOWNLOAD,$(XFSPROGS_SITE),$(XFSPROGS_SOURCE)) $(call DOWNLOAD,$(XFSPROGS_SITE)/$(XFSPROGS_SOURCE))
xfsprogs-source: $(DL_DIR)/$(XFSPROGS_SOURCE) xfsprogs-source: $(DL_DIR)/$(XFSPROGS_SOURCE)

View File

@ -172,7 +172,7 @@ endif
$(DL_DIR)/$(GCC_SOURCE): $(DL_DIR)/$(GCC_SOURCE):
mkdir -p $(DL_DIR) mkdir -p $(DL_DIR)
$(call DOWNLOAD,$(GCC_SITE),$(GCC_SOURCE)) $(call DOWNLOAD,$(GCC_SITE)/$(GCC_SOURCE))
gcc-unpacked: $(GCC_DIR)/.patched gcc-unpacked: $(GCC_DIR)/.patched
$(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE) $(GCC_DIR)/.unpacked: $(DL_DIR)/$(GCC_SOURCE)

View File

@ -24,7 +24,7 @@ endif
GDB_DIR:=$(TOOLCHAIN_DIR)/gdb-$(GDB_VERSION) GDB_DIR:=$(TOOLCHAIN_DIR)/gdb-$(GDB_VERSION)
$(DL_DIR)/$(GDB_SOURCE): $(DL_DIR)/$(GDB_SOURCE):
$(call DOWNLOAD,$(GDB_SITE),$(GDB_SOURCE)) $(call DOWNLOAD,$(GDB_SITE)/$(GDB_SOURCE))
gdb-unpacked: $(GDB_DIR)/.unpacked gdb-unpacked: $(GDB_DIR)/.unpacked
$(GDB_DIR)/.unpacked: $(DL_DIR)/$(GDB_SOURCE) $(GDB_DIR)/.unpacked: $(DL_DIR)/$(GDB_SOURCE)

View File

@ -81,7 +81,7 @@ $(DL_DIR)/$(LINUX_HEADERS_SOURCE):
ifeq ($(BR2_KERNEL_HEADERS_SNAP),y) ifeq ($(BR2_KERNEL_HEADERS_SNAP),y)
$(error No local $@ found, cannot continue. Are you sure you wanted to enable BR2_KERNEL_HEADERS_SNAP?) $(error No local $@ found, cannot continue. Are you sure you wanted to enable BR2_KERNEL_HEADERS_SNAP?)
endif endif
$(call DOWNLOAD,$(LINUX_HEADERS_SITE),$(LINUX_HEADERS_SOURCE)) $(call DOWNLOAD,$(LINUX_HEADERS_SITE)/$(LINUX_HEADERS_SOURCE))
kernel-headers: $(LINUX_HEADERS_DIR)/.configured kernel-headers: $(LINUX_HEADERS_DIR)/.configured

View File

@ -253,10 +253,10 @@ endif
# components than usual. # components than usual.
ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2010RC1)$(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2011R1),y) ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2010RC1)$(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2011R1),y)
$(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1): $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1):
$(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE_1),$(TOOLCHAIN_EXTERNAL_SOURCE_1)) $(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE_1)/$(TOOLCHAIN_EXTERNAL_SOURCE_1))
$(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2): $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2):
$(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE_2),$(TOOLCHAIN_EXTERNAL_SOURCE_2)) $(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE_2)/$(TOOLCHAIN_EXTERNAL_SOURCE_2))
$(TOOLCHAIN_EXTERNAL_DIR)/.extracted: $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2) $(TOOLCHAIN_EXTERNAL_DIR)/.extracted: $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2)
mkdir -p $(@D) mkdir -p $(@D)
@ -279,7 +279,7 @@ endif
else else
# Download and extraction of a toolchain # Download and extraction of a toolchain
$(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE): $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE):
$(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE),$(TOOLCHAIN_EXTERNAL_SOURCE)) $(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE)$(TOOLCHAIN_EXTERNAL_SOURCE),$(TOOLCHAIN_EXTERNAL_SOURCE))
$(TOOLCHAIN_EXTERNAL_DIR)/.extracted: $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE) $(TOOLCHAIN_EXTERNAL_DIR)/.extracted: $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE)
mkdir -p $(@D) mkdir -p $(@D)

View File

@ -67,7 +67,7 @@ UCLIBC_ARM_TYPE:=CONFIG_$(call qstrip,$(BR2_ARM_TYPE))
UCLIBC_SPARC_TYPE:=CONFIG_SPARC_$(call qstrip,$(BR2_SPARC_TYPE)) UCLIBC_SPARC_TYPE:=CONFIG_SPARC_$(call qstrip,$(BR2_SPARC_TYPE))
$(DL_DIR)/$(UCLIBC_SOURCE): $(DL_DIR)/$(UCLIBC_SOURCE):
$(call DOWNLOAD,$(UCLIBC_SITE),$(UCLIBC_SOURCE)) $(call DOWNLOAD,$(UCLIBC_SITE)/$(UCLIBC_SOURCE))
uclibc-unpacked: $(UCLIBC_DIR)/.unpacked uclibc-unpacked: $(UCLIBC_DIR)/.unpacked
$(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE) $(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE)