#!/usr/bin/make -f

LC_ALL:=C.UTF-8
export LC_ALL

%:
	dh $@ --with phpcomposer --with apache2

execute_after_dh_auto_clean:
	-rm -f public/scripts/movim_emojis_list.js

execute_before_dh_auto_build:
	php -d debian=build daemon.php emojisToJson

override_dh_install:
	dh_install
	# remove files only of use for development
	rm -f \
	    debian/*/usr/share/movim/locales/update*.sh \
	    debian/*/usr/share/php/Movim/Emoji/compile-file-list.sh \
	    debian/*/usr/share/php/Movim/Emoji/replace-test.php \
	    debian/*/usr/share/php/Movim/Emoji/test-all-images.sh
	# remove files replaced later
	rm -rf debian/*/usr/share/movim/public/theme/fonts/OpenSans
	#rm -rf debian/*/usr/share/movim/public/theme/fonts/MaterialIcons
	cd debian/*/usr/share/movim/public/theme/fonts/MaterialIcons && \
	    rm -f LICENSE README.md
	# handle one of these replacements
	mkdir -p debian/movim/usr/share/movim/public/theme/fonts/OpenSans
	install -c -m 644 debian/opensans/font.css \
	    debian/movim/usr/share/movim/public/theme/fonts/OpenSans/
