rules revision 7515a7447836708241b2b30ca7d70d1257265e75
1#! /usr/bin/make -f
2# -*- makefile -*-
3#
4# Invoke each target with `./debian/rules <target>'.  All targets should be
5# invoked with the package root as the current directory.
6#
7# The `binary' target must be run as root, as it needs to install files with
8# specific ownerships.
9
10# be paranoid
11export LC_ALL=C
12
13# These are used for cross-compiling and for saving the configure script
14# from having to guess our platform (since we know it already)
15DEB_HOST_ARCH   ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
16DEB_BUILD_ARCH   ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
17DEB_HOST_OS   ?= $(shell dpkg-architecture -qDEB_HOST_OS)
18DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
19DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
20
21# find the version for the main package, from changelog file
22MAIN_VERSION = $(shell head -n 1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g')
23# find versions for libraries going into their own packages, from their Makefile.in's,
24# and sonames for all libs
25COMERR_VERSION = $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3)
26COMERR_SOVERSION = $(shell grep ELF_SO_VERSION lib/et/Makefile.in | cut '-d ' -f3)
27SS_VERSION = $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
28SS_SOVERSION = $(shell grep ELF_SO_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
29UUID_VERSION = $(shell grep ELF_VERSION lib/uuid/Makefile.in | cut '-d ' -f3)
30UUID_SOVERSION = $(shell grep ELF_SO_VERSION lib/uuid/Makefile.in | cut '-d ' -f3)
31BLKID_VERSION = $(shell grep ELF_VERSION lib/blkid/Makefile.in | cut '-d ' -f3)
32BLKID_SOVERSION = $(shell grep ELF_SO_VERSION lib/blkid/Makefile.in | cut '-d ' -f3)
33EXT2FS_SOVERSION = $(shell grep ELF_SO_VERSION lib/ext2fs/Makefile.in | cut '-d ' -f3)
34E2P_SOVERSION = $(shell grep ELF_SO_VERSION lib/e2p/Makefile.in | cut '-d ' -f3)
35
36package=e2fsprogs
37
38topdir=$(shell pwd)
39debdir=${topdir}/debian
40tmpdir=${debdir}/tmp
41udebdir=${debdir}/e2fsprogs-udeb
42blkidudebdir=${debdir}/libblkid1-udeb
43uuidudebdir=${debdir}/libuuid1-udeb
44libcomerrdir=${debdir}/libcomerr${COMERR_SOVERSION}
45comerrdevdir=${debdir}/comerr-dev
46libcomerrdbgdir=${debdir}/libcomerr2-dbg
47libssdir=${debdir}/libss${SS_SOVERSION}
48ssdevdir=${debdir}/ss-dev
49libssdbgdir=${debdir}/libss2-dbg
50libblkiddir=${debdir}/libblkid${BLKID_SOVERSION}
51libblkiddevdir=${debdir}/libblkid-dev
52libblkiddbgdir=${debdir}/libblkid1-dbg
53libuuiddir=${debdir}/libuuid${UUID_SOVERSION}
54uuiddevdir=${debdir}/uuid-dev
55libuuiddbgdir=${debdir}/libuuid1-dbg
56uuidruntimedir=${debdir}/uuid-runtime
57uuidruntimedbgdir=${debdir}/uuid-runtime-dbg
58libext2dir=${debdir}/e2fslibs
59libext2devdir=${debdir}/e2fslibs-dev
60libext2dbgdir=${debdir}/e2fslibs-dbg
61maindir=${debdir}/e2fsprogs
62e2fsckstaticdir=${debdir}/e2fsck-static
63debugdir=${debdir}/e2fsprogs-dbg
64stdbuilddir=${debdir}/BUILD-STD
65bfbuilddir=${debdir}/BUILD-BF
66staticbuilddir=${debdir}/BUILD-STATIC
67mipsbuilddir=${debdir}/BUILD-MIPS
68mipsbuilddir64=${debdir}/BUILD-MIPS-64
69# docdir=${maindir}/usr/share/doc/${package}
70MANDIR=/usr/share/man
71mandir=${tmpdir}${MANDIR}
72
73UDEB_NAME = $(package)-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb
74UDEB_PRIORITY = $(shell grep '^Package: e2fsprogs-udeb' debian/control -A 10 | grep ^Priority: | cut -d ' ' -f 2)
75
76BLKID_UDEB_NAME = libblkid1-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb
77BLKID_UDEB_PRIORITY = $(shell grep '^Package: libblkid1-udeb' debian/control -A 10 | grep ^Priority: | cut -d ' ' -f 2)
78
79UUID_UDEB_NAME = libuuid1-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb
80UUID_UDEB_PRIORITY = $(shell grep '^Package: libuuid1-udeb' debian/control -A 10 | grep ^Priority: | cut -d ' ' -f 2)
81
82STAMPSDIR=debian/stampdir
83CFGSTDSTAMP=${STAMPSDIR}/configure-std-stamp
84CFGBFSTAMP=${STAMPSDIR}/configure-bf-stamp
85CFGSTATICSTAMP=${STAMPSDIR}/configure-static-stamp
86BUILDSTDSTAMP=${STAMPSDIR}/build-std-stamp
87BUILDBFSTAMP=${STAMPSDIR}/build-bf-stamp
88BUILDSTATICSTAMP=${STAMPSDIR}/build-static-stamp
89
90CCOPTS = -g
91
92INSTALL = install
93INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 0755
94
95ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
96CCOPTS += -O2
97endif
98#ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
99#INSTALL_PROGRAM += -s
100#endif
101
102ifeq (${DEB_HOST_ARCH},alpha)
103CCOPTS += -DHAVE_NETINET_IN_H
104else
105CCOPTS += -D__NO_STRING_INLINES
106endif
107
108ifeq (${DEB_HOST_ARCH_OS},linux)
109BUILD_STATIC = build-static
110E2FSCK_STATIC = ${staticbuilddir}/e2fsck/e2fsck.static
111else
112E2FSCK_STATIC = ${stdbuilddir}/e2fsck/e2fsck.static
113endif
114
115BF_CCOPTS = -Os -fomit-frame-pointer
116
117COMMON_CONF_FLAGS =  \
118                --enable-elf-shlibs --infodir=/usr/share/info --enable-fsck
119
120STD_CONF_FLAGS = --with-ccopts="${CCOPTS}" --enable-compression
121
122BF_CONF_FLAGS = --with-ccopts="${CCOPTS} ${BF_CCOPTS}" \
123	--disable-nls --disable-imager \
124	--disable-uuidd --disable-tls \
125	--disable-debugfs  --disable-e2initrd-helper
126
127STATIC_CONF_FLAGS = --with-ccopts="${CCOPTS}" \
128	--disable-nls --disable-imager \
129	--disable-uuidd --disable-tls \
130	--disable-e2initrd-helper \
131	--with-ccopts=-fno-stack-protector
132
133MIPS_NOPIC_CONF_FLAGS = --with-ccopts="${CCOPTS}" \
134	--disable-nls --disable-imager \
135	--disable-uuidd --disable-tls \
136        --disable-resizer # --disable-debugfs
137
138# we can't use those flags at configure time
139MIPS_CFLAGS= -G 0 -fno-pic -mno-abicalls
140MIPS_CFLAGS_64= -mabi=64 -G 0 -fno-pic -mno-abicalls
141
142ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
143ifneq (,$(findstring $(DEB_BUILD_ARCH),mips mipsel))
144ismips=ismips
145endif
146endif
147
148${CFGSTDSTAMP}:
149	dh_testdir
150
151	# Make sure we don't try to rebuild the configure scripts
152	find . -name configure | xargs touch
153
154	mkdir -p ${stdbuilddir}
155ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
156	cd ${stdbuilddir} && AWK=/usr/bin/awk \
157		${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS}
158else
159	cd ${stdbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
160		${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
161		--build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
162endif
163
164  # specially-built MIPS libs
165ifneq ($(ismips),)
166	mkdir -p ${mipsbuilddir} ${mipsbuilddir64}
167	cd ${mipsbuilddir} && AWK=/usr/bin/awk \
168		${topdir}/configure ${MIPS_NOPIC_CONF_FLAGS}
169	cd ${mipsbuilddir64} && AWK=/usr/bin/awk \
170		${topdir}/configure ${MIPS_NOPIC_CONF_FLAGS}
171endif
172
173	mkdir -p ${STAMPSDIR}
174	touch ${CFGSTDSTAMP}
175
176${CFGBFSTAMP}:
177	dh_testdir
178	rm -f config.cache
179
180	mkdir -p ${bfbuilddir}
181ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
182	cd ${bfbuilddir} && AWK=/usr/bin/awk \
183		${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS}
184else
185	cd ${bfbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
186		${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \
187		--build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
188endif
189	mkdir -p ${STAMPSDIR}
190	touch ${CFGBFSTAMP}
191
192${CFGSTATICSTAMP}:
193	dh_testdir
194	rm -f config.cache
195
196	mkdir -p ${staticbuilddir}
197ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
198	if type diet > /dev/null  2>&1 ; then \
199		STATIC_CONF_FLAGS="$STATIC_CONF_FLAGS --with-diet-libc"; \
200	fi
201	cd ${staticbuilddir} && AWK=/usr/bin/awk \
202		${topdir}/configure ${STATIC_CONF_FLAGS}
203else
204	cd ${staticbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
205		${topdir}/configure ${COMMON_CONF_FLAGS} ${STATIC_CONF_FLAGS} \
206		--build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
207endif
208	mkdir -p ${STAMPSDIR}
209	touch ${CFGSTATICSTAMP}
210
211build: build-std build-bf $(BUILD_STATIC)
212
213build-std: ${BUILDSTDSTAMP}
214${BUILDSTDSTAMP}: ${CFGSTDSTAMP}
215	dh_testdir
216	$(MAKE) -C ${stdbuilddir} all
217	$(MAKE) -C ${stdbuilddir}/e2fsck e2fsck.static
218
219	( cd ${stdbuilddir}/doc && \
220	  texi2html -split_chapter ${topdir}/doc/libext2fs.texinfo )
221	( cd ${stdbuilddir}/lib/et && $(MAKE) com_err.info && \
222	  texi2html -split_chapter -expandinfo ${topdir}/lib/et/com_err.texinfo )
223
224  # specially-built MIPS libs
225ifneq ($(ismips),)
226	$(MAKE) -C ${mipsbuilddir}/util
227	$(MAKE) -C ${mipsbuilddir} \
228		CFLAGS="${CCOPTS} ${MIPS_CFLAGS}" \
229		LIB_SUBDIRS="lib/et lib/ext2fs" libs
230	$(MAKE) -C ${mipsbuilddir64}/util
231	$(MAKE) -C ${mipsbuilddir64} \
232		CFLAGS="${CCOPTS} ${MIPS_CFLAGS_64}" \
233		LIB_SUBDIRS="lib/et lib/ext2fs" libs
234endif
235
236	touch ${BUILDSTDSTAMP}
237
238build-bf: ${BUILDBFSTAMP}
239${BUILDBFSTAMP}: ${CFGBFSTAMP}
240	dh_testdir
241	$(MAKE) -C ${bfbuilddir} libs
242	$(MAKE) -C ${bfbuilddir}/e2fsck all
243	$(MAKE) -C ${bfbuilddir}/misc all
244	touch ${BUILDBFSTAMP}
245
246build-static: ${BUILDSTATICSTAMP}
247${BUILDSTATICSTAMP}: ${CFGSTATICSTAMP}
248	dh_testdir
249	$(MAKE) -C ${staticbuilddir} libs
250	$(MAKE) -C ${staticbuilddir}/e2fsck all e2fsck.static
251	touch ${BUILDSTATICSTAMP}
252
253clean:
254	dh_testdir
255	rm -rf ${STAMPSDIR}
256	[ ! -f ${stdbuilddir}/Makefile ] || $(MAKE) -C ${stdbuilddir} distclean
257	[ ! -f ${bfbuilddir}/Makefile ] || $(MAKE) -C ${bfbuilddir} distclean
258	[ ! -f ${staticbuilddir}/Makefile ] || $(MAKE) -C ${staticbuilddir} distclean
259	rm -rf ${stdbuilddir} ${bfbuilddir} ${staticbuilddir} ${mipsbuilddir} ${mipsbuilddir64}
260	rm -f doc/libext2fs/*.html lib/et/com_err/*.html debian/*.substvars
261	dh_clean
262
263install: cleanup install-std
264
265# This rule allows to factorize the dh_clean between the 2 install rules
266# This must be launched before install-* (if launching them by hand, for
267# exemple) or results are unpredictable
268cleanup:
269	dh_testdir
270	dh_testroot
271	dh_clean -k
272
273install-std: DH_OPTIONS=
274install-std: build
275	dh_testdir
276	dh_testroot
277	dh_installdirs
278
279	mkdir -p ${tmpdir}/sbin
280	$(MAKE) -C ${stdbuilddir} install DESTDIR=${tmpdir} \
281		INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
282  # static libs and .h files
283	$(MAKE) -C ${stdbuilddir} install-libs DESTDIR=${tmpdir} LDCONFIG=true
284
285  # statically-linked fsck
286	${INSTALL_PROGRAM} $(E2FSCK_STATIC) ${tmpdir}/sbin
287	cp ${mandir}/man8/e2fsck.8 ${mandir}/man8/e2fsck.static.8
288
289	ln -s et/com_err.h ${tmpdir}/usr/include
290
291	dh_movefiles
292	test -z `find ${tmpdir} -type f`
293
294  # specially-built MIPS libs
295ifneq ($(ismips),)
296	$(INSTALL) -p -m 0644 ${mipsbuilddir}/lib/libext2fs.a \
297		${debdir}/e2fslibs-dev/usr/lib/libext2fs-nopic.a
298	$(INSTALL) -p -m 0644 ${mipsbuilddir64}/lib/libext2fs.a \
299		${debdir}/e2fslibs-dev/usr/lib/lib64ext2fs-nopic.a
300endif
301
302install-udeb: DH_OPTIONS=
303install-udeb: build
304	dh_testdir
305	dh_testroot
306
307	$(MAKE) -C ${bfbuilddir} install-shlibs-libs-recursive DESTDIR=${udebdir} \
308		INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
309	$(MAKE) -C ${bfbuilddir}/e2fsck install DESTDIR=${udebdir} \
310		INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
311	$(MAKE) -C ${bfbuilddir}/misc install DESTDIR=${udebdir} \
312		INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
313	$(MAKE) -C ${bfbuilddir}/resize install DESTDIR=${udebdir} \
314		INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
315
316	rm -rf ${udebdir}/usr
317	find ${udebdir}/sbin -type f -a ! -name e2fsck \
318		-a ! -name mke2fs -a ! -name tune2fs \
319		-a ! -name resize2fs -a ! -name badblocks -print | xargs rm
320
321	(cd ${udebdir}/sbin; ln -s e2fsck fsck.ext2 ; \
322		ln -s e2fsck fsck.ext3 ; ln -s mke2fs mkfs.ext2 ; \
323		ln -s mke2fs mkfs.ext3)
324
325	mkdir -p ${blkidudebdir}/lib
326	mv ${udebdir}/lib/libblkid.* ${blkidudebdir}/lib
327
328	mkdir -p ${uuidudebdir}/lib
329	mv ${udebdir}/lib/libuuid.* ${uuidudebdir}/lib
330
331binary-indep: 
332  # no arch-independant debs.
333
334binary-arch: DH_OPTIONS= -a
335binary-arch: install install-udeb
336	dh_testdir
337	dh_testroot
338
339  # lintian overrides
340	for i in $$(cd debian && echo *.lintian-overrides); do \
341		pkg=$${i%.lintian-overrides} ;\
342		$(INSTALL) -m 0644 -D -p debian/$$i ${debdir}/$${pkg}/usr/share/lintian/overrides/$${pkg} ;\
343	done
344
345  # mkinitrd script
346	mkdir -p debian/e2fsprogs/usr/share/initrd-tools/scripts
347	$(INSTALL) -p -o root -g root -m 0755 debian/initrd-tools.e2fsprogs \
348		debian/e2fsprogs/usr/share/initrd-tools/scripts/e2fsprogs
349
350  # initrd script
351	mkdir -p debian/e2fsprogs/usr/share/e2fsprogs
352	$(INSTALL) -p -o root -g root -m 0755 debian/initrd.ext3-add-journal \
353		debian/e2fsprogs/usr/share/e2fsprogs/initrd.ext3-add-journal
354
355
356  # symlinks to prepare dh_installdocs run
357
358	mkdir -p ${debdir}/libblkid${BLKID_SOVERSION}/usr/share/doc/libblkid${BLKID_SOVERSION}
359	mkdir -p ${debdir}/libblkid-dev/usr/share/doc
360	ln -sf libblkid${BLKID_SOVERSION} ${debdir}/libblkid-dev/usr/share/doc/libblkid-dev
361
362	mkdir -p ${debdir}/libss${SS_SOVERSION}/usr/share/doc/libss${SS_SOVERSION}
363	mkdir -p ${debdir}/ss-dev/usr/share/doc
364	ln -sf libss${SS_SOVERSION} ${debdir}/ss-dev/usr/share/doc/ss-dev
365
366	mkdir -p ${debdir}/libcomerr${COMERR_SOVERSION}/usr/share/doc/libcomerr${COMERR_SOVERSION}
367	mkdir -p ${debdir}/comerr-dev/usr/share/doc
368	ln -sf libcomerr${COMERR_SOVERSION} ${debdir}/comerr-dev/usr/share/doc/comerr-dev
369
370	mkdir -p ${debdir}/libuuid${UUID_SOVERSION}/usr/share/doc/libuuid${UUID_SOVERSION}
371	mkdir -p ${debdir}/uuid-dev/usr/share/doc
372#	ln -sf libuuid${UUID_SOVERSION} ${debdir}/uuid-dev/usr/share/doc/uuid-dev
373
374	mkdir -p ${debdir}/e2fslibs/usr/share/doc/e2fslibs
375	mkdir -p ${debdir}/e2fslibs-dev/usr/share/doc
376	ln -sf e2fslibs ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev
377
378	$(INSTALL) -p -m 0644 debian/libblkid.copyright \
379		${debdir}/libblkid${BLKID_SOVERSION}/usr/share/doc/libblkid${BLKID_SOVERSION}/copyright
380
381	dh_installdocs -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
382
383  # HTML docs
384	$(INSTALL) -d ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/html-info/
385	$(INSTALL) -p -m 0644 ${stdbuilddir}/doc/libext2fs/*.html \
386	   ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/html-info/
387	$(INSTALL) -d ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/html-info/
388	$(INSTALL) -p -m 0644 ${stdbuilddir}/lib/et/com_err/*.html \
389	   ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/html-info/
390
391  # texinfo docs
392	mkdir -p ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}
393	$(INSTALL) -p -m 0644 ${topdir}/doc/libext2fs.texinfo \
394	   ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/libext2fs.texi
395	$(INSTALL) -p -m 0644 ${topdir}/lib/et/com_err.texinfo \
396	   ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/com_err.texi
397
398	$(INSTALL) -d ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/examples
399	$(INSTALL) -p -m 0644 lib/ss/ss_err.et \
400		${stdbuilddir}/lib/ext2fs/ext2_err.et \
401		${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/examples
402	$(INSTALL) -d ${debdir}/ss-dev/usr/share/doc/libss${SS_SOVERSION}/examples
403	$(INSTALL) -p -m 0644 debugfs/debug_cmds.ct \
404		${debdir}/ss-dev/usr/share/doc/libss${SS_SOVERSION}/examples
405
406	if test -f /etc/lsb-release && \
407		grep -q DISTRIB_ID=Ubuntu /etc/lsb-release; then \
408	$(INSTALL) -p -m 0644 e2fsck/e2fsck.conf.ubuntu \
409		${debdir}/e2fsprogs/etc/e2fsck.conf; \
410	fi
411
412	dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info
413	dh_installinfo -pe2fslibs-dev ${stdbuilddir}/doc/libext2fs.info
414
415	DH_OPTIONS= dh_installchangelogs -pe2fsprogs \
416		-plibblkid${BLKID_SOVERSION} -plibcomerr${COMERR_SOVERSION} \
417		-plibss${SS_SOVERSION} -plibuuid${UUID_SOVERSION} \
418		-pe2fslibs -puuid-dev -puuid-runtime -pe2fsck-static \
419		-pe2fsprogs-dbg -puuid-runtime-dbg -pe2fslibs-dbg \
420		-plibcomerr2-dbg -plibss2-dbg -plibblkid1-dbg -plibuuid1-dbg
421
422	dh_fixperms
423ifneq ($(ismips),)
424	dh_strip -k -Xlib64ext2fs-nopic.a
425else
426	dh_strip -k
427endif
428
429	# debug package stuff
430	rm -rf ${udebdir}/usr
431	rm -rf ${blkidudebdir}/usr
432	rm -rf ${uuidudebdir}/usr
433
434	mkdir -p ${debugdir}/usr/lib
435	mv ${maindir}/usr/lib/debug ${debugdir}/usr/lib
436	rm -rf ${maindir}/usr/lib/debug
437	mv ${e2fsckstaticdir}/usr/lib/debug/sbin/* \
438		${debugdir}/usr/lib/debug
439	rm -rf ${e2fsckstaticdir}/usr/lib
440
441	mkdir -p ${uuidruntimedbgdir}/usr/lib
442	mv ${uuidruntimedir}/usr/lib/debug ${uuidruntimedbgdir}/usr/lib
443	rmdir ${uuidruntimedir}/usr/lib
444
445	mkdir -p ${libext2dbgdir}/usr/lib
446	mv ${libext2dir}/usr/lib/debug ${libext2dbgdir}/usr/lib
447	rmdir ${libext2dir}/usr/lib
448
449	mkdir -p ${libcomerrdbgdir}/usr/lib
450	mv ${libcomerrdir}/usr/lib/debug ${libcomerrdbgdir}/usr/lib
451	rmdir ${libcomerrdir}/usr/lib
452
453	mkdir -p ${libssdbgdir}/usr/lib
454	mv ${libssdir}/usr/lib/debug ${libssdbgdir}/usr/lib
455	rmdir ${libssdir}/usr/lib
456
457	mkdir -p ${libuuiddbgdir}/usr/lib
458	mv ${libuuiddir}/usr/lib/debug ${libuuiddbgdir}/usr/lib
459	rmdir ${libuuiddir}/usr/lib
460
461	mkdir -p ${libblkiddbgdir}/usr/lib
462	mv ${libblkiddir}/usr/lib/debug ${libblkiddbgdir}/usr/lib
463	rmdir ${libblkiddir}/usr/lib
464
465	# dpkg symbol handling
466ifneq (,$(findstring update-symbols,$(DEB_BUILD_OPTIONS)))
467	for i in e2fslibs libcomerr2 libss2 libblkid1 libuuid1; \
468	do \
469		echo "Generating symbols for $$i..."; \
470		dpkg-gensymbols -p$$i -Pdebian/$$i > debian/$$i.tmp-patch; \
471		cat debian/$$i.tmp-patch; \
472		patch debian/$$i.symbols < debian/$$i.tmp-patch; \
473		/bin/rm debian/$$i.tmp-patch; \
474	done
475endif
476
477	$(INSTALL) -p -m 0644 debian/e2fsprogs.copyright \
478		${debugdir}/usr/share/doc/e2fsprogs-dbg/copyright
479
480	$(INSTALL) -p -m 0644 debian/uuid-runtime.copyright \
481		${uuidruntimedbgdir}/usr/share/doc/uuid-runtime-dbg/copyright
482
483	$(INSTALL) -p -m 0644 debian/e2fslibs.copyright \
484		${libext2dbgdir}/usr/share/doc/e2fslibs-dbg/copyright
485
486	$(INSTALL) -p -m 0644 debian/libcomerr2.copyright \
487		${libcomerrdbgdir}/usr/share/doc/libcomerr2-dbg/copyright
488
489	$(INSTALL) -p -m 0644 debian/libss2.copyright \
490		${libssdbgdir}/usr/share/doc/libss2-dbg/copyright
491
492	$(INSTALL) -p -m 0644 debian/libblkid.copyright \
493		${libblkiddbgdir}/usr/share/doc/libblkid1-dbg/copyright
494
495	$(INSTALL) -p -m 0644 debian/libuuid1.copyright \
496		${libuuiddbgdir}/usr/share/doc/libuuid1-dbg/copyright
497
498	dh_compress
499
500	dh_makeshlibs -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
501	dh_makeshlibs -plibcomerr${COMERR_SOVERSION} \
502		-V 'libcomerr2 (>= 1.33-3)'
503	dh_makeshlibs -plibblkid${BLKID_SOVERSION} -V 'libblkid1 (>= 1.39-1)'
504	echo "udeb: libblkid 1 libblkid1-udeb" >> \
505		debian/libblkid1/DEBIAN/shlibs
506	echo "udeb: libuuid 1 libuuid1-udeb" >> debian/libuuid1/DEBIAN/shlibs
507
508	dh_installdeb
509	rm debian/e2fsprogs-udeb/DEBIAN/conffiles
510	dh_shlibdeps -l${stdbuilddir}/lib
511	dh_shlibdeps -pe2fsprogs -l${stdbuilddir}/lib \
512		-u"-Ldebian/e2fsprogs.shlibs.local"
513	dh_shlibdeps -pe2fsprogs-udeb -l${stdbuilddir}/lib \
514		-u"-Ldebian/e2fsprogs-udeb.shlibs.local"
515
516	dh_gencontrol -Ncomerr-dev -Nss-dev -Nuuid-dev \
517		-Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
518	DH_OPTIONS= dh_gencontrol -pcomerr-dev \
519	  -u '-v${COMERR_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}'
520	DH_OPTIONS= dh_gencontrol -pss-dev \
521	  -u '-v${SS_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}'
522	DH_OPTIONS= dh_gencontrol -puuid-dev \
523	  -u '-v${UUID_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}'
524
525	dh_md5sums -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
526	dh_builddeb -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
527
528	# udeb stuff
529	dh_gencontrol	-pe2fsprogs-udeb -- -fdebian/files~
530	dpkg-distaddfile $(UDEB_NAME) debian-installer $(UDEB_PRIORITY)
531	dh_builddeb -pe2fsprogs-udeb --filename=$(UDEB_NAME)
532
533	dh_gencontrol	-plibblkid1-udeb -- -fdebian/files~
534	dpkg-distaddfile $(BLKID_UDEB_NAME) debian-installer $(BLKID_UDEB_PRIORITY)
535	dh_builddeb -plibblkid1-udeb --filename=$(BLKID_UDEB_NAME)
536
537	dh_gencontrol	-plibuuid1-udeb -- -fdebian/files~
538	dpkg-distaddfile $(UUID_UDEB_NAME) debian-installer $(UUID_UDEB_PRIORITY)
539	dh_builddeb -plibuuid1-udeb --filename=$(UUID_UDEB_NAME)
540
541binary: binary-indep binary-arch
542
543.PHONY: binary binary-arch binary-indep clean checkroot
544