File: rules

package info (click to toggle)
libgtkada2 2.8.1-6lenny3
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 13,496 kB
  • ctags: 3,886
  • sloc: ada: 103,189; ansic: 45,411; perl: 5,500; sh: 2,812; makefile: 1,169; xml: 19
file content (408 lines) | stat: -rwxr-xr-x 13,518 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
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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
#!/usr/bin/make -f
# debian/rules for libgtkada2.
# Copyright (c) 2003-2006 Ludovic Brenta <lbrenta@debian.org>
#
# 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 of the License, 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.
# 
# The full text of the GNU General Public License is in the file
# /usr/share/common-licenses/GPL on Debian systems.

export DH_COMPAT=5
export SHELL=/bin/bash

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


# 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)
CPUS := $(shell getconf _NPROCESSORS_ONLN)

CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	INSTALL_PROGRAM += -s
endif

# Parse the version number from the change log:
# major.minor.micro-revision
regexp:=^Version: \([0-9]\+\)\.\([0-9]\+\)\.\([0-9]\+\)-\(.\+\)$$
major:=$(shell dpkg-parsechangelog | grep ^Version: | sed 's/$(regexp)/\1/')
minor:=$(shell dpkg-parsechangelog | grep ^Version: | sed  's/$(regexp)/\2/')
micro:=$(shell dpkg-parsechangelog | grep ^Version: | sed  's/$(regexp)/\3/')
revision:=$(shell dpkg-parsechangelog | grep ^Version: | sed  's/$(regexp)/\4/')

patch-stamp:
	if [ ! -f patch-stamp ]; then \
	   cp -R docs/gtkada_rm docs/gtkada_rm.save; \
	   cp -R docs/gtkada_ug docs/gtkada_ug.save; \
	fi
	-quilt push -a
	touch $@

unpatch:
	-quilt pop -a
	if [ -f patch-stamp ] ; then \
	   for i in rm ug ; do \
	      if [ -d docs/gtkada_$$i.save ] ; then \
	         rm -rf docs/gtkada_$$i; \
	         mv docs/gtkada_$$i.save docs/gtkada_$$i; \
	      fi \
	   done; \
	   rm patch-stamp; \
	fi

clean: unpatch
	dh_testdir
	dh_testroot
	rm -f build-stamp docs-stamp configure-stamp config.status
	-rm -f debian/shlibs.local
	-rm -f config.cache config.log src/config.h
	-rm -f po/Makefile projects/gtkada.pc
	-rm -f b~*
	-rm -rf src/lib-obj src/obj-tools gtkada-intl.adb
	-for i in . glade gnome gtkextra opengl; do \
	    for j in obj-static obj-shared; do \
	        rm -rf src/$$i/$$j; \
	    done; \
	    rm -f src/$$i/Makefile src/$$i/Makefile.common; \
	    rm -f src/$$i/lib*.so* src/$$i/lib*.a ; \
	    rm -f src/$$i/b~*; \
	done
	-rm -f Makefile testgtk/Makefile
	-rm -f src/gate$(major) src/dgate$(major) src/gtkada-config
	-rm -f src/gate$(major)-in.exe src/gtkada$(major)-config
	-rm -f src/gdialog$(major) src/generate$(major)
	-rm -f src/gtkada-intl.adb src/gtkada.gpr
	-rm -f testgtk/opengl/view_gl.adb
# unpatch restores the docs directories.
	dh_clean

build: build-stamp docs-stamp
build-stamp: patch-stamp configure-stamp
	dh_testdir
	: # Make the static libraries
	$(MAKE) -C src -j$(CPUS) \
		ADAC=gnatgcc FPIC= BUILD_SHARED=no LIB_DIR=obj-static \
		dirs extra
	$(MAKE) -C src \
		ADAC=gnatgcc FPIC= BUILD_SHARED=no LIB_DIR=obj-static \
		GNATMAKE="gnatmake -j$(CPUS)" \
		libgtkada$(major).a
	$(MAKE) -C src \
		ADAC=gnatgcc FPIC= BUILD_SHARED=no LIB_DIR=obj-static \
		GNATMAKE="gnatmake -j$(CPUS)" \
		gnome opengl
	$(MAKE) -C src \
		ADAC=gnatgcc FPIC= BUILD_SHARED=no LIB_DIR=obj-static \
		GNATMAKE="gnatmake -j$(CPUS)" \
		opengl
	$(MAKE) -C src/glade \
		ADAC=gnatgcc FPIC= LIB_DIR=obj-static \
		GNATMAKE="gnatmake -j$(CPUS)" \
		libgtkada$(major)_glade.a
	: # Make the shared libraries
	$(MAKE) -C src -j$(CPUS) \
		ADAC=gnatgcc LIB_DIR=obj-shared \
		dirs extra
	$(MAKE) -C src \
		ADAC=gnatgcc LIB_DIR=obj-shared \
		GNATMAKE="gnatmake -j$(CPUS)" \
		libgtkada$(major).so
	$(MAKE) -C src/glade -j$(CPUS) \
		ADAC=gnatgcc LIB_DIR=obj-shared \
		GNATMAKE="gnatmake -j$(CPUS)" \
		libgtkada$(major)_glade.so
	$(MAKE) -C src/gnome -j$(CPUS) \
		ADAC=gnatgcc LIB_DIR=obj-shared \
		GNATMAKE="gnatmake -j$(CPUS)" \
		libgnomeada$(major).so
	$(MAKE) -C src/opengl -j$(CPUS) \
		ADAC=gnatgcc LIB_DIR=obj-shared \
		GNATMAKE="gnatmake -j$(CPUS)" \
		libgtkada$(major)_gl.so
	chmod a=r \
	    src/obj-shared/*.ali \
	    src/glade/obj-shared/*.ali \
	    src/gnome/obj-shared/*.ali \
	    src/opengl/obj-shared/*.ali
	: # Make the tools, link against the shared libraries
	$(MAKE) -C src -j$(CPUS) \
		ADAC=gnatgcc LIB_DIR=obj-shared tools dgate$(major)
	touch $@

configure-stamp: $(shell find . -name Makefile.in)
	ADAC=gnatgcc ./configure --host=$(DEB_HOST_GNU_TYPE) \
		--build=$(DEB_BUILD_GNU_TYPE) \
		--prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		CFLAGS="$(CFLAGS)" \
		INSTALL_PROGRAM="$(INSTALL_PROGRAM)"
	rm config.log
	mv src/gate src/gate$(major)
	mv src/gtkada-config src/gtkada$(major)-config
	cp src/generate.pl src/generate$(major)
	touch $@

MAKEINFO := makeinfo --force --no-split

docs: docs-stamp
docs-stamp: patch-stamp
	: # Make the docs
# I don't use the upstream Makefile because I don't care for the
# PostScript documentation, and I also prefer unsplit info files.
	cd docs/gtkada_rm; \
	./generate_doc.pl ../../src/*.ads ../../src/glade/*.ads \
		../../src/gnome/*.ads ../../src/opengl/*.ads
	for j in rm ug; do \
	    (cd docs/gtkada_$$j; \
	    $(MAKEINFO) -o gtkada$(major)_$$j.info gtkada_$$j.texi; \
	    $(MAKEINFO) --html -o gtkada$(major)_$$j.html gtkada_$$j.texi; \
	    $(MAKEINFO) --plaintext -o gtkada$(major)_$$j.txt gtkada_$$j.texi; \
	    texi2pdf --silent -o gtkada$(major)_$$j.pdf gtkada_$$j.texi); \
	done
	touch $@

pre-build:
	dh_clean -k

binary-arch:
	dh_testdir
	dh_testroot
	dh_installdirs -plibgnomeada-$(major).$(minor) usr/lib
	dh_installdirs -plibgtkada-$(major).$(minor) usr/lib
	dh_installdirs -plibgtkada-gl-$(major).$(minor) usr/lib
	dh_installdirs -plibgtkada-glade-$(major).$(minor) usr/lib
	dh_installdirs -plibgtkada$(major)-dev \
		usr/bin \
		usr/share/ada/adainclude/gtkada$(major) \
		usr/lib/ada/adalib/gtkada$(major)/bin \
		usr/lib
	dh_installdirs -plibgnomeada$(major)-dev \
		usr/share/ada/adainclude/gnomeada$(major) \
		usr/lib/ada/adalib/gnomeada$(major) \
		usr/lib

	dh_installdocs -a -A
	dh_installchangelogs -a

	: # The shared libraries
	ln -f src/libgtkada.so.$(major).$(minor) \
	      src/libgtkada.so.$(major).$(minor).$(micro)
	dh_install -plibgtkada-$(major).$(minor) \
		src/libgtkada.so.$(major).$(minor).$(micro) \
		usr/lib
	dh_link -plibgtkada-$(major).$(minor) \
		usr/lib/libgtkada.so.$(major).$(minor).$(micro) \
		usr/lib/libgtkada.so.$(major).$(minor)

	ln -f src/gnome/libgnomeada.so.$(major).$(minor) \
	      src/gnome/libgnomeada.so.$(major).$(minor).$(micro)
	dh_install -plibgnomeada-$(major).$(minor) \
		src/gnome/libgnomeada.so.$(major).$(minor).$(micro) \
		usr/lib
	dh_link -plibgnomeada-$(major).$(minor) \
		usr/lib/libgnomeada.so.$(major).$(minor).$(micro) \
		usr/lib/libgnomeada.so.$(major).$(minor)

	ln -f src/glade/libgtkada_glade.so.$(major).$(minor) \
	      src/glade/libgtkada_glade.so.$(major).$(minor).$(micro)
	dh_install -plibgtkada-glade-$(major).$(minor) \
		src/glade/libgtkada_glade.so.$(major).$(minor).$(micro) \
		usr/lib
	dh_link -plibgtkada-glade-$(major).$(minor) \
		usr/lib/libgtkada_glade.so.$(major).$(minor).$(micro) \
		usr/lib/libgtkada_glade.so.$(major).$(minor)

	ln -f src/opengl/libgtkada_gl.so.$(major).$(minor) \
	      src/opengl/libgtkada_gl.so.$(major).$(minor).$(micro)
	dh_install -plibgtkada-gl-$(major).$(minor) \
		src/opengl/libgtkada_gl.so.$(major).$(minor).$(micro) \
		usr/lib
	dh_link -plibgtkada-gl-$(major).$(minor) \
		usr/lib/libgtkada_gl.so.$(major).$(minor).$(micro) \
		usr/lib/libgtkada_gl.so.$(major).$(minor)

	dh_makeshlibs -plibgnomeada-$(major).$(minor) -V
	dh_makeshlibs -plibgtkada-$(major).$(minor) -V
	dh_makeshlibs -plibgtkada-gl-$(major).$(minor) -V
	dh_makeshlibs -plibgtkada-glade-$(major).$(minor) -V
	cat debian/*/DEBIAN/shlibs > debian/shlibs.local

	: # Dependencies between library packages
	dh_shlibdeps -plibgtkada-$(major).$(minor)

	dh_shlibdeps -plibgnomeada-$(major).$(minor) \
		-ldebian/libgtkada-$(major).$(minor)/usr/lib

	dh_shlibdeps -plibgtkada-gl-$(major).$(minor) \
		-ldebian/libgtkada-$(major).$(minor)/usr/lib

	dh_shlibdeps -plibgtkada-glade-$(major).$(minor) \
		-ldebian/libgtkada-$(major).$(minor)/usr/lib

	: # Symbolic links to shared libraries
	dh_link -plibgtkada$(major)-dev \
		usr/lib/libgtkada.so.$(major).$(minor) \
		usr/lib/libgtkada$(major).so

	dh_link -plibgtkada$(major)-dev \
		usr/lib/libgtkada_glade.so.$(major).$(minor) \
		usr/lib/libgtkada$(major)_glade.so

	dh_link -plibgtkada$(major)-dev \
		usr/lib/libgtkada_gl.so.$(major).$(minor) \
		usr/lib/libgtkada$(major)_gl.so

	dh_link -plibgnomeada$(major)-dev \
		usr/lib/libgtkada_gnome.so.$(major).$(minor) \
		usr/lib/libgnomeada$(major).so

	: # Ada include files
	dh_install -plibgtkada$(major)-dev \
		src/glib*.ad[bs] src/gdk*.ad[bs] src/gtk*.ad[bs] \
		src/pango*.ad[bs] src/glade/glade*.ad[bs] \
		src/opengl/*.ad[bs] \
		usr/share/ada/adainclude/gtkada$(major)

	dh_install -plibgnomeada$(major)-dev \
		src/gnome/bonobo*.ad[bs] src/gnome/gnome*.ad[bs] \
		usr/share/ada/adainclude/gnomeada$(major)

	: # ALI files
	dh_install -plibgtkada$(major)-dev \
		src/obj-shared/glib*.ali src/obj-shared/gdk*.ali \
		src/obj-shared/gtk*.ali src/obj-shared/pango*.ali \
		src/glade/obj-shared/glade*.ali src/opengl/obj-shared/*.ali \
		usr/lib/ada/adalib/gtkada$(major)

	dh_install -plibgnomeada$(major)-dev \
		src/gnome/obj-shared/bonobo*.ali src/gnome/obj-shared/gnome*.ali \
		usr/lib/ada/adalib/gnomeada$(major)

	: # GNAT project files
	dh_install -plibgtkada$(major)-dev \
		debian/gtkada$(major).gpr usr/share/ada/adainclude
	dh_install -plibgnomeada$(major)-dev \
	  	debian/gnomeada$(major).gpr usr/share/ada/adainclude

	: # Static libraries
	dh_install -plibgtkada$(major)-dev \
		src/libgtkada$(major).a \
		src/glade/libgtkada$(major)_glade.a \
		src/opengl/libgtkada$(major)_gl.a \
		usr/lib

	dh_install -plibgnomeada$(major)-dev \
		src/gnome/libgnomeada$(major).a \
		usr/lib

	: # Executable programs
	dh_install -plibgtkada$(major)-bin \
		src/dgate$(major) src/gate$(major) \
		src/gdialog$(major) src/generate$(major) \
		src/gtkada$(major)-config \
		usr/bin
	dh_install -plibgtkada$(major)-bin \
		src/gate$(major)-in.exe \
		usr/lib/ada/adalib/gtkada$(major)/bin
	dh_link -plibgtkada$(major)-bin \
		usr/bin/gtkada$(major)-config usr/bin/gtkada-config \
		usr/bin/gate$(major) usr/bin/gate \
		usr/bin/dgate$(major) usr/bin/dgate

	dh_shlibdeps -v -plibgtkada$(major)-bin \
		-ldebian/libgtkada-$(major).$(minor)/usr/lib \
		debian/libgtkada$(major)-dev/usr/bin/* \
		debian/libgtkada$(major)-dev/usr/lib/ada/adalib/gtkada$(major)/bin/*

	: # Man pages
	dh_installdirs -plibgtkada$(major)-bin usr/share/man/man1
	for i in dgate gate generate gdialog; do \
	  cp docs/$${i}.1 docs/$${i}$(major).1; \
	  dh_installman -plibgtkada$(major)-bin docs/$${i}$(major).1; \
	  rm docs/$${i}$(major).1; \
	done
	cp docs/gtkada-config.1 docs/gtkada$(major)-config.1
	dh_installman -plibgtkada$(major)-bin docs/gtkada$(major)-config.1
	rm docs/gtkada$(major)-config.1
	dh_link -plibgtkada$(major)-bin \
		usr/share/man/man1/gtkada$(major)-config.1 \
		usr/share/man/man1/gtkada-config.1 \
		usr/share/man/man1/dgate$(major).1 \
		usr/share/man/man1/dgate.1 \
		usr/share/man/man1/gate$(major).1 \
		usr/share/man/man1/gate.1

	: # Finally strip, compress, and build the .debs
	dh_strip -plibgtkada$(major)-dev -X.a
	dh_strip -plibgtkada$(major)-bin
	dh_strip -plibgnomeada$(major)-dev -X.a
	dh_strip -plibgtkada-$(major).$(minor) --dbg-package=libgtkada$(major)-dbg
	dh_strip -plibgnomeada-$(major).$(minor) --dbg-package=libgnomeada$(major)-dbg
	dh_strip -plibgtkada-glade-$(major).$(minor)
	dh_strip -plibgtkada-gl-$(major).$(minor)
	dh_compress -a
	dh_fixperms -a
	dh_installdeb -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a


binary-indep: build-stamp
	dh_testdir
	dh_testroot
	: # The -doc package.
	dh_installdirs -plibgtkada$(major)-doc \
		usr/share/doc/libgtkada$(major)-doc \
		usr/share/info
	dh_installdocs -plibgtkada$(major)-doc \
		ANNOUNCE AUTHORS known-problems docs/*.txt
	dh_installchangelogs -plibgtkada$(major)-doc
	dh_install -plibgtkada$(major)-doc \
		docs/gtkada_rm/gtkada$(major)_rm.txt \
		docs/gtkada_rm/gtkada$(major)_rm.pdf \
		docs/gtkada_rm/*.{html,jpg,ps} \
		usr/share/doc/libgtkada$(major)-doc/gtkada_rm
	dh_install -plibgtkada$(major)-doc \
		docs/gtkada_ug/gtkada$(major)_ug.txt \
		docs/gtkada_ug/gtkada$(major)_ug.pdf \
		docs/gtkada_ug/*.{html,jpg,ps} \
		usr/share/doc/libgtkada$(major)-doc/gtkada_ug
	tar czf testgtk.tar.gz testgtk
	dh_installexamples -plibgtkada$(major)-doc examples/* testgtk.tar.gz
	-rm -f testgtk.tar.gz

	dh_installinfo -plibgtkada$(major)-doc \
		docs/gtkada_rm/gtkada$(major)_rm.info* \
		docs/gtkada_ug/gtkada$(major)_ug.info*

	dh_strip -i
	dh_compress -i -X.adb -X.ads -XMakefile -X.gpb -X.glade
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary: pre-build binary-indep binary-arch

.PHONY: build clean clean-docs docs binary-indep binary-arch binary install
.PHONY: static shared tools docs