#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1

ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
    MEDIATOMB_DEBUG_OPTIONS += --enable-debug-malloc0 \
			--enable-tombdebug \
			--enable-upnpdebug \
			--enable-debug-log
endif

# Implement a MEDIATOMB_CONFIG_OPTIONS variable that sets the default configure
# options and allow it to be overridden.
# Use DEB_HOST_ARCH_OS from dpkg-architecture to determine OS we're building
# for.
export DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
ifeq (linux,$(DEB_HOST_ARCH_OS))
   ENABLE_INOTIFY = --enable-inotify
endif
MEDIATOMB_CONFIG_OPTIONS ?= --enable-sqlite3 \
			--enable-mysql \
			--disable-libjs \
			--enable-libmagic \
			$(ENABLE_INOTIFY) \
			--enable-libexif \
			--enable-taglib \
			--enable-ffmpeg \
			--enable-ffmpegthumbnailer \
			--enable-external-transcoding \
			--enable-curl \
			--enable-youtube \
			--enable-db-autocreate \
			--disable-id3lib \
			--disable-libmp4v2 \
			--disable-lastfm \
			$(MEDIATOMB_DEBUG_OPTIONS)

override_dh_auto_configure:
	dh_auto_configure -- $(MEDIATOMB_CONFIG_OPTIONS) --disable-silent-rules

override_dh_installinit:
	dh_installinit --name=mediatomb 

override_dh_installlogrotate:
	dh_installlogrotate --name=mediatomb

override_dh_strip:
	dh_strip --dbg-package=mediatomb-dbg

%:
	dh $@ --with autoreconf,systemd

get-orig-source:
	sh debian/get-git-source.sh

.PHONY: get-orig-source
