#!/usr/bin/make -f

# No parallel builds on mipsel
PARALLEL :=
ifneq (,$(filter $(DEB_HOST_ARCH), mipsel))
    PARALLEL := --no-parallel
endif

%:
	dh $@ --buildsystem R $(PARALLEL)

override_dh_gencontrol:
	tmbversion=`dpkg -l r-cran-tmb | grep 'ii' | sed 's/^.*r-cran-tmb[[:space:]]\+\([0-9.-]\+\)[[:space:]]\+.*/\1/'`; \
	sed -i "s/r-cran-tmb[^,]*/r-cran-tmb (>= $${tmbversion})/" debian/*substvars
	dh_gencontrol

#	This is to strict - see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1055922#68
#	sed -i "s/r-cran-tmb[^,]*/r-cran-tmb (>= $${tmbversion}), r-cran-tmb (< $${tmbversion}99)/" debian/*substvars
