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