#!/bin/zsh
DO=$0
main() {
	args url! filename sha256sum
	rebuild-if-refetch
	eval $(getvars)

	local scheme rest filename
	scheme=${url%%:*}
	rest=/${${${url#*:}#/}#/}
	filename=${DO:h:a}/downloads/${scheme}${rest:a}
	setvar filename $filename

	wget --timestamping --force-directories --protocol-directories -P downloads $url \
		|| die "Failed to fetch ${(qqq)url}"
	dep_add_file $filename sha256sum
}
. ./common.zsh
# vim: fileencoding=utf8 ft=zsh noet sw=4 ts=4 sts=4