#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
MODPLUG_DEV_LIBDIR = debian/libopenmpt-modplug-dev/usr/lib/$(DEB_HOST_MULTIARCH)

%:
	dh $@

.PHONY: build
build:
	dh $@

override_dh_autoreconf:
	dh_autoreconf --as-needed

override_dh_auto_configure:
	dh_auto_configure -- --disable-static --without-ltdl --enable-libopenmpt_modplug

override_dh_installchangelogs:
	dh_installchangelogs libopenmpt/dox/changelog.md

override_dh_install:
	dh_install
	mkdir -p $(MODPLUG_DEV_LIBDIR)/pkgconfig
	sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/' debian/libmodplug.pc.in > $(MODPLUG_DEV_LIBDIR)/pkgconfig/libmodplug.pc
	ln -s libopenmpt_modplug.so $(MODPLUG_DEV_LIBDIR)/libmodplug.so
