#!/usr/bin/make -f
%:
	dh $@ --with autoreconf

override_dh_auto_configure:
	dh_auto_configure -- --enable-opengl-render

override_dh_auto_test:
	-HOME=$$PWD dh_auto_test

override_dh_auto_clean:
	dh_auto_clean
	rm -fr .starpu

# Switch to main rules
main:
	sed -i 's/starpu-contrib/starpu/' debian/changelog
	sed -i '1s/^Source: starpu-contrib/Source: starpu/' debian/control
	sed -i 's/Package: libstarpu-contrib/Package: libstarpu/' debian/control
	sed -i 's/Package: starpu-contrib/Package: starpu/' debian/control
	sed -i 's/Depends: libstarpu-contrib/Depends: libstarpu/' debian/control
	sed -i 's/Conflicts: libstarpu/Conflicts: libstarpu-contrib/' debian/control
	sed -i 's/Conflicts: starpu/Conflicts: starpu-contrib/' debian/control
	sed -i 's/^Architecture: amd64 i386/Architecture: any/' debian/control
	sed -i 's/^	nvidia-cuda-toolkit,/#	nvidia-cuda-toolkit,/' debian/control
	sed -i 's/^	libcuda1,/#	libcuda1,/' debian/control
	sed -i 's_^Section: contrib/_Section: _' debian/control
	sed -i 's/contrib-contrib/contrib/g' debian/control debian/changelog

# Switch to contrib rules
contrib:
	sed -i '1s/^starpu /starpu-contrib /' debian/changelog
	sed -i '1s/^Source: starpu/Source: starpu-contrib/' debian/control
	sed -i 's/Package: libstarpu/Package: libstarpu-contrib/' debian/control
	sed -i 's/Package: starpu/Package: starpu-contrib/' debian/control
	sed -i 's/Depends: libstarpu/Depends: libstarpu-contrib/' debian/control
	sed -i 's/Conflicts: libstarpu-contrib/Conflicts: libstarpu/' debian/control
	sed -i 's/Conflicts: starpu-contrib/Conflicts: starpu/' debian/control
	sed -i 's/^Architecture: any/Architecture: amd64 i386/' debian/control
	sed -i 's/#	nvidia-cuda-toolkit,/	nvidia-cuda-toolkit,/' debian/control
	sed -i 's/#	libcuda1,/	libcuda1,/' debian/control
	sed -i 's_^Section: _Section: contrib/_' debian/control
	sed -i 's_contrib/contrib/_contrib_g' debian/control debian/control
	sed -i 's/contrib-contrib/contrib/g' debian/control debian/changelog
