mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 22:43:50 +01:00
The dlcache script is useful to avoid unnecessary repeated downloads of zip archives, similar to the git-cache scripts. The command order was changed to stay compatible with DOWNLOAD_TO_FILE and the only other usage of $(DLCACHE) was changed accordingly. To avoid the risk of collisions, dlcache now uses SHA512 sums instead of MD5. If no SHA512 checksum is given to dlcache.sh, it will just act as $(DOWNLOAD_TO_FILE).
45 lines
1.9 KiB
HTTP
45 lines
1.9 KiB
HTTP
PKG_NAME = my_pkg # name of the package
|
|
PKG_URL = http://example.com/downloads # source url of the package e.g. a git repository
|
|
PKG_VERSION = v1.2.3 # version of the package to use e.g. a git commit/ref
|
|
PKG_EXT = zip # extension of this package
|
|
PKG_LICENSE = MIT # license of the package
|
|
PKG_SHA512 = 5bcc4310f09ea247f5b65d63afae872fb92bb5c39029f336d94503fe04feccfcd22aa42b377b0927ab7f0a19111fd5a0a6842ecab147761c8f218f7f115e0da5 # SHA512 checksum of the package
|
|
|
|
ifneq ($(RIOTBASE),)
|
|
include $(RIOTBASE)/Makefile.base
|
|
endif
|
|
|
|
.PHONY: all clean patch distclean
|
|
|
|
all: patch
|
|
$(MAKE) -C $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)
|
|
|
|
patch: $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)/Makefile
|
|
# Dependancy might be changed accordingly though we think the Makefile
|
|
# will be the first thing you want to change
|
|
#
|
|
# Here might not happen anything besides dependancy checks
|
|
|
|
$(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)/Makefile: $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)/
|
|
# Here you apply your patch.
|
|
cd $< && patch ../patch.txt
|
|
|
|
$(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)/: $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT)
|
|
# Here you unpack the file.
|
|
# This example assumes the common pattern that the archive contains its data in a subfolder with the same name as itself.
|
|
$(Q)$(UNZIP_HERE) $<
|
|
|
|
$(CURDIR)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT):
|
|
# Get PKG_VERSION of package from PKG_URL
|
|
$(Q)$(DOWNLOAD_TO_FILE) $@ $(PKG_URL)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT) $(PKG_SHA512)
|
|
# Note: Since Release 2025.10, DOWNLOAD_TO_FILE uses dlcache and
|
|
# requires an SHA512 checksum for caching!
|
|
|
|
clean::
|
|
# Reset package to checkout state.
|
|
rm -rf $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION) && \
|
|
$(MAKE) $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)/Makefile
|
|
|
|
distclean::
|
|
rm -rf $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION) $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT)
|