#!/usr/bin/make -f
# -*- makefile -*-
# Package building rules for the SimGrid Debian Package.
# Strongly inspirated from the sample debhelper file, originally written by Joey Hess and Craig Small.
# Adapted to SimGrid by Lucas Nussbaum and Martin Quinson.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh  $@

# -Dprefix needed because SimGrid doesn't use CMAKE_INSTALL_PREFIX
override_dh_auto_configure:
	dh_auto_configure -Scmake -- \
		-Dprefix=/usr

# FIXME renable tests at some point
override_dh_auto_test:
	dh_auto_test || true

# FIXME do not generate the manpage manually once it's fixed upstream
override_dh_auto_build:
	dh_auto_build
	pod2man tools/simgrid_update_xml.pl > doc/simgrid_update_xml.1

override_dh_auto_clean:
	dh_auto_clean
	rm -f doc/simgrid_update_xml.1 # FIXME: kill me once manpage generation is done properly upstream

override_dh_auto_install:
	dh_auto_install
	chrpath -d debian/simgrid/usr/bin/graphicator
	chrpath -d debian/simgrid/usr/bin/gras_stub_generator
	chrpath -d debian/simgrid/usr/bin/tesh
	# move doc to correct place
	mkdir -p debian/simgrid/usr/share/doc/simgrid
	mv debian/simgrid/usr/doc/simgrid/* debian/simgrid/usr/share/doc/simgrid/
	rm -rf debian/simgrid/usr/doc
	# remove cruft introduced in 3.6~rc3
	rm -r debian/simgrid/usr/tools
