#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2015-2016 Jonas Smedegaard <dr@jones.dk>
# Description: Main Debian packaging script for gst-plugins-espeak
#
# 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

CDBS_BUILD_DEPENDS +=, autoconf-archive
include /usr/share/cdbs/1/rules/autoreconf.mk

pkg = gstreamer1.0-espeak

DEB_UPSTREAM_PACKAGE = $(DEB_SOURCE_PACKAGE)
DEB_UPSTREAM_URL = https://download.sugarlabs.org/sources/honey/$(DEB_UPSTREAM_PACKAGE)

# Needed by upstream build process
bdeps = libgstreamer1.0-dev, libgstreamer-plugins-base1.0-dev
bdeps +=, libespeak-ng-libespeak-dev | libespeak-dev

CDBS_BUILD_DEPENDS +=, $(bdeps)

# optimize linking
LDFLAGS += -Wl,-O1
# disallow undefined symbols
LDFLAGS += -Wl,-z,defs
# link only when needed
LDFLAGS += -Wl,--as-needed

DEB_CONFIGURE_EXTRA_FLAGS += --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)

# Remove .la file
binary-post-install/$(pkg)::
	find $(cdbs_curdestdir)/usr -type f -name '*.la' -delete
