#! /usr/bin/make -f # -*- makefile -*- # # Invoke each target with `./debian/rules '. All targets should be # invoked with the package root as the current directory. # # The `binary' target must be run as root, as it needs to install files with # specific ownerships. # be paranoid export LC_ALL=C DEB_BUILD_ARCH := $(shell dpkg --print-architecture) DEB_BUILD_GNU_TYPE := $(shell ./config.guess) ifndef DEB_HOST_ARCH DEB_HOST_ARCH := ${DEB_BUILD_ARCH} endif DEB_HOST_GNU_CPU := $(patsubst hurd-%,%,$(DEB_HOST_ARCH)) ifeq ($(filter-out hurd-%,${DEB_HOST_ARCH}),) DEB_HOST_GNU_SYSTEM := gnu else # FIXME: we won't have always just Hurd and Linux DEB_HOST_GNU_SYSTEM := linux endif DEB_HOST_GNU_TYPE := ${DEB_HOST_GNU_CPU}-${DEB_HOST_GNU_SYSTEM} # find the version for the main package, from changelog file MAIN_VERSION = $(shell head -1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g') # find versions for libraries going into their own packages, from their Makefile.in's, # and sonames for all libs COMERR_VERSION = $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3) COMERR_SOVERSION = $(shell grep ELF_SO_VERSION lib/et/Makefile.in | cut '-d ' -f3) SS_VERSION = $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3) SS_SOVERSION = $(shell grep ELF_SO_VERSION lib/ss/Makefile.in | cut '-d ' -f3) UUID_VERSION = $(shell grep ELF_VERSION lib/uuid/Makefile.in | cut '-d ' -f3) UUID_SOVERSION = $(shell grep ELF_SO_VERSION lib/uuid/Makefile.in | cut '-d ' -f3) EXT2FS_SOVERSION = $(shell grep ELF_SO_VERSION lib/ext2fs/Makefile.in | cut '-d ' -f3) E2P_SOVERSION = $(shell grep ELF_SO_VERSION lib/e2p/Makefile.in | cut '-d ' -f3) package=e2fsprogs topdir=$(shell pwd) debdir=${topdir}/debian tmpdir=${debdir}/tmp bfdir=${debdir}/e2fsprogs-bf udebdir=${debdir}/e2fsprogs-udeb maindir=${debdir}/e2fsprogs stdbuilddir=${debdir}/BUILD-STD bfbuilddir=${debdir}/BUILD-BF mipsbuilddir=${debdir}/BUILD-MIPS # docdir=${maindir}/usr/share/doc/${package} MANDIR=/usr/share/man mandir=${tmpdir}${MANDIR} UDEB_NAME = $(package)-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb UDEB_PRIORITY = $(shell grep '^Package: e2fsprogs-udeb' debian/control -A 10 | grep ^Priority: | cut -d ' ' -f 2) SUBPACKAGES_DIRS = tmp e2fslibs-dev comerr-dev ss-dev STAMPSDIR=debian/stampdir CFGSTDSTAMP=${STAMPSDIR}/configure-std-stamp CFGBFSTAMP=${STAMPSDIR}/configure-bf-stamp BUILDSTDSTAMP=${STAMPSDIR}/build-std-stamp BUILDBFSTAMP=${STAMPSDIR}/build-bf-stamp CCOPTS = -O2 -fsigned-char LIBC-DEV = libc6-dev INSTALL = install INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) CCOPTS += -g -O1 endif ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif ifeq (${DEB_HOST_ARCH},alpha) CCOPTS += -DHAVE_NETINET_IN_H LIBC-DEV = libc6.1-dev else CCOPTS += -D__NO_STRING_INLINES endif BF_CCOPTS = -Os -fomit-frame-pointer COMMON_CONF_FLAGS = \ --enable-elf-shlibs --enable-dynamic-e2fsck \ --enable-nls \ --infodir=/usr/share/info STD_CONF_FLAGS = --with-ccopts="${CCOPTS}" --enable-compression BF_CONF_FLAGS = --with-ccopts="${CCOPTS} ${BF_CCOPTS}" \ --disable-swapfs --disable-imager \ --disable-resizer --disable-debugfs MIPS_NOPIC_CONF_FLAGS = --with-ccopts="${CCOPTS}" \ --disable-nls \ --disable-swapfs --disable-imager \ --disable-resizer # --disable-debugfs # we can't use those flags at configure time MIPS_CFLAGS= -G 0 -fno-pic -mno-abicalls ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) ifneq (,$(findstring $(DEB_BUILD_ARCH),mips mipsel)) ismips=ismips endif endif ${CFGSTDSTAMP}: dh_testdir mkdir -p ${stdbuilddir} ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) cd ${stdbuilddir} && \ ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} else cd ${stdbuilddir} && CC="${DEB_HOST_GNU_TYPE}-gcc" \ ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \ --build=$(DEB_BUILD_GNU_TYPE) $(DEB_HOST_GNU_TYPE) endif # specially-built MIPS lib if [ ismips = "${ismips}" ]; then \ mkdir -p ${mipsbuilddir} ; \ cd ${mipsbuilddir} && \ ${topdir}/configure ${MIPS_NOPIC_CONF_FLAGS} ; \ fi mkdir -p ${STAMPSDIR} touch ${CFGSTDSTAMP} ${CFGBFSTAMP}: dh_testdir rm -f config.cache mkdir -p ${bfbuilddir} ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) cd ${bfbuilddir} && \ ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} else cd ${bfbuilddir} && CC="${DEB_HOST_GNU_TYPE}-gcc" \ ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \ --build=$(DEB_BUILD_GNU_TYPE) $(DEB_HOST_GNU_TYPE) endif mkdir -p ${STAMPSDIR} touch ${CFGBFSTAMP} build: build-std build-bf build-std: ${BUILDSTDSTAMP} ${BUILDSTDSTAMP}: ${CFGSTDSTAMP} dh_testdir make -C ${stdbuilddir} all ( cd ${stdbuilddir}/doc && \ texi2html -split_chapter ${topdir}/doc/libext2fs.texinfo ) ( cd ${stdbuilddir}/lib/et && make com_err.info && \ texi2html -split_chapter -expandinfo ${topdir}/lib/et/com_err.texinfo ) # specially-built MIPS lib if [ ismips = "${ismips}" ]; then \ make -C ${mipsbuilddir}/util ; \ make -C ${mipsbuilddir} libs \ CFLAGS="${CCOPTS} ${MIPS_CFLAGS}" \ LIB_SUBDIRS="lib/et lib/ext2fs" ; \ fi touch ${BUILDSTDSTAMP} build-bf: ${BUILDBFSTAMP} ${BUILDBFSTAMP}: ${CFGBFSTAMP} dh_testdir make -C ${bfbuilddir} all touch ${BUILDBFSTAMP} clean: dh_testdir rm -rf ${STAMPSDIR} -make -C ${stdbuilddir} -i distclean -make -C ${bfbuilddir} -i distclean rm -rf ${stdbuilddir} ${bfbuilddir} ${mipsbuilddir} rm -f doc/libext2fs_*.html lib/et/com_err_*.html debian/*.substvars dh_clean install: cleanup install-std install-bf # This rule allows to factorize the dh_clean between the 2 install rules # This must be launched before install-* (if launching them by hand, for # exemple) or results are unpredictable cleanup: dh_testdir dh_testroot dh_clean -k install-std: DH_OPTIONS= install-std: build dh_testdir dh_testroot dh_installdirs mkdir -p ${tmpdir}/sbin make -C ${stdbuilddir} install DESTDIR=${tmpdir} \ INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true # static libs and .h files make -C ${stdbuilddir} install-libs DESTDIR=${tmpdir} LDCONFIG=true # remove FSIM for now. rm ${tmpdir}/lib/evms/libe2fsim.1.1.1.so # statically-linked fsck ${INSTALL_PROGRAM} ${stdbuilddir}/e2fsck/e2fsck.static ${tmpdir}/sbin ln -s e2fsck.8.gz ${mandir}/man8/e2fsck.static.8.gz dh_movefiles test -z `find ${tmpdir} -type f` # specially-built MIPS lib if [ ismips = "${ismips}" ]; then \ cp ${mipsbuilddir}/lib/libext2fs.a \ ${debdir}/e2fslibs-dev/usr/lib/libext2fs-nopic.a ; \ fi install-bf: DH_OPTIONS= install-bf: build dh_testdir dh_testroot dh_installdirs mkdir -p ${bfdir}/sbin make -C ${bfbuilddir} install DESTDIR=${bfdir} \ INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true rm -rf ${bfdir}/usr/share ${bfdir}/usr/lib cd ${bfdir}/sbin && rm -f e2label cd ${bfdir}/usr/bin && rm -f uuidgen # remove FSIM for now. rm ${bfdir}/lib/evms/libe2fsim.1.1.1.so install-udeb: install-bf dh_testdir dh_testroot dh_installdirs cp -a ${bfdir}/lib ${udebdir}/ mkdir -p ${udebdir}/sbin cp -a ${bfdir}/sbin/mke2fs ${udebdir}/sbin/ ln -s mke2fs ${udebdir}/sbin/mkfs.ext2 ln -s mke2fs ${udebdir}/sbin/mkfs.ext3 cp -a ${bfdir}/sbin/e2fsck ${udebdir}/sbin/ ln -s e2fsck ${udebdir}/sbin/fsck.ext2 ln -s e2fsck ${udebdir}/sbin/fsck.ext3 binary-indep: # no arch-independant debs. binary-arch: DH_OPTIONS= -a binary-arch: install install-udeb dh_testdir dh_testroot # remove obsolete maint-scripts provided by 1.26 upstream cd debian && rm -f comerr-dev.postinst e2fslibs-dev.postinst \ e2fsprogs.postinst e2fsprogs.shlibs e2fsprogs.shlibs.in # lintian overrides for i in $$(cd debian && echo *.lintian-overrides); do \ pkg=$${i%.lintian-overrides} ;\ install -m644 -D -p debian/$$i ${debdir}/$${pkg}/usr/share/lintian/overrides/$${pkg} ;\ done # mkinitrd script mkdir -p debian/e2fsprogs/etc/mkinitrd/scripts install -m755 debian/e2fsprogs.mkinitrd \ debian/e2fsprogs/etc/mkinitrd/scripts/e2fsprogs # symlinks to prepare dh_installdocs run mkdir -p ${debdir}/e2fsck-static/usr/share/doc/ ln -sf e2fsprogs ${debdir}/e2fsck-static/usr/share/doc/e2fsck-static mkdir -p ${debdir}/e2fslibs-dev/usr/share/doc/e2fsprogs ln -sf e2fsprogs ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev mkdir -p ${debdir}/uuid-dev/usr/share/doc/e2fsprogs ln -sf e2fsprogs ${debdir}/uuid-dev/usr/share/doc/uuid-dev # comerr and ss have their own copyright notices mkdir -p ${maindir}/usr/share/doc/libcomerr${COMERR_SOVERSION} mkdir -p ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION} ln -sf libcomerr${COMERR_SOVERSION} ${debdir}/comerr-dev/usr/share/doc/comerr-dev mkdir -p ${maindir}/usr/share/doc/libss${SS_SOVERSION} mkdir -p ${debdir}/ss-dev/usr/share/doc/libss${SS_SOVERSION} ln -sf libss${SS_SOVERSION} ${debdir}/ss-dev/usr/share/doc/ss-dev for i in libcomerr${COMERR_SOVERSION} libss${SS_SOVERSION}; do \ install -m 644 debian/$$i.copyright \ ${maindir}/usr/share/doc/$$i/copyright ; \ done dh_installdocs -Ne2fsprogs-udeb install -m 644 debian/e2fsprogs.copyright \ ${bfdir}/usr/share/doc/e2fsprogs-bf/copyright # HTML docs install -d ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/html-info/ install -p ${stdbuilddir}/doc/libext2fs_*.html \ ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/html-info/ install -d ${debdir}/comerr-dev/usr/share/doc/comerr-dev/html-info/ install -p ${stdbuilddir}/lib/et/com_err_*.html \ ${debdir}/comerr-dev/usr/share/doc/comerr-dev/html-info/ # texinfo docs install -p ${topdir}/doc/libext2fs.texinfo \ ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/libext2fs.texi install -p ${topdir}/lib/et/com_err.texinfo \ ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/com_err.texi dh_installexamples dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info dh_installinfo -pe2fslibs-dev ${stdbuilddir}/doc/libext2fs.info dh_undocumented DH_OPTIONS= dh_installchangelogs -pe2fsprogs -pe2fsprogs-bf ChangeLog for i in libcomerr${COMERR_SOVERSION} libss${SS_SOVERSION} ; do \ mkdir -p ${maindir}/usr/share/doc/$$i ; \ ln -s ../e2fsprogs/changelog.Debian.gz ${maindir}/usr/share/doc/$$i/ ; \ ln -s ../e2fsprogs/changelog.gz ${maindir}/usr/share/doc/$$i/ ; \ done dh_strip dh_compress dh_fixperms echo "libcdev:Depends=${LIBC-DEV}" > debian/comerr-dev.substvars echo "libcdev:Depends=${LIBC-DEV}" > debian/ss-dev.substvars echo "libcdev:Depends=${LIBC-DEV}" > debian/uuid-dev.substvars echo "libcdev:Depends=${LIBC-DEV}" > debian/e2fslibs-dev.substvars # Call this mostly to get the maintainer-script snippets dh_makeshlibs -pe2fsprogs # We overwrite the shlibs by hand because of virtual packages used : > debian/e2fsprogs/DEBIAN/shlibs echo "libext2fs ${EXT2FS_SOVERSION} libext2fs${EXT2FS_SOVERSION}" \ >> debian/e2fsprogs/DEBIAN/shlibs echo "libe2p ${E2P_SOVERSION} libe2p${E2P_SOVERSION}" \ >> debian/e2fsprogs/DEBIAN/shlibs echo "libuuid ${UUID_SOVERSION} libuuid${UUID_SOVERSION}" \ >> debian/e2fsprogs/DEBIAN/shlibs echo "libcom_err ${COMERR_SOVERSION} libcomerr${COMERR_SOVERSION}" \ >> debian/e2fsprogs/DEBIAN/shlibs echo "libss ${SS_SOVERSION} libss${SS_SOVERSION}" \ >> debian/e2fsprogs/DEBIAN/shlibs dh_installdeb dh_shlibdeps -l${stdbuilddir}/lib dh_gencontrol -Ncomerr-dev -Nss-dev -Nuuid-dev -Ne2fsprogs-udeb DH_OPTIONS= dh_gencontrol -pcomerr-dev \ -u '-v${COMERR_VERSION}-${MAIN_VERSION}' DH_OPTIONS= dh_gencontrol -pss-dev \ -u '-v${SS_VERSION}-${MAIN_VERSION}' DH_OPTIONS= dh_gencontrol -puuid-dev \ -u '-v${UUID_VERSION}-${MAIN_VERSION}' dh_md5sums -Ne2fsprogs-udeb dh_builddeb -Ne2fsprogs-udeb # udeb stuff dh_gencontrol -pe2fsprogs-udeb -- -fdebian/files~ dpkg-distaddfile $(UDEB_NAME) debian-installer $(UDEB_PRIORITY) dh_builddeb -pe2fsprogs-udeb --filename=$(UDEB_NAME) binary: binary-indep binary-arch .PHONY: binary binary-arch binary-indep clean checkroot