#!/usr/bin/make -f

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

ifneq ($(DEB_HOST_ARCH_OS),linux)
	CONFIGURE_FLAGS += --disable-alsa
endif

%:
	dh $@ --parallel --with=autoreconf,python2

override_dh_auto_configure:
	dh_auto_configure -- $(CONFIGURE_FLAGS)

override_dh_auto_build:
	dh_auto_build
	$(MAKE) docs

override_dh_fixperms:
	dh_fixperms
ifneq (,$(findstring python-ecasound, $(shell dh_listpackages)))
	chmod a-x debian/python-ecasound/usr/share/pyshared/pyeca.py
	chmod a-x debian/python-ecasound/usr/share/pyshared/ecacontrol.py
	chmod a-x debian/python-ecasound/usr/share/pyshared/eci.py
endif
ifneq (,$(findstring ruby-ecasound, $(shell dh_listpackages)))
	chmod a-x debian/ruby-ecasound/usr/lib/ruby/vendor_ruby/ecasound.rb
endif

override_dh_installchangelogs:
	dh_installchangelogs NEWS

override_dh_auto_test:
	TERM=xterm LD_LIBRARY_PATH=$(CURDIR)/libecasoundc/.libs dh_auto_test
