#!/usr/bin/make -f

%:
	dh $@

override_dh_auto_configure:
	#debian/check-upstream-versus-debian
	dh_auto_configure -- $(shell dpkg-buildflags --export=configure)

ruby_versions = $(shell dh_ruby --print-supported)

.PHONY: $(ruby_versions)

override_dh_auto_install: $(ruby_versions)
	dh_auto_install

$(ruby_versions):
	debian/build $@

override_dh_strip:
	for i in $$(sed -n '/Package: ruby-.*-dbg/ { s/Package: \(.*\)-dbg/\1/ p }' debian/control) ; do \
		dh_strip -p$$i --dbg-package=$$i-dbg ; \
	done
	dh_strip

override_dh_fixperms-arch:
	dh_fixperms
	# Remove executable flag from some examples that aren't actually executable.
	chmod -x debian/ruby-glib2/usr/share/doc/ruby-glib2/examples/type-register*.rb
	chmod -x debian/ruby-gtk2/usr/share/doc/ruby-gtk2/examples/misc/properties.rb
	chmod -x debian/ruby-gtk3/usr/share/doc/ruby-gtk3/examples/misc/properties.rb

override_dh_compress:
	dh_compress -X.rb

override_dh_shlibdeps:
	dh_shlibdeps
	dh_ruby_fixdepends
