rules revision 62775dc54257c1986a05e33bee25c956c92d783f
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 13DEB_BUILD_ARCH := $(shell dpkg --print-architecture) 14DEB_BUILD_GNU_TYPE := $(shell ./config.guess) 15ifndef DEB_HOST_ARCH 16 DEB_HOST_ARCH := ${DEB_BUILD_ARCH} 17endif 18DEB_HOST_GNU_CPU := $(patsubst hurd-%,%,$(DEB_HOST_ARCH)) 19ifeq ($(filter-out hurd-%,${DEB_HOST_ARCH}),) 20 DEB_HOST_GNU_SYSTEM := gnu 21else 22# FIXME: we won't have always just Hurd and Linux 23 DEB_HOST_GNU_SYSTEM := linux 24endif 25DEB_HOST_GNU_TYPE := ${DEB_HOST_GNU_CPU}-${DEB_HOST_GNU_SYSTEM} 26 27 28# find the version for the main package, from changelog file 29MAIN_VERSION = $(shell head -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 32COMERR_VERSION = $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3) 33COMERR_SOVERSION = $(shell grep ELF_SO_VERSION lib/et/Makefile.in | cut '-d ' -f3) 34SS_VERSION = $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3) 35SS_SOVERSION = $(shell grep ELF_SO_VERSION lib/ss/Makefile.in | cut '-d ' -f3) 36UUID_VERSION = $(shell grep ELF_VERSION lib/uuid/Makefile.in | cut '-d ' -f3) 37UUID_SOVERSION = $(shell grep ELF_SO_VERSION lib/uuid/Makefile.in | cut '-d ' -f3) 38BLKID_VERSION = $(shell grep ELF_VERSION lib/blkid/Makefile.in | cut '-d ' -f3) 39BLKID_SOVERSION = $(shell grep ELF_SO_VERSION lib/blkid/Makefile.in | cut '-d ' -f3) 40EXT2FS_SOVERSION = $(shell grep ELF_SO_VERSION lib/ext2fs/Makefile.in | cut '-d ' -f3) 41E2P_SOVERSION = $(shell grep ELF_SO_VERSION lib/e2p/Makefile.in | cut '-d ' -f3) 42 43package=e2fsprogs 44 45topdir=$(shell pwd) 46debdir=${topdir}/debian 47tmpdir=${debdir}/tmp 48udebdir=${debdir}/e2fsprogs-udeb 49blkidudebdir=${debdir}/libblkid1-udeb 50maindir=${debdir}/e2fsprogs 51stdbuilddir=${debdir}/BUILD-STD 52bfbuilddir=${debdir}/BUILD-BF 53mipsbuilddir=${debdir}/BUILD-MIPS 54# docdir=${maindir}/usr/share/doc/${package} 55MANDIR=/usr/share/man 56mandir=${tmpdir}${MANDIR} 57 58UDEB_NAME = $(package)-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb 59UDEB_PRIORITY = $(shell grep '^Package: e2fsprogs-udeb' debian/control -A 10 | grep ^Priority: | cut -d ' ' -f 2) 60 61BLKID_UDEB_NAME = libblkid1-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb 62BLKID_UDEB_PRIORITY = $(shell grep '^Package: libblkid1-udeb' debian/control -A 10 | grep ^Priority: | cut -d ' ' -f 2) 63 64SUBPACKAGES_DIRS = tmp e2fslibs-dev comerr-dev ss-dev 65 66STAMPSDIR=debian/stampdir 67CFGSTDSTAMP=${STAMPSDIR}/configure-std-stamp 68CFGBFSTAMP=${STAMPSDIR}/configure-bf-stamp 69BUILDSTDSTAMP=${STAMPSDIR}/build-std-stamp 70BUILDBFSTAMP=${STAMPSDIR}/build-bf-stamp 71 72CCOPTS = -O2 -fsigned-char 73LIBC-DEV = libc6-dev 74 75INSTALL = install 76INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755 77 78ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) 79CCOPTS += -g -O1 80endif 81ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) 82INSTALL_PROGRAM += -s 83endif 84 85ifeq (${DEB_HOST_ARCH},alpha) 86CCOPTS += -DHAVE_NETINET_IN_H 87LIBC-DEV = libc6.1-dev 88else 89CCOPTS += -D__NO_STRING_INLINES 90endif 91 92BF_CCOPTS = -Os -fomit-frame-pointer 93 94COMMON_CONF_FLAGS = \ 95 --enable-elf-shlibs --enable-dynamic-e2fsck --disable-evms \ 96 --infodir=/usr/share/info 97 98STD_CONF_FLAGS = --with-ccopts="${CCOPTS}" --enable-compression 99 100BF_CONF_FLAGS = --with-ccopts="${CCOPTS} ${BF_CCOPTS}" \ 101 --disable-nls --disable-swapfs --disable-imager \ 102 --disable-resizer --disable-debugfs 103 104MIPS_NOPIC_CONF_FLAGS = --with-ccopts="${CCOPTS}" \ 105 --disable-nls \ 106 --disable-swapfs --disable-imager \ 107 --disable-resizer # --disable-debugfs 108# we can't use those flags at configure time 109MIPS_CFLAGS= -G 0 -fno-pic -mno-abicalls 110 111ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) 112ifneq (,$(findstring $(DEB_BUILD_ARCH),mips mipsel)) 113ismips=ismips 114endif 115endif 116 117${CFGSTDSTAMP}: 118 dh_testdir 119 120 mkdir -p ${stdbuilddir} 121ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) 122 cd ${stdbuilddir} && \ 123 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} 124else 125 cd ${stdbuilddir} && CC="${DEB_HOST_GNU_TYPE}-gcc" \ 126 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \ 127 --build=$(DEB_BUILD_GNU_TYPE) $(DEB_HOST_GNU_TYPE) 128endif 129 130 # specially-built MIPS lib 131 if [ ismips = "${ismips}" ]; then \ 132 mkdir -p ${mipsbuilddir} ; \ 133 cd ${mipsbuilddir} && \ 134 ${topdir}/configure ${MIPS_NOPIC_CONF_FLAGS} ; \ 135 fi 136 137 mkdir -p ${STAMPSDIR} 138 touch ${CFGSTDSTAMP} 139 140${CFGBFSTAMP}: 141 dh_testdir 142 rm -f config.cache 143 144 mkdir -p ${bfbuilddir} 145ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) 146 cd ${bfbuilddir} && \ 147 ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} 148else 149 cd ${bfbuilddir} && CC="${DEB_HOST_GNU_TYPE}-gcc" \ 150 ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \ 151 --build=$(DEB_BUILD_GNU_TYPE) $(DEB_HOST_GNU_TYPE) 152endif 153 mkdir -p ${STAMPSDIR} 154 touch ${CFGBFSTAMP} 155 156build: build-std build-bf 157 158build-std: ${BUILDSTDSTAMP} 159${BUILDSTDSTAMP}: ${CFGSTDSTAMP} 160 dh_testdir 161 make -C ${stdbuilddir} all 162 163 ( cd ${stdbuilddir}/doc && \ 164 texi2html -split_chapter ${topdir}/doc/libext2fs.texinfo ) 165 ( cd ${stdbuilddir}/lib/et && make com_err.info && \ 166 texi2html -split_chapter -expandinfo ${topdir}/lib/et/com_err.texinfo ) 167 168 # specially-built MIPS lib 169 if [ ismips = "${ismips}" ]; then \ 170 make -C ${mipsbuilddir}/util ; \ 171 make -C ${mipsbuilddir} libs \ 172 CFLAGS="${CCOPTS} ${MIPS_CFLAGS}" \ 173 LIB_SUBDIRS="lib/et lib/ext2fs" ; \ 174 fi 175 176 touch ${BUILDSTDSTAMP} 177 178build-bf: ${BUILDBFSTAMP} 179${BUILDBFSTAMP}: ${CFGBFSTAMP} 180 dh_testdir 181 make -C ${bfbuilddir} libs 182 make -C ${bfbuilddir}/e2fsck all 183 make -C ${bfbuilddir}/misc all 184 touch ${BUILDBFSTAMP} 185 186clean: 187 dh_testdir 188 rm -rf ${STAMPSDIR} 189 -make -C ${stdbuilddir} -i distclean 190 -make -C ${bfbuilddir} -i distclean 191 rm -rf ${stdbuilddir} ${bfbuilddir} ${mipsbuilddir} 192 rm -f doc/libext2fs_*.html lib/et/com_err_*.html debian/*.substvars 193 dh_clean 194 195install: cleanup install-std 196 197# This rule allows to factorize the dh_clean between the 2 install rules 198# This must be launched before install-* (if launching them by hand, for 199# exemple) or results are unpredictable 200cleanup: 201 dh_testdir 202 dh_testroot 203 dh_clean -k 204 205install-std: DH_OPTIONS= 206install-std: build 207 dh_testdir 208 dh_testroot 209 dh_installdirs 210 211 mkdir -p ${tmpdir}/sbin 212 make -C ${stdbuilddir} install DESTDIR=${tmpdir} \ 213 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true 214 # static libs and .h files 215 make -C ${stdbuilddir} install-libs DESTDIR=${tmpdir} LDCONFIG=true 216 217 # statically-linked fsck 218 ${INSTALL_PROGRAM} ${stdbuilddir}/e2fsck/e2fsck.static ${tmpdir}/sbin 219 ln -s e2fsck.8.gz ${mandir}/man8/e2fsck.static.8.gz 220 221 ln -s et/com_err.h ${tmpdir}/usr/include 222 223 dh_movefiles 224 test -z `find ${tmpdir} -type f` 225 226 # specially-built MIPS lib 227 if [ ismips = "${ismips}" ]; then \ 228 cp ${mipsbuilddir}/lib/libext2fs.a \ 229 ${debdir}/e2fslibs-dev/usr/lib/libext2fs-nopic.a ; \ 230 fi 231 232install-udeb: DH_OPTIONS= 233install-udeb: build 234 dh_testdir 235 dh_testroot 236 237 make -C ${bfbuilddir} install-shlibs-libs-recursive DESTDIR=${udebdir} \ 238 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true 239 make -C ${bfbuilddir}/e2fsck install DESTDIR=${udebdir} \ 240 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true 241 make -C ${bfbuilddir}/misc install DESTDIR=${udebdir} \ 242 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true 243 244 rm -rf ${udebdir}/usr 245 find ${udebdir}/sbin -type f -a ! -name mkfs.\* -a ! -name fsck.\* \ 246 -a ! -name e2fsck -a ! -name mke2fs -print | xargs rm 247 248 mkdir -p ${blkidudebdir}/lib 249 mv ${udebdir}/lib/libblkid.* ${blkidudebdir}/lib 250 251binary-indep: 252 # no arch-independant debs. 253 254binary-arch: DH_OPTIONS= -a 255binary-arch: install install-udeb 256 dh_testdir 257 dh_testroot 258 259 # lintian overrides 260 for i in $$(cd debian && echo *.lintian-overrides); do \ 261 pkg=$${i%.lintian-overrides} ;\ 262 install -m644 -D -p debian/$$i ${debdir}/$${pkg}/usr/share/lintian/overrides/$${pkg} ;\ 263 done 264 265 # mkinitrd script 266 mkdir -p debian/e2fsprogs/etc/mkinitrd/scripts 267 install -m755 debian/e2fsprogs.mkinitrd \ 268 debian/e2fsprogs/etc/mkinitrd/scripts/e2fsprogs 269 270 # symlinks to prepare dh_installdocs run 271 mkdir -p ${debdir}/e2fsck-static/usr/share/doc/ 272 ln -sf e2fsprogs ${debdir}/e2fsck-static/usr/share/doc/e2fsck-static 273 274 mkdir -p ${debdir}/e2fslibs-dev/usr/share/doc/e2fsprogs 275 ln -sf e2fsprogs ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev 276 277 mkdir -p ${debdir}/uuid-dev/usr/share/doc/e2fsprogs 278 ln -sf e2fsprogs ${debdir}/uuid-dev/usr/share/doc/uuid-dev 279 280 # comerr and ss have their own copyright notices 281 mkdir -p ${maindir}/usr/share/doc/libcomerr${COMERR_SOVERSION} 282 mkdir -p ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION} 283 ln -sf libcomerr${COMERR_SOVERSION} ${debdir}/comerr-dev/usr/share/doc/comerr-dev 284 285 mkdir -p ${maindir}/usr/share/doc/libss${SS_SOVERSION} 286 mkdir -p ${debdir}/ss-dev/usr/share/doc/libss${SS_SOVERSION} 287 ln -sf libss${SS_SOVERSION} ${debdir}/ss-dev/usr/share/doc/ss-dev 288 289 mkdir -p ${debdir}/libblkid${BLKID_SOVERSION}/usr/share/doc/libblkid${BLKID_SOVERSION} 290 mkdir -p ${debdir}/libblkid-dev/usr/share/doc 291 ln -sf libblkid${BLKID_SOVERSION} ${debdir}/libblkid-dev/usr/share/doc/libblkid-dev 292 293 for i in libcomerr${COMERR_SOVERSION} libss${SS_SOVERSION}; do \ 294 install -m 644 debian/$$i.copyright \ 295 ${maindir}/usr/share/doc/$$i/copyright ; \ 296 done 297 298 install -m 644 debian/libblkid.copyright \ 299 ${debdir}/libblkid${BLKID_SOVERSION}/usr/share/doc/libblkid${BLKID_SOVERSION}/copyright 300 301 dh_installdocs -Ne2fsprogs-udeb -Nlibblkid1-udeb 302 303 # libblkid is under the the LGPL 304 305 # HTML docs 306 install -d ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/html-info/ 307 install -p ${stdbuilddir}/doc/libext2fs_*.html \ 308 ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/html-info/ 309 install -d ${debdir}/comerr-dev/usr/share/doc/comerr-dev/html-info/ 310 install -p ${stdbuilddir}/lib/et/com_err_*.html \ 311 ${debdir}/comerr-dev/usr/share/doc/comerr-dev/html-info/ 312 313 # texinfo docs 314 install -p ${topdir}/doc/libext2fs.texinfo \ 315 ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/libext2fs.texi 316 install -p ${topdir}/lib/et/com_err.texinfo \ 317 ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/com_err.texi 318 319 dh_installexamples 320 321 dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info 322 dh_installinfo -pe2fslibs-dev ${stdbuilddir}/doc/libext2fs.info 323 324 dh_undocumented 325 326 DH_OPTIONS= dh_installchangelogs -pe2fsprogs -plibblkid${BLKID_SOVERSION} ChangeLog 327 328 for i in libcomerr${COMERR_SOVERSION} libss${SS_SOVERSION} ; do \ 329 mkdir -p ${maindir}/usr/share/doc/$$i ; \ 330 ln -s ../e2fsprogs/changelog.Debian.gz ${maindir}/usr/share/doc/$$i/ ; \ 331 ln -s ../e2fsprogs/changelog.gz ${maindir}/usr/share/doc/$$i/ ; \ 332 done 333 334 dh_strip 335 336 dh_compress 337 dh_fixperms 338 339 echo "libcdev:Depends=${LIBC-DEV}" > debian/comerr-dev.substvars 340 echo "libcdev:Depends=${LIBC-DEV}" > debian/ss-dev.substvars 341 echo "libcdev:Depends=${LIBC-DEV}" > debian/uuid-dev.substvars 342 echo "libcdev:Depends=${LIBC-DEV}" > debian/blkid-dev.substvars 343 echo "libcdev:Depends=${LIBC-DEV}" > debian/e2fslibs-dev.substvars 344 345# Call this mostly to get the maintainer-script snippets 346 dh_makeshlibs -pe2fsprogs 347# We overwrite the shlibs by hand because of virtual packages used 348 : > debian/e2fsprogs/DEBIAN/shlibs 349 echo "libext2fs ${EXT2FS_SOVERSION} libext2fs${EXT2FS_SOVERSION}" \ 350 >> debian/e2fsprogs/DEBIAN/shlibs 351 echo "libe2p ${E2P_SOVERSION} libe2p${E2P_SOVERSION}" \ 352 >> debian/e2fsprogs/DEBIAN/shlibs 353 echo "libuuid ${UUID_SOVERSION} libuuid${UUID_SOVERSION}" \ 354 >> debian/e2fsprogs/DEBIAN/shlibs 355 echo "libcom_err ${COMERR_SOVERSION} libcomerr${COMERR_SOVERSION}" \ 356 >> debian/e2fsprogs/DEBIAN/shlibs 357 echo "libss ${SS_SOVERSION} libss${SS_SOVERSION}" \ 358 >> debian/e2fsprogs/DEBIAN/shlibs 359 360 dh_makeshlibs -plibblkid${BLKID_SOVERSION} 361 362 dh_installdeb 363 dh_shlibdeps -l${stdbuilddir}/lib 364 365 dh_gencontrol -Ncomerr-dev -Nss-dev -Nuuid-dev -Ne2fsprogs-udeb -Nlibblkid1-udeb 366 DH_OPTIONS= dh_gencontrol -pcomerr-dev \ 367 -u '-v${COMERR_VERSION}-${MAIN_VERSION}' 368 DH_OPTIONS= dh_gencontrol -pss-dev \ 369 -u '-v${SS_VERSION}-${MAIN_VERSION}' 370 DH_OPTIONS= dh_gencontrol -puuid-dev \ 371 -u '-v${UUID_VERSION}-${MAIN_VERSION}' 372 DH_OPTIONS= dh_gencontrol -plibblkid-dev \ 373 -u '-v${MAIN_VERSION}' 374 DH_OPTIONS= dh_gencontrol -plibblkid${BLKID_SOVERSION} \ 375 -u '-v${MAIN_VERSION}' 376 377 dh_md5sums -Ne2fsprogs-udeb -Nlibblkid1-udeb 378 dh_builddeb -Ne2fsprogs-udeb -Nlibblkid1-udeb 379 380 # udeb stuff 381 dh_gencontrol -pe2fsprogs-udeb -- -fdebian/files~ 382 dpkg-distaddfile $(UDEB_NAME) debian-installer $(UDEB_PRIORITY) 383 dh_builddeb -pe2fsprogs-udeb --filename=$(UDEB_NAME) 384 385 dh_gencontrol -plibblkid1-udeb -- -fdebian/files~ 386 dpkg-distaddfile $(BLKID_UDEB_NAME) debian-installer $(BLKID_UDEB_PRIORITY) 387 dh_builddeb -plibblkid1-udeb --filename=$(BLKID_UDEB_NAME) 388 389binary: binary-indep binary-arch 390 391.PHONY: binary binary-arch binary-indep clean checkroot 392