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 DEB_BUILD_ARCH := $(shell dpkg --print-architecture)
14 DEB_BUILD_GNU_TYPE := $(shell ./config.guess)
16 DEB_HOST_ARCH := ${DEB_BUILD_ARCH}
18 DEB_HOST_GNU_CPU := $(patsubst hurd-%,%,$(DEB_HOST_ARCH))
19 ifeq ($(filter-out hurd-%,${DEB_HOST_ARCH}),)
20 DEB_HOST_GNU_SYSTEM := gnu
22 # FIXME: we won't have always just Hurd and Linux
23 DEB_HOST_GNU_SYSTEM := linux
25 DEB_HOST_GNU_TYPE := ${DEB_HOST_GNU_CPU}-${DEB_HOST_GNU_SYSTEM}
28 # find the version for the main package, from changelog file
29 MAIN_VERSION = $(shell head -1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g')
30 # find versions for libraries going into their own packages, from their Makefile.in's,
31 # and sonames for all libs
32 COMERR_VERSION = $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3)
33 COMERR_SOVERSION = $(shell grep ELF_SO_VERSION lib/et/Makefile.in | cut '-d ' -f3)
34 SS_VERSION = $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
35 SS_SOVERSION = $(shell grep ELF_SO_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
36 UUID_VERSION = $(shell grep ELF_VERSION lib/uuid/Makefile.in | cut '-d ' -f3)
37 UUID_SOVERSION = $(shell grep ELF_SO_VERSION lib/uuid/Makefile.in | cut '-d ' -f3)
38 EXT2FS_SOVERSION = $(shell grep ELF_SO_VERSION lib/ext2fs/Makefile.in | cut '-d ' -f3)
39 E2P_SOVERSION = $(shell grep ELF_SO_VERSION lib/e2p/Makefile.in | cut '-d ' -f3)
44 debdir=${topdir}/debian
46 bfdir=${debdir}/e2fsprogs-bf
47 maindir=${debdir}/e2fsprogs
48 stdbuilddir=${debdir}/BUILD-STD
49 bfbuilddir=${debdir}/BUILD-BF
50 mipsbuilddir=${debdir}/BUILD-MIPS
51 # docdir=${maindir}/usr/share/doc/${package}
53 mandir=${tmpdir}${MANDIR}
55 SUBPACKAGES_DIRS = tmp e2fslibs-dev comerr-dev ss-dev
57 STAMPSDIR=debian/stampdir
58 CFGSTDSTAMP=${STAMPSDIR}/configure-std-stamp
59 CFGBFSTAMP=${STAMPSDIR}/configure-bf-stamp
60 BUILDSTDSTAMP=${STAMPSDIR}/build-std-stamp
61 BUILDBFSTAMP=${STAMPSDIR}/build-bf-stamp
63 CCOPTS = -O2 -fsigned-char
67 INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755
69 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
72 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
76 ifeq (${DEB_HOST_ARCH},alpha)
77 CCOPTS += -DHAVE_NETINET_IN_H
78 LIBC-DEV = libc6.1-dev
80 CCOPTS += -D__NO_STRING_INLINES
83 BF_CCOPTS = -Os -fomit-frame-pointer
86 --enable-elf-shlibs --enable-dynamic-e2fsck \
88 --infodir=/usr/share/info
90 STD_CONF_FLAGS = --with-ccopts="${CCOPTS}" --enable-compression
92 BF_CONF_FLAGS = --with-ccopts="${CCOPTS} ${BF_CCOPTS}" \
93 --disable-swapfs --disable-imager \
94 --disable-resizer --disable-debugfs
96 MIPS_NOPIC_CONF_FLAGS = --with-ccopts="${CCOPTS}" \
98 --disable-swapfs --disable-imager \
99 --disable-resizer --disable-debugfs
100 # we can't use those flags at configure time
101 MIPS_CFLAGS= -G 0 -fno-pic -mno-abicalls
103 ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
104 ifneq (,$(findstring $(DEB_BUILD_ARCH),mips mipsel))
112 mkdir -p ${stdbuilddir}
113 ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
114 cd ${stdbuilddir} && \
115 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS}
117 cd ${stdbuilddir} && CC="${DEB_HOST_GNU_TYPE}-gcc" \
118 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
119 --build=$(DEB_BUILD_GNU_TYPE) $(DEB_HOST_GNU_TYPE)
122 # specially-built MIPS lib
123 if [ ismips = "${ismips}" ]; then \
124 mkdir -p ${mipsbuilddir} ; \
125 cd ${mipsbuilddir} && \
126 ${topdir}/configure ${MIPS_NOPIC_CONF_FLAGS} ; \
129 mkdir -p ${STAMPSDIR}
136 mkdir -p ${bfbuilddir}
137 ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
138 cd ${bfbuilddir} && \
139 ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS}
141 cd ${bfbuilddir} && CC="${DEB_HOST_GNU_TYPE}-gcc" \
142 ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \
143 --build=$(DEB_BUILD_GNU_TYPE) $(DEB_HOST_GNU_TYPE)
145 mkdir -p ${STAMPSDIR}
148 build: build-std build-bf
150 build-std: ${BUILDSTDSTAMP}
151 ${BUILDSTDSTAMP}: ${CFGSTDSTAMP}
153 make -C ${stdbuilddir} all
155 ( cd ${stdbuilddir}/doc && \
156 texi2html -split_chapter ${topdir}/doc/libext2fs.texinfo )
157 ( cd ${stdbuilddir}/lib/et && make com_err.info && \
158 texi2html -split_chapter -expandinfo ${topdir}/lib/et/com_err.texinfo )
160 # specially-built MIPS lib
161 if [ ismips = "${ismips}" ]; then \
162 make -C ${mipsbuilddir}/util ; \
163 make -C ${mipsbuilddir} libs \
164 CFLAGS="${CCOPTS} ${MIPS_CFLAGS}" \
165 LIB_SUBDIRS="lib/et lib/ext2fs" ; \
168 touch ${BUILDSTDSTAMP}
170 build-bf: ${BUILDBFSTAMP}
171 ${BUILDBFSTAMP}: ${CFGBFSTAMP}
173 make -C ${bfbuilddir} all
174 touch ${BUILDBFSTAMP}
179 -make -C ${stdbuilddir} -i distclean
180 -make -C ${bfbuilddir} -i distclean
181 rm -rf ${stdbuilddir} ${bfbuilddir} ${mipsbuilddir}
182 rm -f doc/libext2fs_*.html lib/et/com_err_*.html debian/*.substvars
185 install: cleanup install-std install-bf
187 # This rule allows to factorize the dh_clean between the 2 install rules
188 # This must be launched before install-* (if launching them by hand, for
189 # exemple) or results are unpredictable
195 install-std: DH_OPTIONS=
201 mkdir -p ${tmpdir}/sbin
202 make -C ${stdbuilddir} install DESTDIR=${tmpdir} \
203 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
204 # static libs and .h files
205 make -C ${stdbuilddir} install-libs DESTDIR=${tmpdir} LDCONFIG=true
207 # remove FSIM for now.
208 rm ${tmpdir}/lib/evms/libe2fsim.1.1.1.so
210 # statically-linked fsck
211 ${INSTALL_PROGRAM} ${stdbuilddir}/e2fsck/e2fsck.static ${tmpdir}/sbin
212 ln -s e2fsck.8.gz ${mandir}/man8/e2fsck.static.8.gz
215 test -z `find ${tmpdir} -type f`
217 # specially-built MIPS lib
218 if [ ismips = "${ismips}" ]; then \
219 cp ${mipsbuilddir}/lib/libext2fs.a \
220 ${debdir}/e2fslibs-dev/usr/lib/libext2fs-nopic.a ; \
223 install-bf: DH_OPTIONS=
229 mkdir -p ${bfdir}/sbin
230 make -C ${bfbuilddir} install DESTDIR=${bfdir} \
231 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
232 rm -rf ${bfdir}/usr/share ${bfdir}/usr/lib
233 cd ${bfdir}/sbin && rm -f e2label
234 cd ${bfdir}/usr/bin && rm -f uuidgen
236 # remove FSIM for now.
237 rm ${bfdir}/lib/evms/libe2fsim.1.1.1.so
241 # no arch-independant debs.
243 binary-arch: DH_OPTIONS= -a
248 # remove obsolete maint-scripts provided by 1.26 upstream
249 cd debian && rm -f comerr-dev.postinst e2fslibs-dev.postinst \
250 e2fsprogs.postinst e2fsprogs.shlibs e2fsprogs.shlibs.in
253 for i in $$(cd debian && echo *.lintian-overrides); do \
254 pkg=$${i%.lintian-overrides} ;\
255 install -m644 -D -p debian/$$i ${debdir}/$${pkg}/usr/share/lintian/overrides/$${pkg} ;\
259 dh_install -p e2fsprogs debian/e2fsprogs.mkinitrd \
260 /etc/mkinitrd/scripts/e2fsprogs
261 chmod +x ${debdir}/e2fsprogs/etc/mkinitrd/scripts/*
263 # symlinks to prepare dh_installdocs run
264 mkdir -p ${debdir}/e2fsck-static/usr/share/doc/
265 ln -sf e2fsprogs ${debdir}/e2fsck-static/usr/share/doc/e2fsck-static
267 mkdir -p ${debdir}/e2fslibs-dev/usr/share/doc/e2fsprogs
268 ln -sf e2fsprogs ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev
270 mkdir -p ${debdir}/uuid-dev/usr/share/doc/e2fsprogs
271 ln -sf e2fsprogs ${debdir}/uuid-dev/usr/share/doc/uuid-dev
273 # comerr and ss have their own copyright notices
274 mkdir -p ${maindir}/usr/share/doc/libcomerr${COMERR_SOVERSION}
275 mkdir -p ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}
276 ln -sf libcomerr${COMERR_SOVERSION} ${debdir}/comerr-dev/usr/share/doc/comerr-dev
278 mkdir -p ${maindir}/usr/share/doc/libss${SS_SOVERSION}
279 mkdir -p ${debdir}/ss-dev/usr/share/doc/libss${SS_SOVERSION}
280 ln -sf libss${SS_SOVERSION} ${debdir}/ss-dev/usr/share/doc/ss-dev
282 for i in libcomerr${COMERR_SOVERSION} libss${SS_SOVERSION}; do \
283 install -m 644 debian/$$i.copyright \
284 ${maindir}/usr/share/doc/$$i/copyright ; \
289 install -m 644 debian/e2fsprogs.copyright \
290 ${bfdir}/usr/share/doc/e2fsprogs-bf/copyright
293 install -d ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/html-info/
294 install -p ${stdbuilddir}/doc/libext2fs_*.html \
295 ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/html-info/
296 install -d ${debdir}/comerr-dev/usr/share/doc/comerr-dev/html-info/
297 install -p ${stdbuilddir}/lib/et/com_err_*.html \
298 ${debdir}/comerr-dev/usr/share/doc/comerr-dev/html-info/
301 install -p ${topdir}/doc/libext2fs.texinfo \
302 ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/libext2fs.texi
303 install -p ${topdir}/lib/et/com_err.texinfo \
304 ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/com_err.texi
308 dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info
309 dh_installinfo -pe2fslibs-dev ${stdbuilddir}/doc/libext2fs.info
313 DH_OPTIONS= dh_installchangelogs -pe2fsprogs -pe2fsprogs-bf ChangeLog
315 for i in libcomerr${COMERR_SOVERSION} libss${SS_SOVERSION} ; do \
316 mkdir -p ${maindir}/usr/share/doc/$$i ; \
317 ln -s ../e2fsprogs/changelog.Debian.gz ${maindir}/usr/share/doc/$$i/ ; \
318 ln -s ../e2fsprogs/changelog.gz ${maindir}/usr/share/doc/$$i/ ; \
326 echo "libcdev:Depends=${LIBC-DEV}" > debian/comerr-dev.substvars
327 echo "libcdev:Depends=${LIBC-DEV}" > debian/ss-dev.substvars
328 echo "libcdev:Depends=${LIBC-DEV}" > debian/uuid-dev.substvars
329 echo "libcdev:Depends=${LIBC-DEV}" > debian/e2fslibs-dev.substvars
331 # Call this mostly to get the maintainer-script snippets
332 dh_makeshlibs -pe2fsprogs
333 # We overwrite the shlibs by hand because of virtual packages used
334 : > debian/e2fsprogs/DEBIAN/shlibs
335 echo "libext2fs ${EXT2FS_SOVERSION} libext2fs${EXT2FS_SOVERSION}" \
336 >> debian/e2fsprogs/DEBIAN/shlibs
337 echo "libe2p ${E2P_SOVERSION} libe2p${E2P_SOVERSION}" \
338 >> debian/e2fsprogs/DEBIAN/shlibs
339 echo "libuuid ${UUID_SOVERSION} libuuid${UUID_SOVERSION}" \
340 >> debian/e2fsprogs/DEBIAN/shlibs
341 echo "libcom_err ${COMERR_SOVERSION} libcomerr${COMERR_SOVERSION}" \
342 >> debian/e2fsprogs/DEBIAN/shlibs
343 echo "libss ${SS_SOVERSION} libss${SS_SOVERSION}" \
344 >> debian/e2fsprogs/DEBIAN/shlibs
347 dh_shlibdeps -l${stdbuilddir}/lib
349 dh_gencontrol -Ncomerr-dev -Nss-dev -Nuuid-dev
350 DH_OPTIONS= dh_gencontrol -pcomerr-dev \
351 -u '-v${COMERR_VERSION}-${MAIN_VERSION}'
352 DH_OPTIONS= dh_gencontrol -pss-dev \
353 -u '-v${SS_VERSION}-${MAIN_VERSION}'
354 DH_OPTIONS= dh_gencontrol -puuid-dev \
355 -u '-v${UUID_VERSION}-${MAIN_VERSION}'
360 binary: binary-indep binary-arch
362 .PHONY: binary binary-arch binary-indep clean checkroot