1*6a54128fSAndroid Build Coastguard Worker#! /usr/bin/make -f 2*6a54128fSAndroid Build Coastguard Worker 3*6a54128fSAndroid Build Coastguard Worker# export DH_VERBOSE=1 4*6a54128fSAndroid Build Coastguard Worker 5*6a54128fSAndroid Build Coastguard Workerexport DEB_BUILD_MAINT_OPTIONS ?= hardening=+all 6*6a54128fSAndroid Build Coastguard Worker 7*6a54128fSAndroid Build Coastguard WorkerDPKG_EXPORT_BUILDFLAGS = 1 8*6a54128fSAndroid Build Coastguard Workerinclude /usr/share/dpkg/default.mk 9*6a54128fSAndroid Build Coastguard Worker 10*6a54128fSAndroid Build Coastguard Worker# be paranoid 11*6a54128fSAndroid Build Coastguard Workerexport LC_ALL ?= C 12*6a54128fSAndroid Build Coastguard Worker 13*6a54128fSAndroid Build Coastguard Workerifeq ($(DEB_HOST_ARCH_OS), hurd) 14*6a54128fSAndroid Build Coastguard WorkerSKIP_FUSE2FS=yes 15*6a54128fSAndroid Build Coastguard Workerendif 16*6a54128fSAndroid Build Coastguard Worker 17*6a54128fSAndroid Build Coastguard Workerifneq ($(filter pkg.e2fsprogs.no-fuse2fs,$(DEB_BUILD_PROFILES)),) 18*6a54128fSAndroid Build Coastguard WorkerSKIP_FUSE2FS=yes 19*6a54128fSAndroid Build Coastguard Workerendif 20*6a54128fSAndroid Build Coastguard Worker 21*6a54128fSAndroid Build Coastguard WorkerCOMERR_VERSION ?= $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3) 22*6a54128fSAndroid Build Coastguard WorkerSS_VERSION ?= $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3) 23*6a54128fSAndroid Build Coastguard Worker 24*6a54128fSAndroid Build Coastguard Workertopdir ?= $(shell pwd) 25*6a54128fSAndroid Build Coastguard Workertmpdir ?= ${topdir}/debian/tmp 26*6a54128fSAndroid Build Coastguard Workerudebdir ?= ${topdir}/debian/e2fsprogs-udeb 27*6a54128fSAndroid Build Coastguard Workerstdbuilddir ?= ${topdir}/debian/BUILD-STD 28*6a54128fSAndroid Build Coastguard Worker 29*6a54128fSAndroid Build Coastguard WorkerINSTALL ?= install 30*6a54128fSAndroid Build Coastguard WorkerINSTALL_PROGRAM ?= $(INSTALL) -p -m 0755 31*6a54128fSAndroid Build Coastguard Worker 32*6a54128fSAndroid Build Coastguard Workerifneq (,$(findstring update-symbols,$(DEB_BUILD_OPTIONS))) 33*6a54128fSAndroid Build Coastguard WorkerSYMBOL_LIBS := libext2fs libcomerr2 libss2 34*6a54128fSAndroid Build Coastguard Workerendif 35*6a54128fSAndroid Build Coastguard Worker 36*6a54128fSAndroid Build Coastguard WorkerCFLAGS_SHLIB = $(CFLAGS) 37*6a54128fSAndroid Build Coastguard WorkerCFLAGS_STLIB = $(CFLAGS) 38*6a54128fSAndroid Build Coastguard WorkerLDFLAGS_SHLIB = $(LDFLAGS) 39*6a54128fSAndroid Build Coastguard WorkerLDFLAGS_STATIC = $(filter-out -fPIE -fpie -pie,$(LDFLAGS)) 40*6a54128fSAndroid Build Coastguard Worker 41*6a54128fSAndroid Build Coastguard WorkerBACKTRACE_CONF_FLAGS ?= $(shell if debian/scripts/test-backtrace ; then echo --disable-backtrace ; fi) 42*6a54128fSAndroid Build Coastguard Worker 43*6a54128fSAndroid Build Coastguard WorkerCOMMON_CONF_FLAGS = --enable-elf-shlibs --disable-ubsan \ 44*6a54128fSAndroid Build Coastguard Worker --disable-addrsan --disable-threadsan --disable-e2initrd-helper \ 45*6a54128fSAndroid Build Coastguard Worker --disable-fsck --disable-libblkid --disable-libuuid --disable-uuidd \ 46*6a54128fSAndroid Build Coastguard Worker --infodir=/usr/share/info --enable-symlink-install \ 47*6a54128fSAndroid Build Coastguard Worker --with-multiarch=$(DEB_HOST_MULTIARCH) \ 48*6a54128fSAndroid Build Coastguard Worker $(BACKTRACE_CONF_FLAGS) ${EXTRA_CONF_FLAGS} 49*6a54128fSAndroid Build Coastguard Worker 50*6a54128fSAndroid Build Coastguard Workerifneq ($(SKIP_FUSE2FS),) 51*6a54128fSAndroid Build Coastguard WorkerCOMMON_CONF_FLAGS += --disable-fuse2fs 52*6a54128fSAndroid Build Coastguard Workerendif 53*6a54128fSAndroid Build Coastguard Worker 54*6a54128fSAndroid Build Coastguard Workerifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) 55*6a54128fSAndroid Build Coastguard WorkerCC ?= $(DEB_HOST_GNU_TYPE)-gcc 56*6a54128fSAndroid Build Coastguard WorkerCOMMON_CONF_FLAGS += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) 57*6a54128fSAndroid Build Coastguard Workerendif 58*6a54128fSAndroid Build Coastguard Worker 59*6a54128fSAndroid Build Coastguard Worker%: 60*6a54128fSAndroid Build Coastguard Worker dh $@ -B${stdbuilddir} 61*6a54128fSAndroid Build Coastguard Worker 62*6a54128fSAndroid Build Coastguard Workeroverride_dh_autoreconf: 63*6a54128fSAndroid Build Coastguard Worker 64*6a54128fSAndroid Build Coastguard Workeroverride_dh_auto_configure: 65*6a54128fSAndroid Build Coastguard Worker mkdir -p ${stdbuilddir} 66*6a54128fSAndroid Build Coastguard Worker cd ${stdbuilddir} && AWK=/usr/bin/awk \ 67*6a54128fSAndroid Build Coastguard Worker ../../configure ${COMMON_CONF_FLAGS} 68*6a54128fSAndroid Build Coastguard Worker 69*6a54128fSAndroid Build Coastguard Workeroverride_dh_auto_build: 70*6a54128fSAndroid Build Coastguard Worker $(MAKE) -C ${stdbuilddir} V=1 all 71*6a54128fSAndroid Build Coastguard Workerifeq (,$(filter pkg.e2fsprogs.no-static,$(DEB_BUILD_PROFILES))) 72*6a54128fSAndroid Build Coastguard Worker $(MAKE) -C ${stdbuilddir}/e2fsck V=1 e2fsck.static 73*6a54128fSAndroid Build Coastguard Workerendif 74*6a54128fSAndroid Build Coastguard Worker if ! test -d debian/orig-gmo ; then \ 75*6a54128fSAndroid Build Coastguard Worker mkdir debian/orig-gmo ; \ 76*6a54128fSAndroid Build Coastguard Worker mv po/*.gmo po/*.po debian/orig-gmo ; \ 77*6a54128fSAndroid Build Coastguard Worker cp debian/orig-gmo/*.po po ; \ 78*6a54128fSAndroid Build Coastguard Worker fi 79*6a54128fSAndroid Build Coastguard Worker $(MAKE) -C ${stdbuilddir}/po V=1 update-gmo 80*6a54128fSAndroid Build Coastguard Worker 81*6a54128fSAndroid Build Coastguard Worker $(MAKE) -C ${stdbuilddir}/doc V=1 libext2fs.html 82*6a54128fSAndroid Build Coastguard Worker $(MAKE) -C ${stdbuilddir}/lib/et V=1 com_err.info com_err.html 83*6a54128fSAndroid Build Coastguard Worker cat $(shell /bin/ls -1 ./doc/RelNotes/*.txt | tac) | \ 84*6a54128fSAndroid Build Coastguard Worker gzip -9n > ${stdbuilddir}/NEWS.gz 85*6a54128fSAndroid Build Coastguard Worker 86*6a54128fSAndroid Build Coastguard Workeroverride_dh_auto_clean: 87*6a54128fSAndroid Build Coastguard Worker if test -d debian/orig-gmo ; then \ 88*6a54128fSAndroid Build Coastguard Worker rm -f po/*.gmo po/*.po ; \ 89*6a54128fSAndroid Build Coastguard Worker mv debian/orig-gmo/* po ; \ 90*6a54128fSAndroid Build Coastguard Worker rmdir debian/orig-gmo ; \ 91*6a54128fSAndroid Build Coastguard Worker fi 92*6a54128fSAndroid Build Coastguard Worker rm -rf ${stdbuilddir} 93*6a54128fSAndroid Build Coastguard Worker 94*6a54128fSAndroid Build Coastguard Workeroverride_dh_auto_install: 95*6a54128fSAndroid Build Coastguard Worker mkdir -p ${tmpdir}/sbin 96*6a54128fSAndroid Build Coastguard Worker $(MAKE) -C ${stdbuilddir} V=1 install DESTDIR=${tmpdir} \ 97*6a54128fSAndroid Build Coastguard Worker INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true 98*6a54128fSAndroid Build Coastguard Worker # static libs and .h files 99*6a54128fSAndroid Build Coastguard Worker $(MAKE) -C ${stdbuilddir} V=1 install-libs DESTDIR=${tmpdir} LDCONFIG=true 100*6a54128fSAndroid Build Coastguard Worker 101*6a54128fSAndroid Build Coastguard Workerifeq (,$(filter pkg.e2fsprogs.no-static,$(DEB_BUILD_PROFILES))) 102*6a54128fSAndroid Build Coastguard Worker # statically-linked fsck 103*6a54128fSAndroid Build Coastguard Worker ${INSTALL_PROGRAM} ${stdbuilddir}/e2fsck/e2fsck.static ${tmpdir}/sbin 104*6a54128fSAndroid Build Coastguard Worker (cd debian/tmp/usr/share/man/man8 ; cp e2fsck.8 e2fsck.static.8) 105*6a54128fSAndroid Build Coastguard Workerendif 106*6a54128fSAndroid Build Coastguard Worker 107*6a54128fSAndroid Build Coastguard Workerifeq ($(DEB_HOST_ARCH_OS), hurd) 108*6a54128fSAndroid Build Coastguard Worker ${INSTALL} -m 0644 misc/mke2fs-hurd.conf ${tmpdir}/etc/mke2fs.conf 109*6a54128fSAndroid Build Coastguard Workerendif 110*6a54128fSAndroid Build Coastguard Worker 111*6a54128fSAndroid Build Coastguard Workeroverride_dh_install: 112*6a54128fSAndroid Build Coastguard Worker dh_install -p e2fsprogs --sourcedir=${stdbuilddir} NEWS.gz \ 113*6a54128fSAndroid Build Coastguard Worker usr/share/doc/e2fsprogs 114*6a54128fSAndroid Build Coastguard Worker dh_install 115*6a54128fSAndroid Build Coastguard Worker dh_missing --fail-missing 116*6a54128fSAndroid Build Coastguard Worker 117*6a54128fSAndroid Build Coastguard Workerifeq (,$(filter noudeb,$(DEB_BUILD_PROFILES))) 118*6a54128fSAndroid Build Coastguard Workeroverride_dh_lintian: 119*6a54128fSAndroid Build Coastguard Worker dh_lintian 120*6a54128fSAndroid Build Coastguard Worker $(INSTALL) -D -p -m644 debian/e2fsprogs-udeb.lintian-overrides \ 121*6a54128fSAndroid Build Coastguard Worker debian/e2fsprogs-udeb/usr/share/lintian/overrides/e2fsprogs-udeb 122*6a54128fSAndroid Build Coastguard Workerendif 123*6a54128fSAndroid Build Coastguard Worker 124*6a54128fSAndroid Build Coastguard Workeroverride_dh_installinfo: 125*6a54128fSAndroid Build Coastguard Worker # HTML docs 126*6a54128fSAndroid Build Coastguard Worker $(INSTALL) -d debian/libext2fs-dev/usr/share/doc/libext2fs2/html-info/ 127*6a54128fSAndroid Build Coastguard Worker $(INSTALL) -p -m 0644 ${stdbuilddir}/doc/*.html \ 128*6a54128fSAndroid Build Coastguard Worker debian/libext2fs-dev/usr/share/doc/libext2fs2/html-info/ 129*6a54128fSAndroid Build Coastguard Worker $(INSTALL) -d debian/comerr-dev/usr/share/doc/comerr-dev/html-info/ 130*6a54128fSAndroid Build Coastguard Worker $(INSTALL) -p -m 0644 ${stdbuilddir}/lib/et/*.html \ 131*6a54128fSAndroid Build Coastguard Worker debian/comerr-dev/usr/share/doc/comerr-dev/html-info/ 132*6a54128fSAndroid Build Coastguard Worker 133*6a54128fSAndroid Build Coastguard Worker # texinfo docs 134*6a54128fSAndroid Build Coastguard Worker mkdir -p debian/comerr-dev/usr/share/doc/comerr-dev 135*6a54128fSAndroid Build Coastguard Worker $(INSTALL) -p -m 0644 ${topdir}/doc/libext2fs.texinfo \ 136*6a54128fSAndroid Build Coastguard Worker debian/libext2fs-dev/usr/share/doc/libext2fs2/libext2fs.texi 137*6a54128fSAndroid Build Coastguard Worker $(INSTALL) -p -m 0644 ${topdir}/lib/et/com_err.texinfo \ 138*6a54128fSAndroid Build Coastguard Worker debian/comerr-dev/usr/share/doc/comerr-dev/com_err.texi 139*6a54128fSAndroid Build Coastguard Worker 140*6a54128fSAndroid Build Coastguard Worker $(INSTALL) -d debian/comerr-dev/usr/share/doc/comerr-dev/examples 141*6a54128fSAndroid Build Coastguard Worker $(INSTALL) -p -m 0644 lib/ss/ss_err.et \ 142*6a54128fSAndroid Build Coastguard Worker ${stdbuilddir}/lib/ext2fs/ext2_err.et \ 143*6a54128fSAndroid Build Coastguard Worker debian/comerr-dev/usr/share/doc/comerr-dev/examples 144*6a54128fSAndroid Build Coastguard Worker $(INSTALL) -d debian/ss-dev/usr/share/doc/ss-dev/examples 145*6a54128fSAndroid Build Coastguard Worker $(INSTALL) -p -m 0644 debugfs/debug_cmds.ct \ 146*6a54128fSAndroid Build Coastguard Worker debian/ss-dev/usr/share/doc/ss-dev/examples 147*6a54128fSAndroid Build Coastguard Worker 148*6a54128fSAndroid Build Coastguard Worker dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info 149*6a54128fSAndroid Build Coastguard Worker dh_installinfo -plibext2fs-dev ${stdbuilddir}/doc/libext2fs.info 150*6a54128fSAndroid Build Coastguard Worker 151*6a54128fSAndroid Build Coastguard Workeroverride_dh_makeshlibs: 152*6a54128fSAndroid Build Coastguard Worker for i in $(SYMBOL_LIBS); \ 153*6a54128fSAndroid Build Coastguard Worker do \ 154*6a54128fSAndroid Build Coastguard Worker echo "Generating symbols for $$i..."; \ 155*6a54128fSAndroid Build Coastguard Worker dpkg-gensymbols -p$$i -Pdebian/$$i > debian/$$i.tmp-patch; \ 156*6a54128fSAndroid Build Coastguard Worker cat debian/$$i.tmp-patch; \ 157*6a54128fSAndroid Build Coastguard Worker patch debian/$$i.symbols < debian/$$i.tmp-patch; \ 158*6a54128fSAndroid Build Coastguard Worker /bin/rm debian/$$i.tmp-patch; \ 159*6a54128fSAndroid Build Coastguard Worker done 160*6a54128fSAndroid Build Coastguard Worker dh_makeshlibs $(if $(filter noudeb,$(DEB_BUILD_PROFILES)),,--add-udeb=e2fsprogs-udeb) 161*6a54128fSAndroid Build Coastguard Worker 162*6a54128fSAndroid Build Coastguard Workeroverride_dh_shlibdeps: 163*6a54128fSAndroid Build Coastguard Worker dh_shlibdeps -pe2fsprogs -l${stdbuilddir}/lib \ 164*6a54128fSAndroid Build Coastguard Worker -- -Ldebian/e2fsprogs.shlibs.local 165*6a54128fSAndroid Build Coastguard Workerifeq (,$(filter noudeb,$(DEB_BUILD_PROFILES))) 166*6a54128fSAndroid Build Coastguard Worker dh_shlibdeps -pe2fsprogs-udeb -l${stdbuilddir}/lib \ 167*6a54128fSAndroid Build Coastguard Worker -- -Ldebian/e2fsprogs-udeb.shlibs.local 168*6a54128fSAndroid Build Coastguard Workerendif 169*6a54128fSAndroid Build Coastguard Workerifeq ($(SKIP_FUSE2FS),) 170*6a54128fSAndroid Build Coastguard Worker dh_shlibdeps -pfuse2fs -l${stdbuilddir}/lib \ 171*6a54128fSAndroid Build Coastguard Worker -- -Ldebian/e2fsprogs.shlibs.local 172*6a54128fSAndroid Build Coastguard Workerendif 173*6a54128fSAndroid Build Coastguard Worker dh_shlibdeps --remaining-packages -l${stdbuilddir}/lib 174*6a54128fSAndroid Build Coastguard Worker 175*6a54128fSAndroid Build Coastguard Workeroverride_dh_gencontrol: 176*6a54128fSAndroid Build Coastguard Worker dh_gencontrol -pcomerr-dev -- -v${COMERR_VERSION}-${DEB_VERSION} -VmainBinary=${DEB_VERSION} 177*6a54128fSAndroid Build Coastguard Worker dh_gencontrol -pss-dev -- -v${SS_VERSION}-${DEB_VERSION} -VmainBinary=${DEB_VERSION} 178*6a54128fSAndroid Build Coastguard Worker dh_gencontrol --remaining-packages 179*6a54128fSAndroid Build Coastguard Worker 180*6a54128fSAndroid Build Coastguard Workeroverride_dh_auto_test: 181*6a54128fSAndroid Build Coastguard Workerifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) 182*6a54128fSAndroid Build Coastguard Worker PRINT_FAILED=yes $(MAKE) -C ${stdbuilddir} V=1 check 183*6a54128fSAndroid Build Coastguard Workerendif 184*6a54128fSAndroid Build Coastguard Worker 185*6a54128fSAndroid Build Coastguard Workertest_printenv: 186*6a54128fSAndroid Build Coastguard Worker printenv | sort 187