#!/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=system \
 	--with-midi=system \
 	--with-portaudio=system \
 	--with-portsmf=system \
	--with-sbsms=local \
 	--with-soundtouch=system \
 	$(NULL)

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

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(configure_flags)

# tests fails with system portaudio
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
