#!/usr/bin/make -f
%:
	dh $@ --with phpcomposer

PHP_VERSION=$(shell phpquery -V | head -1)

execute_after_dh_clean:
	# https://github.com/RSS-Bridge/rss-bridge/issues/2435
	chmod -x ./bridges/BukowskisBridge.php ./bridges/GiphyBridge.php ./bridges/ThePirateBayBridge.php

execute_after_dh_install:
	install -d -o www-data -g www-data $(CURDIR)/debian/rss-bridge/var/cache/rss-bridge
	mkdir -p $(CURDIR)/debian/rss-bridge/usr/share/doc/rss-bridge/examples
	sed -e 's/@PHP_VERSION@/$(PHP_VERSION)/' \
	  < debian/nginx.conf.in > $(CURDIR)/debian/rss-bridge/usr/share/doc/rss-bridge/examples/nginx.conf
	cp whitelist.default.txt $(CURDIR)/debian/rss-bridge/etc/rss-bridge

override_dh_fixperms:
	dh_fixperms --exclude /var/cache/rss-bridge
