#!/usr/bin/make -f

DEB_BUILD_GNU_TYPE      := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE       := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
  PERL_VER := $(shell perl -MConfig -e'print "$$Config{version}\n"')
  export PERL5LIB=/usr/$(DEB_HOST_GNU_TYPE)/lib/perl/$(PERL_VER)

  ifneq (true,$(shell [ -f $(PERL5LIB)/Config.pm -a -f $(PERL5LIB)/Config_heavy.pl ] && echo true))
    $(error Config.pm & Config_heavy.pl for cross building not found in $(PERL5LIB))
  endif
endif

%:
	dh $@

# The generated ${perl:Depends} must be on perl-base and not perl as the
# package is part of the base system
override_dh_perl:
	dh_perl -d

