#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all reproducible=+all future=+lfs
# Needed to inject correctly the python versions supported
export PYBUILD_SYSTEM=cmake
export PYBUILD_CONFIGURE_ARGS=-DPYVER={version} \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_SKIP_INSTALL_RPATH=ON \
		-DDART_SKIP_FLANN=ON \
		-DDART_SKIP_PAGMO=ON \
		-DDART_VERBOSE=ON \
		-DDARTPY_PYTHON_VERSION={version}

ifneq (,$(filter $(DEB_HOST_ARCH),mips mipsel))
  export DEB_CXXFLAGS_MAINT_APPEND += -g1
endif

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_auto_install:
	rm -f debian/tmp/usr/share/doc/dart/data/screencap/.KEEP

execute_before_dh_auto_test:
	PYBUILD_BUILD_ARGS="tests" dh_auto_build

ifneq (,$(filter $(DEB_BUILD_ARCH),i386))
override_dh_auto_test:
	 dh_auto_test --no-parallel
endif

override_dh_compress:
	dh_compress \
            -X.hpp -X.h -X.c -X.cpp \
            -X.dae -X.obj -X.stl -X.STL \
            -X.sdf -X.skel -X.urdf -X.vsk -X.world \
            -X.c3d -X.changelog -X.dof -X.path -X.tris

execute_before_dh_link:
	jdupes -rl debian/dart-doc/usr