]>
Commit | Line | Data |
---|---|---|
1 | #! /usr/bin/make -f | |
2 | ||
3 | # export DH_VERBOSE=1 | |
4 | ||
5 | export DEB_BUILD_MAINT_OPTIONS ?= hardening=+all | |
6 | ||
7 | DPKG_EXPORT_BUILDFLAGS = 1 | |
8 | include /usr/share/dpkg/default.mk | |
9 | ||
10 | # be paranoid | |
11 | export LC_ALL ?= C | |
12 | ||
13 | ifeq ($(DEB_HOST_ARCH_OS), hurd) | |
14 | SKIP_FUSE2FS=yes | |
15 | endif | |
16 | ||
17 | ifeq ($(DEB_HOST_ARCH_OS), linux) | |
18 | export deb_systemdsystemunitdir = $(shell pkg-config --variable=systemdsystemunitdir systemd | sed s,^/,,) | |
19 | export deb_udevudevdir = $(shell pkg-config pkg-config --variable=udevdir udev | sed s,^/,,) | |
20 | endif | |
21 | ||
22 | ifneq ($(filter pkg.e2fsprogs.no-fuse2fs,$(DEB_BUILD_PROFILES)),) | |
23 | SKIP_FUSE2FS=yes | |
24 | endif | |
25 | ||
26 | ifneq (,$(filter-out parallel=1,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))) | |
27 | NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) | |
28 | JOBS = -j$(NUMJOBS) | |
29 | endif | |
30 | ||
31 | COMERR_VERSION ?= $(shell grep ELF_VERSION lib/et/Makefile.in | cut '-d ' -f3) | |
32 | SS_VERSION ?= $(shell grep ELF_VERSION lib/ss/Makefile.in | cut '-d ' -f3) | |
33 | ||
34 | topdir ?= $(shell pwd) | |
35 | tmpdir ?= ${topdir}/debian/tmp | |
36 | udebdir ?= ${topdir}/debian/e2fsprogs-udeb | |
37 | stdbuilddir ?= ${topdir}/debian/BUILD-STD | |
38 | ||
39 | INSTALL ?= install | |
40 | INSTALL_PROGRAM ?= $(INSTALL) -p -m 0755 | |
41 | ||
42 | ifneq (,$(findstring update-symbols,$(DEB_BUILD_OPTIONS))) | |
43 | SYMBOL_LIBS := libext2fst64 libcom-err2 libss2 | |
44 | endif | |
45 | ||
46 | CFLAGS_SHLIB = $(CFLAGS) | |
47 | CFLAGS_STLIB = $(CFLAGS) | |
48 | LDFLAGS_SHLIB = $(LDFLAGS) | |
49 | LDFLAGS_STATIC = $(filter-out -fPIE -fpie -pie,$(LDFLAGS)) | |
50 | ||
51 | BACKTRACE_CONF_FLAGS ?= $(shell if debian/scripts/test-backtrace ; then echo --disable-backtrace ; fi) | |
52 | ||
53 | COMMON_CONF_FLAGS = --enable-elf-shlibs --disable-ubsan \ | |
54 | --disable-addrsan --disable-threadsan --disable-e2initrd-helper \ | |
55 | --disable-fsck --disable-libblkid --disable-libuuid --disable-uuidd \ | |
56 | --infodir=/usr/share/info --enable-symlink-install \ | |
57 | --with-multiarch=$(DEB_HOST_MULTIARCH) \ | |
58 | $(BACKTRACE_CONF_FLAGS) ${EXTRA_CONF_FLAGS} | |
59 | ||
60 | ifneq ($(SKIP_FUSE2FS),) | |
61 | COMMON_CONF_FLAGS += --disable-fuse2fs | |
62 | endif | |
63 | ||
64 | ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) | |
65 | CC ?= $(DEB_HOST_GNU_TYPE)-gcc | |
66 | COMMON_CONF_FLAGS += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) | |
67 | endif | |
68 | ||
69 | # work around Debian Bug #1070042 | |
70 | ifeq ($(DEB_HOST_ARCH),mips64el) | |
71 | COMMON_CONF_FLAGS += --without-libarchive | |
72 | endif | |
73 | ||
74 | %: | |
75 | dh $@ -B${stdbuilddir} | |
76 | ||
77 | override_dh_autoreconf: | |
78 | ||
79 | override_dh_auto_configure: | |
80 | mkdir -p ${stdbuilddir} | |
81 | cd ${stdbuilddir} && AWK=/usr/bin/awk \ | |
82 | ../../configure ${COMMON_CONF_FLAGS} | |
83 | ||
84 | override_dh_auto_build: | |
85 | $(MAKE) -C ${stdbuilddir} V=1 $(JOBS) all | |
86 | ifeq (,$(filter pkg.e2fsprogs.no-static,$(DEB_BUILD_PROFILES))) | |
87 | $(MAKE) -C ${stdbuilddir}/e2fsck V=1 e2fsck.static | |
88 | endif | |
89 | if ! test -d debian/orig-gmo ; then \ | |
90 | mkdir debian/orig-gmo ; \ | |
91 | mv po/*.gmo po/*.po debian/orig-gmo ; \ | |
92 | cp debian/orig-gmo/*.po po ; \ | |
93 | fi | |
94 | $(MAKE) -C ${stdbuilddir}/po V=1 update-gmo | |
95 | ||
96 | $(MAKE) -C ${stdbuilddir}/doc V=1 libext2fs.html | |
97 | $(MAKE) -C ${stdbuilddir}/lib/et V=1 com_err.info com_err.html | |
98 | cat $(shell /bin/ls -1 ./doc/RelNotes/*.txt | tac) | \ | |
99 | gzip -9n > ${stdbuilddir}/NEWS.gz | |
100 | ||
101 | override_dh_auto_clean: | |
102 | if test -d debian/orig-gmo ; then \ | |
103 | rm -f po/*.gmo po/*.po ; \ | |
104 | mv debian/orig-gmo/* po ; \ | |
105 | rmdir debian/orig-gmo ; \ | |
106 | fi | |
107 | rm -rf ${stdbuilddir} | |
108 | ||
109 | override_dh_auto_install: | |
110 | mkdir -p ${tmpdir}/sbin | |
111 | $(MAKE) -C ${stdbuilddir} V=1 install DESTDIR=${tmpdir} \ | |
112 | INSTALL_PROGRAM="${INSTALL_PROGRAM}" LDCONFIG=true | |
113 | # static libs and .h files | |
114 | $(MAKE) -C ${stdbuilddir} V=1 install-libs DESTDIR=${tmpdir} LDCONFIG=true | |
115 | ||
116 | ifeq (,$(filter pkg.e2fsprogs.no-static,$(DEB_BUILD_PROFILES))) | |
117 | # statically-linked fsck | |
118 | ${INSTALL_PROGRAM} ${stdbuilddir}/e2fsck/e2fsck.static ${tmpdir}/sbin | |
119 | (cd debian/tmp/usr/share/man/man8 ; cp e2fsck.8 e2fsck.static.8) | |
120 | endif | |
121 | ||
122 | ifeq ($(DEB_HOST_ARCH_OS), hurd) | |
123 | ${INSTALL} -m 0644 misc/mke2fs-hurd.conf ${tmpdir}/etc/mke2fs.conf | |
124 | endif | |
125 | ||
126 | override_dh_install: | |
127 | dh_install -p e2fsprogs --sourcedir=${stdbuilddir} NEWS.gz \ | |
128 | usr/share/doc/e2fsprogs | |
129 | dh_install | |
130 | dh_missing --fail-missing | |
131 | ||
132 | ifeq (,$(filter noudeb,$(DEB_BUILD_PROFILES))) | |
133 | override_dh_lintian: | |
134 | dh_lintian | |
135 | $(INSTALL) -D -p -m644 debian/e2fsprogs-udeb.lintian-overrides \ | |
136 | debian/e2fsprogs-udeb/usr/share/lintian/overrides/e2fsprogs-udeb | |
137 | endif | |
138 | ||
139 | override_dh_installinfo: | |
140 | # HTML docs | |
141 | $(INSTALL) -d debian/libext2fs-dev/usr/share/doc/libext2fs2/html-info/ | |
142 | $(INSTALL) -p -m 0644 ${stdbuilddir}/doc/*.html \ | |
143 | debian/libext2fs-dev/usr/share/doc/libext2fs2/html-info/ | |
144 | $(INSTALL) -d debian/comerr-dev/usr/share/doc/comerr-dev/html-info/ | |
145 | $(INSTALL) -p -m 0644 ${stdbuilddir}/lib/et/*.html \ | |
146 | debian/comerr-dev/usr/share/doc/comerr-dev/html-info/ | |
147 | ||
148 | # texinfo docs | |
149 | mkdir -p debian/comerr-dev/usr/share/doc/comerr-dev | |
150 | $(INSTALL) -p -m 0644 ${topdir}/doc/libext2fs.texinfo \ | |
151 | debian/libext2fs-dev/usr/share/doc/libext2fs2/libext2fs.texi | |
152 | $(INSTALL) -p -m 0644 ${topdir}/lib/et/com_err.texinfo \ | |
153 | debian/comerr-dev/usr/share/doc/comerr-dev/com_err.texi | |
154 | ||
155 | $(INSTALL) -d debian/comerr-dev/usr/share/doc/comerr-dev/examples | |
156 | $(INSTALL) -p -m 0644 lib/ss/ss_err.et \ | |
157 | ${stdbuilddir}/lib/ext2fs/ext2_err.et \ | |
158 | debian/comerr-dev/usr/share/doc/comerr-dev/examples | |
159 | $(INSTALL) -d debian/ss-dev/usr/share/doc/ss-dev/examples | |
160 | $(INSTALL) -p -m 0644 debugfs/debug_cmds.ct \ | |
161 | debian/ss-dev/usr/share/doc/ss-dev/examples | |
162 | ||
163 | dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info | |
164 | dh_installinfo -plibext2fs-dev ${stdbuilddir}/doc/libext2fs.info | |
165 | ||
166 | ifneq ($(DEB_HOST_ARCH_OS), hurd) | |
167 | override_dh_installsystemd: | |
168 | dh_installsystemd -p e2fsprogs --no-restart-after-upgrade --no-stop-on-upgrade e2scrub_all.timer e2scrub_reap.service | |
169 | endif | |
170 | ||
171 | override_dh_makeshlibs: | |
172 | for i in $(SYMBOL_LIBS); \ | |
173 | do \ | |
174 | echo "Generating symbols for $$i..."; \ | |
175 | dpkg-gensymbols -p$$i -Pdebian/$$i > debian/$$i.tmp-patch; \ | |
176 | cat debian/$$i.tmp-patch; \ | |
177 | patch debian/$$i.symbols < debian/$$i.tmp-patch; \ | |
178 | /bin/rm debian/$$i.tmp-patch; \ | |
179 | done | |
180 | dh_makeshlibs $(if $(filter noudeb,$(DEB_BUILD_PROFILES)),,--add-udeb=e2fsprogs-udeb) | |
181 | ||
182 | override_dh_shlibdeps: | |
183 | dh_shlibdeps -pe2fsprogs -l${stdbuilddir}/lib \ | |
184 | -- -Ldebian/e2fsprogs.shlibs.local | |
185 | ifeq (,$(filter noudeb,$(DEB_BUILD_PROFILES))) | |
186 | dh_shlibdeps -pe2fsprogs-udeb -l${stdbuilddir}/lib \ | |
187 | -- -Ldebian/e2fsprogs-udeb.shlibs.local | |
188 | endif | |
189 | ifeq ($(SKIP_FUSE2FS),) | |
190 | dh_shlibdeps -pfuse2fs -l${stdbuilddir}/lib \ | |
191 | -- -Ldebian/e2fsprogs.shlibs.local | |
192 | endif | |
193 | dh_shlibdeps --remaining-packages -l${stdbuilddir}/lib | |
194 | ||
195 | override_dh_gencontrol: | |
196 | dh_gencontrol -pcomerr-dev -- -v${COMERR_VERSION}-${DEB_VERSION} -VmainBinary=${DEB_VERSION} | |
197 | dh_gencontrol -pss-dev -- -v${SS_VERSION}-${DEB_VERSION} -VmainBinary=${DEB_VERSION} | |
198 | dh_gencontrol --remaining-packages -- -Vmisc:Built-Using="$(shell dpkg-query -f '$${source:Package} (= $${source:Version})' -W libc-dev-bin)" | |
199 | ||
200 | override_dh_auto_test: | |
201 | ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) | |
202 | PRINT_FAILED=yes $(MAKE) -C ${stdbuilddir} V=1 $(JOBS) check | |
203 | endif | |
204 | ||
205 | test_printenv: | |
206 | printenv | sort |