#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2010 Jonas Smedegaard <dr@jones.dk>
# Description: Main Debian packaging script for Hydrogen
#
# 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 debian/cdbs/1/class/scons.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include debian/cdbs/1/rules/buildinfo.mk

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

DEB_SCONS_OPTIONS = libarchive=1 portaudio=1 portmidi=1 lash=1 prefix=/usr
DEB_SCONS_OPTIONS += optflags="$(CXXFLAGS)"

DEB_SCONS_INSTALL_OPTIONS = DESTDIR=$(DEB_DESTDIR)

DEB_INSTALL_EXAMPLES_hydrogen = extra/serverTools

imgstub = data/img/gray/h2-icon
common-build-arch::
	#inkscape -z -e$(imgstub).png -D -w32 -h32 --export-area-snap $(imgstub).svg
	rsvg -w32 -h32 $(imgstub).svg $(imgstub).png
	pngtopnm -alpha $(imgstub).png > $(imgstub).alpha.pgm
	pngtopnm $(imgstub).png | ppmtoxpm -alphamask=$(imgstub).alpha.pgm > $(imgstub).xpm
	rm -f $(imgstub).png $(imgstub).alpha.pgm
clean::
	rm -f $(imgstub).xpm

clean::
	rm -f qt4.pyc version.cpp config.h scache.conf
	rm -rf scons_cache

# Needed by upstream build process
CDBS_BUILD_DEPENDS += , docbook-utils, libqt4-dev, libz-dev, pkg-config, libarchive-dev
CDBS_BUILD_DEPENDS += , libasound2-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386]
CDBS_BUILD_DEPENDS += , libaudiofile-dev, libjack-dev, liblrdf-dev, libsndfile1-dev, libflac++-dev, libflac-dev (>= 1.1.1-3), portaudio19-dev, libportmidi-dev, liblash-dev

# Needed for our packaging
CDBS_BUILD_DEPENDS += , librsvg2-bin, netpbm

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