#!/usr/bin/make -f

#Rodney Dawes Version simplifies things :)

DH_CMAKE_BUILD_DIR=obj	-${DEB_BUILD_GNU_TYPE}
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_HOST_ARCH      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_ARCH_OS   ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)

CMAKE_OPTS=
ifneq ($(DEB_HOST_ARCH_OS),linux)
CMAKE_OPTS+= -DWANT_ALSA=0
endif

ifeq ($(DEB_HOST_ARCH),i386)
WINE_PATH := /usr/lib/$(DEB_HOST_MULTIARCH)/wine
CMAKE_OPTS+= -DWINE_CXX_FLAGS="-Wl,--enable-new-dtags,-rpath=$(WINE_PATH) -lstdc++"
else
CMAKE_OPTS+= -DWANT_VST_NOWINE=1 \
	-DREMOTE_VST_PLUGIN_FILEPATH=../../i386-linux-gnu/lmms/RemoteVstPlugin
endif

%:
	dh $@ --buildsystem cmake

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_INSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) $(CMAKE_OPTS)
