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

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

export DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)

ifeq ($(DEB_HOST_ARCH_OS), linux)
        linuxflags += --with-alsa
endif

unexport HOME

PKGDIR:=$(CURDIR)/debian/vice

override_dh_auto_configure:
	./configure \
		--prefix=/usr \
		--infodir=/usr/share/info \
		--mandir=/usr/share/man \
		--enable-html-docs \
		--enable-pdf-docs \
		--enable-native-gtk3ui \
		--enable-x64 \
		--disable-parsid \
		--enable-hardsid \
		--with-resid \
		--enable-arch=no \
		--enable-x64-image \
		--with-png \
		--with-jpeg \
		--enable-lame \
		--disable-ffmpeg \
		--enable-rs232 \
		--enable-ipv6 \
		--with-oss \
		$(linuxflags) \
		--with-pulse \
		--without-libcurl \
		--enable-cpuhistory \
		--enable-realdevice \
		--verbose

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

override_dh_installinfo:
	dh_installinfo
	rm -rf $(PKGDIR)/usr/share/info/

override_dh_compress:
	dh_compress -X.pdf

%:
	dh $@

.PHONY: override_dh_auto_configure override_dh_install \
	override_dh_installinfo override_dh_compress