blob: df2fe8d802aa48c4986f8c97ec74fce559e165cb [file] [log] [blame]
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +00001#! /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
Theodore Ts'of85cc2a2003-07-26 00:48:08 -040013# These are used for cross-compiling and for saving the configure script
14# from having to guess our platform (since we know it already)
15DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
16DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
Samuel Thibault3e416082007-08-14 11:25:45 +020017DEB_HOST_OS ?= $(shell dpkg-architecture -qDEB_HOST_OS)
Theodore Ts'of85cc2a2003-07-26 00:48:08 -040018DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
19DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000020
21# find the version for the main package, from changelog file
Theodore Ts'o56eb4d42004-09-17 19:54:22 -040022MAIN_VERSION = $(shell head -n 1 debian/changelog | cut '-d ' -f 2 | sed 's/[()]//g')
Theodore Ts'oe5b16432002-08-17 21:11:29 -040023# find versions for libraries going into their own packages, from their Makefile.in's,
24# and sonames for all libs
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000025COMERR_VERSION = $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3)
Theodore Ts'oe5b16432002-08-17 21:11:29 -040026COMERR_SOVERSION = $(shell grep ELF_SO_VERSION lib/et/Makefile.in | cut '-d ' -f3)
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000027SS_VERSION = $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
Theodore Ts'oe5b16432002-08-17 21:11:29 -040028SS_SOVERSION = $(shell grep ELF_SO_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000029UUID_VERSION = $(shell grep ELF_VERSION lib/uuid/Makefile.in | cut '-d ' -f3)
Theodore Ts'oe5b16432002-08-17 21:11:29 -040030UUID_SOVERSION = $(shell grep ELF_SO_VERSION lib/uuid/Makefile.in | cut '-d ' -f3)
Theodore Ts'o6fe7d112003-03-16 19:58:25 -050031BLKID_VERSION = $(shell grep ELF_VERSION lib/blkid/Makefile.in | cut '-d ' -f3)
32BLKID_SOVERSION = $(shell grep ELF_SO_VERSION lib/blkid/Makefile.in | cut '-d ' -f3)
Theodore Ts'oe5b16432002-08-17 21:11:29 -040033EXT2FS_SOVERSION = $(shell grep ELF_SO_VERSION lib/ext2fs/Makefile.in | cut '-d ' -f3)
34E2P_SOVERSION = $(shell grep ELF_SO_VERSION lib/e2p/Makefile.in | cut '-d ' -f3)
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000035
36package=e2fsprogs
37
38topdir=$(shell pwd)
39debdir=${topdir}/debian
Theodore Ts'ob90b8262001-06-15 22:54:34 +000040tmpdir=${debdir}/tmp
Theodore Ts'odd198d62002-10-31 03:44:35 -050041udebdir=${debdir}/e2fsprogs-udeb
Theodore Ts'o417781a2003-04-10 00:18:56 -040042blkidudebdir=${debdir}/libblkid1-udeb
Theodore Ts'oe254d052003-12-07 01:57:04 -050043uuidudebdir=${debdir}/libuuid1-udeb
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -040044libcomerrdir=${debdir}/libcomerr${COMERR_SOVERSION}
45comerrdevdir=${debdir}/comerr-dev
46libcomerrdbgdir=${debdir}/libcomerr2-dbg
47libssdir=${debdir}/libss${SS_SOVERSION}
48ssdevdir=${debdir}/ss-dev
49libssdbgdir=${debdir}/libss2-dbg
50libblkiddir=${debdir}/libblkid${BLKID_SOVERSION}
51libblkiddevdir=${debdir}/libblkid-dev
52libblkiddbgdir=${debdir}/libblkid1-dbg
53libuuiddir=${debdir}/libuuid${UUID_SOVERSION}
54uuiddevdir=${debdir}/uuid-dev
55libuuiddbgdir=${debdir}/libuuid1-dbg
56uuidruntimedir=${debdir}/uuid-runtime
57uuidruntimedbgdir=${debdir}/uuid-runtime-dbg
58libext2dir=${debdir}/e2fslibs
59libext2devdir=${debdir}/e2fslibs-dev
60libext2dbgdir=${debdir}/e2fslibs-dbg
Theodore Ts'ob90b8262001-06-15 22:54:34 +000061maindir=${debdir}/e2fsprogs
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -040062e2fsckstaticdir=${debdir}/e2fsck-static
63debugdir=${debdir}/e2fsprogs-dbg
Theodore Ts'o79786212001-06-22 23:05:23 -040064stdbuilddir=${debdir}/BUILD-STD
65bfbuilddir=${debdir}/BUILD-BF
Theodore Ts'oa827a2a2007-12-31 17:17:39 -050066staticbuilddir=${debdir}/BUILD-STATIC
Theodore Ts'oe5b16432002-08-17 21:11:29 -040067mipsbuilddir=${debdir}/BUILD-MIPS
Theodore Ts'ob1e22d52005-12-29 09:16:00 -050068mipsbuilddir64=${debdir}/BUILD-MIPS-64
Theodore Ts'ob90b8262001-06-15 22:54:34 +000069# docdir=${maindir}/usr/share/doc/${package}
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000070MANDIR=/usr/share/man
Theodore Ts'ob90b8262001-06-15 22:54:34 +000071mandir=${tmpdir}${MANDIR}
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000072
Theodore Ts'odd198d62002-10-31 03:44:35 -050073UDEB_NAME = $(package)-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb
74UDEB_PRIORITY = $(shell grep '^Package: e2fsprogs-udeb' debian/control -A 10 | grep ^Priority: | cut -d ' ' -f 2)
75
Theodore Ts'o417781a2003-04-10 00:18:56 -040076BLKID_UDEB_NAME = libblkid1-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb
77BLKID_UDEB_PRIORITY = $(shell grep '^Package: libblkid1-udeb' debian/control -A 10 | grep ^Priority: | cut -d ' ' -f 2)
78
Theodore Ts'oe254d052003-12-07 01:57:04 -050079UUID_UDEB_NAME = libuuid1-udeb_$(MAIN_VERSION)_$(DEB_HOST_ARCH).udeb
80UUID_UDEB_PRIORITY = $(shell grep '^Package: libuuid1-udeb' debian/control -A 10 | grep ^Priority: | cut -d ' ' -f 2)
81
Theodore Ts'o541d1732002-02-23 21:23:26 -050082STAMPSDIR=debian/stampdir
83CFGSTDSTAMP=${STAMPSDIR}/configure-std-stamp
84CFGBFSTAMP=${STAMPSDIR}/configure-bf-stamp
Theodore Ts'oa827a2a2007-12-31 17:17:39 -050085CFGSTATICSTAMP=${STAMPSDIR}/configure-static-stamp
Theodore Ts'o541d1732002-02-23 21:23:26 -050086BUILDSTDSTAMP=${STAMPSDIR}/build-std-stamp
87BUILDBFSTAMP=${STAMPSDIR}/build-bf-stamp
Theodore Ts'oa827a2a2007-12-31 17:17:39 -050088BUILDSTATICSTAMP=${STAMPSDIR}/build-static-stamp
Theodore Ts'o541d1732002-02-23 21:23:26 -050089
Theodore Ts'of77704e2006-11-11 22:32:35 -050090CCOPTS = -g
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000091
Theodore Ts'o1893e712001-05-21 02:48:41 +000092INSTALL = install
Theodore Ts'ob1e22d52005-12-29 09:16:00 -050093INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 0755
Theodore Ts'o1893e712001-05-21 02:48:41 +000094
Theodore Ts'o1d658a12003-08-21 01:53:07 -040095ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
96CCOPTS += -O2
Theodore Ts'o1893e712001-05-21 02:48:41 +000097endif
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -040098#ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
99#INSTALL_PROGRAM += -s
100#endif
Theodore Ts'o1893e712001-05-21 02:48:41 +0000101
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000102ifeq (${DEB_HOST_ARCH},alpha)
103CCOPTS += -DHAVE_NETINET_IN_H
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000104else
105CCOPTS += -D__NO_STRING_INLINES
106endif
107
Samuel Thibault3e416082007-08-14 11:25:45 +0200108ifeq (${DEB_HOST_ARCH_OS},linux)
109DEVMAPPER = --enable-blkid-devmapper
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500110BUILD_STATIC = build-static
111E2FSCK_STATIC = ${staticbuilddir}/e2fsck/e2fsck.static
112else
113E2FSCK_STATIC = ${stdbuilddir}/e2fsck/e2fsck.static
Samuel Thibault3e416082007-08-14 11:25:45 +0200114endif
115
Theodore Ts'o79786212001-06-22 23:05:23 -0400116BF_CCOPTS = -Os -fomit-frame-pointer
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000117
Theodore Ts'o79786212001-06-22 23:05:23 -0400118COMMON_CONF_FLAGS = \
Theodore Ts'o7e8fe322008-01-27 17:43:10 -0500119 --enable-elf-shlibs --infodir=/usr/share/info --enable-fsck
Theodore Ts'o79786212001-06-22 23:05:23 -0400120
Theodore Ts'od2d0d792006-03-08 17:42:40 -0500121STD_CONF_FLAGS = --with-ccopts="${CCOPTS}" --enable-compression \
Samuel Thibault3e416082007-08-14 11:25:45 +0200122 ${DEVMAPPER}
Theodore Ts'o79786212001-06-22 23:05:23 -0400123
124BF_CONF_FLAGS = --with-ccopts="${CCOPTS} ${BF_CCOPTS}" \
Theodore Ts'oa5dda052007-08-11 03:11:12 -0400125 --disable-nls --disable-imager \
Theodore Ts'o61a679d2007-12-31 11:20:01 -0500126 --disable-uuidd --disable-tls \
Theodore Ts'o8a8a12c2005-12-10 22:56:21 -0500127 --disable-debugfs --disable-e2initrd-helper
Theodore Ts'o79786212001-06-22 23:05:23 -0400128
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500129STATIC_CONF_FLAGS = --with-ccopts="${CCOPTS}" \
130 --disable-nls --disable-imager \
131 --disable-uuidd --disable-tls \
132 --disable-e2initrd-helper \
Theodore Ts'o4f2e8f12008-01-27 17:20:44 -0500133 --with-ccopts=-fno-stack-protector
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500134
Theodore Ts'o2a4c77b2002-09-24 01:30:00 -0400135MIPS_NOPIC_CONF_FLAGS = --with-ccopts="${CCOPTS}" \
Theodore Ts'ofef2b382008-01-01 12:41:35 -0500136 --disable-nls --disable-imager \
Theodore Ts'o61a679d2007-12-31 11:20:01 -0500137 --disable-uuidd --disable-tls \
Theodore Ts'odd198d62002-10-31 03:44:35 -0500138 --disable-resizer # --disable-debugfs
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500139
Theodore Ts'o2a4c77b2002-09-24 01:30:00 -0400140# we can't use those flags at configure time
141MIPS_CFLAGS= -G 0 -fno-pic -mno-abicalls
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500142MIPS_CFLAGS_64= -mabi=64 -G 0 -fno-pic -mno-abicalls
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400143
144ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
145ifneq (,$(findstring $(DEB_BUILD_ARCH),mips mipsel))
146ismips=ismips
147endif
148endif
149
Theodore Ts'o541d1732002-02-23 21:23:26 -0500150${CFGSTDSTAMP}:
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000151 dh_testdir
Theodore Ts'o541d1732002-02-23 21:23:26 -0500152
Theodore Ts'o41b6ae62004-09-24 10:07:05 -0400153 # Make sure we don't try to rebuild the configure scripts
154 find . -name configure | xargs touch
155
Theodore Ts'o79786212001-06-22 23:05:23 -0400156 mkdir -p ${stdbuilddir}
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000157ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
Theodore Ts'obe5a72d2005-03-17 01:16:34 -0500158 cd ${stdbuilddir} && AWK=/usr/bin/awk \
Theodore Ts'o79786212001-06-22 23:05:23 -0400159 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS}
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000160else
Theodore Ts'obe5a72d2005-03-17 01:16:34 -0500161 cd ${stdbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
Theodore Ts'o79786212001-06-22 23:05:23 -0400162 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STD_CONF_FLAGS} \
Theodore Ts'oa6ea47a2007-12-15 20:34:41 -0500163 --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000164endif
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400165
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500166 # specially-built MIPS libs
167ifneq ($(ismips),)
168 mkdir -p ${mipsbuilddir} ${mipsbuilddir64}
169 cd ${mipsbuilddir} && AWK=/usr/bin/awk \
170 ${topdir}/configure ${MIPS_NOPIC_CONF_FLAGS}
171 cd ${mipsbuilddir64} && AWK=/usr/bin/awk \
172 ${topdir}/configure ${MIPS_NOPIC_CONF_FLAGS}
173endif
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400174
Theodore Ts'o541d1732002-02-23 21:23:26 -0500175 mkdir -p ${STAMPSDIR}
176 touch ${CFGSTDSTAMP}
Theodore Ts'o79786212001-06-22 23:05:23 -0400177
Theodore Ts'o541d1732002-02-23 21:23:26 -0500178${CFGBFSTAMP}:
Theodore Ts'o79786212001-06-22 23:05:23 -0400179 dh_testdir
Theodore Ts'o541d1732002-02-23 21:23:26 -0500180 rm -f config.cache
181
Theodore Ts'o79786212001-06-22 23:05:23 -0400182 mkdir -p ${bfbuilddir}
183ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
Theodore Ts'obe5a72d2005-03-17 01:16:34 -0500184 cd ${bfbuilddir} && AWK=/usr/bin/awk \
Theodore Ts'o79786212001-06-22 23:05:23 -0400185 ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS}
186else
Theodore Ts'obe5a72d2005-03-17 01:16:34 -0500187 cd ${bfbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
Theodore Ts'o79786212001-06-22 23:05:23 -0400188 ${topdir}/configure ${COMMON_CONF_FLAGS} ${BF_CONF_FLAGS} \
Theodore Ts'oa6ea47a2007-12-15 20:34:41 -0500189 --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
Theodore Ts'o79786212001-06-22 23:05:23 -0400190endif
Theodore Ts'o541d1732002-02-23 21:23:26 -0500191 mkdir -p ${STAMPSDIR}
192 touch ${CFGBFSTAMP}
Theodore Ts'o79786212001-06-22 23:05:23 -0400193
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500194${CFGSTATICSTAMP}:
195 dh_testdir
196 rm -f config.cache
197
198 mkdir -p ${staticbuilddir}
199ifeq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
Theodore Ts'o4f2e8f12008-01-27 17:20:44 -0500200 if type diet > /dev/null 2>&1 ; then \
201 STATIC_CONF_FLAGS="$STATIC_CONF_FLAGS --with-diet-libc"; \
202 fi
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500203 cd ${staticbuilddir} && AWK=/usr/bin/awk \
204 ${topdir}/configure ${STATIC_CONF_FLAGS}
205else
206 cd ${staticbuilddir} && AWK=/usr/bin/awk CC="${DEB_HOST_GNU_TYPE}-gcc" \
207 ${topdir}/configure ${COMMON_CONF_FLAGS} ${STATIC_CONF_FLAGS} \
208 --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
209endif
210 mkdir -p ${STAMPSDIR}
211 touch ${CFGSTATICSTAMP}
212
213build: build-std build-bf $(BUILD_STATIC)
Theodore Ts'o79786212001-06-22 23:05:23 -0400214
Theodore Ts'o541d1732002-02-23 21:23:26 -0500215build-std: ${BUILDSTDSTAMP}
216${BUILDSTDSTAMP}: ${CFGSTDSTAMP}
Theodore Ts'o79786212001-06-22 23:05:23 -0400217 dh_testdir
Theodore Ts'o26d68912008-01-01 16:23:38 -0500218 $(MAKE) -C ${stdbuilddir} all
Theodore Ts'o7e8fe322008-01-27 17:43:10 -0500219 $(MAKE) -C ${stdbuilddir}/e2fsck e2fsck.static
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400220
Theodore Ts'o79786212001-06-22 23:05:23 -0400221 ( cd ${stdbuilddir}/doc && \
222 texi2html -split_chapter ${topdir}/doc/libext2fs.texinfo )
Theodore Ts'o26d68912008-01-01 16:23:38 -0500223 ( cd ${stdbuilddir}/lib/et && $(MAKE) com_err.info && \
Theodore Ts'o79786212001-06-22 23:05:23 -0400224 texi2html -split_chapter -expandinfo ${topdir}/lib/et/com_err.texinfo )
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400225
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500226 # specially-built MIPS libs
227ifneq ($(ismips),)
Theodore Ts'o26d68912008-01-01 16:23:38 -0500228 $(MAKE) -C ${mipsbuilddir}/util
229 $(MAKE) -C ${mipsbuilddir} \
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500230 CFLAGS="${CCOPTS} ${MIPS_CFLAGS}" \
231 LIB_SUBDIRS="lib/et lib/ext2fs" libs
Theodore Ts'o26d68912008-01-01 16:23:38 -0500232 $(MAKE) -C ${mipsbuilddir64}/util
233 $(MAKE) -C ${mipsbuilddir64} \
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500234 CFLAGS="${CCOPTS} ${MIPS_CFLAGS_64}" \
235 LIB_SUBDIRS="lib/et lib/ext2fs" libs
236endif
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400237
Theodore Ts'o541d1732002-02-23 21:23:26 -0500238 touch ${BUILDSTDSTAMP}
Theodore Ts'o79786212001-06-22 23:05:23 -0400239
Theodore Ts'o541d1732002-02-23 21:23:26 -0500240build-bf: ${BUILDBFSTAMP}
241${BUILDBFSTAMP}: ${CFGBFSTAMP}
Theodore Ts'o79786212001-06-22 23:05:23 -0400242 dh_testdir
Theodore Ts'o26d68912008-01-01 16:23:38 -0500243 $(MAKE) -C ${bfbuilddir} libs
244 $(MAKE) -C ${bfbuilddir}/e2fsck all
245 $(MAKE) -C ${bfbuilddir}/misc all
Theodore Ts'o541d1732002-02-23 21:23:26 -0500246 touch ${BUILDBFSTAMP}
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000247
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500248build-static: ${BUILDSTATICSTAMP}
249${BUILDSTATICSTAMP}: ${CFGSTATICSTAMP}
250 dh_testdir
Theodore Ts'o26d68912008-01-01 16:23:38 -0500251 $(MAKE) -C ${staticbuilddir} libs
Theodore Ts'o7e8fe322008-01-27 17:43:10 -0500252 $(MAKE) -C ${staticbuilddir}/e2fsck all e2fsck.static
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500253 touch ${BUILDSTATICSTAMP}
254
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000255clean:
256 dh_testdir
Theodore Ts'o541d1732002-02-23 21:23:26 -0500257 rm -rf ${STAMPSDIR}
Theodore Ts'o26d68912008-01-01 16:23:38 -0500258 [ ! -f ${stdbuilddir}/Makefile ] || $(MAKE) -C ${stdbuilddir} distclean
259 [ ! -f ${bfbuilddir}/Makefile ] || $(MAKE) -C ${bfbuilddir} distclean
260 [ ! -f ${staticbuilddir}/Makefile ] || $(MAKE) -C ${staticbuilddir} distclean
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500261 rm -rf ${stdbuilddir} ${bfbuilddir} ${staticbuilddir} ${mipsbuilddir} ${mipsbuilddir64}
Theodore Ts'o8c5829f2005-07-21 19:32:36 -0500262 rm -f doc/libext2fs/*.html lib/et/com_err/*.html debian/*.substvars
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000263 dh_clean
264
Theodore Ts'o62775dc2003-05-08 10:39:50 -0400265install: cleanup install-std
Theodore Ts'o79786212001-06-22 23:05:23 -0400266
267# This rule allows to factorize the dh_clean between the 2 install rules
268# This must be launched before install-* (if launching them by hand, for
269# exemple) or results are unpredictable
270cleanup:
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000271 dh_testdir
272 dh_testroot
273 dh_clean -k
Theodore Ts'o79786212001-06-22 23:05:23 -0400274
275install-std: DH_OPTIONS=
276install-std: build
277 dh_testdir
278 dh_testroot
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000279 dh_installdirs
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000280
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000281 mkdir -p ${tmpdir}/sbin
Theodore Ts'o26d68912008-01-01 16:23:38 -0500282 $(MAKE) -C ${stdbuilddir} install DESTDIR=${tmpdir} \
Theodore Ts'o79786212001-06-22 23:05:23 -0400283 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
284 # static libs and .h files
Theodore Ts'o26d68912008-01-01 16:23:38 -0500285 $(MAKE) -C ${stdbuilddir} install-libs DESTDIR=${tmpdir} LDCONFIG=true
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000286
Theodore Ts'o1893e712001-05-21 02:48:41 +0000287 # statically-linked fsck
Theodore Ts'oa827a2a2007-12-31 17:17:39 -0500288 ${INSTALL_PROGRAM} $(E2FSCK_STATIC) ${tmpdir}/sbin
Theodore Ts'oec3bb412006-10-04 09:12:35 -0400289 cp ${mandir}/man8/e2fsck.8 ${mandir}/man8/e2fsck.static.8
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000290
Theodore Ts'o020c5472003-04-10 00:01:19 -0400291 ln -s et/com_err.h ${tmpdir}/usr/include
292
Theodore Ts'o2a4c77b2002-09-24 01:30:00 -0400293 dh_movefiles
294 test -z `find ${tmpdir} -type f`
295
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500296 # specially-built MIPS libs
297ifneq ($(ismips),)
298 $(INSTALL) -p -m 0644 ${mipsbuilddir}/lib/libext2fs.a \
299 ${debdir}/e2fslibs-dev/usr/lib/libext2fs-nopic.a
300 $(INSTALL) -p -m 0644 ${mipsbuilddir64}/lib/libext2fs.a \
301 ${debdir}/e2fslibs-dev/usr/lib/lib64ext2fs-nopic.a
302endif
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400303
Theodore Ts'o62775dc2003-05-08 10:39:50 -0400304install-udeb: DH_OPTIONS=
305install-udeb: build
Theodore Ts'o79786212001-06-22 23:05:23 -0400306 dh_testdir
307 dh_testroot
Theodore Ts'o79786212001-06-22 23:05:23 -0400308
Theodore Ts'o26d68912008-01-01 16:23:38 -0500309 $(MAKE) -C ${bfbuilddir} install-shlibs-libs-recursive DESTDIR=${udebdir} \
Theodore Ts'o79786212001-06-22 23:05:23 -0400310 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
Theodore Ts'o26d68912008-01-01 16:23:38 -0500311 $(MAKE) -C ${bfbuilddir}/e2fsck install DESTDIR=${udebdir} \
Theodore Ts'o62775dc2003-05-08 10:39:50 -0400312 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
Theodore Ts'o26d68912008-01-01 16:23:38 -0500313 $(MAKE) -C ${bfbuilddir}/misc install DESTDIR=${udebdir} \
Theodore Ts'o62775dc2003-05-08 10:39:50 -0400314 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
Theodore Ts'o26d68912008-01-01 16:23:38 -0500315 $(MAKE) -C ${bfbuilddir}/resize install DESTDIR=${udebdir} \
Theodore Ts'o8a8a12c2005-12-10 22:56:21 -0500316 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
Theodore Ts'o79786212001-06-22 23:05:23 -0400317
Theodore Ts'o62775dc2003-05-08 10:39:50 -0400318 rm -rf ${udebdir}/usr
Theodore Ts'oe3075ae2003-07-12 16:28:09 -0400319 find ${udebdir}/sbin -type f -a ! -name e2fsck \
Theodore Ts'o8a8a12c2005-12-10 22:56:21 -0500320 -a ! -name mke2fs -a ! -name tune2fs \
321 -a ! -name resize2fs -a ! -name badblocks -print | xargs rm
Theodore Ts'oe3075ae2003-07-12 16:28:09 -0400322
323 (cd ${udebdir}/sbin; ln -s e2fsck fsck.ext2 ; \
324 ln -s e2fsck fsck.ext3 ; ln -s mke2fs mkfs.ext2 ; \
325 ln -s mke2fs mkfs.ext3)
Theodore Ts'o2a4c77b2002-09-24 01:30:00 -0400326
Theodore Ts'o417781a2003-04-10 00:18:56 -0400327 mkdir -p ${blkidudebdir}/lib
328 mv ${udebdir}/lib/libblkid.* ${blkidudebdir}/lib
Theodore Ts'o79786212001-06-22 23:05:23 -0400329
Theodore Ts'oe254d052003-12-07 01:57:04 -0500330 mkdir -p ${uuidudebdir}/lib
331 mv ${udebdir}/lib/libuuid.* ${uuidudebdir}/lib
332
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000333binary-indep:
334 # no arch-independant debs.
335
336binary-arch: DH_OPTIONS= -a
Theodore Ts'odd198d62002-10-31 03:44:35 -0500337binary-arch: install install-udeb
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000338 dh_testdir
339 dh_testroot
340
Theodore Ts'o541d1732002-02-23 21:23:26 -0500341 # lintian overrides
342 for i in $$(cd debian && echo *.lintian-overrides); do \
343 pkg=$${i%.lintian-overrides} ;\
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500344 $(INSTALL) -m 0644 -D -p debian/$$i ${debdir}/$${pkg}/usr/share/lintian/overrides/$${pkg} ;\
Theodore Ts'o541d1732002-02-23 21:23:26 -0500345 done
Theodore Ts'o79786212001-06-22 23:05:23 -0400346
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400347 # mkinitrd script
Theodore Ts'o1d658a12003-08-21 01:53:07 -0400348 mkdir -p debian/e2fsprogs/usr/share/initrd-tools/scripts
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500349 $(INSTALL) -p -o root -g root -m 0755 debian/initrd-tools.e2fsprogs \
Theodore Ts'oe2de6b92004-04-11 16:25:56 -0400350 debian/e2fsprogs/usr/share/initrd-tools/scripts/e2fsprogs
351
352 # initrd script
353 mkdir -p debian/e2fsprogs/usr/share/e2fsprogs
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500354 $(INSTALL) -p -o root -g root -m 0755 debian/initrd.ext3-add-journal \
Theodore Ts'oe2de6b92004-04-11 16:25:56 -0400355 debian/e2fsprogs/usr/share/e2fsprogs/initrd.ext3-add-journal
356
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400357
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000358 # symlinks to prepare dh_installdocs run
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000359
Theodore Ts'o6fe7d112003-03-16 19:58:25 -0500360 mkdir -p ${debdir}/libblkid${BLKID_SOVERSION}/usr/share/doc/libblkid${BLKID_SOVERSION}
361 mkdir -p ${debdir}/libblkid-dev/usr/share/doc
362 ln -sf libblkid${BLKID_SOVERSION} ${debdir}/libblkid-dev/usr/share/doc/libblkid-dev
363
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400364 mkdir -p ${debdir}/libss${SS_SOVERSION}/usr/share/doc/libss${SS_SOVERSION}
365 mkdir -p ${debdir}/ss-dev/usr/share/doc
366 ln -sf libss${SS_SOVERSION} ${debdir}/ss-dev/usr/share/doc/ss-dev
367
368 mkdir -p ${debdir}/libcomerr${COMERR_SOVERSION}/usr/share/doc/libcomerr${COMERR_SOVERSION}
369 mkdir -p ${debdir}/comerr-dev/usr/share/doc
370 ln -sf libcomerr${COMERR_SOVERSION} ${debdir}/comerr-dev/usr/share/doc/comerr-dev
371
372 mkdir -p ${debdir}/libuuid${UUID_SOVERSION}/usr/share/doc/libuuid${UUID_SOVERSION}
373 mkdir -p ${debdir}/uuid-dev/usr/share/doc
Theodore Ts'oec3bb412006-10-04 09:12:35 -0400374# ln -sf libuuid${UUID_SOVERSION} ${debdir}/uuid-dev/usr/share/doc/uuid-dev
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400375
376 mkdir -p ${debdir}/e2fslibs/usr/share/doc/e2fslibs
377 mkdir -p ${debdir}/e2fslibs-dev/usr/share/doc
378 ln -sf e2fslibs ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs-dev
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000379
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500380 $(INSTALL) -p -m 0644 debian/libblkid.copyright \
Theodore Ts'o6fe7d112003-03-16 19:58:25 -0500381 ${debdir}/libblkid${BLKID_SOVERSION}/usr/share/doc/libblkid${BLKID_SOVERSION}/copyright
382
Theodore Ts'oe254d052003-12-07 01:57:04 -0500383 dh_installdocs -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000384
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000385 # HTML docs
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500386 $(INSTALL) -d ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/html-info/
387 $(INSTALL) -p -m 0644 ${stdbuilddir}/doc/libext2fs/*.html \
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400388 ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/html-info/
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500389 $(INSTALL) -d ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/html-info/
390 $(INSTALL) -p -m 0644 ${stdbuilddir}/lib/et/com_err/*.html \
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400391 ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/html-info/
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000392
393 # texinfo docs
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400394 mkdir -p ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500395 $(INSTALL) -p -m 0644 ${topdir}/doc/libext2fs.texinfo \
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400396 ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/libext2fs.texi
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500397 $(INSTALL) -p -m 0644 ${topdir}/lib/et/com_err.texinfo \
Theodore Ts'oe5b16432002-08-17 21:11:29 -0400398 ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/com_err.texi
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000399
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500400 $(INSTALL) -d ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/examples
401 $(INSTALL) -p -m 0644 lib/ss/ss_err.et \
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400402 ${stdbuilddir}/lib/ext2fs/ext2_err.et \
403 ${debdir}/comerr-dev/usr/share/doc/libcomerr${COMERR_SOVERSION}/examples
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500404 $(INSTALL) -d ${debdir}/ss-dev/usr/share/doc/libss${SS_SOVERSION}/examples
405 $(INSTALL) -p -m 0644 debugfs/debug_cmds.ct \
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400406 ${debdir}/ss-dev/usr/share/doc/libss${SS_SOVERSION}/examples
407
Theodore Ts'o60702c22007-09-22 20:42:04 -0400408 if test -f /etc/lsb-release && \
409 grep -q DISTRIB_ID=Ubuntu /etc/lsb-release; then \
410 $(INSTALL) -p -m 0644 e2fsck/e2fsck.conf.ubuntu \
411 ${debdir}/e2fsprogs/etc/e2fsck.conf; \
412 fi
413
Theodore Ts'o541d1732002-02-23 21:23:26 -0500414 dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info
Theodore Ts'o79786212001-06-22 23:05:23 -0400415 dh_installinfo -pe2fslibs-dev ${stdbuilddir}/doc/libext2fs.info
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000416
Theodore Ts'oec3bb412006-10-04 09:12:35 -0400417 DH_OPTIONS= dh_installchangelogs -pe2fsprogs \
418 -plibblkid${BLKID_SOVERSION} -plibcomerr${COMERR_SOVERSION} \
419 -plibss${SS_SOVERSION} -plibuuid${UUID_SOVERSION} \
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400420 -pe2fslibs -puuid-dev -puuid-runtime -pe2fsck-static \
421 -pe2fsprogs-dbg -puuid-runtime-dbg -pe2fslibs-dbg \
422 -plibcomerr2-dbg -plibss2-dbg -plibblkid1-dbg -plibuuid1-dbg
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000423
Theodore Ts'oa3f464f2007-07-04 14:51:18 -0400424 dh_fixperms
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500425ifneq ($(ismips),)
Theodore Ts'o30f142e2008-07-15 11:38:33 -0400426 dh_strip -k -Xlib64ext2fs-nopic.a
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500427else
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400428 dh_strip -k
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500429endif
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000430
Theodore Ts'ofbcb3a82008-07-07 09:43:26 -0400431 # debug package stuff
432 rm -rf ${udebdir}/usr
433 rm -rf ${blkidudebdir}/usr
434 rm -rf ${uuidudebdir}/usr
435
436 mkdir -p ${debugdir}/usr/lib
437 mv ${maindir}/usr/lib/debug ${debugdir}/usr/lib
438 rm -rf ${maindir}/usr/lib/debug
439 mv ${e2fsckstaticdir}/usr/lib/debug/sbin/* \
440 ${debugdir}/usr/lib/debug
441 rm -rf ${e2fsckstaticdir}/usr/lib
442
443 mkdir -p ${uuidruntimedbgdir}/usr/lib
444 mv ${uuidruntimedir}/usr/lib/debug ${uuidruntimedbgdir}/usr/lib
445 rmdir ${uuidruntimedir}/usr/lib
446
447 mkdir -p ${libext2dbgdir}/usr/lib
448 mv ${libext2dir}/usr/lib/debug ${libext2dbgdir}/usr/lib
449 rmdir ${libext2dir}/usr/lib
450
451 mkdir -p ${libcomerrdbgdir}/usr/lib
452 mv ${libcomerrdir}/usr/lib/debug ${libcomerrdbgdir}/usr/lib
453 rmdir ${libcomerrdir}/usr/lib
454
455 mkdir -p ${libssdbgdir}/usr/lib
456 mv ${libssdir}/usr/lib/debug ${libssdbgdir}/usr/lib
457 rmdir ${libssdir}/usr/lib
458
459 mkdir -p ${libuuiddbgdir}/usr/lib
460 mv ${libuuiddir}/usr/lib/debug ${libuuiddbgdir}/usr/lib
461 rmdir ${libuuiddir}/usr/lib
462
463 mkdir -p ${libblkiddbgdir}/usr/lib
464 mv ${libblkiddir}/usr/lib/debug ${libblkiddbgdir}/usr/lib
465 rmdir ${libblkiddir}/usr/lib
466
467 $(INSTALL) -p -m 0644 debian/e2fsprogs.copyright \
468 ${debugdir}/usr/share/doc/e2fsprogs-dbg/copyright
469
470 $(INSTALL) -p -m 0644 debian/uuid-runtime.copyright \
471 ${uuidruntimedbgdir}/usr/share/doc/uuid-runtime-dbg/copyright
472
473 $(INSTALL) -p -m 0644 debian/e2fslibs.copyright \
474 ${libext2dbgdir}/usr/share/doc/e2fslibs-dbg/copyright
475
476 $(INSTALL) -p -m 0644 debian/libcomerr2.copyright \
477 ${libcomerrdbgdir}/usr/share/doc/libcomerr2-dbg/copyright
478
479 $(INSTALL) -p -m 0644 debian/libss2.copyright \
480 ${libssdbgdir}/usr/share/doc/libss2-dbg/copyright
481
482 $(INSTALL) -p -m 0644 debian/libblkid.copyright \
483 ${libblkiddbgdir}/usr/share/doc/libblkid1-dbg/copyright
484
485 $(INSTALL) -p -m 0644 debian/libuuid1.copyright \
486 ${libuuiddbgdir}/usr/share/doc/libuuid1-dbg/copyright
487
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000488 dh_compress
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000489
Theodore Ts'oe254d052003-12-07 01:57:04 -0500490 dh_makeshlibs -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400491 dh_makeshlibs -plibcomerr${COMERR_SOVERSION} \
492 -V 'libcomerr2 (>= 1.33-3)'
Theodore Ts'oa1788522007-03-04 08:17:18 -0500493 dh_makeshlibs -plibblkid${BLKID_SOVERSION} -V 'libblkid1 (>= 1.39-1)'
Theodore Ts'o7512f132006-03-29 19:03:38 -0500494 echo "udeb: libblkid 1 libblkid1-udeb" >> \
495 debian/libblkid1/DEBIAN/shlibs
496 echo "udeb: libuuid 1 libuuid1-udeb" >> debian/libuuid1/DEBIAN/shlibs
Theodore Ts'o6fe7d112003-03-16 19:58:25 -0500497
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000498 dh_installdeb
Theodore Ts'oa0010282006-03-30 01:03:17 -0500499 rm debian/e2fsprogs-udeb/DEBIAN/conffiles
Theodore Ts'o79786212001-06-22 23:05:23 -0400500 dh_shlibdeps -l${stdbuilddir}/lib
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400501 dh_shlibdeps -pe2fsprogs -l${stdbuilddir}/lib \
502 -u"-Ldebian/e2fsprogs.shlibs.local"
Theodore Ts'o7a15db22003-07-29 22:15:33 -0400503 dh_shlibdeps -pe2fsprogs-udeb -l${stdbuilddir}/lib \
504 -u"-Ldebian/e2fsprogs-udeb.shlibs.local"
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000505
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400506 dh_gencontrol -Ncomerr-dev -Nss-dev -Nuuid-dev \
Theodore Ts'oe254d052003-12-07 01:57:04 -0500507 -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000508 DH_OPTIONS= dh_gencontrol -pcomerr-dev \
Theodore Ts'od8a1a672008-01-30 07:20:54 -0500509 -u '-v${COMERR_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}'
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000510 DH_OPTIONS= dh_gencontrol -pss-dev \
Theodore Ts'od8a1a672008-01-30 07:20:54 -0500511 -u '-v${SS_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}'
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000512 DH_OPTIONS= dh_gencontrol -puuid-dev \
Theodore Ts'od8a1a672008-01-30 07:20:54 -0500513 -u '-v${UUID_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}'
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000514
Theodore Ts'oe254d052003-12-07 01:57:04 -0500515 dh_md5sums -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
516 dh_builddeb -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb
Theodore Ts'odd198d62002-10-31 03:44:35 -0500517
518 # udeb stuff
519 dh_gencontrol -pe2fsprogs-udeb -- -fdebian/files~
520 dpkg-distaddfile $(UDEB_NAME) debian-installer $(UDEB_PRIORITY)
521 dh_builddeb -pe2fsprogs-udeb --filename=$(UDEB_NAME)
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000522
Theodore Ts'o417781a2003-04-10 00:18:56 -0400523 dh_gencontrol -plibblkid1-udeb -- -fdebian/files~
524 dpkg-distaddfile $(BLKID_UDEB_NAME) debian-installer $(BLKID_UDEB_PRIORITY)
525 dh_builddeb -plibblkid1-udeb --filename=$(BLKID_UDEB_NAME)
526
Theodore Ts'oe254d052003-12-07 01:57:04 -0500527 dh_gencontrol -plibuuid1-udeb -- -fdebian/files~
528 dpkg-distaddfile $(UUID_UDEB_NAME) debian-installer $(UUID_UDEB_PRIORITY)
529 dh_builddeb -plibuuid1-udeb --filename=$(UUID_UDEB_NAME)
530
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000531binary: binary-indep binary-arch
532
533.PHONY: binary binary-arch binary-indep clean checkroot