File: rules

package info (click to toggle)
gtk+2.0 2.24.32-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 128,080 kB
  • sloc: ansic: 574,621; makefile: 5,197; sh: 4,500; xml: 1,193; python: 1,119; perl: 749; awk: 72; cpp: 34
file content (313 lines) | stat: -rwxr-xr-x 10,688 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
#!/usr/bin/make -f

# Debian GNOME Maintainers
DISABLE_UPDATE_UPLOADERS := 1
include /usr/share/gnome-pkg-tools/1/rules/uploaders.mk
include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

GNOME_MODULE := gtk+

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

STAMP_DIR := debian/stampdir

PATCH_DIR := debian/patches

# rules in this debian/rules Makefile can be built concurrently as well as
# upstream rules in Makefile; all $(MAKE) invocations will inherit this flag,
# if you recurse into debian/rules ($(MAKE)
# -f debian/rules in rules), you need to pass a flag to avoid adding "-jX" when
# the childs encounters this line
DEB_BUILD_OPTIONS_PARALLEL ?= $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
PARALLEL_FLAGS += $(if $(DEB_BUILD_OPTIONS_PARALLEL),-j$(DEB_BUILD_OPTIONS_PARALLEL))

DEB_BUILD_OPTIONS += multiarch
# relative libdir
ifneq (,$(findstring multiarch,$(DEB_BUILD_OPTIONS)))
LIBDIR := usr/lib/$(DEB_HOST_MULTIARCH)
else
LIBDIR := usr/lib
endif

# ppc64 support; see #386815
ifeq ($(DEB_HOST_GNU_CPU),powerpc64)
	CFLAGS += -mminimal-toc
endif

# default CFLAGS; these can be expanded with $(call flavor_get, )
CFLAGS += -Wall -g -O$(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),0,2)

# default LDFLAGS; these can be expanded with $(call flavor_get, )
# currently fails in the cups gtkprint backend
#LDFLAGS += -Wl,-z,defs

APIVER := 2.0
SONAME := 0
SHVER := 2.24.0

# earliest version that this release has backwards binary compatibility for
GTK_BINARY_VERSION := 2.10.0

# Gtk binary version virtual Provide
GTK_BINVER_DEP := gtk$(APIVER)-binver-$(GTK_BINARY_VERSION)

# relative base directory for all types of modules
MODULES_BASE_PATH := $(LIBDIR)/gtk-$(APIVER)/$(GTK_BINARY_VERSION)
OLD_MODULES_BASE_PATH := usr/lib/gtk-$(APIVER)/$(GTK_BINARY_VERSION)

# package names
SHARED_PKG := libgtk$(APIVER)-$(SONAME)
COMMON_PKG := libgtk$(APIVER)-common
DEV_PKG := libgtk$(APIVER)-dev
UDEB_PKG := $(SHARED_PKG)-udeb
DOC_PKG := libgtk$(APIVER)-doc
BIN_PKG := libgtk$(APIVER)-bin
EXAMPLES_PKG := gtk$(APIVER)-examples
PIXBUF_PKG := gtk2-engines-pixbuf

# package groups, used in rule dependencies and in cleanup
BINARY_INDEP_PKGS := $(COMMON_PKG) $(DOC_PKG) libgail-doc
BINARY_ARCH_PKGS := $(SHARED_PKG) $(BIN_PKG) $(UDEB_PKG) $(DEV_PKG) $(EXAMPLES_PKG) $(PIXBUF_PKG) gir1.2-gtk-2.0 libgail18 libgail18-udeb libgail-dbg libgail-dev libgail-common
ALL_PKGS := $(BINARY_INDEP_PKGS) $(BINARY_ARCH_PKGS)

# list of flavors we build; each gets a builddir, a configure pass (configure
# args are defined below), a build pass, and an install pass (in two steps)
# Note: the shared flavor is required
FLAVORS := shared shared_udeb static

# current flavor we're building; this is only expanded in flavor specific
# targets
current_flavor = $*

# macro to get a value for the current flavor we're building; for example
# when building the shared flavor, $(call flavor_get,CFLAGS) will expand to
# shared_CFLAGS if it's set or to CFLAGS otherwise; pay attention to not adding
# superflous spaces when for the arguments of $(call ); only some vars can
# be expanded in this way though
flavor_get = $(or $($(current_flavor)_$(1)),$($(1)))

# build dir for the current flavor; this is only expanded in flavor specific
# targets
builddir = $(buildbasedir)/$(current_flavor)
buildbasedir = $(CURDIR)/debian/build

# install dir for the current flavor; this is only expanded in flavor specific
# targets
installdir = $(installbasedir)/$(current_flavor)
installbasedir = $(CURDIR)/debian/install

# configure flags
configure_flags := \
			--prefix=/usr \
			--libdir=/$(LIBDIR) \
			--mandir=\$${prefix}/share/man \
			--infodir=\$${prefix}/share/info \
			--sysconfdir=/etc \
			--enable-test-print-backend \
			--enable-introspection=no \
			--with-xinput=yes \
			--build=$(DEB_BUILD_GNU_TYPE)
ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	configure_flags += --host=$(DEB_HOST_GNU_TYPE)
endif

shared_configure_flags := $(configure_flags) \
			--enable-shared \
			--enable-introspection \
			--enable-man \
			--disable-static
shared_udeb_configure_flags := $(configure_flags) \
			--enable-shared \
			--disable-static \
			--disable-introspection \
			--disable-xcomposite \
			--disable-xdamage \
			--disable-xfixes \
			--disable-xrandr
static_configure_flags := $(configure_flags) \
			--with-included-loaders=yes \
			--disable-modules \
			--disable-shared \
			--enable-static

# list of flavors to run the test suite on
CHECK_FLAVORS := $(filter shared static, $(FLAVORS))

DH_INSTALLDOCS_FILES := NEWS README AUTHORS

# macro computing the list of 'debian/<pkg>.*" files which have a corresponding
# ".in" file; pass the list of packages in $(1)
dh_subst_files = $(patsubst %.in,%,$(wildcard $(addprefix debian/, $(addsuffix *.in, $(1)))))

# Gruik gruik generation of .devhelp files for the FAQ and tutorial
debian/gtk-%.devhelp: docs/%/html/index.html
	gawk -f debian/gruik2devhelp.awk -v name=gtk-$* $< > $@
devhelpfiles: debian/gtk-faq.devhelp debian/gtk-tutorial.devhelp

debian/dh_gtkmodules.1: debian/dh_gtkmodules
	cd debian && pod2man -c "Gtk" -r "$(DEB_VERSION)" dh_gtkmodules dh_gtkmodules.1

patch: $(STAMP_DIR)/patch-stamp

$(STAMP_DIR)/patch-stamp:
	dh_testdir
	mkdir $(STAMP_DIR)
	mkdir -p m4
	cp /usr/share/gtk-doc/data/gtk-doc.make .
	dh_autoreconf
	touch $@

$(STAMP_DIR)/configure-stamp-%: $(STAMP_DIR)/patch-stamp
	dh_testdir
	mkdir -p $(builddir)
	cd $(builddir) && \
		CFLAGS="$(call flavor_get,CFLAGS)" \
		LDFLAGS="$(call flavor_get,LDFLAGS)" \
			$(CURDIR)/configure $(call flavor_get,configure_flags)
	touch $@

configure: $(addprefix $(STAMP_DIR)/configure-stamp-, $(FLAVORS))

.NOTPARALLEL: $(addprefix $(STAMP_DIR)/build-stamp-, $(FLAVORS))
$(STAMP_DIR)/build-stamp-%: $(STAMP_DIR)/configure-stamp-%
	dh_testdir
	LD_LIBRARY_PATH=$(builddir)/gtk/.libs:$(builddir)/gdk/.libs:$(LD_LIBRARY_PATH) \
		$(MAKE) $(PARALLEL_FLAGS) -C $(builddir)
	touch $@

build-arch: $(addprefix $(STAMP_DIR)/build-stamp-, $(FLAVORS))
build-indep: $(addprefix $(STAMP_DIR)/build-stamp-, shared)
build: build-arch build-indep

$(STAMP_DIR)/check-stamp-%: $(STAMP_DIR)/build-stamp-%
	dh_testdir
	# setting LD_LIBRARY_PATH for "make check" might be needed in the
	# future, but doesn't seem necessary right now
	#LD_LIBRARY_PATH=$(builddir)/gtk/.libs:$(builddir)/gdk/.libs:$(LD_LIBRARY_PATH)
	# testsuite failures are ignored
	-$(MAKE) -C $(builddir) check
	touch $@

check: $(addprefix $(STAMP_DIR)/check-stamp-, $(CHECK_FLAVORS))

$(STAMP_DIR)/install-stamp-%: $(STAMP_DIR)/build-stamp-%
	mkdir -p $(installdir)
	$(MAKE) -C $(builddir) install \
		DESTDIR=$(installdir)
	touch $@

install-arch: $(addprefix $(STAMP_DIR)/install-stamp-, $(FLAVORS))
install-indep: $(addprefix $(STAMP_DIR)/install-stamp-, shared)

# gross kludge to force control generation with the %.in target
clean::
	touch debian/control.in

debian/%: debian/%.in
	dh_testdir
	sed \
		-e "s#@SONAME@#$(SONAME)#g" \
		-e "s#@APIVER@#$(APIVER)#g" \
		-e "s#@VERSION@#$(DEB_VERSION_UPSTREAM)#g" \
		-e "s#@GTK_BINVER_DEP@#$(GTK_BINVER_DEP)#g" \
		-e "s#@SHARED_PKG@#$(SHARED_PKG)#g" \
		-e "s#@COMMON_PKG@#$(COMMON_PKG)#g" \
		-e "s#@DEV_PKG@#$(DEV_PKG)#g" \
		-e "s#@UDEB_PKG@#$(UDEB_PKG)#g" \
		-e "s#@DOC_PKG@#$(DOC_PKG)#g" \
		-e "s#@BIN_PKG@#$(BIN_PKG)#g" \
		-e "s#@EXAMPLES_PKG@#$(EXAMPLES_PKG)#g" \
		-e "s#@PIXBUF_PKG@#$(PIXBUF_PKG)#g" \
		-e "s#@GNOME_TEAM@#$(UPLOADERS)#g" \
		-e "s#@GTK_BINARY_VERSION@#$(GTK_BINARY_VERSION)#g" \
		-e "s#@LIBDIR@#$(LIBDIR)#g" \
		-e "s#@MODULES_BASE_PATH@#$(MODULES_BASE_PATH)#g" \
		-e "s#@OLD_MODULES_BASE_PATH@#$(OLD_MODULES_BASE_PATH)#g" \
		$@.in \
		> $@

clean:: debian/control
	dh_testdir
	dh_testroot
	# remove install and build dirs
	rm -rf $(installbasedir)
	rm -rf $(buildbasedir)
	dh_autoreconf_clean
	rm -f gtk-doc.make
	rm -f debian/*.devhelp
	-rm -rf $(STAMP_DIR)
	-rm -f $(call dh_subst_files,$(ALL_PKGS))
	-rm -f debian/dh_gtkmodules debian/dh_gtkmodules.1
	dh_clean

maybe_check = $(if $(findstring nocheck,$(DEB_BUILD_OPTIONS)),,check)

binary-indep: build-indep install-indep $(call dh_subst_files,$(BINARY_INDEP_PKGS)) devhelpfiles
	dh_testdir
	dh_testroot
	dh_install -i
	# changelog.gz symlinks will be overwritten by dh_link
	dh_installchangelogs -i -XChangeLog
	# do not merge the calls: dh_installdocs will only install some files
	# in the first package
	dh_installdocs -p$(COMMON_PKG) $(DH_INSTALLDOCS_FILES)
	dh_installdocs -p$(DOC_PKG) -X.in $(DH_INSTALLDOCS_FILES)
	# install copyright in all packages; the -p is for the special behavior
	# of dh_installdocs (ship README.Debian etc. in the first package)
	dh_installdocs -p$(COMMON_PKG) -X.in -i
	dh_installman -i
	dh_link -i
	dh_compress -i -X.sgml -X.devhelp
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i -- -Zxz

binary-arch: build-arch $(maybe_check) install-arch $(call dh_subst_files,$(BINARY_ARCH_PKGS)) debian/dh_gtkmodules debian/dh_gtkmodules.1
	dh_testdir
	dh_testroot
	dh_install -s
	# changelog.gz symlinks will be overwritten by dh_link
	dh_installchangelogs -s -XChangeLog
	# install copyright in all packages; the -p is for the special behavior
	# of dh_installdocs (ship README.Debian etc. in the first package)
	dh_installdocs -p$(PIXBUF_PKG) -s
	dh_installman -s
	dh_installexamples -s
	dh_link -s
	dh_strip -s --dbgsym-migration="libgtk2.0-0-dbg (<< 2.24.31-3~)" -N$(UDEB_PKG) -Nlibgail18 -Nlibgail18-udeb -Nlibgail-common
	dh_strip -plibgail18 -plibgail-common --dbgsym-migration="libgail-dbg (<< 2.24.31-3~)"
	dh_strip -p$(UDEB_PKG) -plibgail18-udeb
	dh_compress -s -X.sgml -X.devhelp
	dh_fixperms -s -X$(LIBDIR)/$(SHARED_PKG)
	dh_makeshlibs -p$(SHARED_PKG) \
		-X$(MODULES_BASE_PATH) \
		-V"$(SHARED_PKG) (>= $(SHVER))" \
		--add-udeb=$(UDEB_PKG) \
		-- -c4
	dh_makeshlibs -plibgail18 \
		-X$(MODULES_BASE_PATH) \
		-V"libgail18 (>= $(SHVER))" \
		--add-udeb=libgail18-udeb \
		-- -c4
	dh_girepository -pgir1.2-gtk-2.0
	dh_installdeb -s
	dh_shlibdeps -p$(PIXBUF_PKG) -- -xlibgtk2.0-0
	# --remaining-packages didn't work right so let's at least make sure
	# it doesn't run a second time for the pixbuf .so
	dh_shlibdeps --remaining-packages -Xlibpixmap.so
	dh_gencontrol -s
	dh_md5sums -s
	dh_builddeb -s -- -Zxz

list-missing:
	perl -w debian/dh_listmissing.pl $(foreach f,$(FLAVORS),$(subst $(CURDIR)/,,$(installbasedir))/$(f)) 2>&1 | \
	    egrep -v '(\.la|$(LIBDIR)/gtk-2.0/$(GTK_BINARY_VERSION)/[^/]+/[^/]+\.a) has been installed' >&2

binary: binary-indep binary-arch
.PHONY: patch configure build build-indep build-arch check install clean binary binary-indep binary-arch list-missing devhelpfiles