#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2009, 2010, 2011, 2012 Jonas Smedegaard <dr@jones.dk>
# Description: Main Debian packaging script for Pinot
#
# 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, see <http://www.gnu.org/licenses/>.

-include /usr/share/cdbs/1/rules/upstream-tarball.mk
include /usr/share/cdbs/1/rules/autoreconf.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/debhelper.mk

pkg = $(DEB_SOURCE_PACKAGE)

DEB_UPSTREAM_URL = http://pinot-search.googlecode.com/files
DEB_UPSTREAM_TARBALL_MD5 = b35fa660ac25d842b4ca7d9ca9ab54ad

# Limit linking to actually used libs
LDFLAGS += -Wl,--as-needed
# Fix FTBFS with GCC5: https://bugs.debian.org/778063
CXXFLAGS += -std=gnu++11

DEB_DH_MAKESHLIBS_ARGS = -Xusr/lib/pinot

binary-fixup/pinot::
	chmod a+x $(CURDIR)/debian/$(cdbs_curpkg)/usr/share/pinot/*.sh

binary-install/pinot::
	dh_icons

# Needed by upstream build
lib-bdeps = curl4-openssl xapian boost exttextcat tag1 sqlite3 xml++2.6
lib-bdeps += dbus-glib-1 sigc++-2.0 glib2.0 ssl glibmm-2.4 gtkmm-2.4 attr1
bdeps = $(patsubst %,$(comma) lib%-dev,$(lib-bdeps))
bdeps +=, libgmime-2.6-dev | libgmime-2.4-dev
bdeps +=, libexiv2-dev (>= 0.18~)
bdeps +=, shared-mime-info, desktop-file-utils

# Needed (always/often) at runtime
depends = dbus-x11
recommends = antiword, catdoc, catdvi, djvulibre-bin
recommends +=, poppler-utils, unrtf, unzip, python-docutils, bzip2
suggests = file, rpm

CDBS_BUILD_DEPENDS +=, $(bdeps)
CDBS_DEPENDS_$(pkg) = $(depends)
CDBS_RECOMMENDS_$(pkg) = $(recommends)
CDBS_SUGGESTS_$(pkg) = $(suggests)
