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