blob: e36bcaaafc89edf2bc57052700b4daf5088c31e1 [file] [log] [blame]
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +00001#! /usr/bin/make -f
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +00002
Theodore Ts'o336ac182019-07-11 00:06:07 -04003# export DH_VERBOSE=1
Theodore Ts'o965e82c2018-01-03 01:28:55 -05004
Theodore Ts'o697e21f2016-05-22 03:19:30 -04005export DEB_BUILD_MAINT_OPTIONS ?= hardening=+all
6
Theodore Ts'o336ac182019-07-11 00:06:07 -04007DPKG_EXPORT_BUILDFLAGS = 1
8include /usr/share/dpkg/default.mk
9
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000010# be paranoid
Theodore Ts'od973c182012-03-26 17:37:10 -070011export LC_ALL ?= C
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000012
Theodore Ts'o716ff032017-09-03 23:53:57 -040013ifeq ($(DEB_HOST_ARCH_OS), hurd)
Theodore Ts'od3c05952016-05-31 01:48:18 -040014SKIP_FUSE2FS=yes
15endif
16
Simon McVittie8c72de12018-01-01 23:23:36 +000017ifneq ($(filter pkg.e2fsprogs.no-fuse2fs,$(DEB_BUILD_PROFILES)),)
18SKIP_FUSE2FS=yes
19endif
20
Theodore Ts'od973c182012-03-26 17:37:10 -070021COMERR_VERSION ?= $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3)
Theodore Ts'od973c182012-03-26 17:37:10 -070022SS_VERSION ?= $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000023
Theodore Ts'od973c182012-03-26 17:37:10 -070024topdir ?= $(shell pwd)
Theodore Ts'o336ac182019-07-11 00:06:07 -040025tmpdir ?= ${topdir}/debian/tmp
26udebdir ?= ${topdir}/debian/e2fsprogs-udeb
27stdbuilddir ?= ${topdir}/debian/BUILD-STD
Theodore Ts'o541d1732002-02-23 21:23:26 -050028
Theodore Ts'od973c182012-03-26 17:37:10 -070029INSTALL ?= install
30INSTALL_PROGRAM ?= $(INSTALL) -p -o root -g root -m 0755
Theodore Ts'o1893e712001-05-21 02:48:41 +000031
Theodore Ts'o618dcd22014-05-18 22:29:01 -040032ifneq (,$(findstring update-symbols,$(DEB_BUILD_OPTIONS)))
Theodore Ts'o146649c2018-02-08 23:39:22 -050033SYMBOL_LIBS := libext2fs libcomerr2 libss2
Theodore Ts'o618dcd22014-05-18 22:29:01 -040034endif
35
Theodore Ts'o04f34e72016-05-31 01:27:24 -040036CFLAGS_SHLIB = $(CFLAGS)
37CFLAGS_STLIB = $(CFLAGS)
38LDFLAGS_SHLIB = $(LDFLAGS)
Theodore Ts'o697e21f2016-05-22 03:19:30 -040039LDFLAGS_STATIC = $(filter-out -fPIE -fpie -pie,$(LDFLAGS))
40
Theodore Ts'o336ac182019-07-11 00:06:07 -040041BACKTRACE_CONF_FLAGS ?= $(shell if debian/scripts/test-backtrace ; then echo --disable-backtrace ; fi)
Theodore Ts'o79786212001-06-22 23:05:23 -040042
Theodore Ts'ocfb073a2019-07-29 11:40:25 -040043COMMON_CONF_FLAGS = --enable-elf-shlibs --disable-ubsan \
Theodore Ts'o336ac182019-07-11 00:06:07 -040044 --disable-addrsan --disable-threadsan --disable-e2initrd-helper \
45 --disable-fsck --disable-libblkid --disable-libuuid --disable-uuidd \
Theodore Ts'oefeda9d2013-12-30 17:35:58 -050046 --infodir=/usr/share/info --enable-symlink-install \
Theodore Ts'oe84a4a62017-08-22 12:15:26 -040047 --with-multiarch=$(DEB_HOST_MULTIARCH) \
Theodore Ts'o336ac182019-07-11 00:06:07 -040048 $(BACKTRACE_CONF_FLAGS) ${EXTRA_CONF_FLAGS}
Theodore Ts'o79786212001-06-22 23:05:23 -040049
Theodore Ts'o336ac182019-07-11 00:06:07 -040050ifneq ($(SKIP_FUSE2FS),)
51COMMON_CONF_FLAGS += --disable-fuse2fs
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000052endif
Theodore Ts'oe5b16432002-08-17 21:11:29 -040053
Theodore Ts'o336ac182019-07-11 00:06:07 -040054ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
55CC ?= $(DEB_HOST_GNU_TYPE)-gcc
56COMMON_CONF_FLAGS += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
57endif
Theodore Ts'o79786212001-06-22 23:05:23 -040058
Theodore Ts'o336ac182019-07-11 00:06:07 -040059%:
60 dh $@ -B${stdbuilddir}
Theodore Ts'o79786212001-06-22 23:05:23 -040061
Theodore Ts'o336ac182019-07-11 00:06:07 -040062override_dh_autoreconf:
63
64override_dh_auto_configure:
65 mkdir -p ${stdbuilddir}
66 cd ${stdbuilddir} && AWK=/usr/bin/awk \
67 ../../configure ${COMMON_CONF_FLAGS}
68
69override_dh_auto_build:
Theodore Ts'of921eda2012-02-20 18:17:37 -050070 $(MAKE) -C ${stdbuilddir} V=1 all
Theodore Ts'ob637c572021-02-09 15:56:12 -050071ifeq (,$(filter pkg.e2fsprogs.no-static,$(DEB_BUILD_PROFILES)))
Theodore Ts'ocd056792016-09-01 23:48:03 -040072 $(MAKE) -C ${stdbuilddir}/e2fsck V=1 e2fsck.static
Theodore Ts'ob637c572021-02-09 15:56:12 -050073endif
Theodore Ts'o2c0e8c72016-05-20 23:43:29 -040074 if ! test -d debian/orig-gmo ; then \
75 mkdir debian/orig-gmo ; \
76 mv po/*.gmo po/*.po debian/orig-gmo ; \
77 cp debian/orig-gmo/*.po po ; \
78 fi
Theodore Ts'of921eda2012-02-20 18:17:37 -050079 $(MAKE) -C ${stdbuilddir}/po V=1 update-gmo
Theodore Ts'oe5b16432002-08-17 21:11:29 -040080
Theodore Ts'o922a40c2019-07-09 19:04:20 -040081 $(MAKE) -C ${stdbuilddir}/doc V=1 libext2fs.html
82 $(MAKE) -C ${stdbuilddir}/lib/et V=1 com_err.info com_err.html
Theodore Ts'o40ab4052018-08-21 20:10:02 -040083 cat $(shell /bin/ls -1 ./doc/RelNotes/*.txt | tac) | \
84 gzip -9n > ${stdbuilddir}/NEWS.gz
Theodore Ts'oe5b16432002-08-17 21:11:29 -040085
Theodore Ts'o336ac182019-07-11 00:06:07 -040086override_dh_auto_clean:
Theodore Ts'o2c0e8c72016-05-20 23:43:29 -040087 if test -d debian/orig-gmo ; then \
88 rm -f po/*.gmo po/*.po ; \
89 mv debian/orig-gmo/* po ; \
90 rmdir debian/orig-gmo ; \
91 fi
Theodore Ts'o336ac182019-07-11 00:06:07 -040092 rm -rf ${stdbuilddir}
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +000093
Theodore Ts'o336ac182019-07-11 00:06:07 -040094override_dh_auto_install:
Theodore Ts'ob90b8262001-06-15 22:54:34 +000095 mkdir -p ${tmpdir}/sbin
Theodore Ts'oc1986ec2012-06-13 15:29:13 -040096 $(MAKE) -C ${stdbuilddir} V=1 install DESTDIR=${tmpdir} \
Theodore Ts'o79786212001-06-22 23:05:23 -040097 INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
98 # static libs and .h files
Theodore Ts'oc1986ec2012-06-13 15:29:13 -040099 $(MAKE) -C ${stdbuilddir} V=1 install-libs DESTDIR=${tmpdir} LDCONFIG=true
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000100
Theodore Ts'ob637c572021-02-09 15:56:12 -0500101ifeq (,$(filter pkg.e2fsprogs.no-static,$(DEB_BUILD_PROFILES)))
Theodore Ts'o1893e712001-05-21 02:48:41 +0000102 # statically-linked fsck
Theodore Ts'o336ac182019-07-11 00:06:07 -0400103 ${INSTALL_PROGRAM} ${stdbuilddir}/e2fsck/e2fsck.static ${tmpdir}/sbin
104 (cd debian/tmp/usr/share/man/man8 ; cp e2fsck.8 e2fsck.static.8)
Theodore Ts'ob637c572021-02-09 15:56:12 -0500105endif
Filipe Brandenburgera8ffb5c2012-12-14 20:47:03 -0800106
Theodore Ts'o716ff032017-09-03 23:53:57 -0400107ifeq ($(DEB_HOST_ARCH_OS), hurd)
Theodore Ts'ob1c828e2011-09-28 23:12:45 -0400108 ${INSTALL} -m 0644 misc/mke2fs-hurd.conf ${tmpdir}/etc/mke2fs.conf
109endif
110
Theodore Ts'o336ac182019-07-11 00:06:07 -0400111override_dh_install:
Theodore Ts'o922a40c2019-07-09 19:04:20 -0400112 dh_install -p e2fsprogs --sourcedir=${stdbuilddir} NEWS.gz \
113 usr/share/doc/e2fsprogs
Theodore Ts'oe98cdaf2019-07-13 15:58:56 -0400114 dh_install
115 dh_missing --fail-missing
Theodore Ts'o922a40c2019-07-09 19:04:20 -0400116
Theodore Ts'ob637c572021-02-09 15:56:12 -0500117ifeq (,$(filter noudeb,$(DEB_BUILD_PROFILES)))
Theodore Ts'o336ac182019-07-11 00:06:07 -0400118override_dh_lintian:
119 dh_lintian
120 $(INSTALL) -D -p -m644 debian/e2fsprogs-udeb.lintian-overrides \
121 debian/e2fsprogs-udeb/usr/share/lintian/overrides/e2fsprogs-udeb
Theodore Ts'ob637c572021-02-09 15:56:12 -0500122endif
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000123
Theodore Ts'o336ac182019-07-11 00:06:07 -0400124override_dh_installinfo:
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000125 # HTML docs
Theodore Ts'o336ac182019-07-11 00:06:07 -0400126 $(INSTALL) -d debian/libext2fs-dev/usr/share/doc/libext2fs2/html-info/
Theodore Ts'o4534f8b2009-11-29 20:19:10 -0500127 $(INSTALL) -p -m 0644 ${stdbuilddir}/doc/*.html \
Theodore Ts'o336ac182019-07-11 00:06:07 -0400128 debian/libext2fs-dev/usr/share/doc/libext2fs2/html-info/
129 $(INSTALL) -d debian/comerr-dev/usr/share/doc/comerr-dev/html-info/
Theodore Ts'o4534f8b2009-11-29 20:19:10 -0500130 $(INSTALL) -p -m 0644 ${stdbuilddir}/lib/et/*.html \
Theodore Ts'o336ac182019-07-11 00:06:07 -0400131 debian/comerr-dev/usr/share/doc/comerr-dev/html-info/
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000132
133 # texinfo docs
Theodore Ts'o336ac182019-07-11 00:06:07 -0400134 mkdir -p debian/comerr-dev/usr/share/doc/comerr-dev
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500135 $(INSTALL) -p -m 0644 ${topdir}/doc/libext2fs.texinfo \
Theodore Ts'o336ac182019-07-11 00:06:07 -0400136 debian/libext2fs-dev/usr/share/doc/libext2fs2/libext2fs.texi
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500137 $(INSTALL) -p -m 0644 ${topdir}/lib/et/com_err.texinfo \
Theodore Ts'o336ac182019-07-11 00:06:07 -0400138 debian/comerr-dev/usr/share/doc/comerr-dev/com_err.texi
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000139
Theodore Ts'o336ac182019-07-11 00:06:07 -0400140 $(INSTALL) -d debian/comerr-dev/usr/share/doc/comerr-dev/examples
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500141 $(INSTALL) -p -m 0644 lib/ss/ss_err.et \
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400142 ${stdbuilddir}/lib/ext2fs/ext2_err.et \
Theodore Ts'o336ac182019-07-11 00:06:07 -0400143 debian/comerr-dev/usr/share/doc/comerr-dev/examples
144 $(INSTALL) -d debian/ss-dev/usr/share/doc/ss-dev/examples
Theodore Ts'ob1e22d52005-12-29 09:16:00 -0500145 $(INSTALL) -p -m 0644 debugfs/debug_cmds.ct \
Theodore Ts'o336ac182019-07-11 00:06:07 -0400146 debian/ss-dev/usr/share/doc/ss-dev/examples
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400147
Theodore Ts'o541d1732002-02-23 21:23:26 -0500148 dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info
Theodore Ts'o146649c2018-02-08 23:39:22 -0500149 dh_installinfo -plibext2fs-dev ${stdbuilddir}/doc/libext2fs.info
Theodore Ts'o4d8f08f2001-05-09 04:51:07 +0000150
Theodore Ts'o336ac182019-07-11 00:06:07 -0400151override_dh_makeshlibs:
Theodore Ts'o95f65c32009-07-18 22:14:58 -0400152 for i in $(SYMBOL_LIBS); \
Theodore Ts'o649bd282008-08-25 00:00:35 -0400153 do \
154 echo "Generating symbols for $$i..."; \
155 dpkg-gensymbols -p$$i -Pdebian/$$i > debian/$$i.tmp-patch; \
156 cat debian/$$i.tmp-patch; \
157 patch debian/$$i.symbols < debian/$$i.tmp-patch; \
158 /bin/rm debian/$$i.tmp-patch; \
159 done
Theodore Ts'ob637c572021-02-09 15:56:12 -0500160 dh_makeshlibs $(if $(filter noudeb,$(DEB_BUILD_PROFILES)),,--add-udeb=e2fsprogs-udeb)
Theodore Ts'o649bd282008-08-25 00:00:35 -0400161
Theodore Ts'o336ac182019-07-11 00:06:07 -0400162override_dh_shlibdeps:
Theodore Ts'o151c86a2003-07-25 07:03:00 -0400163 dh_shlibdeps -pe2fsprogs -l${stdbuilddir}/lib \
Theodore Ts'o336ac182019-07-11 00:06:07 -0400164 -- -Ldebian/e2fsprogs.shlibs.local
Theodore Ts'ob637c572021-02-09 15:56:12 -0500165ifeq (,$(filter noudeb,$(DEB_BUILD_PROFILES)))
Theodore Ts'o7a15db22003-07-29 22:15:33 -0400166 dh_shlibdeps -pe2fsprogs-udeb -l${stdbuilddir}/lib \
Theodore Ts'o336ac182019-07-11 00:06:07 -0400167 -- -Ldebian/e2fsprogs-udeb.shlibs.local
Theodore Ts'ob637c572021-02-09 15:56:12 -0500168endif
Theodore Ts'od3c05952016-05-31 01:48:18 -0400169ifeq ($(SKIP_FUSE2FS),)
Theodore Ts'od1335612016-05-24 15:38:01 -0400170 dh_shlibdeps -pfuse2fs -l${stdbuilddir}/lib \
Theodore Ts'o336ac182019-07-11 00:06:07 -0400171 -- -Ldebian/e2fsprogs.shlibs.local
Theodore Ts'od3c05952016-05-31 01:48:18 -0400172endif
Theodore Ts'o336ac182019-07-11 00:06:07 -0400173 dh_shlibdeps --remaining-packages -l${stdbuilddir}/lib
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000174
Theodore Ts'o336ac182019-07-11 00:06:07 -0400175override_dh_gencontrol:
Theodore Ts'oe98cdaf2019-07-13 15:58:56 -0400176 dh_gencontrol -pcomerr-dev -- -v${COMERR_VERSION}-${DEB_VERSION} -VmainBinary=${DEB_VERSION}
177 dh_gencontrol -pss-dev -- -v${SS_VERSION}-${DEB_VERSION} -VmainBinary=${DEB_VERSION}
Theodore Ts'o336ac182019-07-11 00:06:07 -0400178 dh_gencontrol --remaining-packages
Theodore Ts'ob90b8262001-06-15 22:54:34 +0000179
Theodore Ts'o7f4c3bb2019-07-24 20:40:19 -0400180override_dh_auto_test:
Theodore Ts'o20a18d52019-07-27 12:17:06 -0400181ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
Theodore Ts'o7f4c3bb2019-07-24 20:40:19 -0400182 $(MAKE) -C ${stdbuilddir} V=1 check
Theodore Ts'o20a18d52019-07-27 12:17:06 -0400183endif
Theodore Ts'o7f4c3bb2019-07-24 20:40:19 -0400184
Theodore Ts'o336ac182019-07-11 00:06:07 -0400185test_printenv:
186 printenv | sort