# This file is part of MXE. See LICENSE.md for licensing information. # Generic updater # $(call GET_LATEST_VERSION, base url[, prefix, ext, filter, separator]) # base url : required page returning list of versions # e.g https://ftp.gnu.org/gnu/libfoo # prefix : segment before version # defaults to lastword of url with dash i.e. `libfoo-` # ext : segment ending version - default `\.tar` # filter : `grep -i` filter-out pattern - default alpha\|beta\|rc # separator: transform char to `.` - typically `_` # # test changes with: # make check-get-latest-version # # and update tools/skeleton.py with usage notes define GET_LATEST_VERSION $(WGET) -q -O- '$(strip $(1))' | \ $(SED) -n 's,.* $(2) ignoring)), $(info NEW $(1) $($(1)_VERSION) --> $(2)) $(if $(findstring undefined, $(origin UPDATE_DRYRUN)), $(SED) -i 's/^\([^ ]*_VERSION *:=\).*/\1 $(2)/' '$($(1)_MAKEFILE)' $(MAKE) -f '$(MAKEFILE)' 'update-checksum-$(1)' \ || { $(SED) -i 's/^\([^ ]*_VERSION *:=\).*/\1 $($(1)_VERSION)/' '$($(1)_MAKEFILE)'; \ exit 1; }))), $(info Unable to update version number of package $(1) \ $(newline)$(newline)$($(1)_UPDATE)$(newline))) endef update: $(foreach PKG,$(PKGS),\ $(and $($(PKG)_UPDATE),$(call UPDATE,$(PKG),$(shell $($(PKG)_UPDATE))))) update-package-%: $(if $(call set_is_member,$*,$(PKGS)), \ $(and $($*_UPDATE),$(call UPDATE,$*,$(shell $($*_UPDATE)))), \ $(error Package $* not found)) @echo -n check-update-package-%: UPDATE_DRYRUN = true check-update-package-%: update-package-% ; update-checksum-%: MXE_NO_BACKUP_DL = true update-checksum-%: SKIP_CHECHSUM = true update-checksum-%: $(if $(call set_is_member,$*,$(PKGS)), \ $(call DOWNLOAD_PKG_ARCHIVE,$*) && \ $(SED) -i 's/^\([^ ]*_CHECKSUM *:=\).*/\1 '"`$(call PKG_CHECKSUM,$*)`"'/' '$($*_MAKEFILE)', \ $(error Package $* not found))