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
13 # These are used for cross-compiling and for saving the configure script
14 # from having to guess our platform (since we know it already)
15 DEB_HOST_ARCH ?
= $(shell dpkg-architecture
-qDEB_HOST_ARCH
)
16 DEB_BUILD_ARCH ?
= $(shell dpkg-architecture
-qDEB_BUILD_ARCH
)
17 DEB_HOST_OS ?
= $(shell dpkg-architecture
-qDEB_HOST_OS
)
18 DEB_HOST_GNU_TYPE ?
= $(shell dpkg-architecture
-qDEB_HOST_GNU_TYPE
)
19 DEB_BUILD_GNU_TYPE ?
= $(shell dpkg-architecture
-qDEB_BUILD_GNU_TYPE
)
21 # find the version for the main package, from changelog file
22 MAIN_VERSION
= $(shell head
-n
1 debian
/changelog | cut
'-d ' -f
2 | sed
's/[()]//g')
23 # find versions for libraries going into their own packages, from their Makefile.in's,
24 # and sonames for all libs
25 COMERR_VERSION
= $(shell grep ELF_VERSION lib
/et
/Makefile.in | cut
'-d ' -f3
)
26 COMERR_SOVERSION
= $(shell grep ELF_SO_VERSION lib
/et
/Makefile.in | cut
'-d ' -f3
)
27 SS_VERSION
= $(shell grep ELF_VERSION lib
/ss
/Makefile.in | cut
'-d ' -f3
)
28 SS_SOVERSION
= $(shell grep ELF_SO_VERSION lib
/ss
/Makefile.in | cut
'-d ' -f3
)
29 UUID_VERSION
= $(shell grep ELF_VERSION lib
/uuid
/Makefile.in | cut
'-d ' -f3
)
30 UUID_SOVERSION
= $(shell grep ELF_SO_VERSION lib
/uuid
/Makefile.in | cut
'-d ' -f3
)
31 BLKID_VERSION
= $(shell grep ELF_VERSION lib
/blkid
/Makefile.in | cut
'-d ' -f3
)
32 BLKID_SOVERSION
= $(shell grep ELF_SO_VERSION lib
/blkid
/Makefile.in | cut
'-d ' -f3
)
33 EXT2FS_SOVERSION
= $(shell grep ELF_SO_VERSION lib
/ext2fs
/Makefile.in | cut
'-d ' -f3
)
34 E2P_SOVERSION
= $(shell grep ELF_SO_VERSION lib
/e2p
/Makefile.in | cut
'-d ' -f3
)
39 debdir
=${topdir}/debian
41 udebdir
=${debdir}/e2fsprogs-udeb
42 blkidudebdir
=${debdir}/libblkid1-udeb
43 uuidudebdir
=${debdir}/libuuid1-udeb
44 maindir
=${debdir}/e2fsprogs
45 stdbuilddir
=${debdir}/BUILD-STD
46 bfbuilddir
=${debdir}/BUILD-BF
47 mipsbuilddir
=${debdir}/BUILD-MIPS
48 mipsbuilddir64
=${debdir}/BUILD-MIPS-64
49 # docdir=${maindir}/usr/share/doc/${package}
51 mandir=${tmpdir}${MANDIR}
53 UDEB_NAME
= $(package
)-udeb_
$(MAIN_VERSION
)_
$(DEB_HOST_ARCH
).udeb
54 UDEB_PRIORITY
= $(shell grep
'^Package: e2fsprogs-udeb' debian
/control
-A
10 | grep ^Priority
: | cut
-d
' ' -f
2)
56 BLKID_UDEB_NAME
= libblkid1-udeb_
$(MAIN_VERSION
)_
$(DEB_HOST_ARCH
).udeb
57 BLKID_UDEB_PRIORITY
= $(shell grep
'^Package: libblkid1-udeb' debian
/control
-A
10 | grep ^Priority
: | cut
-d
' ' -f
2)
59 UUID_UDEB_NAME
= libuuid1-udeb_
$(MAIN_VERSION
)_
$(DEB_HOST_ARCH
).udeb
60 UUID_UDEB_PRIORITY
= $(shell grep
'^Package: libuuid1-udeb' debian
/control
-A
10 | grep ^Priority
: | cut
-d
' ' -f
2)
62 STAMPSDIR
=debian
/stampdir
63 CFGSTDSTAMP
=${STAMPSDIR}/configure-std-stamp
64 CFGBFSTAMP
=${STAMPSDIR}/configure-bf-stamp
65 BUILDSTDSTAMP
=${STAMPSDIR}/build-std-stamp
66 BUILDBFSTAMP
=${STAMPSDIR}/build-bf-stamp
71 INSTALL_PROGRAM
= $(INSTALL
) -p
-o root
-g root
-m
0755
73 ifeq (,$(findstring noopt
,$(DEB_BUILD_OPTIONS
)))
76 ifeq (,$(findstring nostrip
,$(DEB_BUILD_OPTIONS
)))
80 ifeq (${DEB_HOST_ARCH},alpha
)
81 CCOPTS
+= -DHAVE_NETINET_IN_H
83 CCOPTS
+= -D__NO_STRING_INLINES
86 ifeq (${DEB_HOST_ARCH_OS},linux
)
87 DEVMAPPER
= --enable-blkid-devmapper
90 BF_CCOPTS
= -Os
-fomit-frame-pointer
93 --enable-elf-shlibs
--enable-dynamic-e2fsck \
94 --infodir=/usr
/share
/info --enable-fsck
96 STD_CONF_FLAGS
= --with-ccopts
="${CCOPTS}" --enable-compression \
99 BF_CONF_FLAGS
= --with-ccopts
="${CCOPTS} ${BF_CCOPTS}" \
100 --disable-nls
--disable-imager \
101 --disable-debugfs
--disable-e2initrd-helper
103 MIPS_NOPIC_CONF_FLAGS
= --with-ccopts
="${CCOPTS}" \
104 --disable-nls
--disable-imager
--disable-resizer
# --disable-debugfs
106 # we can't use those flags at configure time
107 MIPS_CFLAGS
= -G
0 -fno-pic
-mno-abicalls
108 MIPS_CFLAGS_64
= -mabi
=64 -G
0 -fno-pic
-mno-abicalls
110 ifeq ($(DEB_BUILD_ARCH
),$(DEB_HOST_ARCH
))
111 ifneq (,$(findstring $(DEB_BUILD_ARCH
),mips mipsel
))
119 # Make sure we don't try to rebuild the configure scripts
120 find .
-name configure | xargs touch
122 mkdir
-p
${stdbuilddir}
123 ifeq ($(DEB_BUILD_ARCH
),$(DEB_HOST_ARCH
))
124 cd
${stdbuilddir} && AWK
=/usr
/bin
/awk \
125 ${topdir}/configure
${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS}
127 cd
${stdbuilddir} && AWK
=/usr
/bin
/awk CC
="${DEB_HOST_GNU_TYPE}-gcc" \
128 ${topdir}/configure
${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
129 --build
=$(DEB_BUILD_GNU_TYPE
) --host
=$(DEB_HOST_GNU_TYPE
)
132 # specially-built MIPS libs
134 mkdir
-p
${mipsbuilddir} ${mipsbuilddir64}
135 cd
${mipsbuilddir} && AWK
=/usr
/bin
/awk \
136 ${topdir}/configure
${MIPS_NOPIC_CONF_FLAGS}
137 cd
${mipsbuilddir64} && AWK
=/usr
/bin
/awk \
138 ${topdir}/configure
${MIPS_NOPIC_CONF_FLAGS}
141 mkdir
-p
${STAMPSDIR}
148 mkdir
-p
${bfbuilddir}
149 ifeq ($(DEB_BUILD_ARCH
),$(DEB_HOST_ARCH
))
150 cd
${bfbuilddir} && AWK
=/usr
/bin
/awk \
151 ${topdir}/configure
${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS}
153 cd
${bfbuilddir} && AWK
=/usr
/bin
/awk CC
="${DEB_HOST_GNU_TYPE}-gcc" \
154 ${topdir}/configure
${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \
155 --build
=$(DEB_BUILD_GNU_TYPE
) --host
=$(DEB_HOST_GNU_TYPE
)
157 mkdir
-p
${STAMPSDIR}
160 build
: build-std build-bf
162 build-std
: ${BUILDSTDSTAMP}
163 ${BUILDSTDSTAMP}: ${CFGSTDSTAMP}
165 make
-C
${stdbuilddir} all
167 ( cd
${stdbuilddir}/doc
&& \
168 texi2html
-split_chapter
${topdir}/doc
/libext2fs.texinfo
)
169 ( cd
${stdbuilddir}/lib
/et
&& make com_err.
info && \
170 texi2html
-split_chapter
-expandinfo
${topdir}/lib
/et
/com_err.texinfo
)
172 # specially-built MIPS libs
174 make
-C
${mipsbuilddir}/util
175 make
-C
${mipsbuilddir} \
176 CFLAGS
="${CCOPTS} ${MIPS_CFLAGS}" \
177 LIB_SUBDIRS
="lib/et lib/ext2fs" libs
178 make
-C
${mipsbuilddir64}/util
179 make
-C
${mipsbuilddir64} \
180 CFLAGS
="${CCOPTS} ${MIPS_CFLAGS_64}" \
181 LIB_SUBDIRS
="lib/et lib/ext2fs" libs
184 touch
${BUILDSTDSTAMP}
186 build-bf
: ${BUILDBFSTAMP}
187 ${BUILDBFSTAMP}: ${CFGBFSTAMP}
189 make
-C
${bfbuilddir} libs
190 make
-C
${bfbuilddir}/e2fsck
all
191 make
-C
${bfbuilddir}/misc
all
192 touch
${BUILDBFSTAMP}
197 [ ! -f
${stdbuilddir}/Makefile
] || make
-C
${stdbuilddir} distclean
198 [ ! -f
${bfbuilddir}/Makefile
] || make
-C
${bfbuilddir} distclean
199 rm -rf
${stdbuilddir} ${bfbuilddir} ${mipsbuilddir} ${mipsbuilddir64}
200 rm -f doc
/libext2fs
/*.html lib
/et
/com_err
/*.html debian
/*.substvars
203 install: cleanup install-std
205 # This rule allows to factorize the dh_clean between the 2 install rules
206 # This must be launched before install-* (if launching them by hand, for
207 # exemple) or results are unpredictable
213 install-std
: DH_OPTIONS
=
219 mkdir
-p
${tmpdir}/sbin
220 make
-C
${stdbuilddir} install DESTDIR
=${tmpdir} \
221 INSTALL_PROGRAM
="${INSTALL_PROGRAM}" LDCONFIG
=true
222 # static libs and .h files
223 make
-C
${stdbuilddir} install-libs DESTDIR
=${tmpdir} LDCONFIG
=true
225 # statically-linked fsck
226 ${INSTALL_PROGRAM} ${stdbuilddir}/e2fsck
/e2fsck.static
${tmpdir}/sbin
227 cp
${mandir}/man8
/e2fsck
.8 ${mandir}/man8
/e2fsck.static
.8
229 ln
-s et
/com_err.h
${tmpdir}/usr
/include
232 test -z
`find ${tmpdir} -type f`
234 # specially-built MIPS libs
236 $(INSTALL
) -p
-m
0644 ${mipsbuilddir}/lib
/libext2fs.a \
237 ${debdir}/e2fslibs-dev
/usr
/lib
/libext2fs-nopic.a
238 $(INSTALL
) -p
-m
0644 ${mipsbuilddir64}/lib
/libext2fs.a \
239 ${debdir}/e2fslibs-dev
/usr
/lib
/lib64ext2fs-nopic.a
242 install-udeb
: DH_OPTIONS
=
247 make
-C
${bfbuilddir} install-shlibs-libs-recursive DESTDIR
=${udebdir} \
248 INSTALL_PROGRAM
="${INSTALL_PROGRAM}" LDCONFIG
=true
249 make
-C
${bfbuilddir}/e2fsck
install DESTDIR
=${udebdir} \
250 INSTALL_PROGRAM
="${INSTALL_PROGRAM}" LDCONFIG
=true
251 make
-C
${bfbuilddir}/misc
install DESTDIR
=${udebdir} \
252 INSTALL_PROGRAM
="${INSTALL_PROGRAM}" LDCONFIG
=true
253 make
-C
${bfbuilddir}/resize
install DESTDIR
=${udebdir} \
254 INSTALL_PROGRAM
="${INSTALL_PROGRAM}" LDCONFIG
=true
256 rm -rf
${udebdir}/usr
257 find
${udebdir}/sbin
-type f
-a
! -name e2fsck \
258 -a
! -name mke2fs
-a
! -name tune2fs \
259 -a
! -name resize2fs
-a
! -name badblocks
-print | xargs
rm
261 (cd
${udebdir}/sbin
; ln
-s e2fsck fsck.ext2
; \
262 ln
-s e2fsck fsck.ext3
; ln
-s mke2fs mkfs.ext2
; \
263 ln
-s mke2fs mkfs.ext3
)
265 mkdir
-p
${blkidudebdir}/lib
266 mv
${udebdir}/lib
/libblkid.
* ${blkidudebdir}/lib
268 mkdir
-p
${uuidudebdir}/lib
269 mv
${udebdir}/lib
/libuuid.
* ${uuidudebdir}/lib
272 # no arch-independant debs.
274 binary-arch
: DH_OPTIONS
= -a
275 binary-arch
: install install-udeb
280 for i in
$$(cd debian
&& echo
*.lintian-overrides
); do \
281 pkg
=$${i
%.lintian-overrides
} ;\
282 $(INSTALL
) -m
0644 -D
-p debian
/$$i ${debdir}/$${pkg}/usr
/share
/lintian
/overrides
/$${pkg} ;\
286 mkdir
-p debian
/e2fsprogs
/usr
/share
/initrd-tools
/scripts
287 $(INSTALL
) -p
-o root
-g root
-m
0755 debian
/initrd-tools.e2fsprogs \
288 debian
/e2fsprogs
/usr
/share
/initrd-tools
/scripts
/e2fsprogs
291 mkdir
-p debian
/e2fsprogs
/usr
/share
/e2fsprogs
292 $(INSTALL
) -p
-o root
-g root
-m
0755 debian
/initrd.ext3-add-journal \
293 debian
/e2fsprogs
/usr
/share
/e2fsprogs
/initrd.ext3-add-journal
296 # symlinks to prepare dh_installdocs run
298 mkdir
-p
${debdir}/libblkid
${BLKID_SOVERSION}/usr
/share
/doc
/libblkid
${BLKID_SOVERSION}
299 mkdir
-p
${debdir}/libblkid-dev
/usr
/share
/doc
300 ln
-sf libblkid
${BLKID_SOVERSION} ${debdir}/libblkid-dev
/usr
/share
/doc
/libblkid-dev
302 mkdir
-p
${debdir}/libss
${SS_SOVERSION}/usr
/share
/doc
/libss
${SS_SOVERSION}
303 mkdir
-p
${debdir}/ss-dev
/usr
/share
/doc
304 ln
-sf libss
${SS_SOVERSION} ${debdir}/ss-dev
/usr
/share
/doc
/ss-dev
306 mkdir
-p
${debdir}/libcomerr
${COMERR_SOVERSION}/usr
/share
/doc
/libcomerr
${COMERR_SOVERSION}
307 mkdir
-p
${debdir}/comerr-dev
/usr
/share
/doc
308 ln
-sf libcomerr
${COMERR_SOVERSION} ${debdir}/comerr-dev
/usr
/share
/doc
/comerr-dev
310 mkdir
-p
${debdir}/libuuid
${UUID_SOVERSION}/usr
/share
/doc
/libuuid
${UUID_SOVERSION}
311 mkdir
-p
${debdir}/uuid-dev
/usr
/share
/doc
312 # ln -sf libuuid${UUID_SOVERSION} ${debdir}/uuid-dev/usr/share/doc/uuid-dev
314 mkdir
-p
${debdir}/e2fslibs
/usr
/share
/doc
/e2fslibs
315 mkdir
-p
${debdir}/e2fslibs-dev
/usr
/share
/doc
316 ln
-sf e2fslibs
${debdir}/e2fslibs-dev
/usr
/share
/doc
/e2fslibs-dev
318 $(INSTALL
) -p
-m
0644 debian
/libblkid.copyright \
319 ${debdir}/libblkid
${BLKID_SOVERSION}/usr
/share
/doc
/libblkid
${BLKID_SOVERSION}/copyright
321 dh_installdocs
-Ne2fsprogs-udeb
-Nlibblkid1-udeb
-Nlibuuid1-udeb
324 $(INSTALL
) -d
${debdir}/e2fslibs-dev
/usr
/share
/doc
/e2fslibs
/html-info
/
325 $(INSTALL
) -p
-m
0644 ${stdbuilddir}/doc
/libext2fs
/*.html \
326 ${debdir}/e2fslibs-dev
/usr
/share
/doc
/e2fslibs
/html-info
/
327 $(INSTALL
) -d
${debdir}/comerr-dev
/usr
/share
/doc
/libcomerr
${COMERR_SOVERSION}/html-info
/
328 $(INSTALL
) -p
-m
0644 ${stdbuilddir}/lib
/et
/com_err
/*.html \
329 ${debdir}/comerr-dev
/usr
/share
/doc
/libcomerr
${COMERR_SOVERSION}/html-info
/
332 mkdir
-p
${debdir}/comerr-dev
/usr
/share
/doc
/libcomerr
${COMERR_SOVERSION}
333 $(INSTALL
) -p
-m
0644 ${topdir}/doc
/libext2fs.texinfo \
334 ${debdir}/e2fslibs-dev
/usr
/share
/doc
/e2fslibs
/libext2fs.texi
335 $(INSTALL
) -p
-m
0644 ${topdir}/lib
/et
/com_err.texinfo \
336 ${debdir}/comerr-dev
/usr
/share
/doc
/libcomerr
${COMERR_SOVERSION}/com_err.texi
338 $(INSTALL
) -d
${debdir}/comerr-dev
/usr
/share
/doc
/libcomerr
${COMERR_SOVERSION}/examples
339 $(INSTALL
) -p
-m
0644 lib
/ss
/ss_err.et \
340 ${stdbuilddir}/lib
/ext2fs
/ext2_err.et \
341 ${debdir}/comerr-dev
/usr
/share
/doc
/libcomerr
${COMERR_SOVERSION}/examples
342 $(INSTALL
) -d
${debdir}/ss-dev
/usr
/share
/doc
/libss
${SS_SOVERSION}/examples
343 $(INSTALL
) -p
-m
0644 debugfs
/debug_cmds.ct \
344 ${debdir}/ss-dev
/usr
/share
/doc
/libss
${SS_SOVERSION}/examples
346 $(INSTALL
) -d
${debdir}/uuid-dev
/usr
/share
/doc
/libuuid
${UUID_SOVERSION}
348 if
test -f
/etc
/lsb-release
&& \
349 grep
-q DISTRIB_ID
=Ubuntu
/etc
/lsb-release
; then \
350 $(INSTALL
) -p
-m
0644 e2fsck
/e2fsck.conf.ubuntu \
351 ${debdir}/e2fsprogs
/etc
/e2fsck.conf
; \
354 dh_installinfo
-pcomerr-dev
${stdbuilddir}/lib
/et
/com_err.
info
355 dh_installinfo
-pe2fslibs-dev
${stdbuilddir}/doc
/libext2fs.
info
357 DH_OPTIONS
= dh_installchangelogs
-pe2fsprogs \
358 -plibblkid
${BLKID_SOVERSION} -plibcomerr
${COMERR_SOVERSION} \
359 -plibss
${SS_SOVERSION} -plibuuid
${UUID_SOVERSION} \
360 -pe2fslibs
-puuid-dev
-puuid-runtime
-pe2fsck-static
364 dh_strip
-Xlib64ext2fs-nopic.a
371 dh_makeshlibs
-Ne2fsprogs-udeb
-Nlibblkid1-udeb
-Nlibuuid1-udeb
372 dh_makeshlibs
-plibcomerr
${COMERR_SOVERSION} \
373 -V
'libcomerr2 (>= 1.33-3)'
374 dh_makeshlibs
-plibblkid
${BLKID_SOVERSION} -V
'libblkid1 (>= 1.39-1)'
375 echo
"udeb: libblkid 1 libblkid1-udeb" >> \
376 debian
/libblkid1
/DEBIAN
/shlibs
377 echo
"udeb: libuuid 1 libuuid1-udeb" >> debian
/libuuid1
/DEBIAN
/shlibs
380 rm debian
/e2fsprogs-udeb
/DEBIAN
/conffiles
381 dh_shlibdeps
-l
${stdbuilddir}/lib
382 dh_shlibdeps
-pe2fsprogs
-l
${stdbuilddir}/lib \
383 -u
"-Ldebian/e2fsprogs.shlibs.local"
384 dh_shlibdeps
-pe2fsprogs-udeb
-l
${stdbuilddir}/lib \
385 -u
"-Ldebian/e2fsprogs-udeb.shlibs.local"
387 dh_gencontrol
-Ncomerr-dev
-Nss-dev
-Nuuid-dev \
388 -Ne2fsprogs-udeb
-Nlibblkid1-udeb
-Nlibuuid1-udeb
389 DH_OPTIONS
= dh_gencontrol
-pcomerr-dev \
390 -u
'-v${COMERR_VERSION}-${MAIN_VERSION}'
391 DH_OPTIONS
= dh_gencontrol
-pss-dev \
392 -u
'-v${SS_VERSION}-${MAIN_VERSION}'
393 DH_OPTIONS
= dh_gencontrol
-puuid-dev \
394 -u
'-v${UUID_VERSION}-${MAIN_VERSION}'
396 dh_md5sums
-Ne2fsprogs-udeb
-Nlibblkid1-udeb
-Nlibuuid1-udeb
397 dh_builddeb
-Ne2fsprogs-udeb
-Nlibblkid1-udeb
-Nlibuuid1-udeb
400 dh_gencontrol
-pe2fsprogs-udeb
-- -fdebian
/files~
401 dpkg-distaddfile
$(UDEB_NAME
) debian-installer
$(UDEB_PRIORITY
)
402 dh_builddeb
-pe2fsprogs-udeb
--filename
=$(UDEB_NAME
)
404 dh_gencontrol
-plibblkid1-udeb
-- -fdebian
/files~
405 dpkg-distaddfile
$(BLKID_UDEB_NAME
) debian-installer
$(BLKID_UDEB_PRIORITY
)
406 dh_builddeb
-plibblkid1-udeb
--filename
=$(BLKID_UDEB_NAME
)
408 dh_gencontrol
-plibuuid1-udeb
-- -fdebian
/files~
409 dpkg-distaddfile
$(UUID_UDEB_NAME
) debian-installer
$(UUID_UDEB_PRIORITY
)
410 dh_builddeb
-plibuuid1-udeb
--filename
=$(UUID_UDEB_NAME
)
412 binary
: binary-indep binary-arch
414 .PHONY
: binary binary-arch binary-indep
clean checkroot