File: rules

package info (click to toggle)
sugar-toolkit-gtk3 0.112-3
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 5,184 kB
  • sloc: python: 12,700; ansic: 8,195; sh: 4,241; makefile: 362
file content (141 lines) | stat: -rwxr-xr-x 5,879 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright 2012, 2015-2017 Jonas Smedegaard <dr@jones.dk>
# 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 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/>.

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

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

# TODO: convince upstream to install headers, and provide proper -dev package
stem = sugarext
pkgbranch = $(subst $(space),.,$(wordlist 1, 2,$(subst .,$(space),$(DEB_UPSTREAM_VERSION))))
abi = 0
lib = lib$(stem)
pkg-lib = lib$(stem)$(abi)
pkg-dev = lib$(stem)-dev
pkg-gir = gir1.2-$(stem)-1.0
pkg-data = lib$(stem)-data
#pkg-bin = sugar-activity
pkg-bin = python-sugar3
pkg-python = python-sugar3

# Adapt packaging in maintainer mode when targeting experimental branch:
#  * Switch git packaging branch
#  * Track any release (else only current branch)
ifneq (,$(DEB_MAINTAINER_MODE))
watch-limit = $(if $(DEB_SUITE_EXP),,$(pkgbranch)\\.)
debian-branch = $(if $(DEB_SUITE_EXP),master,master-$(pkgbranch))
clean::
	perl -i -pe 's/\([\d.\\]*\.\*\)/($(watch-limit).*)/' \
		debian/watch
	perl -i -pe 's/^debian-branch *= *\K.*/$(debian-branch)/' \
		debian/gbp.conf
endif

# Needed by upstream build process
#  * linux-libc-dev/hurd-dev needed by sugar-fatattr
dev-bdeps = gtk-3 gdk-pixbuf2.0 sm ice rsvg2 xfixes xi x11
bdeps = $(patsubst %,$(comma) lib%-dev,$(dev-bdeps))
bdeps +=, gettext, intltool, libxml-parser-perl, x11proto-core-dev
bdeps +=, libasound2-dev | libasound-dev, libgirepository1.0-dev
bdeps +=, linux-libc-dev [linux-any], hurd-dev [hurd-any]

# Needed (always/often/seldom) at runtime
#  * Carquinol used in sugar3.datastore.*
#  * Jarabe used in sugar3.graphics.popwindow
#  * alsa-utils (mayby still) needed to unmute devices at boot (bug#581504)
#  * shared-mime-info (update-mime-database) used in sugar.bundle.bundlebuilder
#  * unzip used in sugar3.bundle.bundle
#  * git used in sugar3.activity.bundlebuilder
#  * gstreamer1.0-espeak used in sugar3.speech
#  * gstreamer1.0-plugins-good (autoaudiosink) used in sugar3.speech
# TODO: relax dependencies for our own GIR when its API is stable
gir-deps = glib-2.0 gtk-3.0 gdkpixbuf-2.0 pango-1.0 rsvg-2.0 atspi-2.0
python-deps = gi gi-cairo dbus cairo telepathy dateutil decorator
depends = $(patsubst %,$(comma) python-%,$(python-deps))
depends +=, $(patsubst %,$(comma) gir1.2-%,$(gir-deps))
depends +=, gir1.2-sugarext-1.0 (>= $(DEB_VERSION))
depends +=, gir1.2-sugarext-1.0 (<< $(DEB_VERSION).1~)
depends-dev = $(pkg-gir) (= $(DEB_VERSION))
depends-gir = $(pkg-lib) (= $(DEB_VERSION))
recommends = unzip, telepathy-mission-control-5, alsa-utils
recommends +=, telepathy-salut, shared-mime-info
recommends +=, gir1.2-webkit2-4.0
recommends +=, gir1.2-webkit2-4.0 | gir1.2-webkit-3.0
recommends +=, gstreamer1.0-espeak, gstreamer1.0-plugins-good
suggests = git, ipython
suggests +=, python-jarabe, python-carquinyol

CDBS_BUILD_DEPENDS +=, $(bdeps)
CDBS_DEPENDS_$(pkg-python) +=, $(depends)
CDBS_DEPENDS_$(pkg-dev) = $(depends-dev)
CDBS_DEPENDS_$(pkg-gir) = $(depends-gir)
CDBS_RECOMMENDS_$(pkg-python) = $(recommends)
CDBS_SUGGESTS_$(pkg-python) = $(suggests)

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

# 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_ALL = --autodest
DEB_DH_INSTALL_ARGS_$(pkg-python) = usr/bin usr/lib/python*
DEB_DH_INSTALL_ARGS_$(pkg-gir) = usr/lib/$(DEB_HOST_MULTIARCH)/girepository-1.0
DEB_DH_INSTALL_ARGS_$(pkg-data) = usr/share/locale

# Drop created dir if empty to please lintian
binary-post-install/$(pkg-data)::
	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.59~)
binary-post-install/$(pkg-lib):: debian/stamp-local-shlibs-$(lib)
# the --override s/libfribidi0-dev/libfribidi-dev/ below is needed to
# address https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=895235
debian/stamp-local-shlibs-$(lib): binary-install/$(pkg-lib)
	d-shlibmove --commit \
		--multiarch \
		--exclude-la --exclude-a \
		--devunversioned --ignorelibdep \
		--movedev debian/tmp/usr/share/gir-1.0 usr/share/ \
		--extralib debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libsugar-eventcontroller.so \
		--override s/libfribidi0-dev/libfribidi-dev/ \
		debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/$(lib).so
	touch $@
clean::
	rm -f debian/stamp-local-shlibs-$(lib)

# Ensure proper hash-bang in Python script (Python Policy 0.9 ยง3.1)
#  * TODO: drop cdbs_python_binary fallback when cdbs 0.5 is stable
binary-fixup/$(pkg-python)::
	egrep -r -l -Z '^#! ?/usr/bin/(env )?python[[:print:]]*$$' \
		debian/$(cdbs_curpkg)/usr/bin/* \
		| xargs -r -0 perl -pi -e 's,^#! ?/usr/bin/(env )?python[[:print:]]*$$,#!/usr/bin/$(strip $(or $(cdbs_curpythonruntime),$(cdbs_python_binary))),'

# Fix favor ISO 639-1 when differing from ISO 639-2
binary-post-install/$(pkg-data)::
	mv debian/$(cdbs_curpkg)/usr/share/locale/ibo \
		debian/$(cdbs_curpkg)/usr/share/locale/ig