#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DEB_CMAKE_PREFIX = /usr
BASE_CMAKE_DEFS = -DKDE_INSTALL_BINDIR=$(DEB_CMAKE_PREFIX)/bin -Wno-dev -DWITH_FFMPEG=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo

%:
	dh $@ --parallel --builddirectory=kid3-build

override_dh_auto_configure:
	dh_auto_configure -- \
		-DSYSCONF_INSTALL_DIR=/etc \
		-DCMAKE_INSTALL_PREFIX=$(DEB_CMAKE_PREFIX) \
		$(BASE_CMAKE_DEFS) \
		-DLIB_INSTALL_DIR=$(DEB_CMAKE_PREFIX)/lib/kid3 \
		-DCMAKE_C_FLAGS="$(CFLAGS)" \
		-DCMAKE_CXX_FLAGS="$(CXXFLAGS)"

override_dh_auto_build:
	dh_auto_build
	cp kid3-build/doc/en/kid3.1 kid3-build/doc/en/kid3-core.1
	cp kid3-build/doc/de/kid3.1 kid3-build/doc/de/kid3-core.de.1

override_dh_auto_install:
	dh_auto_install

override_dh_install:
	dh_install
	-sed '/This file was auto-generated by:/,+1 d' -i \
		$(CURDIR)/debian/kid3-core/usr/lib/kid3/plugins/imports/Kid3/plugins.qmltypes

override_dh_makeshlibs:
	dh_makeshlibs --noscripts

override_dh_compress:
	dh_compress --exclude=.docbook
