4 # Invoke each target with `./debian/rules <target>'. All targets should be
5 # invoked with the package root as the current directory.
7 # The `binary' target must be run as root, as it needs to install files with
10 .PHONY
: binary binary-arch binary-indep build build-arch build-indep \
11 build-std
install install-udeb \
12 clean checkroot mrproper debug_flags debian-files
14 export DEB_BUILD_MAINT_OPTIONS ?
= hardening
=+all
19 # These are used for cross-compiling and for saving the configure script
20 # from having to guess our platform (since we know it already)
21 DEB_HOST_ARCH ?
= $(shell dpkg-architecture
-qDEB_HOST_ARCH
)
22 DEB_BUILD_ARCH ?
= $(shell dpkg-architecture
-qDEB_BUILD_ARCH
)
23 DEB_HOST_OS ?
= $(shell dpkg-architecture
-qDEB_HOST_OS
)
24 DEB_HOST_GNU_TYPE ?
= $(shell dpkg-architecture
-qDEB_HOST_GNU_TYPE
)
25 DEB_BUILD_GNU_TYPE ?
= $(shell dpkg-architecture
-qDEB_BUILD_GNU_TYPE
)
26 DEB_HOST_MULTIARCH ?
= $(shell dpkg-architecture
-qDEB_HOST_MULTIARCH
)
27 DEB_HOST_ARCH_OS ?
= $(shell dpkg-architecture
-qDEB_HOST_ARCH_OS
)
29 # Allow distro-specific behaviour
30 DISTRO
:=$(shell sed
-ne
'/DISTRIB_ID/s/.*=//p' /etc
/lsb-release
2>/dev
/null || echo Debian
)
32 ifeq ($(DEB_HOST_ARCH_OS
), hurd
)
36 ifneq ($(filter pkg.e2fsprogs.no-fuse2fs
,$(DEB_BUILD_PROFILES
)),)
40 # find the version for the main package, from changelog file
41 MAIN_VERSION
= $(shell head
-n
1 debian
/changelog | cut
'-d ' -f
2 | sed
's/[()]//g')
42 # find versions for libraries going into their own packages, from their Makefile.in's,
43 # and sonames for all libs
44 COMERR_VERSION ?
= $(shell grep ELF_VERSION lib
/et
/Makefile.in | cut
'-d ' -f3
)
45 COMERR_SOVERSION ?
= $(shell grep ELF_SO_VERSION lib
/et
/Makefile.in | cut
'-d ' -f3
)
46 SS_VERSION ?
= $(shell grep ELF_VERSION lib
/ss
/Makefile.in | cut
'-d ' -f3
)
47 SS_SOVERSION ?
= $(shell grep ELF_SO_VERSION lib
/ss
/Makefile.in | cut
'-d ' -f3
)
49 EXT2FS_SOVERSION ?
= $(shell grep ELF_SO_VERSION lib
/ext2fs
/Makefile.in | cut
'-d ' -f3
)
50 E2P_SOVERSION ?
= $(shell grep ELF_SO_VERSION lib
/e2p
/Makefile.in | cut
'-d ' -f3
)
54 topdir ?
= $(shell pwd
)
55 debdir ?
= ${topdir}/debian
56 tmpdir ?
= ${debdir}/tmp
57 udebdir ?
= ${debdir}/e2fsprogs-udeb
58 libcomerrdir ?
= ${debdir}/libcom-err
${COMERR_SOVERSION}
59 comerrdevdir ?
= ${debdir}/comerr-dev
60 libssdir ?
= ${debdir}/libss
${SS_SOVERSION}
61 ssdevdir ?
= ${debdir}/ss-dev
62 libext2dir ?
= ${debdir}/libext2fs2
63 libext2devdir ?
= ${debdir}/libext2fs-dev
64 maindir ?
= ${debdir}/e2fsprogs
65 e2fsckstaticdir ?
= ${debdir}/e2fsck-static
66 stdbuilddir ?
= ${debdir}/BUILD-STD
67 # docdir ?= ${maindir}/usr/share/doc/${package}
68 MANDIR ?
= /usr
/share
/man
69 mandir ?
= ${tmpdir}${MANDIR}
71 UDEB_NAME ?
= $(package
)-udeb_
$(MAIN_VERSION
)_
$(DEB_HOST_ARCH
).udeb
72 UDEB_PRIORITY ?
= $(shell grep
'^Package: e2fsprogs-udeb' debian
/control
-A
10 | grep ^Priority
: | cut
-d
' ' -f
2)
74 STAMPSDIR ?
= debian
/stampdir
75 CFGSTDSTAMP ?
= ${STAMPSDIR}/configure-std-stamp
76 BUILDSTDSTAMP ?
= ${STAMPSDIR}/build-std-stamp
79 INSTALL_PROGRAM ?
= $(INSTALL
) -p
-o root
-g root
-m
0755
81 #ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
82 #INSTALL_PROGRAM += -s
85 ifneq (,$(findstring update-symbols
,$(DEB_BUILD_OPTIONS
)))
86 SYMBOL_LIBS
:= libext2fs libcomerr2 libss2
89 DEFAULT_CFLAGS ?
= -g
-O2
90 DEFAULT_LDFLAGS ?
= -Wl
,-Bsymbolic-functions
92 CFLAGS ?
= $(shell if dpkg-buildflags
> /dev
/null
2>&1 ; then \
93 DEB_BUILD_MAINT_OPTIONS
=$(DEB_BUILD_MAINT_OPTIONS
) \
94 dpkg-buildflags
--get CFLAGS
; else echo
$(DEFAULT_CFLAGS
) ; fi
)
95 LDFLAGS ?
= $(shell if dpkg-buildflags
> /dev
/null
2>&1 ; then \
96 DEB_BUILD_MAINT_OPTIONS
=$(DEB_BUILD_MAINT_OPTIONS
) \
97 dpkg-buildflags
--get LDFLAGS
; else echo
$(DEFAULT_LDFLAGS
) ; fi
)
98 CPPFLAGS ?
= $(shell if dpkg-buildflags
> /dev
/null
2>&1 ; then \
99 DEB_BUILD_MAINT_OPTIONS
=$(DEB_BUILD_MAINT_OPTIONS
) \
100 dpkg-buildflags
--get CPPFLAGS
; fi
)
102 ifeq (${DEB_HOST_ARCH},alpha
)
103 CFLAGS
+= -DHAVE_NETINET_IN_H
105 CFLAGS
+= -D__NO_STRING_INLINES
108 E2FSCK_STATIC
= ${stdbuilddir}/e2fsck
/e2fsck.static
110 CFLAGS_SHLIB
= $(CFLAGS
)
111 CFLAGS_STLIB
= $(CFLAGS
)
112 LDFLAGS_SHLIB
= $(LDFLAGS
)
113 LDFLAGS_STATIC
= $(filter-out -fPIE
-fpie
-pie
,$(LDFLAGS
))
115 UTIL_CONF_FLAGS ?
= --disable-fsck
--disable-libblkid \
116 --disable-libuuid
--disable-uuidd
118 ifneq ($(SKIP_FUSE2FS
),)
119 UTIL_CONF_FLAGS
+= --disable-fuse2fs
122 BACKTRACE_CONF_FLAGS ?
= $(shell if
${debdir}/scripts
/test-backtrace
; then echo
--disable-backtrace
; fi
)
124 COMMON_CONF_FLAGS
= --enable-lto
--disable-ubsan
--disable-addrsan \
125 --disable-threadsan
--disable-e2initrd-helper \
126 --infodir=/usr
/share
/info --enable-symlink-install \
127 --with-multiarch
=$(DEB_HOST_MULTIARCH
) \
128 $(BACKTRACE_CONF_FLAGS
) $(UTIL_CONF_FLAGS
)
130 STD_CONF_FLAGS ?
= --enable-elf-shlibs
133 if
test -f debian
/control.save
; then \
134 mv debian
/control.save debian
/control
; \
139 if which dh_update_autotools_config
> /dev
/null
2>&1 ; then \
140 dh_update_autotools_config
;\
143 # Make sure we don't try to rebuild the configure scripts
144 find .
-name configure | xargs touch
146 mkdir
-p
${stdbuilddir}
147 ifeq ($(DEB_BUILD_ARCH
),$(DEB_HOST_ARCH
))
148 cd
${stdbuilddir} && AWK
=/usr
/bin
/awk \
149 ..
/..
/configure
${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
150 ${EXTRA_CONF_FLAGS} CFLAGS
="${CFLAGS}" CPPFLAGS
="$(CPPFLAGS)" \
151 LDFLAGS
="$(LDFLAGS)" CFLAGS_SHLIB
="$(CFLAGS_SHLIB)" \
152 CFLAGS_STLIB
="$(CFLAGS_STLIB)" \
153 LDFLAGS_SHLIB
="$(LDFLAGS_SHLIB)" \
154 LDFLAGS_STATIC
="$(LDFLAGS_STATIC)"
156 cd
${stdbuilddir} && AWK
=/usr
/bin
/awk CC
="${DEB_HOST_GNU_TYPE}-gcc" \
157 ..
/..
/configure
${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
158 ${EXTRA_CONF_FLAGS} --build
=$(DEB_BUILD_GNU_TYPE
) \
159 --host
=$(DEB_HOST_GNU_TYPE
) CFLAGS
="${CFLAGS}" \
160 CPPFLAGS
="$(CPPFLAGS)" CFLAGS_SHLIB
="$(CFLAGS_SHLIB)" \
161 CFLAGS_STLIB
="$(CFLAGS_STLIB)" \
162 LDFLAGS
="$(LDFLAGS)" \
163 LDFLAGS_SHLIB
="$(LDFLAGS_SHLIB)" \
164 LDFLAGS_STATIC
="$(LDFLAGS_STATIC)"
167 mkdir
-p
${STAMPSDIR}
173 build
: ${BUILDSTDSTAMP}
174 ${BUILDSTDSTAMP}: ${CFGSTDSTAMP}
176 $(MAKE
) -C
${stdbuilddir} V
=1 all
177 $(MAKE
) -C
${stdbuilddir}/e2fsck V
=1 e2fsck.static
178 if
! test -d debian
/orig-gmo
; then \
179 mkdir debian
/orig-gmo
; \
180 mv po
/*.gmo po
/*.po debian
/orig-gmo
; \
181 cp debian
/orig-gmo
/*.po po
; \
183 $(MAKE
) -C
${stdbuilddir}/po V
=1 update-gmo
185 $(MAKE
) -C
${stdbuilddir}/doc V
=1 libext2fs.html
186 $(MAKE
) -C
${stdbuilddir}/lib
/et V
=1 com_err.
info com_err.html
187 cat
$(shell /bin
/ls
-1 .
/doc
/RelNotes
/*.txt | tac
) | \
188 gzip
-9n
> ${stdbuilddir}/NEWS.gz
190 touch
${BUILDSTDSTAMP}
194 if
test -d debian
/orig-gmo
; then \
195 rm -f po
/*.gmo po
/*.po
; \
196 mv debian
/orig-gmo
/* po
; \
197 rmdir debian
/orig-gmo
; \
199 if
test -f debian
/compat.save
; then \
200 mv debian
/compat.save debian
/compat
; \
202 if
test -f debian
/e2fsprogs.postinst.save
; then \
203 mv debian
/e2fsprogs.postinst.save debian
/e2fsprogs.postinst
; \
205 if
test -f debian
/e2fsprogs.postrm
; then \
206 rm -f debian
/e2fsprogs.postrm
; \
208 rm -rf
${STAMPSDIR} ${stdbuilddir}
209 rm -f debian
/*.substvars
218 mkdir
-p
${tmpdir}/sbin
219 $(MAKE
) -C
${stdbuilddir} V
=1 install DESTDIR
=${tmpdir} \
220 INSTALL_PROGRAM
="${INSTALL_PROGRAM}" LDCONFIG
=true
221 # static libs and .h files
222 $(MAKE
) -C
${stdbuilddir} V
=1 install-libs DESTDIR
=${tmpdir} LDCONFIG
=true
224 # statically-linked fsck
225 ${INSTALL_PROGRAM} $(E2FSCK_STATIC
) ${tmpdir}/sbin
226 cp
${mandir}/man8
/e2fsck
.8 ${mandir}/man8
/e2fsck.static
.8
228 ifeq ($(DEB_HOST_ARCH_OS
), hurd
)
229 ${INSTALL} -m
0644 misc
/mke2fs-hurd.conf
${tmpdir}/etc
/mke2fs.conf
232 # install for e2fsprogs-udeb
233 $(MAKE
) -C
${stdbuilddir} V
=1 install-shlibs-libs-recursive DESTDIR
=${udebdir} \
234 INSTALL_PROGRAM
="${INSTALL_PROGRAM}" LDCONFIG
=true
235 $(MAKE
) -C
${stdbuilddir}/e2fsck V
=1 install DESTDIR
=${udebdir} \
236 INSTALL_PROGRAM
="${INSTALL_PROGRAM}" LDCONFIG
=true
237 $(MAKE
) -C
${stdbuilddir}/misc V
=1 install DESTDIR
=${udebdir} \
238 INSTALL_PROGRAM
="${INSTALL_PROGRAM}" LDCONFIG
=true
239 $(MAKE
) -C
${stdbuilddir}/resize V
=1 install DESTDIR
=${udebdir} \
240 INSTALL_PROGRAM
="${INSTALL_PROGRAM}" LDCONFIG
=true
242 rm -rf
${udebdir}/usr
243 find
${udebdir}/sbin
-type f
-a
! -name e2fsck \
244 -a
! -name mke2fs
-a
! -name tune2fs \
245 -a
! -name resize2fs
-a
! -name badblocks
-print | xargs
rm
247 (cd
${udebdir}/sbin
; ln
-sf e2fsck fsck.ext2
; \
248 ln
-sf e2fsck fsck.ext3
; ln
-sf e2fsck fsck.ext4
; \
249 ln
-sf mke2fs mkfs.ext2
; ln
-sf mke2fs mkfs.ext3
; \
250 ln
-sf mke2fs mkfs.ext4
)
252 # install main e2fsprogs package
253 dh_install
-p e2fsprogs
--sourcedir
=${stdbuilddir} NEWS.gz \
254 usr
/share
/doc
/e2fsprogs
256 test -z
"`find ${tmpdir} -type f`"
258 binary-indep
: install
263 dh_installchangelogs
-i
277 # symlinks to prepare dh_installdocs run
279 mkdir
-p
${debdir}/libss
${SS_SOVERSION}/usr
/share
/doc
/libss
${SS_SOVERSION}
280 mkdir
-p
${debdir}/ss-dev
/usr
/share
/doc
282 mkdir
-p
${debdir}/libcom-err
${COMERR_SOVERSION}/usr
/share
/doc
/libcom-err
${COMERR_SOVERSION}
283 mkdir
-p
${debdir}/comerr-dev
/usr
/share
/doc
285 mkdir
-p
${debdir}/libext2fs2
/usr
/share
/doc
/libext2fs2
286 mkdir
-p
${debdir}/libext2fs-dev
/usr
/share
/doc
288 dh_installdocs
-a
-Ne2fsprogs-udeb
291 $(INSTALL
) -d
${debdir}/libext2fs-dev
/usr
/share
/doc
/libext2fs2
/html-info
/
292 $(INSTALL
) -p
-m
0644 ${stdbuilddir}/doc
/*.html \
293 ${debdir}/libext2fs-dev
/usr
/share
/doc
/libext2fs2
/html-info
/
294 $(INSTALL
) -d
${debdir}/comerr-dev
/usr
/share
/doc
/comerr-dev
/html-info
/
295 $(INSTALL
) -p
-m
0644 ${stdbuilddir}/lib
/et
/*.html \
296 ${debdir}/comerr-dev
/usr
/share
/doc
/comerr-dev
/html-info
/
299 mkdir
-p
${debdir}/comerr-dev
/usr
/share
/doc
/comerr-dev
300 $(INSTALL
) -p
-m
0644 ${topdir}/doc
/libext2fs.texinfo \
301 ${debdir}/libext2fs-dev
/usr
/share
/doc
/libext2fs2
/libext2fs.texi
302 $(INSTALL
) -p
-m
0644 ${topdir}/lib
/et
/com_err.texinfo \
303 ${debdir}/comerr-dev
/usr
/share
/doc
/comerr-dev
/com_err.texi
305 $(INSTALL
) -d
${debdir}/comerr-dev
/usr
/share
/doc
/comerr-dev
/examples
306 $(INSTALL
) -p
-m
0644 lib
/ss
/ss_err.et \
307 ${stdbuilddir}/lib
/ext2fs
/ext2_err.et \
308 ${debdir}/comerr-dev
/usr
/share
/doc
/comerr-dev
/examples
309 $(INSTALL
) -d
${debdir}/ss-dev
/usr
/share
/doc
/ss-dev
/examples
310 $(INSTALL
) -p
-m
0644 debugfs
/debug_cmds.ct \
311 ${debdir}/ss-dev
/usr
/share
/doc
/ss-dev
/examples
313 dh_installinfo
-pcomerr-dev
${stdbuilddir}/lib
/et
/com_err.
info
314 dh_installinfo
-plibext2fs-dev
${stdbuilddir}/doc
/libext2fs.
info
316 dh_installchangelogs
-a
320 # dpkg symbol handling
321 for i in
$(SYMBOL_LIBS
); \
323 echo
"Generating symbols for $$i..."; \
324 dpkg-gensymbols
-p
$$i -Pdebian
/$$i > debian
/$$i.tmp-patch
; \
325 cat debian
/$$i.tmp-patch
; \
326 patch debian
/$$i.symbols
< debian
/$$i.tmp-patch
; \
327 /bin
/rm debian
/$$i.tmp-patch
; \
332 dh_makeshlibs
-a
--add-udeb
=e2fsprogs-udeb
333 dh_installsystemd
-p e2fsprogs
334 $(INSTALL
) -D
-p
-m644 debian
/e2fsprogs-udeb.lintian-overrides \
335 debian
/e2fsprogs-udeb
/usr
/share
/lintian
/overrides
/e2fsprogs-udeb
337 dh_shlibdeps
-a
-l
${stdbuilddir}/lib
338 dh_shlibdeps
-pe2fsprogs
-l
${stdbuilddir}/lib \
339 -u
"-Ldebian/e2fsprogs.shlibs.local"
340 dh_shlibdeps
-pe2fsprogs-udeb
-l
${stdbuilddir}/lib \
341 -u
"-Ldebian/e2fsprogs-udeb.shlibs.local"
342 ifeq ($(SKIP_FUSE2FS
),)
343 dh_shlibdeps
-pfuse2fs
-l
${stdbuilddir}/lib \
344 -u
"-Ldebian/e2fsprogs.shlibs.local"
347 dh_gencontrol
-a
-Ncomerr-dev
-Nss-dev
348 dh_gencontrol
-pcomerr-dev \
349 -u
'-v${COMERR_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}'
350 dh_gencontrol
-pss-dev \
351 -u
'-v${SS_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}'
356 binary
: binary-indep binary-arch
359 @echo CFLAGS is
$(CFLAGS
)
360 @echo LDFLAGS is
$(LDFLAGS
)
361 @echo CPPFLAGS is
$(CPPFLAGS
)