File: rules

package info (click to toggle)
libgsf 1.14.8-1lenny2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 4,984 kB
  • ctags: 3,344
  • sloc: ansic: 18,428; sh: 9,392; xml: 6,653; makefile: 496; perl: 35; python: 13
file content (257 lines) | stat: -rwxr-xr-x 8,267 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
#! /usr/bin/make -f
# Based on the sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

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

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

# 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

# Make the linker only include actual dependencies on libraries, rather than
# for all libraries specified in the link line.
LDFLAGS += -Wl,--as-needed

# 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)

upstreamversion=$(shell dpkg-parsechangelog | grep Version | head -1 | sed -e 's/Version: //g' -e 's/-[A-Za-z0-9\.]*$$//g')

# Only build the runtime packages? Note: be sure to keep this consistent
# with the packages listed in debian/control.
oldlibs_build=0

# These values must match their configure.in counterparts
gsf_version_major=1
gsf_version_minor=14

# This goes into the package names; make sure the debian/* files match
so_version_major=$(shell expr $(gsf_version_major) '*' 100 '+' $(gsf_version_minor))

# Package names
p_libgsf=libgsf-1-$(so_version_major)
p_libgsf_gnome=libgsf-gnome-1-$(so_version_major)
p_libgsf_common=libgsf-1-common
p_libgsf_bin=libgsf-bin
p_libgsf_dev=libgsf-1-dev
p_libgsf_gnome_dev=libgsf-gnome-1-dev
p_libgsf_dbg=libgsf-1-$(so_version_major)-dbg
p_libgsf_gnome_dbg=libgsf-gnome-1-$(so_version_major)-dbg

# Build up the options for "./configure"
confflags :=	-v

# FHS locations
confflags +=	--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		--with-html-dir=\$${prefix}/share/doc/$(p_libgsf_dev)/html

# Compiler, language dialect
confflags +=	--enable-compile-warnings=maximum

# Features
confflags +=	--with-gnome --with-bz2 --enable-gtk-doc --without-python

ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
	confflags += --build $(DEB_HOST_GNU_TYPE)
else
	confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif


source-updates:
	# Update files/links generated by autotools
	env srcdir=`pwd` NOCONFIGURE=1 sh autogen.sh
	# Replace links by copies of their targets
	for file in `find -type l` ; do \
		tf=`tempfile` && \
		install -p $$file $$tf && \
		rm -f $$file && \
		install -p $$tf $$file && \
		rm -f $$tf ; \
	done
	rm -rf autom4te.cache

configure: config-stamp
config-stamp:
	dh_testdir

	rm -rf build && mkdir build
	# With current libtool (1.5.24-1), LDFLAGS ends up on the actual
	# link line after some "-l" parameters. This is unfortunate, as it
	# means that passing "-Wl,--as-needed" through LDFLAGS will not drop
	# references to all unneeded libraries.
	#
	# To work around this, we pass LDFLAGS through CC (which is also
	# used for the link rules). The price we pay is some "linker input
	# file unused because linking not done" warnings.
	cd build && env "CC=$(CC) $(LDFLAGS)" "CFLAGS=$(CFLAGS)" ../configure $(confflags)

	touch config-stamp

build: build-stamp
build-stamp:  config-stamp
	dh_testdir

	$(MAKE) -C build

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f config-stamp build-stamp 

	-$(MAKE) -C build distclean
	rm -rf build
	rm -f config.cache config.status
	rm -f doc/html/*.png doc/html/*.html

	-find -type f -name 'Makefile.am' | sed -e 's/\.am$$//' | xargs rm -f

	# Update config.{sub,guess} from autotools-dev, if possible.
	-for f in config.sub config.guess ; do \
		if test -r /usr/share/misc/$$f ; then \
			OLDDATE=`./$$f -t | tr -d -` ; \
			NEWDATE=`/usr/share/misc/$$f -t | tr -d -` ; \
			if [ $$OLDDATE -lt $$NEWDATE ] ; then \
				echo "GNU config automated update of $$f (replacing $$OLDDATE with $$NEWDATE)" 1>&2 ; \
				cp -f /usr/share/misc/$$f $$f ; \
			fi; \
		fi; \
	done

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/tmp
	$(MAKE) -C build \
		GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 \
		DESTDIR=$(CURDIR)/debian/tmp \
		install

	@if ! test -r $(CURDIR)/debian/tmp/usr/lib/libgsf-gnome-1.so ; then \
		echo "" ; \
		echo "libgsf-gnome-1 didn't get installed properly" ; \
		echo "Perhaps ltmain.sh needs to be regenerated using a libtool package patched" ; \
		echo "with the \"inst-prefix\" patch?" ; \
		exit 1; \
	fi

	rm -f $(CURDIR)/debian/tmp/usr/lib/libgsf-*.la

	mkdir -p $(CURDIR)/debian/tmp/usr/lib/debug
	for l in `find $(CURDIR)/debian/tmp/usr/lib -name '*.so*'`; do \
		cp -vdf $$l $(CURDIR)/debian/tmp/usr/lib/debug ; \
	done

ifeq ($(oldlibs_build),1)
	# Delete files and directories that belong to packages we don't build
	cat debian/$(p_libgsf_common).install debian/$(p_libgsf_bin).install debian/$(p_libgsf_dev).install debian/$(p_libgsf_gnome_dev).install debian/$(p_libgsf_dbg).install debian/$(p_libgsf_gnome_dbg).install | while read pattern ; do \
		(cd debian/tmp && rm -vrf $$pattern) ; \
	done
	# Basically all remaining files and directories should belong to a
	# package.
else
	# Building not just runtime packages. Basically all installed files
	# and directories should belong to a package.
endif

	dh_install --sourcedir=debian/tmp --fail-missing -Xindex.sgml

# This single target is used to build all the packages, all at once, or
# one at a time. So keep in mind: any options passed to commands here will
# affect _all_ packages. Anything that should only affect one package
# should be put in another target (such as the install target) or be put
# into conditional constructs.
binary-common:
	dh_testdir
	dh_testroot
	dh_installchangelogs ChangeLog
ifeq ($(DH_OPTIONS),-s)
	# The -dbg packages don't have separate documentation; link to the
	# corresponding runtime packages' documentation.
	rm -rvf $(CURDIR)/debian/$(p_libgsf_dbg)/usr/share/doc/$(p_libgsf_dbg)
	rm -rvf $(CURDIR)/debian/$(p_libgsf_gnome_dbg)/usr/share/doc/$(p_libgsf_gnome_dbg)

	# Unfortunately, "-s" overrides "-p" for dh_link messes things up.
	env -u DH_OPTIONS dh_link -p$(p_libgsf_dbg) /usr/share/doc/$(p_libgsf)/ /usr/share/doc/$(p_libgsf_dbg)
	env -u DH_OPTIONS dh_link -p$(p_libgsf_gnome_dbg) /usr/share/doc/$(p_libgsf)/ /usr/share/doc/$(p_libgsf_gnome_dbg)

	# Make the documentation accessible through devhelp.
	dh_link -s -p$(p_libgsf_dev) /usr/share/doc/$(p_libgsf_dev)/html/gsf/ /usr/share/gtk-doc/html/gsf
endif
	dh_installdocs
	dh_installexamples
	dh_installmenu
#	dh_installdebconf
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installcatalogs
#	dh_installpam
#	dh_installmime
#	dh_installinit
#	dh_installman
#	dh_installcron
#	dh_installinfo
#	dh_undocumented
	dh_gconf
#	dh_link
	dh_buildinfo
	dh_compress
#	dh_perl
#	dh_python
ifeq ($(DH_OPTIONS),-s)
	dh_strip -s -v -N $(p_libgsf_dbg) -N $(p_libgsf_gnome_dbg)

	# Unfortunately, "-s" overrides "-p" for dh_makeshlibs and by acting
	# on all architecture-dependent packages we would get wrong shlibs
	# here, so we need to undo the "-s".
	env -u DH_OPTIONS dh_makeshlibs -p$(p_libgsf) -V '$(p_libgsf) (>= $(upstreamversion))'
	env -u DH_OPTIONS dh_makeshlibs -p$(p_libgsf_gnome) -V '$(p_libgsf_gnome) (>= $(upstreamversion))'

	dh_shlibdeps -s -l debian/$(p_libgsf)/usr/lib/ -L $(p_libgsf) \
		-l debian/$(p_libgsf_gnome)/usr/lib/ -L $(p_libgsf_gnome)
endif
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture independant packages using the common target.
binary-indep: build install
	 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common

# Build architecture dependant packages using the common target.
binary-arch: build install
	$(MAKE) -f debian/rules DH_OPTIONS=-s binary-common

## Any other binary targets build just one binary package at a time.
#binary-%: build install
#	make -f debian/rules binary-common DH_OPTIONS=-p$*

binary: binary-indep binary-arch
.PHONY: source-updates configure build clean binary-indep binary-arch binary-common binary install