#!/usr/bin/make -f
#export DH_VERBOSE=1

ifeq (ia64, $(shell dpkg-architecture -qDEB_BUILD_ARCH))
	export DH_RUBY_IGNORE_TESTS=all
endif

# Uncomment to ignore some test failures (but the tests will run anyway).
# Valid values:
#export DH_RUBY_IGNORE_TESTS=ruby1.8 ruby1.9.1 require-rubygems
#
# If you need to specify the .gemspec (eg there is more than one)
#export DH_RUBY_GEMSPEC=gem.gemspec

DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
ifneq (,$(filter $(DEB_HOST_ARCH),arm64))
  export DH_RUBY_IGNORE_TESTS=ruby1.8 ruby1.9.1 require-rubygems
endif

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

platform_dir := debian/ruby-ffi/usr/lib/ruby/vendor_ruby/ffi/platform

override_dh_auto_install:
	# fix for #679782 - can be dropped in the next upstream release that has
	# https://github.com/ffi/ffi/pull/269 merged
	test -d lib/ffi/platform/i486-gnu && \
		mkdir -p $(platform_dir) && \
		ln -s i486-gnu $(platform_dir)/i386-gnu
	#
	dh_auto_install

override_dh_auto_clean:
	dh_auto_clean
	rm -rf build/
