debian swirl logo

Back to the packages list sugar-toolkit-gtk3

#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright 2012 Jonas Smedegaard 
# Description: Main Debian packaging script for sugar-toolkit-gtk3
#
# 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 .

DEB_BUILDDIR = build
include /usr/share/cdbs/1/rules/upstream-tarball.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/cdbs/1/class/python-autotools.mk
include /usr/share/cdbs/1/rules/debhelper.mk

# TODO: convince upstream to install headers, and provide proper -dev package
stem = sugarext
abi = 0
lib = lib$(stem)
libpkg = lib$(stem)$(abi)
devpkg = lib$(stem)-dev
girpkg = gir1.2-$(stem)-1.0
datapkg = lib$(stem)-data
#binpkg = sugar-activity
binpkg = python-sugar3
pythonpkg = python-sugar3

DEB_UPSTREAM_URL = http://download.sugarlabs.org/sources/sucrose/glucose/$(DEB_UPSTREAM_PACKAGE)
DEB_UPSTREAM_TARBALL_EXTENSION = tar.bz2

# Multiarch quirks
# (unneeded since Wheezy: can be dropped after Wheezy+1)
CDBS_PREDEPENDS_$(libpkg) = $(if $(DEB_HOST_MULTIARCH),multiarch-support)
DEB_CONFIGURE_EXTRA_FLAGS += --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)

#DEB_AUTOMAKE_ARGS = --add-missing --copy

# Needed by upstream build process
CDBS_BUILD_DEPENDS += , libgtk-3-dev, libgdk-pixbuf2.0-dev, libsm-dev
CDBS_BUILD_DEPENDS += , libice-dev, libasound2-dev | libasound-dev
CDBS_BUILD_DEPENDS += , librsvg2-dev, python-gtk2-dev
CDBS_BUILD_DEPENDS += , libgirepository1.0-dev (>= 1.30.0)
CDBS_BUILD_DEPENDS += , gettext, intltool, libxml-parser-perl
CDBS_BUILD_DEPENDS += , gir1.2-gconf-2.0, libgconf2-dev

# Needed (always/often/seldom) at runtime
#  * telepathy-* versioning follows http://wiki.sugarlabs.org/go/0.90/Notes
#  * zip, git and subversion are used in .xo format packaging routines
CDBS_DEPENDS_$(pythonpkg) = python-gi, python-dbus, python-cairo, python-telepathy, python-dateutil
gir-deps = glib-2.0 gtk-3.0 gconf-2.0 gdkpixbuf-2.0 pango-1.0 rsvg-2.0 sugarext-1.0
CDBS_DEPENDS_$(pythonpkg) += , $(patsubst %,$(comma) gir1.2-%,$(gir-deps))
CDBS_RECOMMENDS_$(pythonpkg) = unzip, telepathy-mission-control-5 (>= 1:5.6)
CDBS_RECOMMENDS_$(pythonpkg) += , telepathy-gabble (>= 0.10), telepathy-salut (>= 0.4)
CDBS_SUGGESTS_$(pythonpkg) = git-core, subversion, ttf-dejavu-extra

# Binary sugar-activity moved from sugar-tools-* to python-sugar3
# (unneeded since Wheezy: can be dropped after Wheezy+1)
non-gtk3-branches = 0.84 0.86 0.88 0.90 0.92 0.94
sugar-tools-old = $(foreach ver,$(non-gtk3-branches),$(comma) sugar-tools-$(ver))
CDBS_CONFLICTS_$(binpkg) = $(sugar-tools-old)
CDBS_REPLACES_$(binpkg) = $(sugar-tools-old)

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

DEB_DH_INSTALL_ARGS_$(girpkg) = usr/lib/$(DEB_HOST_MULTIARCH)/girepository-1.0 usr/lib
DEB_DH_INSTALL_ARGS_$(datapkg) = usr/share/locale

DEB_DH_INSTALL_ARGS_$(libpkg) += usr/lib/$(DEB_HOST_MULTIARCH)/libsugar-eventcontroller.so.0.0.0
DEB_DH_LINK_$(libpkg) += usr/lib/$(DEB_HOST_MULTIARCH)/libsugar-eventcontroller.so.0.0.0 usr/lib/$(DEB_HOST_MULTIARCH)/libsugar-eventcontroller.so.0
DEB_DH_LINK_$(devpkg) += usr/lib/$(DEB_HOST_MULTIARCH)/libsugar-eventcontroller.so.0.0.0 usr/lib/$(DEB_HOST_MULTIARCH)/libsugar-eventcontroller.so

# Drop created dir if empty to please lintian
binary-post-install/$(datapkg)::
		rmdir --ignore-fail-on-non-empty --parents $(DEB_DESTDIR)/usr/share/locale

# Let d-shlibs calculate development package dependencies
#  and handle shared library install
CDBS_BUILD_DEPENDS += , d-shlibs (>= 0.48)
binary-post-install/$(libpkg):: debian/stamp-local-shlibs-$(lib)
debian/stamp-local-shlibs-$(lib): binary-install/$(libpkg) debian/stamp-local-strip-la
		d-shlibmove --commit \
			--multiarch \
			--exclude-la --exclude-a \
			--override s/libcairo-gobject2-dev/libcairo-dev/ \
			--override s/libgdk-3-0-dev/libgtk-3-dev/ \
			--override s/libgtk-3-0-dev/libgtk-3-dev/ \
			--override s/librsvg-2-2-dev/librsvg2-dev/ \
			--override s/libgconf-2-4-dev/libgconf2-dev/ \
			--devunversioned --ignorelibdep \
			--movedev debian/tmp/usr/share/gir-1.0 usr/share/ \
			debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/$(lib).so
		touch $@
clean::
		rm -f debian/stamp-local-shlibs-$(lib)

# avoid unneeded .la file
binary-post-install/$(pythonpkg):: debian/stamp-local-strip-la
debian/stamp-local-strip-la: binary-install/$(pythonpkg)
		find debian -type f -name '*.la' -delete
		touch $@
clean::
		rm -f debian/stamp-local-strip-la

Builds:

gir1.2-sugarext-1.0
gtk3-based sugar toolkit - gobject introspection
libsugarext0
gtk3-based sugar toolkit - runtime library
libsugarext-data
gtk3-based sugar toolkit - common files
libsugarext-dbg
gtk3-based sugar toolkit - debugging symbols
libsugarext-dev
gtk3-based sugar toolkit - develelopment files
python-sugar3
gtk3-based sugar toolkit - python bindings