#!/usr/bin/make -f

LC_ALL:=C
export LC_ALL

override_dh_clean:
	dh_clean
	rm -f FluidR3Mono_GM.sf?

icop:=Copyright (c) Frank Wen, Michael Cowgill, and others; see ICMT chunk or Debian fluidr3mono-gm-soundfont for entire terms and the MIT licence
ieng:=Mono version by Church Organist
override_dh_auto_build:
	LC_ALL=C.UTF-8; export LC_ALL; set -- FluidR3Mono_GM*.SF2; \
	    cmt=$$(sed '1,/^Licence:$$/d' debian/copyright | sed 1d; echo x); \
	    python3 debian/riffedit.py "$$1" FluidR3Mono_GM.sf2 \
	    -az 'LIST<INFO>/INAM' "$${1%2}3" \
	    -az 'LIST<INFO>/ICOP' '${icop}' \
	    -az 'LIST<INFO>/IENG' '${ieng}' \
	    -az 'LIST<INFO>/ICMT' "$${cmt%x}"
	sf3convert -S 0 -q 0.8 -a -1 -z \
	    FluidR3Mono_GM.sf2 FluidR3Mono_GM.sf3

override_dh_installchangelogs:
	dh_installchangelogs FluidR3MonoChangeLog.txt

override_dh_builddeb:
	dh_builddeb -- -Zxz -z8 -Sextreme --no-uniform-compression

%:
	dh $@
