#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2009 Adrian Knoth <adi@drcomp.erfurt.thur.de>
# Copyright © 2010 Jonas Smedegaard <dr@jones.dk>
# Description: Main Debian packaging script for calf
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA.

ifneq (,$(DEB_MAINTAINER_MODE))
  # Enable stuff not policy compliant (eg. unsuitable for build daemons)
  DEB_COPYRIGHT_CHECK_STRICT = yes
  DEB_AUTO_UPDATE_DEBIAN_CONTROL = yes
endif
include debian/cdbs/1/rules/upstream-tarball.mk
include debian/cdbs/1/rules/copyright-check.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include debian/cdbs/1/rules/buildinfo.mk

DEB_UPSTREAM_URL = http://downloads.sourceforge.net/calf

# Avoid useless linking
LDFLAGS += -Wl,--as-needed

# put aside upstream-shipped temp files during build but after copyright-check
upstreamtmpfiles = calf.desktop
pre-build:: debian/stamp-upstreamtmpstuff
debian/stamp-upstreamtmpstuff: debian/stamp-copyright-check
	for file in $(upstreamtmpfiles); do \
		[ ! -e $$file ] || [ -e $$file.upstream ] || mv $$file $$file.upstream; \
	done
	touch $@
clean::
	for file in $(upstreamtmpfiles); do \
		[ ! -e $$file.upstream ] || mv -f $$file.upstream $$file; \
	done
	rm -f debian/stamp-upstreamtmpstuff

# Needed by upstream build process
#  * ALSA is optional upstream and only available on some archs
#    (potentially varying, so we resolve list in maintainer builds)
#  * libjack-dev 0.105 recommended (better MIDI) but not required
CDBS_BUILD_DEPENDS += , libglib2.0-dev, libgtk2.0-dev (>= 2.8), libglade2-dev (>= 2.4), libreadline-dev, libexpat1-dev
CDBS_BUILD_DEPENDS += , libasound2-dev [`sh debian/pkgarchs.sh libasound2-dev`]
CDBS_BUILD_DEPENDS += , ladspa-sdk, dssi-dev, libjack-dev (>= 0.103.0), liblash-dev (>= 0.5.2), lv2core

# Needed for our packaging
#  * devscript needed by pkgarchs.sh (only really needed for maintainer
#    builds, but adding always as it won't hurt and avoids confusion)
CDBS_BUILD_DEPENDS += , devscripts

# Resolve, cleanup and apply CDBS-declared dependencies
include debian/cdbs/1/rules/package-relations.mk
