5 export DEB_BUILD_MAINT_OPTIONS ?= hardening=+all
7 DPKG_EXPORT_BUILDFLAGS = 1
8 include /usr/share/dpkg/default.mk
13 ifeq ($(DEB_HOST_ARCH_OS), hurd)
17 ifneq ($(filter pkg.e2fsprogs.no-fuse2fs,$(DEB_BUILD_PROFILES)),)
21 COMERR_VERSION ?= $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3)
22 SS_VERSION ?= $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
24 topdir ?= $(shell pwd)
25 tmpdir ?= ${topdir}/debian/tmp
26 udebdir ?= ${topdir}/debian/e2fsprogs-udeb
27 stdbuilddir ?= ${topdir}/debian/BUILD-STD
30 INSTALL_PROGRAM ?= $(INSTALL) -p -o root -g root -m 0755
32 ifneq (,$(findstring update-symbols,$(DEB_BUILD_OPTIONS)))
33 SYMBOL_LIBS := libext2fs libcomerr2 libss2
36 CFLAGS_SHLIB = $(CFLAGS)
37 CFLAGS_STLIB = $(CFLAGS)
38 LDFLAGS_SHLIB = $(LDFLAGS)
39 LDFLAGS_STATIC = $(filter-out -fPIE -fpie -pie,$(LDFLAGS))
41 BACKTRACE_CONF_FLAGS ?= $(shell if debian/scripts/test-backtrace ; then echo --disable-backtrace ; fi)
43 COMMON_CONF_FLAGS = --enable-elf-shlibs --disable-ubsan \
44 --disable-addrsan --disable-threadsan --disable-e2initrd-helper \
45 --disable-fsck --disable-libblkid --disable-libuuid --disable-uuidd \
46 --infodir=/usr/share/info --enable-symlink-install \
47 --with-multiarch=$(DEB_HOST_MULTIARCH) \
48 $(BACKTRACE_CONF_FLAGS) ${EXTRA_CONF_FLAGS}
50 ifneq ($(SKIP_FUSE2FS),)
51 COMMON_CONF_FLAGS += --disable-fuse2fs
54 ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
55 CC ?= $(DEB_HOST_GNU_TYPE)-gcc
56 COMMON_CONF_FLAGS += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
60 dh $@ -B${stdbuilddir}
62 override_dh_autoreconf:
64 override_dh_auto_configure:
65 mkdir -p ${stdbuilddir}
66 cd ${stdbuilddir} && AWK=/usr/bin/awk \
67 ../../configure ${COMMON_CONF_FLAGS}
69 override_dh_auto_build:
70 $(MAKE) -C ${stdbuilddir} V=1 all
71 $(MAKE) -C ${stdbuilddir}/e2fsck V=1 e2fsck.static
72 if ! test -d debian/orig-gmo ; then \
73 mkdir debian/orig-gmo ; \
74 mv po/*.gmo po/*.po debian/orig-gmo ; \
75 cp debian/orig-gmo/*.po po ; \
77 $(MAKE) -C ${stdbuilddir}/po V=1 update-gmo
79 $(MAKE) -C ${stdbuilddir}/doc V=1 libext2fs.html
80 $(MAKE) -C ${stdbuilddir}/lib/et V=1 com_err.info com_err.html
81 cat $(shell /bin/ls -1 ./doc/RelNotes/*.txt | tac) | \
82 gzip -9n > ${stdbuilddir}/NEWS.gz
84 override_dh_auto_clean:
85 if test -d debian/orig-gmo ; then \
86 rm -f po/*.gmo po/*.po ; \
87 mv debian/orig-gmo/* po ; \
88 rmdir debian/orig-gmo ; \
92 override_dh_auto_install:
93 mkdir -p ${tmpdir}/sbin
94 $(MAKE) -C ${stdbuilddir} V=1 install DESTDIR=${tmpdir} \
95 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
96 # static libs and .h files
97 $(MAKE) -C ${stdbuilddir} V=1 install-libs DESTDIR=${tmpdir} LDCONFIG=true
99 # statically-linked fsck
100 ${INSTALL_PROGRAM} ${stdbuilddir}/e2fsck/e2fsck.static ${tmpdir}/sbin
101 (cd debian/tmp/usr/share/man/man8 ; cp e2fsck.8 e2fsck.static.8)
103 ifeq ($(DEB_HOST_ARCH_OS), hurd)
104 ${INSTALL} -m 0644 misc/mke2fs-hurd.conf ${tmpdir}/etc/mke2fs.conf
108 dh_install -p e2fsprogs --sourcedir=${stdbuilddir} NEWS.gz \
109 usr/share/doc/e2fsprogs
111 dh_missing --fail-missing
115 $(INSTALL) -D -p -m644 debian/e2fsprogs-udeb.lintian-overrides \
116 debian/e2fsprogs-udeb/usr/share/lintian/overrides/e2fsprogs-udeb
118 override_dh_installinfo:
120 $(INSTALL) -d debian/libext2fs-dev/usr/share/doc/libext2fs2/html-info/
121 $(INSTALL) -p -m 0644 ${stdbuilddir}/doc/*.html \
122 debian/libext2fs-dev/usr/share/doc/libext2fs2/html-info/
123 $(INSTALL) -d debian/comerr-dev/usr/share/doc/comerr-dev/html-info/
124 $(INSTALL) -p -m 0644 ${stdbuilddir}/lib/et/*.html \
125 debian/comerr-dev/usr/share/doc/comerr-dev/html-info/
128 mkdir -p debian/comerr-dev/usr/share/doc/comerr-dev
129 $(INSTALL) -p -m 0644 ${topdir}/doc/libext2fs.texinfo \
130 debian/libext2fs-dev/usr/share/doc/libext2fs2/libext2fs.texi
131 $(INSTALL) -p -m 0644 ${topdir}/lib/et/com_err.texinfo \
132 debian/comerr-dev/usr/share/doc/comerr-dev/com_err.texi
134 $(INSTALL) -d debian/comerr-dev/usr/share/doc/comerr-dev/examples
135 $(INSTALL) -p -m 0644 lib/ss/ss_err.et \
136 ${stdbuilddir}/lib/ext2fs/ext2_err.et \
137 debian/comerr-dev/usr/share/doc/comerr-dev/examples
138 $(INSTALL) -d debian/ss-dev/usr/share/doc/ss-dev/examples
139 $(INSTALL) -p -m 0644 debugfs/debug_cmds.ct \
140 debian/ss-dev/usr/share/doc/ss-dev/examples
142 dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info
143 dh_installinfo -plibext2fs-dev ${stdbuilddir}/doc/libext2fs.info
145 override_dh_makeshlibs:
146 for i in $(SYMBOL_LIBS); \
148 echo "Generating symbols for $$i..."; \
149 dpkg-gensymbols -p$$i -Pdebian/$$i > debian/$$i.tmp-patch; \
150 cat debian/$$i.tmp-patch; \
151 patch debian/$$i.symbols < debian/$$i.tmp-patch; \
152 /bin/rm debian/$$i.tmp-patch; \
154 dh_makeshlibs --add-udeb=e2fsprogs-udeb
156 override_dh_shlibdeps:
157 dh_shlibdeps -pe2fsprogs -l${stdbuilddir}/lib \
158 -- -Ldebian/e2fsprogs.shlibs.local
159 dh_shlibdeps -pe2fsprogs-udeb -l${stdbuilddir}/lib \
160 -- -Ldebian/e2fsprogs-udeb.shlibs.local
161 ifeq ($(SKIP_FUSE2FS),)
162 dh_shlibdeps -pfuse2fs -l${stdbuilddir}/lib \
163 -- -Ldebian/e2fsprogs.shlibs.local
165 dh_shlibdeps --remaining-packages -l${stdbuilddir}/lib
167 override_dh_gencontrol:
168 dh_gencontrol -pcomerr-dev -- -v${COMERR_VERSION}-${DEB_VERSION} -VmainBinary=${DEB_VERSION}
169 dh_gencontrol -pss-dev -- -v${SS_VERSION}-${DEB_VERSION} -VmainBinary=${DEB_VERSION}
170 dh_gencontrol --remaining-packages
172 override_dh_auto_test:
173 ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
174 $(MAKE) -C ${stdbuilddir} V=1 check