#!/usr/bin/make -f
include /usr/share/dpkg/architecture.mk
export DEB_LDFLAGS_MAINT_APPEND=-Wl,-z,defs -Wl,--as-needed
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

configure_flags := \
	--disable-dynamic-loading \
	--with-expat=system \
	--with-ffmpeg=system \
	--with-lame=system \
	--with-libflac=system \
	--with-libid3tag=system \
	--with-libmad=system \
	--with-libsndfile=system \
	--with-libsoxr=system \
	--with-libtwolame=system \
	--with-libvamp=system \
	--with-libvorbis=system \
	--with-lv2=local \
	--with-midi=system \
	--with-portaudio=system \
	--with-sbsms=local \
	--with-portsmf=system \
	--with-soundtouch=system \
	$(NULL)

ifeq ($(DEB_HOST_ARCH_CPU),amd64)
    configure_flags += --enable-sse=yes
else
    configure_flags += --enable-sse=no
endif

%:
	dh $@ --parallel --with autoreconf

override_dh_auto_configure:
	dh_auto_configure -- $(configure_flags)

# The tests fail to build as of version 2.0.6
override_dh_auto_test:

override_dh_auto_install:
	dh_auto_install
	# Don't package unnecessary copy of GPL
	rm debian/tmp/usr/share/doc/audacity/LICENSE.txt
