#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2009, 2012, 2015-2016 Jonas Smedegaard <dr@jones.dk>
# Description: Main Debian packaging script for icon-slicer
#
# 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 3, 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/utils.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/cdbs/1/rules/debhelper.mk

pkg = $(DEB_SOURCE_PACKAGE)
cmd = $(pkg)

DEB_UPSTREAM_URL = http://freedesktop.org/software/$(pkg)/releases
#DEB_UPSTREAM_TARBALL_MD5 = e9997dd73ad5af43aadd49ac89105b33

# Needed by upstream build process
deps = libgtk2.0-dev, libpopt-dev

# Needed for our packaging
deps +=, help2man

# Needed both at build time and (always) at runtime
#  * x11-apps (xcursorgen) needed by icon-slider binary
depends = x11-apps

CDBS_BUILD_DEPENDS +=, $(deps), $(depends)
CDBS_DEPENDS_DEFAULT = $(depends)

DEB_COPYRIGHT_EXTRACT_EXTS = png

LDFLAGS += -Wl,--as-needed

DEB_INSTALL_EXAMPLES_$(pkg) = examples/sample* examples/Sample

# generate manpage based on --help of script itself
DEB_INSTALL_MANPAGES_$(pkg) = debian/$(cmd).1
common-post-build-arch:: debian/$(cmd).1
debian/$(cmd).1: src/$(cmd)
	chmod +x $<
	help2man --name="utility for generating icon themes and libXcursor cursor themes" --no-info --output=$@ $<
clean::
	rm -f debian/$(cmd).1
