summaryrefslogtreecommitdiff
path: root/debian/rules
blob: d5dd5f709639a744fc2fd621958c8ad924c9e735 (plain)
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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
#!/usr/bin/make -f

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

GNOME_MODULE := glib

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)))
MAKEFLAGS += $(if $(DEB_BUILD_OPTIONS_PARALLEL),-j$(DEB_BUILD_OPTIONS_PARALLEL))

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

# Debian architectures
DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB_HOST_ARCH  ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

CFLAGS += -Wall -DMAEMO_CHANGES -g -O$(if $(findstring noopt,$(DEB_BUILD_OPTIONS)),0,2)

# Ensure the build aborts when there are still references to undefined
# symbols
LDFLAGS += -Wl,-z,defs

# Make the linker work a bit harder so dynamic loading can be done faster
LDFLAGS += -Wl,-O1

APIVER := 2.0
SONAME := 0
SHVER := 2.23.1

# package names
SHARED_PKG := libglib$(APIVER)-$(SONAME)
DATA_PKG := libglib$(APIVER)-data
DEV_PKG := libglib$(APIVER)-dev
DOC_PKG := libglib$(APIVER)-doc
DEBUG_PKG := $(SHARED_PKG)-dbg

# 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 "deb" flavor is required
FLAVORS := deb

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

# list of arches on which testsuite failures are fatal
# XXX testsuite failures currently disabled as testsuite fails everywhere when
# $HOME isn't writable
CHECK_SUPPORTED_ARCHES :=
# CHECK_SUPPORTED_ARCHES := alpha amd64 i386 ia64 lpia m68k s390
# testsuite is known to fail on hppa, hurd, kfreebsd-amd64, kfreebsd-i386; see
# Debian #428674
# testsuite is known to fail on arm, mips, mipsel, powerpc, sparc; see GNOME #481573

# build dir for the current flavor; this is only expanded in flavor specific
# targets
# Note: dh_clean will rm -rf debian/tmp, hence all builds
builddir = $(buildbasedir)/$*
buildbasedir = $(CURDIR)/debian/build

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

# configure flags
common_configure_flags := \
			--prefix=/usr \
			--mandir=\$${prefix}/share/man \
			--infodir=\$${prefix}/share/info \
			--with-html-dir=\$${prefix}/share/doc/$(DOC_PKG) \
			--with-pcre=internal \
			--disable-fam

ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	common_configure_flags += --build=$(DEB_BUILD_GNU_TYPE)
else
	common_configure_flags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
endif
deb_configure_flags := $(common_configure_flags) 

$(STAMP_DIR)/patch-stamp:
	dh_testdir
	# backup the original files to restore them in the clean target
	-test -r config.sub && cp config.sub config.sub.orig
	-test -r config.guess && cp config.guess config.guess.orig
	# apply patches
	QUILT_PATCHES=$(PATCH_DIR) \
		quilt --quiltrc /dev/null push -a || test $$? = 2
	-test -r /usr/share/misc/config.sub && \
		cp -f /usr/share/misc/config.sub config.sub
	-test -r /usr/share/misc/config.guess && \
		cp -f /usr/share/misc/config.guess config.guess
	-mkdir -p $(STAMP_DIR)
	autoreconf -f -i
	touch $@

patch: $(STAMP_DIR)/patch-stamp

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

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

$(STAMP_DIR)/build-stamp-%: $(STAMP_DIR)/configure-stamp-%
	dh_testdir
	LD_LIBRARY_PATH=$(builddir)/glib/.libs:$(builddir)/gmodule/.libs:$(builddir)/gobject/.libs:$(builddir)/gthread/.libs:$(LD_LIBRARY_PATH) \
		$(MAKE) -C $(builddir)
	touch $@

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

maybe_ignore_check_failure = $(if $(filter ,$(CHECK_SUPPORTED_ARCHES)),-)

$(STAMP_DIR)/check-stamp-%: $(STAMP_DIR)/build-stamp-%
	dh_testdir
ifeq ($(filter $(DEB_BUILD_ARCH),$(CHECK_SUPPORTED_ARCHES)),$(DEB_BUILD_ARCH))
	# testsuite failures are fatal
	LD_LIBRARY_PATH=$(builddir)/glib/.libs:$(builddir)/gmodule/.libs:$(builddir)/gobject/.libs:$(builddir)/gthread/.libs:$(LD_LIBRARY_PATH) \
		$(MAKE) -k -C $(builddir) check
else
	# testsuite failures are ignored
	-LD_LIBRARY_PATH=$(builddir)/glib/.libs:$(builddir)/gmodule/.libs:$(builddir)/gobject/.libs:$(builddir)/gthread/.libs:$(LD_LIBRARY_PATH) \
		$(MAKE) -k -C $(builddir) check
endif
	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: $(addprefix $(STAMP_DIR)/install-stamp-, $(FLAVORS))

debian/control:
	dh_testdir
	sed \
		-e "s#@SONAME@#$(SONAME)#g" \
		-e "s#@APIVER@#$(APIVER)#g" \
		-e "s#@VERSION@#$(VERSION)#g" \
		-e "s#@SHARED_PKG@#$(SHARED_PKG)#g" \
		-e "s#@DATA_PKG@#$(DATA_PKG)#g" \
		-e "s#@DEV_PKG@#$(DEV_PKG)#g" \
		-e "s#@DOC_PKG@#$(DOC_PKG)#g" \
		-e "s#@DEBUG_PKG@#$(DEBUG_PKG)#g" \
		-e "s#@GNOME_TEAM@#$(UPLOADERS)#g" \
		$@.in >$@

clean:: debian/control
	dh_testdir
	dh_testroot
	# remove install and build dirs
	rm -rf $(installbasedir)
	rm -rf $(buildbasedir)
	# restore files from backup (before unpatching)
	-test -r config.sub.orig && mv -f config.sub.orig config.sub
	-test -r config.guess.orig && mv -f config.guess.orig config.guess
	# unapply patches, if any
	QUILT_PATCHES=$(PATCH_DIR) \
		quilt --quiltrc /dev/null pop -a -R || test $$? = 2
	-rm -rf .pc
	-rm -rf $(STAMP_DIR)
	dh_clean

ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
# maemo: testsuite hangs sb; investigate
maybe_check = 
# maybe_check = $(if $(findstring nocheck,$(DEB_BUILD_OPTIONS)),,check)
else
# can't run the testsuite when cross-compiling
maybe_check =
endif

binary-indep: build $(maybe_check) install
	dh_testdir
	dh_testroot
	dh_install -i
	dh_installchangelogs -i -N$(DATA_PKG) ChangeLog
	dh_installdocs -N$(DATA_PKG) -i NEWS README
	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

binary-arch: build $(maybe_check) install
	dh_testdir
	dh_testroot
	dh_install -s
	# empty the dependency_libs in the *.la files
	sed -i -e "/dependency_libs/ s/'.*'/''/" debian/$(DEV_PKG)/usr/lib/*.la
	dh_installchangelogs -s -N$(DEV_PKG) -N$(DEBUG_PKG) \
		ChangeLog
	dh_installdocs -s -N$(DEV_PKG) -N$(DEBUG_PKG) NEWS README
	dh_link -s
	dh_strip -s --dbg-package=$(DEBUG_PKG)
	dh_compress -s -X.sgml -X.devhelp
	dh_fixperms -s
	dh_makeshlibs	-p$(SHARED_PKG) \
			-V "$(SHARED_PKG) (>= $(SHVER))" \
			 -- -c4
	dh_installdeb -s
	# override shlibs for libraries from this source before computing
	# dependencies of packages generated from this source; we already have
	# inter-dependencies expressed manually in the control file, we do not
	# need the shlibs to add duplicates
	sed -nr -e 's/(([^ ]+: )?([^ ]+) ([^ ]+)) .*/\1/p' \
		debian/*/DEBIAN/shlibs \
		>debian/shlibs.local
	dh_shlibdeps -s -ldebian/$(SHARED_PKG)/usr/lib
	-rm -f debian/shlibs.local
	dh_gencontrol -s
	dh_md5sums -s
	dh_builddeb -s

binary: binary-indep binary-arch
.PHONY: patch configure build check install clean binary-indep binary-arch binary debian/control
#!/usr/bin/make -f

# debian/rules file for CVS glib1.1 Debian package
# based on glib+ debian/rules file
# written April 1998 by Ben Gertzfield <che@debian.org>

build: build-stamp
build-stamp:
	dh_testdir
	./autogen.sh --prefix=/usr
	$(MAKE)
	touch build-stamp

build-dbg: build-dbg-stamp
build-dbg-stamp:
	dh_testdir
	./configure --prefix=/usr --enable-debug=yes
	$(MAKE)
	touch build-dbg-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp build-dbg-stamp install-stamp install-dbg-stamp
	# Add here commands to clean up after the build process.
	-$(MAKE) clean
	-$(MAKE) distclean
	find . -name '*.o' -o -name '_libs' -o -name '*.lo' -o -name '*.a' -o -name '.deps' | xargs rm -rf
	dh_clean

clean-dbg:
	dh_testdir
	dh_testroot
	rm -f build-stamp build-dbg-stamp install-stamp install-dbg-stamp
	# Add here commands to clean up after the build process.
	-$(MAKE) clean
	-$(MAKE) distclean
	find . -name '*.o' -o -name '_libs' -o -name '*.lo' -o -name '*.a' -o -name '.deps' | xargs rm -rf
	dh_clean -k

install: install-stamp
install-stamp: build
	dh_testdir
	dh_testroot
	dh_clean
	$(MAKE) prefix=`pwd`/debian/tmp/usr install
	touch install-stamp

install-dbg: install-dbg-stamp
install-dbg-stamp: build-dbg
	dh_testdir
	dh_testroot
	dh_clean -k
	$(MAKE) prefix=`pwd`/debian/libglib-cvs-dbg/usr install
	touch install-dbg-stamp

# Build architecture-independent files here.
binary-indep: 
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install libglib-cvs-dev libglib-cvs-1.1 libglib-cvs-dbg

libglib-cvs-1.1: build
	dh_testdir -plibglib-cvs-1.1 
	dh_testroot -plibglib-cvs-1.1
	dh_installdirs -plibglib-cvs-1.1
	# Add here commands to install the files into debian/tmp
	rm -rf debian/tmp/usr/bin debian/tmp/usr/include debian/tmp/usr/info debian/tmp/usr/lib/glib debian/tmp/usr/share debian/tmp/usr/man debian/tmp/usr/lib/*.la
	dh_installdocs -plibglib-cvs-1.1
	dh_installchangelogs -plibglib-cvs-1.1
	dh_strip -plibglib-cvs-1.1
	dh_compress -plibglib-cvs-1.1
	dh_fixperms -plibglib-cvs-1.1
	dh_installdeb -plibglib-cvs-1.1
	dh_shlibdeps -plibglib-cvs-1.1
	dh_gencontrol -plibglib-cvs-1.1
	dh_makeshlibs -plibglib-cvs-1.1 -V 'libglib-cvs-1.1 (='`cat debian/version`')'
	dh_md5sums -plibglib-cvs-1.1
	dh_builddeb -plibglib-cvs-1.1

libglib-cvs-dev: build
	dh_testdir -plibglib-cvs-dev
	dh_testroot -plibglib-cvs-dev
	dh_clean -plibglib-cvs-dev -k
	dh_installdirs -plibglib-cvs-dev
	# Add here commands to install the files into debian/tmp
	dh_movefiles -plibglib-cvs-dev
	cp glib-config debian/tmp/usr/bin
	dh_installdocs -plibglib-cvs-dev 
	dh_undocumented -plibglib-cvs-dev glib-config.1
	dh_installchangelogs -plibglib-cvs-dev
	dh_strip -plibglib-cvs-dev
	dh_compress -plibglib-cvs-dev
	dh_fixperms -plibglib-cvs-dev
	dh_installdeb -plibglib-cvs-dev
	dh_shlibdeps -plibglib-cvs-dev
	dh_gencontrol -plibglib-cvs-dev
	dh_md5sums -plibglib-cvs-dev
	dh_builddeb -plibglib-cvs-dev

libglib-cvs-dbg: clean-dbg install-dbg
	dh_testdir -plibglib-cvs-dbg
	dh_testroot -plibglib-cvs-dbg
	dh_installdirs -plibglib-cvs-dbg
	# Add here commands to install the files into debian/libglib-cvs-dbg
	rm -rf debian/libglib-cvs-dbg/usr/bin debian/libglib-cvs-dbg/usr/include debian/libglib-cvs-dbg/usr/info debian/libglib-cvs-dbg/usr/lib/glib debian/libglib-cvs-dbg/usr/man debian/libglib-cvs-dbg/usr/share debian/libglib-cvs-dbg/usr/lib/*.{la,so*}
	for file in `find debian/libglib-cvs-dbg/usr/lib -name '*.a'` ; do \
	  mv $$file debian/libglib-cvs-dbg/usr/lib/`basename $$file .a`_g.a; \
        done
	dh_installdocs -plibglib-cvs-dbg
	dh_installchangelogs -plibglib-cvs-dbg
	dh_compress -plibglib-cvs-dbg
	dh_fixperms -plibglib-cvs-dbg
	dh_installdeb -plibglib-cvs-dbg
	dh_shlibdeps -plibglib-cvs-dbg
	dh_gencontrol -plibglib-cvs-dbg
	dh_makeshlibs -plibglib-cvs-dbg -V
	dh_md5sums -plibglib-cvs-dbg
	dh_builddeb -plibglib-cvs-dbg

source diff:                                                                  
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary