#!/usr/bin/make -f

DISTRIBUTION = $(shell lsb_release -sr)
VERSION = 1.34
PACKAGEVERSION = $(VERSION)-0~$(DISTRIBUTION)0
URL = https://github.com/valeriansaliou/bloom/releases/download/$(VERSION)/

%:
		dh $@ --with systemd

override_dh_auto_clean:
override_dh_auto_test:
override_dh_auto_build:
override_dh_auto_install:
		$(eval ENV_ARCH := $(shell dpkg --print-architecture))
		$(eval ENV_TARBALL := v$(VERSION)-$(ENV_ARCH).tar.gz)

		echo "Architecture: $(ENV_ARCH)"
		echo "Target: $(URL)$(ENV_TARBALL)"

		wget -N --progress=dot:mega $(URL)$(ENV_TARBALL)
		tar -xf $(ENV_TARBALL)
		strip bloom/bloom
		mv bloom/config.cfg bloom/bloom.cfg

override_dh_gencontrol:
		dh_gencontrol -- -v$(PACKAGEVERSION)
