• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /usr/bin/make -f
2
3# export DH_VERBOSE=1
4
5export DEB_BUILD_MAINT_OPTIONS ?= hardening=+all
6
7DPKG_EXPORT_BUILDFLAGS = 1
8include /usr/share/dpkg/default.mk
9
10# be paranoid
11export LC_ALL ?= C
12
13ifeq ($(DEB_HOST_ARCH_OS), hurd)
14SKIP_FUSE2FS=yes
15endif
16
17ifneq ($(filter pkg.e2fsprogs.no-fuse2fs,$(DEB_BUILD_PROFILES)),)
18SKIP_FUSE2FS=yes
19endif
20
21COMERR_VERSION ?= $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3)
22SS_VERSION ?= $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3)
23
24topdir		?= $(shell pwd)
25tmpdir		?= ${topdir}/debian/tmp
26udebdir		?= ${topdir}/debian/e2fsprogs-udeb
27stdbuilddir	?= ${topdir}/debian/BUILD-STD
28
29INSTALL ?= install
30INSTALL_PROGRAM ?= $(INSTALL) -p -m 0755
31
32ifneq (,$(findstring update-symbols,$(DEB_BUILD_OPTIONS)))
33SYMBOL_LIBS := libext2fs libcomerr2 libss2
34endif
35
36CFLAGS_SHLIB = $(CFLAGS)
37CFLAGS_STLIB = $(CFLAGS)
38LDFLAGS_SHLIB = $(LDFLAGS)
39LDFLAGS_STATIC = $(filter-out -fPIE -fpie -pie,$(LDFLAGS))
40
41BACKTRACE_CONF_FLAGS ?= $(shell if debian/scripts/test-backtrace ; then echo --disable-backtrace ; fi)
42
43COMMON_CONF_FLAGS = --enable-elf-shlibs --disable-ubsan \
44	--disable-addrsan --disable-threadsan --disable-e2initrd-helper \
45	--disable-fsck --disable-libblkid --disable-libuuid --disable-uuidd \
46	--infodir=/usr/share/info  --enable-symlink-install \
47	--with-multiarch=$(DEB_HOST_MULTIARCH) \
48	$(BACKTRACE_CONF_FLAGS) ${EXTRA_CONF_FLAGS}
49
50ifneq ($(SKIP_FUSE2FS),)
51COMMON_CONF_FLAGS +=  --disable-fuse2fs
52endif
53
54ifneq ($(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
58
59%:
60	dh $@ -B${stdbuilddir}
61
62override_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:
70	$(MAKE) -C ${stdbuilddir} V=1 all
71ifeq (,$(filter pkg.e2fsprogs.no-static,$(DEB_BUILD_PROFILES)))
72	$(MAKE) -C ${stdbuilddir}/e2fsck V=1 e2fsck.static
73endif
74	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
79	$(MAKE) -C ${stdbuilddir}/po V=1 update-gmo
80
81	$(MAKE) -C ${stdbuilddir}/doc V=1 libext2fs.html
82	$(MAKE) -C ${stdbuilddir}/lib/et V=1 com_err.info com_err.html
83	cat $(shell /bin/ls -1 ./doc/RelNotes/*.txt | tac) | \
84		gzip -9n > ${stdbuilddir}/NEWS.gz
85
86override_dh_auto_clean:
87	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
92	rm -rf ${stdbuilddir}
93
94override_dh_auto_install:
95	mkdir -p ${tmpdir}/sbin
96	$(MAKE) -C ${stdbuilddir} V=1 install DESTDIR=${tmpdir} \
97		INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true
98  # static libs and .h files
99	$(MAKE) -C ${stdbuilddir} V=1 install-libs DESTDIR=${tmpdir} LDCONFIG=true
100
101ifeq (,$(filter pkg.e2fsprogs.no-static,$(DEB_BUILD_PROFILES)))
102  # statically-linked fsck
103	${INSTALL_PROGRAM} ${stdbuilddir}/e2fsck/e2fsck.static ${tmpdir}/sbin
104	(cd debian/tmp/usr/share/man/man8 ; cp e2fsck.8 e2fsck.static.8)
105endif
106
107ifeq ($(DEB_HOST_ARCH_OS), hurd)
108	${INSTALL} -m 0644 misc/mke2fs-hurd.conf ${tmpdir}/etc/mke2fs.conf
109endif
110
111override_dh_install:
112	dh_install -p e2fsprogs --sourcedir=${stdbuilddir} NEWS.gz \
113		usr/share/doc/e2fsprogs
114	dh_install
115	dh_missing --fail-missing
116
117ifeq (,$(filter noudeb,$(DEB_BUILD_PROFILES)))
118override_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
122endif
123
124override_dh_installinfo:
125  # HTML docs
126	$(INSTALL) -d debian/libext2fs-dev/usr/share/doc/libext2fs2/html-info/
127	$(INSTALL) -p -m 0644 ${stdbuilddir}/doc/*.html \
128	   debian/libext2fs-dev/usr/share/doc/libext2fs2/html-info/
129	$(INSTALL) -d debian/comerr-dev/usr/share/doc/comerr-dev/html-info/
130	$(INSTALL) -p -m 0644 ${stdbuilddir}/lib/et/*.html \
131	   debian/comerr-dev/usr/share/doc/comerr-dev/html-info/
132
133  # texinfo docs
134	mkdir -p debian/comerr-dev/usr/share/doc/comerr-dev
135	$(INSTALL) -p -m 0644 ${topdir}/doc/libext2fs.texinfo \
136	   debian/libext2fs-dev/usr/share/doc/libext2fs2/libext2fs.texi
137	$(INSTALL) -p -m 0644 ${topdir}/lib/et/com_err.texinfo \
138	   debian/comerr-dev/usr/share/doc/comerr-dev/com_err.texi
139
140	$(INSTALL) -d debian/comerr-dev/usr/share/doc/comerr-dev/examples
141	$(INSTALL) -p -m 0644 lib/ss/ss_err.et \
142		${stdbuilddir}/lib/ext2fs/ext2_err.et \
143		debian/comerr-dev/usr/share/doc/comerr-dev/examples
144	$(INSTALL) -d debian/ss-dev/usr/share/doc/ss-dev/examples
145	$(INSTALL) -p -m 0644 debugfs/debug_cmds.ct \
146		debian/ss-dev/usr/share/doc/ss-dev/examples
147
148	dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info
149	dh_installinfo -plibext2fs-dev ${stdbuilddir}/doc/libext2fs.info
150
151override_dh_makeshlibs:
152	for i in $(SYMBOL_LIBS); \
153	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
160	dh_makeshlibs $(if $(filter noudeb,$(DEB_BUILD_PROFILES)),,--add-udeb=e2fsprogs-udeb)
161
162override_dh_shlibdeps:
163	dh_shlibdeps -pe2fsprogs -l${stdbuilddir}/lib \
164		-- -Ldebian/e2fsprogs.shlibs.local
165ifeq (,$(filter noudeb,$(DEB_BUILD_PROFILES)))
166	dh_shlibdeps -pe2fsprogs-udeb -l${stdbuilddir}/lib \
167		-- -Ldebian/e2fsprogs-udeb.shlibs.local
168endif
169ifeq ($(SKIP_FUSE2FS),)
170	dh_shlibdeps -pfuse2fs -l${stdbuilddir}/lib \
171		-- -Ldebian/e2fsprogs.shlibs.local
172endif
173	dh_shlibdeps --remaining-packages -l${stdbuilddir}/lib
174
175override_dh_gencontrol:
176	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}
178	dh_gencontrol --remaining-packages
179
180override_dh_auto_test:
181ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
182	$(MAKE) -C ${stdbuilddir} V=1 check
183endif
184
185test_printenv:
186	printenv | sort
187