#!/usr/bin/make -f
# -*- makefile -*-

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

unexport HOME

PKGDIR:=$(CURDIR)/debian/vice

override_dh_auto_configure:
	./configure \
		--prefix=/usr --infodir=/usr/share/info \
		--mandir=/usr/share/man \
		--enable-gnomeui \
		--enable-fullscreen --disable-parsid --with-midas \
		--with-resid \
		--without-uithreads \
		--without-xaw3d \
		--enable-arch=no \
		--enable-fullscreen \
		--enable-vte \
		--with-jpeg \
		--enable-lame \
		--with-oss \
		--with-alsa \
		--with-pulse

override_dh_install:
	dh_install
	# remove extra licence file
	rm -f $(PKGDIR)/usr/lib/vice/doc/COPYING
	rm -rf $(PKGDIR)/usr/share/info/
	# remove ROM 'dummy' placeholders
	find $(PKGDIR)/usr/lib/vice -size 6c -exec rm {} \;
	# remove duplicated documentation
	rm -rf $(PKGDIR)/usr/lib/vice/doc/
	ln -sf vice_toc.html $(PKGDIR)/usr/share/doc/vice/html/index.html
	ln -sf ../../share/doc/vice/html $(PKGDIR)/usr/lib/vice/doc

 .PHONY: build
 build:
	# These files in the original source are not used
	rm -f configure configure.ac

	sed "s/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/g" \
		< configure.proto > configure.ac

	dh $@ --with autoreconf

%:
	dh $@ --with autoreconf

.PHONY: override_dh_auto_configure override_dh_install
