#!/usr/bin/make -f

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

%:
	dh "$@" --with autoreconf

override_dh_autoreconf:
# Deal with embedded stuff
	find doc/ -maxdepth 1 -type d -exec ln -sf /usr/share/texmf/tex/texinfo/texinfo.tex '{}/' \;
# Deal with emscripten placeholder
	cp debian/giac.js doc/giac.js
# Deal with french documentation
	cp -a debian/upstream-doc-fr doc/fr
	mv doc/fr/Makefile.am.Debian doc/fr/Makefile.am
# Actually configure
	dh_autoreconf

override_dh_install:
	rm -f debian/tmp/usr/lib/*/libgiac.la
	rm -f debian/tmp/usr/include/giac/config.h
	dh_install --fail-missing

override_dh_fixperms-indep:
	dh_fixperms
	find debian/giac-doc/usr/share/giac/examples/ \
	  \( -name '*.cas' -o -name '*.xws' -o -name '*.cxx' \) -exec chmod -x '{}' \;
	chmod -x debian/giac-doc/usr/share/giac/examples/lewisw/*_?var
