#!/usr/bin/make -f
# Copyright © 2012 Jonas Smedegaard <dr@jones.dk>

# sample htaccess file is not shipped with main tarball
get-htaccess:
	wget -O debian/htaccess.txt http://www.ideocentric.com/files/download/htaccess.txt

BUILD := debian/http-icons/usr/share/images/http-icons
override_dh_auto_install:
	mkdir -p $(BUILD)/small; \
	set -e; for img in *.gif small/*.gif; do \
		giftopnm --alphaout=$(BUILD)/$$img.alpha $$img > $(BUILD)/$$img.pnm; \
		ppmtogif -sort -alpha=$(BUILD)/$$img.alpha $(BUILD)/$$img.pnm > $(BUILD)/$$img; \
		rm -f $(BUILD)/$$img.alpha $(BUILD)/$$img.pnm; \
	done
	find . -maxdepth 1 -name '*.png' \! -name 'blank.png' -exec optipng -nx -force {} -dir $(BUILD) {} \;
	optipng -nx -force -out $(BUILD)/blank.png blank.gif
	optipng -nx -force -dir $(BUILD)/small small/*.png
	cp -p README $(BUILD)/README.txt
	cp -p small/README.txt $(BUILD)/small/

%:
	dh $@
