Configure: house cleaning.
[gnumeric.git] / debian / rules
blob6059ca3aa362c23ee71ec3cb834230a8431a2273
1 #! /usr/bin/make -f
2 # Based on the sample debian/rules that uses debhelper.
3 # GNU copyright 1997 by Joey Hess.
5 #DEB_BUILD_OPTIONS?="debug nostrip"
6 export DEB_BUILD_OPTIONS
8 export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
9 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
11 ifeq ($(DEB_BUILD_GNU_TYPE),m68k-linux)
12 DEB_BUILD_OPTIONS+=noopt
13 endif
15 # Uncomment this to turn on verbose mode.
16 #export DH_VERBOSE=1
18 # Try to preserve timestamps as much as possible
19 export INSTALL=/usr/bin/install -p
21 # Are we building a release version, or are we doing development?
22 CVS_BUILD=$(shell test ! -d CVS; echo $$?)
24 upstreamversion=$(shell dpkg-parsechangelog | grep Version | head -1 | sed -e 's/Version: //g' -e 's/-[A-Za-z0-9+\.]*$$//g')
26 # Features configuration
27 # ----------------------
29 # We're aiming for a package that's stable, with as much functionality as is
30 # reasonably possible.
32 features:=
34 # Spreadsheet indexer for beagle
35 features+= --enable-ssindex
37 # Plugins to access databases through the GDA framework.
39 # The GnomeDB plugin for gnumeric requires a version of GnomeDB that is not
40 # available as packages yet.
41 # Tue, 01 Sep 2009 20:49:41 +0200
42 features+= --without-gda
44 # Psion files support?
45 features+= --without-psiconv
47 # Paradox database files plugin
48 features+= --with-paradox
50 # Perl plugin
51 features+= --with-perl
53 # The Python plugin
54 features+= PYTHON=/usr/bin/python --with-python
56 # Don't build a PDF of the documentation.
57 features+= --disable-pdfdocs
59 ## Enable it for my development tree:
60 #features+= --enable-pdfdocs
62 confflags := --prefix=/usr \
63 --mandir=\$${prefix}/share/man \
64 --sysconfdir=/etc \
65 --localstatedir=/var/lib \
66 --libexecdir=/usr/bin \
67 --enable-compile-warnings=minimum \
68 --enable-introspection=yes \
69 --disable-maintainer-mode \
70 $(features)
72 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
73 confflags += --build $(DEB_HOST_GNU_TYPE)
74 else
75 confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
76 endif
78 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
79 DPKG_EXPORT_BUILDFLAGS = 1
80 include /usr/share/dpkg/buildflags.mk
82 CFLAGS += -Wall -g
84 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
85 CFLAGS += -O0
86 else
87 CFLAGS += -O2
88 endif
90 # Make the linker work a bit harder so dynamic loading can be done faster.
91 LDFLAGS += -Wl,-O1
93 # Make the linker only include actual dependencies on libraries, rather than
94 # for all libraries specified in the link line.
95 LDFLAGS += -Wl,--as-needed
97 .PHONY: source-updates
98 source-updates:
99 # This target is not part of the regular package build process. It is used
100 # by the package maintainer for development purposes and may have
101 # dependencies beyond the build dependencies specified in debian/control.
102 rm -f configure-stamp
103 # Update files generated by autotools
104 env srcdir=`pwd` NOCONFIGURE=1 \
105 LIBTOOLIZE="libtoolize --copy" \
106 INTLTOOLIZE="intltoolize --copy" \
107 sh autogen.sh $(confflags)
108 convert icons/32x32/gnumeric.png -depth 4 debian/gnome-gnumeric.xpm
110 configure-stamp:
111 dh_testdir
113 # Prepare for build
114 dh_autotools-dev_updateconfig
115 mkdir build
116 cd build && env srcdir=`pwd`/.. \
117 ../configure $(confflags) "CC=$(CC) $(LDFLAGS)" "CFLAGS=$(CFLAGS)"
119 touch configure-stamp
121 .PHONY: configure
122 configure: configure-stamp
124 build-stamp: configure
125 dh_testdir
127 cd build && $(MAKE)
128 touch build-stamp
130 .PHONY: build-arch
131 build-arch: build-stamp
133 .PHONY: build-indep
134 build-indep: build-stamp
136 .PHONY: build
137 build: build-arch build-indep
139 .PHONY: clean
140 clean:
141 dh_testdir
142 dh_testroot
143 rm -f build-stamp configure-stamp debian/*substvars debian/*~ \
144 debian/buildinfo
146 rm -rf debian/tmp build
148 debconf-updatepo
150 -find -type f -name 'Makefile.in' | sed -e 's/\.in$$//' | xargs rm -f
151 -rm -f po/*.gmo
153 # Clean out files generated as part of the documentation generation
154 -rm -f doc/C/index.html doc/C/gnumeric.html doc/C/ld-id*.html \
155 omf-install/gnumeric-C.omf
156 -rm -rf doc/C/gnumeric doc/C/DBTOHTML_OUTPUT_DIR*
158 -rm -rf aclocal.m4 config.h.in stamp-h.in autom4te.cache \
159 doc/C/gnumeric.junk
161 -rm -f GNOME_Gnumeric.server.in GNOME_Gnumeric.server src/gnumeric-paths.h
163 dh_clean
165 .PHONY: install
166 install: build
167 dh_testdir
168 dh_testroot
169 dh_prep
170 dh_installdirs
172 cd build && env GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1 \
173 $(MAKE) install \
174 DESTDIR=`pwd`/../debian/tmp/ \
175 localstatedir=`pwd`/../debian/tmp/var/lib \
176 libexecdir=`pwd`/../debian/tmp/usr/bin \
177 scrollkeeper_localstate_dir=/var/lib/scrollkeeper
179 # Plugins are not intended as stand-alone executables
180 find `pwd`/debian/tmp/usr/lib/*/*/plugins -type f -print0 | xargs -0 chmod a-x
181 # .la files are not needed for plugins
182 find `pwd`/debian/tmp/usr/lib/*/*/plugins -type f -name '*.la' -print0 | xargs -0 rm -f
184 # Remove unwanted files: static libraries and documentation sources
185 find `pwd`/debian/tmp/usr/ -name '*.a' -print0 | xargs -0 rm -f
186 find `pwd`/debian/tmp/ -name '*.sgml' -print0 | xargs -0 rm -f
187 # Bonobo-only files
188 rm -rf debian/tmp/usr/lib/bonobo
189 # libspreadsheet is far from a mature library; loose the development
190 # files
191 rm -f debian/tmp/usr/lib/libspreadsheet*.la
192 rm -f debian/tmp/usr/lib/pkgconfig/libspreadsheet-*.pc
193 rm -rf debian/tmp/usr/include/libspreadsheet-*
195 # Outdated
196 rm -f debian/tmp/usr/share/mc/templates/gnumeric.desktop
198 # Remove scrollkeeper generated files as well; for a package they
199 # need to be (re)generated at package (de)install time.
200 rm -rf `pwd`/debian/tmp/var/lib/scrollkeeper
202 # Low-colour icon for use by the menu system
203 $(INSTALL) -m 644 debian/gnome-gnumeric.xpm `pwd`/debian/tmp/usr/share/pixmaps/
205 dh_install --sourcedir=`pwd`/debian/tmp --fail-missing
207 # Name the binary just "gnumeric"
208 cd debian/gnumeric/usr/bin && mv gnumeric-* gnumeric
210 dh_link usr/share/gnumeric/$(upstreamversion)/idl/GNOME_Gnumeric.idl usr/share/idl/GNOME_Gnumeric.idl
212 # Make the documentation accessible to gnumeric
213 dh_link -pgnumeric-doc usr/share/gnome/help/gnumeric usr/share/gnumeric/$(upstreamversion)/doc
215 dh_link -pgnumeric-doc usr/share/xml/docbook/stylesheet/nwalsh/images/ usr/share/gnumeric/$(upstreamversion)/doc/C/images
217 # Remove files from the main package that belong to a more
218 # specialist package
219 # (dh_install doesn't do the right thing here IMO; perhaps it
220 # doesn't like multiple globs in one line)
221 while read l ; do \
222 rm -rvf debian/gnumeric/$$l ; \
223 done < debian/gnumeric-plugins-extra.install
225 # Remove dirs that are now empty
226 -find debian/gnumeric -depth -type d | xargs rmdir >/dev/null 2>&1
228 # Build architecture-independent files here.
229 # Pass -i to all debhelper commands in this target to reduce clutter.
230 binary-indep: build install
231 dh_testdir -i
232 dh_testroot -i
233 dh_installdebconf -i
234 dh_installdocs -i
236 dh_installexamples -i
237 dh_python2 -i
238 dh_installmenu -i
239 # dh_installlogrotate -i
240 # dh_installemacsen -i
241 # dh_installpam -i
242 dh_installmime -i
243 # dh_installinit -i
244 dh_installcron -i
245 # dh_installman -i
246 dh_link -i
247 dh_installinfo -i
248 # dh_undocumented -i
249 dh_installchangelogs ChangeLog -i
250 dh_gconf -i
251 dh_icons -i
252 dh_link -i
253 dh_compress -i
254 dh_fixperms -i
255 dh_installdeb -i
256 dh_perl -i
257 dh_gencontrol -v -i -- -VUpstream-Version=$(upstreamversion)
258 dh_md5sums -i
259 dh_builddeb -i
261 # Build architecture-dependent files here.
262 .PHONY: binary-arch
263 binary-arch: build install
264 dh_testdir -a
265 dh_testroot -a
266 dh_installdebconf -a
267 dh_installdocs -a --noscripts
268 rm -rf `pwd`/debian/gnumeric-doc/usr/share/doc-base
269 dh_installexamples -a
270 dh_python2 -a
271 dh_installmenu -a
272 # dh_installlogrotate -a
273 # dh_installemacsen -a
274 # dh_installpam -a
275 dh_installmime -a
276 # dh_installinit -a
277 dh_installcron -a
278 dh_installman -a
279 dh_link -a
280 dh_installinfo -a
281 # dh_undocumented -a
282 dh_installchangelogs ChangeLog -a
283 dh_gconf -a
284 dh_icons -a
285 dh_strip -a
286 dh_link -a
287 dh_compress -a
289 dh_buildinfo
291 dh_fixperms -a
292 dh_makeshlibs -a
293 dh_installdeb -a
294 dh_perl -a
296 dh_shlibdeps -v -a
298 dh_gencontrol -v -a -- -VUpstream-Version=$(upstreamversion)
299 dh_md5sums -a
300 dh_builddeb -a
302 .PHONY: binary
303 binary: binary-indep binary-arch