]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - debian/rules
unix_io.c (unix_open): Fix 2.4 resource limit workaround so that
[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
b90b826b
TT
13export DH_COMPAT=2
14
4d8f08f4
TT
15DEB_BUILD_ARCH := $(shell dpkg --print-architecture)
16DEB_BUILD_GNU_TYPE := $(shell ./config.guess)
17ifndef DEB_HOST_ARCH
18 DEB_HOST_ARCH := ${DEB_BUILD_ARCH}
19endif
20DEB_HOST_GNU_CPU := $(patsubst hurd-%,%,$(DEB_HOST_ARCH))
21ifeq ($(filter-out hurd-%,${DEB_HOST_ARCH}),)
22 DEB_HOST_GNU_SYSTEM := gnu
23else
24# FIXME: we won't always have only Hurd and Linux
25 DEB_HOST_GNU_SYSTEM := linux
26endif
27DEB_HOST_GNU_TYPE := ${DEB_HOST_GNU_CPU}-${DEB_HOST_GNU_SYSTEM}
28
29
30# find the version for the main package, from changelog file
31MAIN_VERSION = $(shell head -1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g')
32# find versions for libraries going into their own packages, from their Makefile.in's
33COMERR_VERSION = $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3)
34COMERR_MAJOR = $(word 1,$(subst ., ,${COMERR_VERSION}))
35SS_VERSION = $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
36SS_MAJOR = $(word 1,$(subst ., ,${SS_VERSION}))
37UUID_VERSION = $(shell grep ELF_VERSION lib/uuid/Makefile.in | cut '-d ' -f3)
b90b826b 38# UUID_MAJOR = $(word 1,$(subst ., ,${UUID_VERSION}))
4d8f08f4
TT
39
40package=e2fsprogs
41
42topdir=$(shell pwd)
43debdir=${topdir}/debian
b90b826b 44tmpdir=${debdir}/tmp
79786216 45bfdir=${debdir}/e2fsprogs-bf
b90b826b 46maindir=${debdir}/e2fsprogs
79786216
TT
47stdbuilddir=${debdir}/BUILD-STD
48bfbuilddir=${debdir}/BUILD-BF
b90b826b 49# docdir=${maindir}/usr/share/doc/${package}
4d8f08f4 50MANDIR=/usr/share/man
b90b826b 51mandir=${tmpdir}${MANDIR}
4d8f08f4
TT
52
53SUBPACKAGES_DIRS = tmp e2fslibs-dev comerr-dev ss-dev
54
1893e713 55CCOPTS = -O2 -fsigned-char
4d8f08f4
TT
56LIBC-DEV = libc6-dev
57
1893e713
TT
58INSTALL = install
59INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755
60
61ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
62CCOPTS += -g -O1
63endif
64ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
65INSTALL_PROGRAM += -s
66endif
67
4d8f08f4
TT
68ifeq (${DEB_HOST_ARCH},alpha)
69CCOPTS += -DHAVE_NETINET_IN_H
70LIBC-DEV = libc6.1-dev
71else
72CCOPTS += -D__NO_STRING_INLINES
73endif
74
79786216
TT
75# Try -Os
76BF_CCOPTS = -Os -fomit-frame-pointer
77
78COMMON_CONF_FLAGS = \
79 --enable-elf-shlibs --enable-dynamic-e2fsck \
80 --enable-nls \
81 --mandir=${MANDIR} --infodir=/usr/share/info
82
83STD_CONF_FLAGS = --with-ccopts="${CCOPTS}" --enable-compression
84
85BF_CONF_FLAGS = --with-ccopts="${CCOPTS} ${BF_CCOPTS}" \
86 --disable-swapfs --disable-imager \
87 --disable-resizer --disable-debugfs
88
89configure-std-stamp:
4d8f08f4 90 dh_testdir
79786216
TT
91 mkdir -p ${stdbuilddir}
92ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
93 cd ${stdbuilddir} && CFLAGS="${CFLAGS}" \
94 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS}
95else
96 cd ${stdbuilddir} && CFLAGS="${CFLAGS}" CC="${DEB_HOST_GNU_TYPE}-gcc" \
97 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
98 --build=$(DEB_BUILD_GNU_TYPE) $(DEB_HOST_GNU_TYPE)
99endif
100 touch configure-std-stamp
4d8f08f4 101
79786216 102configure-bf-stamp:
4d8f08f4 103 dh_testdir
79786216 104 mkdir -p ${bfbuilddir}
4d8f08f4 105ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
79786216
TT
106 cd ${bfbuilddir} && CFLAGS="${CFLAGS}" \
107 ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS}
4d8f08f4 108else
79786216
TT
109 cd ${bfbuilddir} && CFLAGS="${CFLAGS}" CC="${DEB_HOST_GNU_TYPE}-gcc" \
110 ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \
4d8f08f4
TT
111 --build=$(DEB_BUILD_GNU_TYPE) $(DEB_HOST_GNU_TYPE)
112endif
79786216
TT
113 touch configure-bf-stamp
114
115build: build-std build-bf
116
117build-std: build-std-stamp
118build-std-stamp: configure-std-stamp
119 dh_testdir
120 make -C ${stdbuilddir} all
121 ( cd ${stdbuilddir}/doc && \
122 texi2html -split_chapter ${topdir}/doc/libext2fs.texinfo )
123 ( cd ${stdbuilddir}/lib/et && make com_err.info && \
124 texi2html -split_chapter -expandinfo ${topdir}/lib/et/com_err.texinfo )
125 touch build-std-stamp
126
127build-bf: build-bf-stamp
128build-bf-stamp: configure-bf-stamp
129 dh_testdir
130 make -C ${bfbuilddir} all
131 touch build-bf-stamp
4d8f08f4
TT
132
133clean:
134 dh_testdir
79786216
TT
135 rm -f build-std-stamp configure-std-stamp build-bf-stamp configure-bf-stamp install
136 -make -C ${stdbuilddir} -i distclean
137 -make -C ${bfbuilddir} -i distclean
138 rm -rf ${stdbuilddir} ${bfbuilddir}
b90b826b 139 rm -f doc/libext2fs_*.html lib/et/com_err_*.html debian/*.substvars
4d8f08f4
TT
140 dh_clean
141
79786216
TT
142install: cleanup install-std install-bf
143
144# This rule allows to factorize the dh_clean between the 2 install rules
145# This must be launched before install-* (if launching them by hand, for
146# exemple) or results are unpredictable
147cleanup:
b90b826b
TT
148 dh_testdir
149 dh_testroot
150 dh_clean -k
79786216
TT
151
152install-std: DH_OPTIONS=
153install-std: build
154 dh_testdir
155 dh_testroot
b90b826b 156 dh_installdirs
4d8f08f4 157
b90b826b 158 mkdir -p ${tmpdir}/sbin
79786216
TT
159 make -C ${stdbuilddir} install DESTDIR=${tmpdir} \
160 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
161 # static libs and .h files
162 make -C ${stdbuilddir} install-libs DESTDIR=${tmpdir} LDCONFIG=true
4d8f08f4 163
1893e713 164 # statically-linked fsck
79786216 165 ${INSTALL_PROGRAM} ${stdbuilddir}/e2fsck/e2fsck.static ${tmpdir}/sbin
1893e713 166 ln -s e2fsck.8.gz ${mandir}/man8/e2fsck.static.8.gz
4d8f08f4 167
b90b826b
TT
168 dh_movefiles
169 test -z `find ${tmpdir} -type f`
4d8f08f4 170
79786216
TT
171install-bf: DH_OPTIONS=
172install-bf: build
173 dh_testdir
174 dh_testroot
175 dh_installdirs
176
177 mkdir -p ${bfdir}/sbin
178 make -C ${bfbuilddir} install DESTDIR=${bfdir} \
179 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
180 rm -rf ${bfdir}/usr/share ${bfdir}/usr/lib
181 cd ${bfdir}/sbin && rm -f e2label
182 cd ${bfdir}/usr/bin && rm -f uuidgen
183
184
b90b826b
TT
185binary-indep:
186 # no arch-independant debs.
4d8f08f4 187
b90b826b
TT
188binary-arch: DH_OPTIONS= -a
189binary-arch: install
190 dh_testdir
191 dh_testroot
192
79786216
TT
193 rm -f debian/TODO debian/README.Debian
194
b90b826b 195 # symlinks to prepare dh_installdocs run
1893e713
TT
196 mkdir -p ${debdir}/e2fsck-static/usr/share/doc/
197 ln -sf e2fsprogs ${debdir}/e2fsck-static/usr/share/doc/e2fsck-static
198
b90b826b
TT
199 mkdir -p ${debdir}/e2fslibs-dev/usr/share/doc/e2fsprogs
200 ln -sf e2fsprogs ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev
201
202 mkdir -p ${debdir}/uuid-dev/usr/share/doc/e2fsprogs
203 ln -sf e2fsprogs ${debdir}/uuid-dev/usr/share/doc/uuid-dev
204
205 # comerr and ss have their own copyright notices
4d8f08f4
TT
206 mkdir -p ${maindir}/usr/share/doc/libcomerr${COMERR_MAJOR}
207 mkdir -p ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_MAJOR}
208 ln -sf libcomerr${COMERR_MAJOR} ${debdir}/comerr-dev/usr/share/doc/comerr-dev
209
210 mkdir -p ${maindir}/usr/share/doc/libss${SS_MAJOR}
211 mkdir -p ${debdir}/ss-dev/usr/share/doc/libss${SS_MAJOR}
212 ln -sf libss${SS_MAJOR} ${debdir}/ss-dev/usr/share/doc/ss-dev
213
4d8f08f4 214 for i in libcomerr${COMERR_MAJOR} libss${SS_MAJOR}; do \
79786216
TT
215 install -m 644 debian/$$i.copyright \
216 ${maindir}/usr/share/doc/$$i/copyright ; \
4d8f08f4
TT
217 done
218
b90b826b
TT
219 dh_installdocs
220
79786216
TT
221 install -m 644 debian/e2fsprogs.copyright \
222 ${bfdir}/usr/share/doc/e2fsprogs-bf/copyright
223
4d8f08f4
TT
224 # HTML docs
225 install -d ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/html-info/
79786216 226 install -p ${stdbuilddir}/doc/libext2fs_*.html \
4d8f08f4
TT
227 ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/html-info/
228 install -d ${debdir}/comerr-dev/usr/share/doc/comerr-dev/html-info/
79786216 229 install -p ${stdbuilddir}/lib/et/com_err_*.html \
4d8f08f4
TT
230 ${debdir}/comerr-dev/usr/share/doc/comerr-dev/html-info/
231
232 # texinfo docs
233 install -p ${topdir}/doc/libext2fs.texinfo \
234 ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev/libext2fs.texi
235 install -p ${topdir}/lib/et/com_err.texinfo \
236 ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_MAJOR}/com_err.texi
237
b90b826b
TT
238 dh_installexamples
239 dh_installman
240
79786216
TT
241# dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info
242 dh_installinfo -pe2fslibs-dev ${stdbuilddir}/doc/libext2fs.info
4d8f08f4 243
b90b826b 244 dh_undocumented
4d8f08f4 245
79786216 246 DH_OPTIONS= dh_installchangelogs -pe2fsprogs -pe2fsprogs-bf ChangeLog
4d8f08f4 247
b90b826b
TT
248 for i in libcomerr${COMERR_MAJOR} libss${SS_MAJOR} ; do \
249 mkdir -p ${maindir}/usr/share/doc/$$i ; \
250 ln -s ../e2fsprogs/changelog.Debian.gz ${maindir}/usr/share/doc/$$i/ ; \
251 ln -s ../e2fsprogs/changelog.gz ${maindir}/usr/share/doc/$$i/ ; \
252 done
4d8f08f4 253
b90b826b 254 dh_strip
4d8f08f4 255
b90b826b
TT
256 dh_link -pe2fsprogs \
257 /usr/share/man/man8/e2fsck.8.gz /usr/share/man/man8/fsck.ext2.8.gz \
258 /usr/share/man/man8/mke2fs.8.gz /usr/share/man/man8/mkfs.ext2.8.gz
259 dh_link -puuid-dev \
260 /usr/share/man/man3/uuid_generate.3.gz /usr/share/man/man3/uuid_generate_random.3.gz \
261 /usr/share/man/man3/uuid_generate.3.gz /usr/share/man/man3/uuid_generate_time.3.gz
4d8f08f4 262
b90b826b
TT
263 dh_compress
264 dh_fixperms
4d8f08f4 265
b90b826b
TT
266 echo "libcdev:Depends=${LIBC-DEV}" > debian/comerr-dev.substvars
267 echo "libcdev:Depends=${LIBC-DEV}" > debian/ss-dev.substvars
268 echo "libcdev:Depends=${LIBC-DEV}" > debian/uuid-dev.substvars
269 echo "libcdev:Depends=${LIBC-DEV}" > debian/e2fslibs-dev.substvars
4d8f08f4 270
b90b826b
TT
271# We do this one by hand
272# dh_makeshlibs
4d8f08f4 273
b90b826b 274 dh_installdeb
79786216 275 dh_shlibdeps -l${stdbuilddir}/lib
b90b826b
TT
276
277 dh_gencontrol -Ncomerr-dev -Nss-dev -Nuuid-dev
278 DH_OPTIONS= dh_gencontrol -pcomerr-dev \
4d8f08f4 279 -u '-v${COMERR_VERSION}-${MAIN_VERSION}'
b90b826b 280 DH_OPTIONS= dh_gencontrol -pss-dev \
4d8f08f4 281 -u '-v${SS_VERSION}-${MAIN_VERSION}'
b90b826b 282 DH_OPTIONS= dh_gencontrol -puuid-dev \
4d8f08f4 283 -u '-v${UUID_VERSION}-${MAIN_VERSION}'
b90b826b
TT
284
285 dh_md5sums
286 dh_builddeb
4d8f08f4
TT
287
288binary: binary-indep binary-arch
289
290.PHONY: binary binary-arch binary-indep clean checkroot