#!/usr/bin/make -f

export GEM2DEB_TEST_RUNNER = --check-dependencies
export DH_RUBY = --gem-install
export DH_RUBY_GEM_INSTALL_EXCLUDE = pages/*

%:
	dh $@ --buildsystem=ruby --with ruby

override_dh_installchangelogs:
	dh_installchangelogs CHANGELOG.md -O--buildsystem=ruby

execute_before_dh_auto_install:
	for r in $$(ruby -rruby_debian_dev -e 'puts RubyDebianDev::SUPPORTED_RUBY_VERSIONS.values'); do \
                dh_install ext/oj/oj.h $$($$r -e 'puts RbConfig::CONFIG["vendorhdrdir"]+"/oj/"'); \
                dh_install ext/oj/cache8.h $$($$r -e 'puts RbConfig::CONFIG["vendorhdrdir"]+"/oj/"'); \
                dh_install ext/oj/rxclass.h $$($$r -e 'puts RbConfig::CONFIG["vendorhdrdir"]+"/oj/"'); \
                dh_install ext/oj/parser.h $$($$r -e 'puts RbConfig::CONFIG["vendorhdrdir"]+"/oj/"'); \
                dh_install ext/oj/buf.h $$($$r -e 'puts RbConfig::CONFIG["vendorhdrdir"]+"/oj/"'); \
                dh_install ext/oj/usual.h $$($$r -e 'puts RbConfig::CONFIG["vendorhdrdir"]+"/oj/"'); \
                dh_install ext/oj/mem.h $$($$r -e 'puts RbConfig::CONFIG["vendorhdrdir"]+"/oj/"'); \
	done
