Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treewide: add DOWNLOAD variable as unification of curl call #8759

Merged
merged 1 commit into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions arch/arm/src/nrf52/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ NRFXLIB_TGZ := $(NRFXLIB_REF).tar.gz
NRFXLIB_URL := https://github.com/nrfconnect/sdk-nrfxlib/archive

$(NRFXLIB_TGZ):
$(Q) echo "Downloading: NRFXLIB"
$(Q) curl -L $(NRFXLIB_URL)/$(NRFXLIB_TGZ) -o chip/$(NRFXLIB_TGZ)
$(call DOWNLOAD,$(NRFXLIB_URL),$(NRFXLIB_TGZ),chip/$(NRFXLIB_TGZ))

chip/$(NRFXLIB_UNPACK): $(NRFXLIB_TGZ)
$(Q) echo "Unpacking: NRXFLIB"
Expand Down
3 changes: 1 addition & 2 deletions arch/arm/src/nrf53/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ NRFXLIB_TGZ := $(NRFXLIB_REF).tar.gz
NRFXLIB_URL := https://github.com/nrfconnect/sdk-nrfxlib/archive

$(NRFXLIB_TGZ):
$(Q) echo "Downloading: NRFXLIB"
$(Q) curl -L $(NRFXLIB_URL)/$(NRFXLIB_TGZ) -o chip/$(NRFXLIB_TGZ)
$(call DOWNLOAD,$(NRFXLIB_URL),$(NRFXLIB_TGZ),chip/$(NRFXLIB_TGZ))

chip/$(NRFXLIB_UNPACK): $(NRFXLIB_TGZ)
$(Q) echo "Unpacking: NRXFLIB"
Expand Down
3 changes: 1 addition & 2 deletions arch/risc-v/src/bl602/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ WIRELESS_DRV_ZIP = v$(WIRELESS_DRV_VERSION).zip
WIRELESS_DRV_URL = https://github.com/bouffalolab/bl_blob/archive/refs/heads

$(WIRELESS_DRV_ZIP):
$(Q) echo "Downloading: BL602 Wireless Drivers"
$(Q) curl -L $(WIRELESS_DRV_URL)/$(WIRELESS_DRV_ZIP) -o chip/$(WIRELESS_DRV_ZIP)
$(call DOWNLOAD,$(WIRELESS_DRV_URL),$(WIRELESS_DRV_ZIP),chip/$(WIRELESS_DRV_ZIP))

chip/$(WIRELESS_DRV_UNPACK): $(WIRELESS_DRV_ZIP)
$(Q) echo "Unpacking: BL602 Wireless Drivers"
Expand Down
8 changes: 3 additions & 5 deletions arch/risc-v/src/esp32c3/Bootloader.mk
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,16 @@ BOOTLOADER_URL = https://github.com/espressif/esp-nuttx-bootloader/releases/
ifeq ($(CONFIG_ESP32C3_APP_FORMAT_MCUBOOT),y)

bootloader:
$(Q) echo "Downloading Bootloader binaries"
$(Q) curl -L $(BOOTLOADER_URL)/mcuboot-esp32c3.bin -o $(TOPDIR)/mcuboot-esp32c3.bin
$(call DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32c3.bin,$(TOPDIR)/mcuboot-esp32c3.bin)

clean_bootloader:
$(call DELFILE,$(TOPDIR)/mcuboot-esp32c3.bin)

else ifeq ($(CONFIG_ESP32C3_APP_FORMAT_LEGACY),y)

bootloader:
$(Q) echo "Downloading Bootloader binaries"
$(Q) curl -L $(BOOTLOADER_URL)/bootloader-esp32c3.bin -o $(TOPDIR)/bootloader-esp32c3.bin
$(Q) curl -L $(BOOTLOADER_URL)/partition-table-esp32c3.bin -o $(TOPDIR)/partition-table-esp32c3.bin
$(call DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32c3.bin,$(TOPDIR)/mcuboot-esp32c3.bin)
$(call DOWNLOAD,$(BOOTLOADER_URL),partition-table-esp32c3.bin,$(TOPDIR)/partition-table-esp32c3.bin)

clean_bootloader:
$(call DELFILE,$(TOPDIR)/bootloader-esp32c3.bin)
Expand Down
3 changes: 1 addition & 2 deletions arch/risc-v/src/esp32c3/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ WIRELESS_DRV_ZIP = $(WIRELESS_DRV_ID).zip
WIRELESS_DRV_URL = https://github.com/espressif/esp-wireless-drivers-3rdparty/archive

$(WIRELESS_DRV_ZIP):
$(Q) echo "Downloading: ESP Wireless Drivers"
$(Q) curl -L $(WIRELESS_DRV_URL)/$(WIRELESS_DRV_ZIP) -o chip/$(WIRELESS_DRV_ZIP)
$(call DOWNLOAD,$(WIRELESS_DRV_URL),$(WIRELESS_DRV_ZIP),chip/$(WIRELESS_DRV_ZIP))

chip/$(WIRELESS_DRV_UNPACK): $(WIRELESS_DRV_ZIP)
$(Q) echo "Unpacking: ESP Wireless Drivers"
Expand Down
3 changes: 1 addition & 2 deletions arch/risc-v/src/opensbi/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ OPENSBI_TARBALL = opensbi.tar.gz
OPENSBI_DIR = riscv-software-src-opensbi-4998a71

$(OPENSBI_TARBALL):
$(Q) echo "Downloading: OpenSBI"
$(Q) curl -L $(OPENSBI_URL)/$(OPENSBI_COMMIT) -o opensbi/$(OPENSBI_TARBALL)
$(call DOWNLOAD,$(OPENSBI_URL),$(OPENSBI_COMMIT),opensbi/$(OPENSBI_TARBALL))

.opensbi_unpack: $(OPENSBI_TARBALL)
$(Q) echo "Unpacking: OpenSBI"
Expand Down
8 changes: 3 additions & 5 deletions arch/xtensa/src/esp32/Bootloader.mk
Original file line number Diff line number Diff line change
Expand Up @@ -177,18 +177,16 @@ BOOTLOADER_URL = https://github.com/espressif/esp-nuttx-bootloader/releases/
ifeq ($(CONFIG_ESP32_APP_FORMAT_MCUBOOT),y)

bootloader:
$(Q) echo "Downloading Bootloader binaries"
$(Q) curl -L $(BOOTLOADER_URL)/mcuboot-esp32.bin -o $(TOPDIR)/mcuboot-esp32.bin
$(call DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32.bin,$(TOPDIR)/mcuboot-esp32.bin)

clean_bootloader:
$(call DELFILE,$(TOPDIR)/mcuboot-esp32.bin)

else ifeq ($(CONFIG_ESP32_APP_FORMAT_LEGACY),y)

bootloader:
$(Q) echo "Downloading Bootloader binaries"
$(Q) curl -L $(BOOTLOADER_URL)/bootloader-esp32.bin -o $(TOPDIR)/bootloader-esp32.bin
$(Q) curl -L $(BOOTLOADER_URL)/partition-table-esp32.bin -o $(TOPDIR)/partition-table-esp32.bin
$(call DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32.bin,$(TOPDIR)/mcuboot-esp32.bin)
$(call DOWNLOAD,$(BOOTLOADER_URL),partition-table-esp32.bin,$(TOPDIR)/partition-table-esp32.bin)

clean_bootloader:
$(call DELFILE,$(TOPDIR)/bootloader-esp32.bin)
Expand Down
3 changes: 1 addition & 2 deletions arch/xtensa/src/esp32/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ WIRELESS_DRV_ZIP = $(WIRELESS_DRV_ID).zip
WIRELESS_DRV_URL = https://github.com/espressif/esp-wireless-drivers-3rdparty/archive

$(WIRELESS_DRV_ZIP):
$(Q) echo "Downloading: ESP Wireless Drivers"
$(Q) curl -L $(WIRELESS_DRV_URL)/$(WIRELESS_DRV_ZIP) -o chip/$(WIRELESS_DRV_ZIP)
$(call DOWNLOAD,$(WIRELESS_DRV_URL),$(WIRELESS_DRV_ZIP),chip/$(WIRELESS_DRV_ZIP))

chip/$(WIRELESS_DRV_UNPACK): $(WIRELESS_DRV_ZIP)
$(Q) echo "Unpacking: ESP Wireless Drivers"
Expand Down
8 changes: 3 additions & 5 deletions arch/xtensa/src/esp32s2/Bootloader.mk
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,16 @@ BOOTLOADER_URL = https://github.com/espressif/esp-nuttx-bootloader/releases/
ifeq ($(CONFIG_ESP32S2_APP_FORMAT_MCUBOOT),y)

bootloader:
$(Q) echo "Downloading Bootloader binaries"
$(Q) curl -L $(BOOTLOADER_URL)/mcuboot-esp32s2.bin -o $(TOPDIR)/mcuboot-esp32s2.bin
$(call DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32s2.bin,$(TOPDIR)/mcuboot-esp32s2.bin)

clean_bootloader:
$(call DELFILE,$(TOPDIR)/mcuboot-esp32s2.bin)

else ifeq ($(CONFIG_ESP32S2_APP_FORMAT_LEGACY),y)

bootloader:
$(Q) echo "Downloading Bootloader binaries"
$(Q) curl -L $(BOOTLOADER_URL)/bootloader-esp32s2.bin -o $(TOPDIR)/bootloader-esp32s2.bin
$(Q) curl -L $(BOOTLOADER_URL)/partition-table-esp32s2.bin -o $(TOPDIR)/partition-table-esp32s2.bin
$(call DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32s2.bin,$(TOPDIR)/mcuboot-esp32s2.bin)
$(call DOWNLOAD,$(BOOTLOADER_URL),partition-table-esp32s2.bin,$(TOPDIR)/partition-table-esp32s2.bin)

clean_bootloader:
$(call DELFILE,$(TOPDIR)/bootloader-esp32s2.bin)
Expand Down
8 changes: 3 additions & 5 deletions arch/xtensa/src/esp32s3/Bootloader.mk
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,16 @@ BOOTLOADER_URL = https://github.com/espressif/esp-nuttx-bootloader/releases/
ifeq ($(CONFIG_ESP32S3_APP_FORMAT_MCUBOOT),y)

bootloader:
$(Q) echo "Downloading Bootloader binaries"
$(Q) curl -L $(BOOTLOADER_URL)/mcuboot-esp32s3.bin -o $(TOPDIR)/mcuboot-esp32s3.bin
$(call DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32s3.bin,$(TOPDIR)/mcuboot-esp32s3.bin)

clean_bootloader:
$(call DELFILE,$(TOPDIR)/mcuboot-esp32s3.bin)

else ifeq ($(CONFIG_ESP32S3_APP_FORMAT_LEGACY),y)

bootloader:
$(Q) echo "Downloading Bootloader binaries"
$(Q) curl -L $(BOOTLOADER_URL)/bootloader-esp32s3.bin -o $(TOPDIR)/bootloader-esp32s3.bin
$(Q) curl -L $(BOOTLOADER_URL)/partition-table-esp32s3.bin -o $(TOPDIR)/partition-table-esp32s3.bin
$(call DOWNLOAD,$(BOOTLOADER_URL),mcuboot-esp32s3.bin,$(TOPDIR)/mcuboot-esp32s3.bin)
$(call DOWNLOAD,$(BOOTLOADER_URL),partition-table-esp32s3.bin,$(TOPDIR)/partition-table-esp32s3.bin)

clean_bootloader:
$(call DELFILE,$(TOPDIR)/bootloader-esp32s3.bin)
Expand Down
4 changes: 2 additions & 2 deletions drivers/segger/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ ifeq ($(CONFIG_SEGGER_RTT),y)
# Download and unpack tarball if no git repo found
ifeq ($(wildcard $(SGDIR)/RTT/.git),)
$(SGDIR)/RTT.zip:
$(Q) curl -L https://github.com/SEGGERMicro/RTT/archive/refs/tags/V$(RTT_VERSION).zip -o $(SGDIR)/RTT.zip
$(call DOWNLOAD,https://github.com/SEGGERMicro/RTT/archive/refs/tags,V$(RTT_VERSION).zip,$(SGDIR)/RTT.zip)
$(Q) unzip -o $(SGDIR)/RTT.zip -d $(SGDIR)
$(Q) mv $(SGDIR)/RTT-$(RTT_VERSION) $(SGDIR)/RTT
$(Q) patch -p0 < segger/0001-segger-RTT-include-the-SEGGER_RTT_Conf.h-from-custom.patch
Expand Down Expand Up @@ -78,7 +78,7 @@ ifeq ($(CONFIG_SEGGER_SYSVIEW),y)
# Download and unpack tarball if no git repo found
ifeq ($(wildcard $(SGDIR)/SystemView/.git),)
$(SGDIR)/SystemView.zip:
$(Q) curl -L https://github.com/SEGGERMicro/SystemView/archive/refs/tags/V$(SYSVIEW_VERSION).zip -o $(SGDIR)/SystemView.zip
$(call DOWNLOAD,https://github.com/SEGGERMicro/SystemView/archive/refs/tags,V$(SYSVIEW_VERSION).zip,$(SGDIR)/SystemView.zip)
$(Q) unzip -o $(SGDIR)/SystemView.zip -d $(SGDIR)
$(Q) mv $(SGDIR)/SystemView-$(SYSVIEW_VERSION) $(SGDIR)/SystemView

Expand Down
2 changes: 1 addition & 1 deletion fs/littlefs/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ LITTLEFS_VERSION ?= 2.4.0
LITTLEFS_TARBALL = v$(LITTLEFS_VERSION).tar.gz

$(LITTLEFS_TARBALL):
$(Q) curl -L -o littlefs/$(LITTLEFS_TARBALL) https://github.com/ARMmbed/littlefs/archive/$(LITTLEFS_TARBALL)
$(call DOWNLOAD,https://github.com/ARMmbed/littlefs/archive,$(LITTLEFS_TARBALL),littlefs/$(LITTLEFS_TARBALL))

.littlefsunpack: $(LITTLEFS_TARBALL)
$(Q) tar zxf littlefs/$(LITTLEFS_TARBALL) -C littlefs
Expand Down
2 changes: 1 addition & 1 deletion libs/libc/audio/libsrc/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ VERSION=0.1.9
# Download and unpack tarball if no git repo found
ifeq ($(wildcard libsamplerate/.git),)
libsamplerate:
$(Q) curl -L https://codeload.github.com/libsndfile/libsamplerate/zip/master -o libsamplerate.zip
$(call DOWNLOAD,https://codeload.github.com/libsndfile/libsamplerate/zip,master,libsamplerate.zip)
$(Q) unzip -o libsamplerate.zip
$(Q) mv libsamplerate-master libsamplerate
endif
Expand Down
4 changes: 2 additions & 2 deletions libs/libc/zoneinfo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ tzbin:
mkdir tzbin

tzcode-latest.tar.gz:
$(Q) curl -L -O ftp://ftp.iana.org/tz/tzcode-latest.tar.gz
$(call DOWNLOAD,ftp://ftp.iana.org/tz,tzcode-latest.tar.gz)

tzdata-latest.tar.gz:
$(Q) curl -L -O ftp://ftp.iana.org/tz/tzdata-latest.tar.gz
$(call DOWNLOAD,ftp://ftp.iana.org/tz,tzdata-latest.tar.gz)

.tzunpack: tzcode tzcode-latest.tar.gz tzdata-latest.tar.gz
$(Q) tar zx -C tzcode -f tzcode-latest.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion libs/libxx/etl.defs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ETL_VERSION=20.32.1
# Download and unpack tarball if no git repo found
ifeq ($(wildcard etl/.git),)
$(ETL_VERSION).tar.gz:
$(Q) curl -O -L https://github.com/ETLCPP/etl/archive/refs/tags/$(ETL_VERSION).tar.gz
$(call DOWNLOAD,https://github.com/ETLCPP/etl/archive/refs/tags,$(ETL_VERSION).tar.gz)

etl: $(ETL_VERSION).tar.gz
$(Q) tar -xf $(ETL_VERSION).tar.gz
Expand Down
2 changes: 1 addition & 1 deletion libs/libxx/libcxx.defs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ LIBCXX_VERSION=12.0.0
# Download and unpack tarball if no git repo found
ifeq ($(wildcard libcxx/.git),)
libcxx-$(LIBCXX_VERSION).src.tar.xz:
$(Q) curl -O -L https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCXX_VERSION)/libcxx-$(LIBCXX_VERSION).src.tar.xz
$(call DOWNLOAD,https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCXX_VERSION),libcxx-$(LIBCXX_VERSION).src.tar.xz)

libcxx: libcxx-$(LIBCXX_VERSION).src.tar.xz
$(Q) tar -xf libcxx-$(LIBCXX_VERSION).src.tar.xz \
Expand Down
2 changes: 1 addition & 1 deletion libs/libxx/libcxxabi.defs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
LIBCXXABI_VERSION=12.0.0

libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz:
$(Q) curl -O -L https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCXXABI_VERSION)/libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz
$(call DOWNLOAD,https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LIBCXXABI_VERSION),libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz)

libcxxabi: libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz
$(Q) tar -xf libcxxabi-$(LIBCXXABI_VERSION).src.tar.xz
Expand Down
2 changes: 1 addition & 1 deletion openamp/libmetal.defs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ LIBMETAL_HDRS_SEDEXP := \
ifeq ($(wildcard libmetal/.git),)
libmetal.zip:
# Download and unpack tarball if no git repo found
$(Q) curl -L https://github.com/OpenAMP/libmetal/archive/v$(VERSION).zip -o libmetal.zip
$(call DOWNLOAD,https://github.com/OpenAMP/libmetal/archive,v$(VERSION).zip,libmetal.zip)
$(Q) unzip -o libmetal.zip
$(Q) mv libmetal-$(VERSION) libmetal

Expand Down
2 changes: 1 addition & 1 deletion openamp/open-amp.defs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CSRCS += open-amp/lib/virtio/virtqueue.c
# Download and unpack tarball if no git repo found
ifeq ($(wildcard open-amp/.git),)
open-amp.zip:
$(Q) curl -L https://github.com/OpenAMP/open-amp/archive/v$(VERSION).zip -o open-amp.zip
$(call DOWNLOAD,https://github.com/OpenAMP/open-amp/archive,v$(VERSION).zip,open-amp.zip)
$(Q) unzip -o open-amp.zip
$(Q) mv open-amp-$(VERSION) open-amp
$(Q) patch -p0 < 0001-ns-acknowledge-the-received-creation-message.patch
Expand Down
12 changes: 12 additions & 0 deletions tools/Config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,18 @@ define FINDSCRIPT
$(if $(wildcard $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(1)),$(BOARD_DIR)$(DELIM)scripts$(DELIM)$(1),$(BOARD_COMMON_DIR)$(DELIM)scripts$(DELIM)$(1))
endef

# DOWNLOAD - Download file. The URL base is joined with TARBALL by '/' and
# downloaded to the TARBALL file.
# The third argument is an output path. The second argument is used
# if it is not provided or is empty.
# Example: $(call DOWNLOAD,$(FOO_URL_BASE),$(FOO_TARBALL),foo.out,foo-)

define DOWNLOAD
$(ECHO_BEGIN)"Downloading: $(if $3,$3,$2) "
$(Q) curl -L $(if $(V),,-Ss) $(1)/$(2) -o $(if $(3),$(3),$(2))
$(ECHO_END)
endef

# CLEAN - Default clean target

ifeq ($(CONFIG_ARCH_COVERAGE),y)
Expand Down