]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - debian/rules
Makefile.in (install): Search all compression extensions when
[thirdparty/e2fsprogs.git] / debian / rules
CommitLineData
4d8f08f4
TT
1#! /usr/bin/make -f
2# -*- makefile -*-
3#
4# Invoke each target with `./debian/rules <target>'. All targets should be
5# invoked with the package root as the current directory.
6#
7# The `binary' target must be run as root, as it needs to install files with
8# specific ownerships.
9
10# be paranoid
11export LC_ALL=C
12
13DEB_BUILD_ARCH := $(shell dpkg --print-architecture)
14DEB_BUILD_GNU_TYPE := $(shell ./config.guess)
15ifndef DEB_HOST_ARCH
16 DEB_HOST_ARCH := ${DEB_BUILD_ARCH}
17endif
18DEB_HOST_GNU_CPU := $(patsubst hurd-%,%,$(DEB_HOST_ARCH))
19ifeq ($(filter-out hurd-%,${DEB_HOST_ARCH}),)
20 DEB_HOST_GNU_SYSTEM := gnu
21else
e5b16437 22# FIXME: we won't have always just Hurd and Linux
4d8f08f4
TT
23 DEB_HOST_GNU_SYSTEM := linux
24endif
25DEB_HOST_GNU_TYPE := ${DEB_HOST_GNU_CPU}-${DEB_HOST_GNU_SYSTEM}
26
27
28# find the version for the main package, from changelog file
29MAIN_VERSION = $(shell head -1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g')
e5b16437
TT
30# find versions for libraries going into their own packages, from their Makefile.in's,
31# and sonames for all libs
4d8f08f4 32COMERR_VERSION = $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3)
e5b16437 33COMERR_SOVERSION = $(shell grep ELF_SO_VERSION lib/et/Makefile.in | cut '-d ' -f3)
4d8f08f4 34SS_VERSION = $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
e5b16437 35SS_SOVERSION = $(shell grep ELF_SO_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
4d8f08f4 36UUID_VERSION = $(shell grep ELF_VERSION lib/uuid/Makefile.in | cut '-d ' -f3)
e5b16437
TT
37UUID_SOVERSION = $(shell grep ELF_SO_VERSION lib/uuid/Makefile.in | cut '-d ' -f3)
38EXT2FS_SOVERSION = $(shell grep ELF_SO_VERSION lib/ext2fs/Makefile.in | cut '-d ' -f3)
39E2P_SOVERSION = $(shell grep ELF_SO_VERSION lib/e2p/Makefile.in | cut '-d ' -f3)
4d8f08f4
TT
40
41package=e2fsprogs
42
43topdir=$(shell pwd)
44debdir=${topdir}/debian
b90b826b 45tmpdir=${debdir}/tmp
79786216 46bfdir=${debdir}/e2fsprogs-bf
b90b826b 47maindir=${debdir}/e2fsprogs
79786216
TT
48stdbuilddir=${debdir}/BUILD-STD
49bfbuilddir=${debdir}/BUILD-BF
e5b16437 50mipsbuilddir=${debdir}/BUILD-MIPS
b90b826b 51# docdir=${maindir}/usr/share/doc/${package}
4d8f08f4 52MANDIR=/usr/share/man
b90b826b 53mandir=${tmpdir}${MANDIR}
4d8f08f4
TT
54
55SUBPACKAGES_DIRS = tmp e2fslibs-dev comerr-dev ss-dev
56
541d173d
TT
57STAMPSDIR=debian/stampdir
58CFGSTDSTAMP=${STAMPSDIR}/configure-std-stamp
59CFGBFSTAMP=${STAMPSDIR}/configure-bf-stamp
60BUILDSTDSTAMP=${STAMPSDIR}/build-std-stamp
61BUILDBFSTAMP=${STAMPSDIR}/build-bf-stamp
62
1893e713 63CCOPTS = -O2 -fsigned-char
4d8f08f4
TT
64LIBC-DEV = libc6-dev
65
1893e713
TT
66INSTALL = install
67INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755
68
69ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
70CCOPTS += -g -O1
71endif
72ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
73INSTALL_PROGRAM += -s
74endif
75
4d8f08f4
TT
76ifeq (${DEB_HOST_ARCH},alpha)
77CCOPTS += -DHAVE_NETINET_IN_H
78LIBC-DEV = libc6.1-dev
79else
80CCOPTS += -D__NO_STRING_INLINES
81endif
82
79786216
TT
83BF_CCOPTS = -Os -fomit-frame-pointer
84
85COMMON_CONF_FLAGS = \
86 --enable-elf-shlibs --enable-dynamic-e2fsck \
87 --enable-nls \
e5b16437 88 --infodir=/usr/share/info
79786216
TT
89
90STD_CONF_FLAGS = --with-ccopts="${CCOPTS}" --enable-compression
91
92BF_CONF_FLAGS = --with-ccopts="${CCOPTS} ${BF_CCOPTS}" \
93 --disable-swapfs --disable-imager \
94 --disable-resizer --disable-debugfs
95
2a4c77bc
TT
96MIPS_NOPIC_CONF_FLAGS = --with-ccopts="${CCOPTS}" \
97 --disable-nls \
e5b16437
TT
98 --disable-swapfs --disable-imager \
99 --disable-resizer --disable-debugfs
2a4c77bc
TT
100# we can't use those flags at configure time
101MIPS_CFLAGS= -G 0 -fno-pic -mno-abicalls
e5b16437
TT
102
103ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
104ifneq (,$(findstring $(DEB_BUILD_ARCH),mips mipsel))
105ismips=ismips
106endif
107endif
108
541d173d 109${CFGSTDSTAMP}:
4d8f08f4 110 dh_testdir
541d173d 111
79786216
TT
112 mkdir -p ${stdbuilddir}
113ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
e5b16437 114 cd ${stdbuilddir} && \
79786216
TT
115 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS}
116else
e5b16437 117 cd ${stdbuilddir} && CC="${DEB_HOST_GNU_TYPE}-gcc" \
79786216
TT
118 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
119 --build=$(DEB_BUILD_GNU_TYPE) $(DEB_HOST_GNU_TYPE)
120endif
e5b16437
TT
121
122 # specially-built MIPS lib
123 if [ ismips = "${ismips}" ]; then \
124 mkdir -p ${mipsbuilddir} ; \
125 cd ${mipsbuilddir} && \
126 ${topdir}/configure ${MIPS_NOPIC_CONF_FLAGS} ; \
127 fi
128
541d173d
TT
129 mkdir -p ${STAMPSDIR}
130 touch ${CFGSTDSTAMP}
4d8f08f4 131
541d173d 132${CFGBFSTAMP}:
4d8f08f4 133 dh_testdir
541d173d
TT
134 rm -f config.cache
135
79786216 136 mkdir -p ${bfbuilddir}
4d8f08f4 137ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
e5b16437 138 cd ${bfbuilddir} && \
79786216 139 ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS}
4d8f08f4 140else
e5b16437 141 cd ${bfbuilddir} && CC="${DEB_HOST_GNU_TYPE}-gcc" \
79786216 142 ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \
4d8f08f4
TT
143 --build=$(DEB_BUILD_GNU_TYPE) $(DEB_HOST_GNU_TYPE)
144endif
541d173d
TT
145 mkdir -p ${STAMPSDIR}
146 touch ${CFGBFSTAMP}
79786216
TT
147
148build: build-std build-bf
149
541d173d
TT
150build-std: ${BUILDSTDSTAMP}
151${BUILDSTDSTAMP}: ${CFGSTDSTAMP}
79786216
TT
152 dh_testdir
153 make -C ${stdbuilddir} all
e5b16437 154
79786216
TT
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 )
e5b16437
TT
159
160 # specially-built MIPS lib
161 if [ ismips = "${ismips}" ]; then \
162 make -C ${mipsbuilddir}/util ; \
2a4c77bc
TT
163 make -C ${mipsbuilddir} libs \
164 CFLAGS="${CCOPTS} ${MIPS_CFLAGS}" \
165 LIB_SUBDIRS="lib/et lib/ext2fs" ; \
e5b16437
TT
166 fi
167
541d173d 168 touch ${BUILDSTDSTAMP}
79786216 169
541d173d
TT
170build-bf: ${BUILDBFSTAMP}
171${BUILDBFSTAMP}: ${CFGBFSTAMP}
79786216
TT
172 dh_testdir
173 make -C ${bfbuilddir} all
541d173d 174 touch ${BUILDBFSTAMP}
4d8f08f4
TT
175
176clean:
177 dh_testdir
541d173d 178 rm -rf ${STAMPSDIR}
79786216
TT
179 -make -C ${stdbuilddir} -i distclean
180 -make -C ${bfbuilddir} -i distclean
2a4c77bc 181 rm -rf ${stdbuilddir} ${bfbuilddir} ${mipsbuilddir}
b90b826b 182 rm -f doc/libext2fs_*.html lib/et/com_err_*.html debian/*.substvars
4d8f08f4
TT
183 dh_clean
184
79786216
TT
185install: cleanup install-std install-bf
186
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
190cleanup:
b90b826b
TT
191 dh_testdir
192 dh_testroot
193 dh_clean -k
79786216
TT
194
195install-std: DH_OPTIONS=
196install-std: build
197 dh_testdir
198 dh_testroot
b90b826b 199 dh_installdirs
4d8f08f4 200
b90b826b 201 mkdir -p ${tmpdir}/sbin
79786216
TT
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
4d8f08f4 206
2a4c77bc
TT
207 # remove FSIM for now.
208 rm ${tmpdir}/lib/evms/libe2fsim.1.1.1.so
209
1893e713 210 # statically-linked fsck
79786216 211 ${INSTALL_PROGRAM} ${stdbuilddir}/e2fsck/e2fsck.static ${tmpdir}/sbin
1893e713 212 ln -s e2fsck.8.gz ${mandir}/man8/e2fsck.static.8.gz
4d8f08f4 213
2a4c77bc
TT
214 dh_movefiles
215 test -z `find ${tmpdir} -type f`
216
e5b16437
TT
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 ; \
221 fi
222
79786216
TT
223install-bf: DH_OPTIONS=
224install-bf: build
225 dh_testdir
226 dh_testroot
227 dh_installdirs
228
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
235
2a4c77bc
TT
236 # remove FSIM for now.
237 rm ${bfdir}/lib/evms/libe2fsim.1.1.1.so
238
79786216 239
b90b826b
TT
240binary-indep:
241 # no arch-independant debs.
4d8f08f4 242
b90b826b
TT
243binary-arch: DH_OPTIONS= -a
244binary-arch: install
245 dh_testdir
246 dh_testroot
247
541d173d
TT
248 # remove obsolete maint-scripts provided by 1.26 upstream
249 cd debian && rm -f comerr-dev.postinst e2fslibs-dev.postinst \
e5b16437 250 e2fsprogs.postinst e2fsprogs.shlibs e2fsprogs.shlibs.in
541d173d
TT
251
252 # lintian overrides
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} ;\
256 done
79786216 257
e5b16437
TT
258 # mkinitrd script
259 dh_install -p e2fsprogs debian/e2fsprogs.mkinitrd \
2a4c77bc
TT
260 /etc/mkinitrd/scripts/e2fsprogs
261 chmod +x ${debdir}/e2fsprogs/etc/mkinitrd/scripts/*
e5b16437 262
b90b826b 263 # symlinks to prepare dh_installdocs run
1893e713
TT
264 mkdir -p ${debdir}/e2fsck-static/usr/share/doc/
265 ln -sf e2fsprogs ${debdir}/e2fsck-static/usr/share/doc/e2fsck-static
266
b90b826b
TT
267 mkdir -p ${debdir}/e2fslibs-dev/usr/share/doc/e2fsprogs
268 ln -sf e2fsprogs ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev
269
270 mkdir -p ${debdir}/uuid-dev/usr/share/doc/e2fsprogs
271 ln -sf e2fsprogs ${debdir}/uuid-dev/usr/share/doc/uuid-dev
272
273 # comerr and ss have their own copyright notices
e5b16437
TT
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
4d8f08f4 277
e5b16437
TT
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
4d8f08f4 281
e5b16437 282 for i in libcomerr${COMERR_SOVERSION} libss${SS_SOVERSION}; do \
79786216
TT
283 install -m 644 debian/$$i.copyright \
284 ${maindir}/usr/share/doc/$$i/copyright ; \
4d8f08f4
TT
285 done
286
b90b826b
TT
287 dh_installdocs
288
79786216
TT
289 install -m 644 debian/e2fsprogs.copyright \
290 ${bfdir}/usr/share/doc/e2fsprogs-bf/copyright
291
4d8f08f4
TT
292 # HTML docs
293 install -d ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/html-info/
79786216 294 install -p ${stdbuilddir}/doc/libext2fs_*.html \
4d8f08f4
TT
295 ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/html-info/
296 install -d ${debdir}/comerr-dev/usr/share/doc/comerr-dev/html-info/
79786216 297 install -p ${stdbuilddir}/lib/et/com_err_*.html \
4d8f08f4
TT
298 ${debdir}/comerr-dev/usr/share/doc/comerr-dev/html-info/
299
300 # texinfo docs
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 \
e5b16437 304 ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/com_err.texi
4d8f08f4 305
b90b826b 306 dh_installexamples
b90b826b 307
541d173d 308 dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info
79786216 309 dh_installinfo -pe2fslibs-dev ${stdbuilddir}/doc/libext2fs.info
4d8f08f4 310
b90b826b 311 dh_undocumented
4d8f08f4 312
79786216 313 DH_OPTIONS= dh_installchangelogs -pe2fsprogs -pe2fsprogs-bf ChangeLog
4d8f08f4 314
e5b16437 315 for i in libcomerr${COMERR_SOVERSION} libss${SS_SOVERSION} ; do \
b90b826b
TT
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/ ; \
319 done
4d8f08f4 320
b90b826b 321 dh_strip
4d8f08f4 322
b90b826b
TT
323 dh_compress
324 dh_fixperms
4d8f08f4 325
b90b826b
TT
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
4d8f08f4 330
541d173d
TT
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
e5b16437
TT
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
4d8f08f4 345
b90b826b 346 dh_installdeb
79786216 347 dh_shlibdeps -l${stdbuilddir}/lib
b90b826b
TT
348
349 dh_gencontrol -Ncomerr-dev -Nss-dev -Nuuid-dev
350 DH_OPTIONS= dh_gencontrol -pcomerr-dev \
4d8f08f4 351 -u '-v${COMERR_VERSION}-${MAIN_VERSION}'
b90b826b 352 DH_OPTIONS= dh_gencontrol -pss-dev \
4d8f08f4 353 -u '-v${SS_VERSION}-${MAIN_VERSION}'
b90b826b 354 DH_OPTIONS= dh_gencontrol -puuid-dev \
4d8f08f4 355 -u '-v${UUID_VERSION}-${MAIN_VERSION}'
b90b826b
TT
356
357 dh_md5sums
358 dh_builddeb
4d8f08f4
TT
359
360binary: binary-indep binary-arch
361
362.PHONY: binary binary-arch binary-indep clean checkroot