]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blobdiff - debian/rules
debian: declare that the debian packaging will be found in debian/master
[thirdparty/e2fsprogs.git] / debian / rules
index 7354a508af5e7570c3eefde616831fe954bd2cdd..41aa202e249c1a210fe959ca1313c72ae3ca896d 100755 (executable)
@@ -7,7 +7,9 @@
 # The `binary' target must be run as root, as it needs to install files with
 # specific ownerships.
 
--include debian/rules.custom
+.PHONY: binary binary-arch binary-indep build build-arch build-indep \
+       build-bf build-std install install-udeb \
+       clean checkroot mrproper debug_flags debian-files
 
 export DEB_BUILD_MAINT_OPTIONS ?= hardening=+all
 
@@ -21,15 +23,28 @@ DEB_BUILD_ARCH              ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
 DEB_HOST_OS            ?= $(shell dpkg-architecture -qDEB_HOST_OS)
 DEB_HOST_GNU_TYPE      ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE     ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-DEB_HOST_MULTIARCH     ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null)
+DEB_HOST_MULTIARCH     ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+DEB_HOST_ARCH_OS       ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
 
 # Allow distro-specific behaviour
 DISTRO :=$(shell sed -ne '/DISTRIB_ID/s/.*=//p' /etc/lsb-release 2>/dev/null || echo Debian)
 
-ifeq ($(DEB_BUILD_GNU_SYSTEM), gnu)
+ifeq ($(DEB_HOST_ARCH_OS), hurd)
 SKIP_FUSE2FS=yes
 endif
 
+ifneq ($(filter pkg.e2fsprogs.no-fuse2fs,$(DEB_BUILD_PROFILES)),)
+SKIP_FUSE2FS=yes
+endif
+
+ifneq ($(filter pkg.e2fsprogs.no-static-e2fsck,$(DEB_BUILD_PROFILES)),)
+SKIP_E2FSCK_STATIC=yes
+endif
+
+ifneq ($(filter noudeb,$(DEB_BUILD_PROFILES)),)
+SKIP_UDEB=yes
+endif
+
 DH_VERSION := $(shell dpkg-query -W -f '$${Version}' debhelper)
 
 # USE_DBGSYM :=
@@ -41,7 +56,10 @@ dh_strip_args2 = -p$(1) --dbgsym-migration='$(2)-dbg (<= 1.43-1)'
 else
 dh_strip_args = -p$(1) --dbg-package=$(1)-dbg
 dh_strip_args2 = -p$(1) --dbg-package=$(2)-dbg
+DBG_PACKAGES += -pe2fsprogs-dbg -plibext2fs-dbg -plibcom-err2-dbg -plibss2-dbg
+export DEB_BUILD_PROFILES += pkg.e2fsprogs.legacy-dbg
 endif
+
 # find the version for the main package, from changelog file
 MAIN_VERSION = $(shell head -n 1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g')
 # find versions for libraries going into their own packages, from their Makefile.in's,
@@ -60,15 +78,15 @@ topdir              ?= $(shell pwd)
 debdir         ?= ${topdir}/debian
 tmpdir         ?= ${debdir}/tmp
 udebdir                ?= ${debdir}/e2fsprogs-udeb
-libcomerrdir   ?= ${debdir}/libcomerr${COMERR_SOVERSION}
+libcomerrdir   ?= ${debdir}/libcom-err${COMERR_SOVERSION}
 comerrdevdir   ?= ${debdir}/comerr-dev
-libcomerrdbgdir        ?= ${debdir}/libcomerr2-dbg
+libcomerrdbgdir        ?= ${debdir}/libcom-err2-dbg
 libssdir       ?= ${debdir}/libss${SS_SOVERSION}
 ssdevdir       ?= ${debdir}/ss-dev
 libssdbgdir    ?= ${debdir}/libss2-dbg
-libext2dir     ?= ${debdir}/e2fslibs
-libext2devdir  ?= ${debdir}/e2fslibs-dev
-libext2dbgdir  ?= ${debdir}/e2fslibs-dbg
+libext2dir     ?= ${debdir}/libext2fs2
+libext2devdir  ?= ${debdir}/libext2fs-dev
+libext2dbgdir  ?= ${debdir}/libext2fs2-dbg
 maindir                ?= ${debdir}/e2fsprogs
 e2fsckstaticdir        ?= ${debdir}/e2fsck-static
 debugdir       ?= ${debdir}/e2fsprogs-dbg
@@ -78,7 +96,7 @@ 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.in -A 10 | grep ^Priority: | cut -d ' ' -f 2)
+UDEB_PRIORITY  ?= $(shell grep '^Package: e2fsprogs-udeb' debian/control -A 10 | grep ^Priority: | cut -d ' ' -f 2)
 
 STAMPSDIR      ?= debian/stampdir
 CFGSTDSTAMP    ?= ${STAMPSDIR}/configure-std-stamp
@@ -94,7 +112,7 @@ INSTALL_PROGRAM ?= $(INSTALL) -p -o root -g root -m 0755
 #endif
 
 ifneq (,$(findstring update-symbols,$(DEB_BUILD_OPTIONS)))
-SYMBOL_LIBS := e2fslibs libcomerr2 libss2
+SYMBOL_LIBS := libext2fs libcomerr2 libss2
 endif
 
 DEFAULT_CFLAGS ?= -g -O2
@@ -144,21 +162,12 @@ ifneq ($(SKIP_FUSE2FS),)
 UTIL_CONF_FLAGS +=  --disable-fuse2fs
 endif
 
-ifneq ($(strip $(DEB_HOST_MULTIARCH)),)
-MULTIARCH_CONF ?= --with-multiarch=$(DEB_HOST_MULTIARCH)
-# This doesn't work yet because gdb and lintian don't expect and/or
-# don't work with /usr/lib/<triplet>/debug
-#USRLIB = /usr/lib/$(DEB_HOST_MULTIARCH)
-USRLIB ?= /usr/lib
-else
-USRLIB ?= /usr/lib
-endif
-
 BACKTRACE_CONF_FLAGS ?= $(shell if ${debdir}/scripts/test-backtrace ; then echo --disable-backtrace ; fi)
 
-COMMON_CONF_FLAGS = --disable-e2initrd-helper --enable-quota \
+COMMON_CONF_FLAGS = --disable-e2initrd-helper \
        --infodir=/usr/share/info  --enable-symlink-install \
-       $(MULTIARCH_CONF) $(BACKTRACE_CONF_FLAGS) $(UTIL_CONF_FLAGS)
+       --with-multiarch=$(DEB_HOST_MULTIARCH) \
+       $(BACKTRACE_CONF_FLAGS) $(UTIL_CONF_FLAGS)
 
 STD_CONF_FLAGS ?= --enable-elf-shlibs
 
@@ -166,59 +175,25 @@ BF_CONF_FLAGS ?= --enable-elf-shlibs --disable-nls --disable-imager \
        --disable-testio-debug --disable-uuidd --disable-tls \
        --disable-tdb --disable-debugfs
 
-M4_ARGS=
 DBG_PACKAGES=
 
-ifeq ($(USE_DBGSYM),yes)
-M4_ARGS+=-DUSE_DBGSYM
-else
-DBG_PACKAGES += -pe2fsprogs-dbg -pe2fslibs-dbg -plibcomerr2-dbg -plibss2-dbg
-M4_ARGS+=-UUSE_DBGSYM
-endif
-
-ifneq ($(strip $(DEB_HOST_MULTIARCH)),)
-M4_ARGS+=-DDO_MULTIARCH
-else
-M4_ARGS+=-UDO_MULTIARCH
-endif
-
-ifneq ($(BUILD_E2FSCK_STATIC),no)
-M4_ARGS+=-DE2FSCK_STATIC
-else
-M4_ARGS+=-UE2FSCK_STATIC
-endif
-
 ifeq ($(SKIP_UDEB),)
 INSTALL_UDEB = install-udeb
-M4_ARGS+=-DUDEB_PKGS
-else
-M4_ARGS+=-UUDEB_PKGS
-endif
-
-ifeq ($(SKIP_FUSE2FS),)
-M4_ARGS+=-DFUSE2FS
-else
-M4_ARGS+=-UFUSE2FS
 endif
 
-FILES_FIXUP= libcomerr2.files comerr-dev.files libss2.files ss-dev.files \
-       libuuid1.files uuid-dev.files libblkid1.files libblkid-dev.files \
-       e2fslibs.files e2fslibs-dev.files
-
-debian-files: debian/control
-ifeq ($(strip $(DEB_HOST_MULTIARCH)),)
-       for i in $(FILES_FIXUP); do \
-               sed -e 's;lib/\*/;lib/;' debian/$$i.in > debian/$$i; \
-       done
-else
-       for i in $(FILES_FIXUP); do cp debian/$$i.in debian/$$i; done
+debian-files:
+ifneq ($(USE_DBGSYM),yes)
+       if test ! -f debian/control.save; then \
+               mv debian/control debian/control.save ; \
+               cat debian/control.save debian/control.legacy-dbg \
+                       >> debian/control ; \
+       fi
 endif
 
 mrproper: clean
-       rm debian/control
-
-debian/control: debian/control.in debian/rules
-       m4 $(M4_ARGS) < debian/control.in | grep -v ^REMOVE_ME$$ > $@
+       if test -f debian/control.save; then \
+               mv debian/control.save debian/control ; \
+       fi
 
 ${CFGSTDSTAMP}:
        dh_testdir
@@ -292,7 +267,7 @@ build-std: ${BUILDSTDSTAMP}
 ${BUILDSTDSTAMP}: ${CFGSTDSTAMP}
        dh_testdir
        $(MAKE) -C ${stdbuilddir} V=1 all
-ifneq ($(BUILD_E2FSCK_STATIC),no)
+ifneq ($(SKIP_E2FSCK_STATIC),yes)
        $(MAKE) -C ${stdbuilddir}/e2fsck V=1 e2fsck.static
 endif
        if ! test -d debian/orig-gmo ; then \
@@ -331,20 +306,10 @@ clean:
        rm -f debian/*.substvars
        dh_clean
 
-install: cleanup install-std
-
-# 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:
+install: build
        dh_testdir
        dh_testroot
        dh_prep
-
-install-std: DH_OPTIONS=
-install-std: build
-       dh_testdir
-       dh_testroot
        dh_installdirs
 
        mkdir -p ${tmpdir}/sbin
@@ -353,20 +318,19 @@ install-std: build
   # static libs and .h files
        $(MAKE) -C ${stdbuilddir} V=1 install-libs DESTDIR=${tmpdir} LDCONFIG=true
 
-ifneq ($(BUILD_E2FSCK_STATIC),no)
+ifneq ($(SKIP_E2FSCK_STATIC),yes)
   # statically-linked fsck
        ${INSTALL_PROGRAM} $(E2FSCK_STATIC) ${tmpdir}/sbin
        cp ${mandir}/man8/e2fsck.8 ${mandir}/man8/e2fsck.static.8
 endif
 
-ifeq ($(DEB_BUILD_GNU_SYSTEM), gnu) 
+ifeq ($(DEB_HOST_ARCH_OS), hurd)
        ${INSTALL} -m 0644 misc/mke2fs-hurd.conf ${tmpdir}/etc/mke2fs.conf
 endif
 
        dh_movefiles
        test -z "`find ${tmpdir} -type f`"
 
-install-udeb: DH_OPTIONS=
 install-udeb: build
        dh_testdir
        dh_testroot
@@ -390,68 +354,74 @@ install-udeb: build
                ln -sf mke2fs mkfs.ext2 ; ln -sf mke2fs mkfs.ext3 ; \
                ln -sf mke2fs mkfs.ext4)
 
-binary-indep: 
-  # no arch-independant debs.
+binary-indep: install
+       dh_testdir
+       dh_testroot
+       dh_lintian -i
+       dh_installdocs -i
+       dh_installchangelogs -i
+       dh_fixperms -i
+       dh_compress -i
+       dh_installdeb -i
+       dh_gencontrol -i
+       dh_md5sums -i
+       dh_builddeb -i
 
-binary-arch: DH_OPTIONS= -a
 binary-arch: install $(INSTALL_UDEB)
        dh_testdir
        dh_testroot
 
-       dh_lintian
+       dh_lintian -a
 
   # symlinks to prepare dh_installdocs run
 
        mkdir -p ${debdir}/libss${SS_SOVERSION}/usr/share/doc/libss${SS_SOVERSION}
        mkdir -p ${debdir}/ss-dev/usr/share/doc
-       ln -sf libss${SS_SOVERSION} ${debdir}/ss-dev/usr/share/doc/ss-dev
 
-       mkdir -p ${debdir}/libcomerr${COMERR_SOVERSION}/usr/share/doc/libcomerr${COMERR_SOVERSION}
+       mkdir -p ${debdir}/libcom-err${COMERR_SOVERSION}/usr/share/doc/libcom-err${COMERR_SOVERSION}
        mkdir -p ${debdir}/comerr-dev/usr/share/doc
-       ln -sf libcomerr${COMERR_SOVERSION} ${debdir}/comerr-dev/usr/share/doc/comerr-dev
 
-       mkdir -p ${debdir}/e2fslibs/usr/share/doc/e2fslibs
-       mkdir -p ${debdir}/e2fslibs-dev/usr/share/doc
-       ln -sf e2fslibs ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev
+       mkdir -p ${debdir}/libext2fs2/usr/share/doc/libext2fs
+       mkdir -p ${debdir}/libext2fs-dev/usr/share/doc
 
-       dh_installdocs -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
+       dh_installdocs -a -Ne2fsprogs-udeb
 
   # HTML docs
-       $(INSTALL) -d ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/html-info/
+       $(INSTALL) -d ${debdir}/libext2fs-dev/usr/share/doc/libext2fs/html-info/
        $(INSTALL) -p -m 0644 ${stdbuilddir}/doc/*.html \
-          ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/html-info/
-       $(INSTALL) -d ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/html-info/
+          ${debdir}/libext2fs-dev/usr/share/doc/libext2fs/html-info/
+       $(INSTALL) -d ${debdir}/comerr-dev/usr/share/doc/comerr-dev/html-info/
        $(INSTALL) -p -m 0644 ${stdbuilddir}/lib/et/*.html \
-          ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/html-info/
+          ${debdir}/comerr-dev/usr/share/doc/comerr-dev/html-info/
 
   # texinfo docs
-       mkdir -p ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}
+       mkdir -p ${debdir}/comerr-dev/usr/share/doc/comerr-dev
        $(INSTALL) -p -m 0644 ${topdir}/doc/libext2fs.texinfo \
-          ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/libext2fs.texi
+          ${debdir}/libext2fs-dev/usr/share/doc/libext2fs/libext2fs.texi
        $(INSTALL) -p -m 0644 ${topdir}/lib/et/com_err.texinfo \
-          ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/com_err.texi
+          ${debdir}/comerr-dev/usr/share/doc/comerr-dev/com_err.texi
 
-       $(INSTALL) -d ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/examples
+       $(INSTALL) -d ${debdir}/comerr-dev/usr/share/doc/comerr-dev/examples
        $(INSTALL) -p -m 0644 lib/ss/ss_err.et \
                ${stdbuilddir}/lib/ext2fs/ext2_err.et \
-               ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/examples
-       $(INSTALL) -d ${debdir}/ss-dev/usr/share/doc/libss${SS_SOVERSION}/examples
+               ${debdir}/comerr-dev/usr/share/doc/comerr-dev/examples
+       $(INSTALL) -d ${debdir}/ss-dev/usr/share/doc/ss-dev/examples
        $(INSTALL) -p -m 0644 debugfs/debug_cmds.ct \
-               ${debdir}/ss-dev/usr/share/doc/libss${SS_SOVERSION}/examples
+               ${debdir}/ss-dev/usr/share/doc/ss-dev/examples
 
        dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info
-       dh_installinfo -pe2fslibs-dev ${stdbuilddir}/doc/libext2fs.info
+       dh_installinfo -plibext2fs-dev ${stdbuilddir}/doc/libext2fs.info
 
-       dh_installchangelogs
-       dh_fixperms
+       dh_installchangelogs -a
+       dh_fixperms -a
        dh_strip $(call dh_strip_args,e2fsprogs)
-ifneq ($(BUILD_E2FSCK_STATIC),no)
+ifneq ($(SKIP_E2FSCK_STATIC),yes)
        dh_strip $(call dh_strip_args2,e2fsck-static,e2fsprogs)
 endif
-       dh_strip $(call dh_strip_args,e2fslibs)
+       dh_strip $(call dh_strip_args,libext2fs2)
        dh_strip $(call dh_strip_args,libss${SS_SOVERSION})
-       dh_strip $(call dh_strip_args,libcomerr${COMERR_SOVERSION})
-       dh_strip
+       dh_strip $(call dh_strip_args,libcom-err${COMERR_SOVERSION})
+       dh_strip -a
 
        # dpkg symbol handling
        for i in $(SYMBOL_LIBS); \
@@ -463,12 +433,14 @@ endif
                /bin/rm debian/$$i.tmp-patch; \
        done
 
-       dh_compress
+       dh_compress -a
 
-       dh_makeshlibs --add-udeb=e2fsprogs-udeb
+       dh_makeshlibs -a --add-udeb=e2fsprogs-udeb
 
-       dh_installdeb
-       dh_shlibdeps -l${stdbuilddir}/lib
+       $(INSTALL) -D -p -m644 debian/e2fsprogs-udeb.lintian-overrides \
+           debian/e2fsprogs-udeb/usr/share/lintian/overrides/e2fsprogs-udeb
+       dh_installdeb -a
+       dh_shlibdeps -a -l${stdbuilddir}/lib
        dh_shlibdeps -pe2fsprogs -l${stdbuilddir}/lib \
                -u"-Ldebian/e2fsprogs.shlibs.local"
 ifeq ($(SKIP_UDEB),)
@@ -480,27 +452,23 @@ ifeq ($(SKIP_FUSE2FS),)
                -u"-Ldebian/e2fsprogs.shlibs.local"
 endif
 
-       dh_gencontrol -Ncomerr-dev -Nss-dev -Nuuid-dev \
-               -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
-       DH_OPTIONS= dh_gencontrol -pcomerr-dev \
+       dh_gencontrol -a -Ncomerr-dev -Nss-dev -Ne2fsprogs-udeb
+       dh_gencontrol -pcomerr-dev \
          -u '-v${COMERR_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}'
-       DH_OPTIONS= dh_gencontrol -pss-dev \
+       dh_gencontrol -pss-dev \
          -u '-v${SS_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}'
 ifeq ($(SKIP_UDEB),)
-       dh_gencontrol   -pe2fsprogs-udeb -- -fdebian/files~
+       dh_gencontrol -pe2fsprogs-udeb -- -fdebian/files~
 endif
 
 ifeq ($(SKIP_UDEB),)
        dpkg-distaddfile $(UDEB_NAME) debian-installer $(UDEB_PRIORITY)
 endif
-       dh_md5sums
-       dh_builddeb
+       dh_md5sums -a
+       dh_builddeb -a
 
 binary: binary-indep binary-arch
 
-.PHONY: binary binary-arch binary-indep clean checkroot mrproper \
-       debug_flags debian-files
-
 debug_flags:
        @echo CFLAGS is $(CFLAGS)
        @echo LDFLAGS is $(LDFLAGS)