Whamcloud - gitweb
LU-17065 build: Remove snmp support
[fs/lustre-release.git] / debian / rules
1 #!/usr/bin/make -f
2 # SPDX-License-Identifier: NOASSERTION
3
4 #
5 # This file is part of Lustre, http://www.lustre.org/
6 #
7 # debian/rules
8 #
9 # Debian rules file
10 #
11 # Copying and modification is unlimited, provided that the modified
12 # version is marked as being modified.
13 # (This version has been modified from the original)
14 #
15 # Created 2009 by Brian J. Murrell based on work by
16 # Alastair McKinstry, <alastair.mckinstry@ichec.ie>, <mckinstry@debian.org>
17 # Patrick Winnertz, and the pkg-lustre Debian maintainers
18 #
19
20 # Uncomment this to turn on verbose mode.
21 # export DH_VERBOSE=1
22
23 DEB_BUILD_GNU_SYSTEM = $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM)
24 DEB_BUILD_GNU_CPU = $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU)
25
26
27 # whether to use module-assistant to build the kernel modules or not
28 USE_MA = true
29
30 # Whether to build the DKMS packages
31 BUILD_DKMS ?= false
32
33 ifeq ($(BUILD_DKMS),true)
34         DKMS_TARGET = binary-$(DKMS_PKG)
35 else
36         DKMS_TARGET =
37 endif
38
39 CFLAGS = -Wall -g
40 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
41         CFLAGS += -O0
42 else
43         CFLAGS += -O2
44 endif
45
46 # This is the debhelper compatibility version to use.
47 export DH_COMPAT=11
48
49 # Module-assistant stuff
50 ifneq (,$(findstring server,$(DEB_BUILD_PROFILES)))
51         PACKAGE=lustre-server-modules
52 else
53         PACKAGE=lustre-client-modules
54 endif
55 MA_DIR ?= /usr/share/modass
56 -include $(MA_DIR)/include/generic.make
57 -include $(MA_DIR)/include/common-rules.make
58
59 ARCH=$(shell dpkg --print-architecture)
60 TOP_DIR:=$(shell pwd)
61
62 # This is the Lustre version
63 VERSION=$(shell sed -n -e '1s/.*(\(.*\)) .*/\1/p' debian/changelog)
64 UPVERSION=$(shell echo $(VERSION) | sed -e 's/-[^-]*$$//')
65
66 # KVER is set to LINUXRELEASE being by autoconf which is either
67 # $(uname -r) or the version of the source specified by the user
68 KVER?=$(LINUXRELEASE)
69
70 # KVERS, KSRC are the kernel version and source to use when building lustre
71 # Will be the default when building lustre-{server,client}-utils, etc but whatever module-assistant
72 # supplied when building modules
73 KVERS?=$(KVER)
74 KSRC?=$(LINUX_OBJ)
75 KSRC_TREE?=$(LINUX)
76 EXTRA_OPTIONS?=$(IB_OPTIONS)
77
78 # Packages provided for both client and server builds
79 IOKIT_PKG=lustre-iokit
80 TESTS_PKG=lustre-tests
81 DEV_PKG=lustre-dev
82 SOURCE_PKG=lustre-source
83
84 # Packages that are only built for server OR client builds
85 # The difference is that server build contain more modules & utils
86 ifneq (,$(findstring server,$(DEB_BUILD_PROFILES)))
87         UTILS_PKG=lustre-server-utils
88         MODS_PKG=lustre-server-modules
89         RESOURCE_PKG=lustre-resource-agents
90         RESOURCE_TARGET=binary-$(RESOURCE_PKG)
91         DKMS_PKG=
92 else
93         UTILS_PKG=lustre-client-utils
94         MODS_PKG=lustre-client-modules
95         RESOURCE_TARGET=
96         RESOURCE_PKG=
97         DKMS_PKG=lustre-client-modules-dkms
98 endif
99
100 #Build dir
101 #BUILDDIR=debian/build
102 #SRCDIR=../..
103 # I'm afraid we seem to have broken the BUILDDIR concept in Lustre's
104 # autoconf macros
105 BUILDDIR=.
106 SRCDIR=.
107
108 AVAIL_CPUS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
109 ifneq ($(AVAIL_CPUS),1)
110       PMAKEARGS := -j $(AVAIL_CPUS)
111 endif
112
113 autogen: autogen-stamp
114 autogen-stamp: patch-stamp
115         # see if any patches requires us to run autogen
116         # (for a distribution release tarball, it is expected that if
117         #  downstream adds any patches that requires autogen.sh to be
118         #  run, a patch will be added by downstream to install the
119         #  needed autogen.sh scripts
120         #  see https://bugzilla.lustre.org/attachment.cgi?id=27156
121         #  for an example)
122         if grep -e "^--- .*\/autoconf\/" \
123                 -e "^--- .*\/autoMakefile\.am" \
124                 -e "^--- .*\/Makefile\.am" \
125                 -e "^--- .*\/configure\.ac" \
126                 -e "^--- .*\/configure\.in" \
127             debian/patches/*; then \
128                 if [ ! -f build/autogen.sh ]; then \
129                         echo "You have patches which require autogen.sh to be run, but it doesn't exist"; \
130                         echo "Please see https://bugzilla.lustre.org/attachment.cgi?id=27156"; \
131                         exit 1; \
132                 fi; \
133                 cp /usr/share/misc/config.sub config.sub; \
134                 cp /usr/share/misc/config.sub ldiskfs/config.sub; \
135                 cp /usr/share/misc/config.guess config.guess; \
136                 cp /usr/share/misc/config.guess ldiskfs/config.guess; \
137                 bash build/autogen.sh; \
138         fi; \
139         touch $@
140
141 # This section configures the lustre-utilities packages.
142 #
143 # Both client and server builds are quite similar, as the utilities build
144 # must create the modules too, to produce the "osd_<fstype>.so" libraries.
145 #
146 # The main difference is that the utilities build does not archive the
147 # modules, whereas the modules build omits the utilities, to create two
148 # neatly separated debian files.
149 #
150 # Note: KERNEL_SRC, KERNEL_OBJ, ZFS_SRC and SPL_SRC need to be set from the
151 # outside. This is done by "make debs". As such, invoking "debuild" or such
152 # direct debian build tools will lead to a client-only build.
153 configure: configure-stamp
154 configure-stamp: autogen-stamp debian/control.main debian/control.modules.in
155         dh_testdir
156         # touch files to same date, to avoid auto*
157         find . -type f -print0 | xargs -0 touch -r COPYING; \
158         if [ "$(BUILDDIR)" != "." ]; then \
159                 mkdir -p $(BUILDDIR)/build $(BUILDDIR)/lustre/contrib; \
160                 cp build/Makefile $(BUILDDIR)/build/; \
161         fi
162         # Determine flags that are different between server/client module builds
163         echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"
164         if echo "$${DEB_BUILD_PROFILES}" | grep -q "server"; then \
165                 export EXTRAFLAGS="--enable-server"; \
166                 if echo "$${DEB_BUILD_PROFILES}" | grep -q "systemd"; then \
167                         cp debian/lustre-server-utils.install.in \
168                                 debian/lustre-server-utils.install; \
169                 else \
170                         sed /systemd/d debian/lustre-server-utils.install.in \
171                                 > debian/lustre-server-utils.install; \
172                 fi; \
173         else \
174                 export EXTRAFLAGS="--disable-server"; \
175                 if echo "$${DEB_BUILD_PROFILES}" | grep -q "systemd"; then \
176                         cp debian/lustre-client-utils.install.in \
177                                 debian/lustre-client-utils.install; \
178                 else \
179                         sed /systemd/d debian/lustre-client-utils.install.in \
180                                 > debian/lustre-client-utils.install; \
181                 fi; \
182         fi; \
183         if echo "$${DEB_BUILD_PROFILES}" | grep -q "zfs"; then \
184                 export EXTRAFLAGS="$${EXTRAFLAGS} --with-zfs=$${ZFS_SRC} --with-spl=$${SPL_SRC}"; \
185         else \
186                 export EXTRAFLAGS="$${EXTRAFLAGS} --without-zfs" ; \
187         fi; \
188         if echo "$${DEB_BUILD_PROFILES}" | grep -q "ldiskfs"; then \
189                 export EXTRAFLAGS="$${EXTRAFLAGS} \
190                         --enable-ldiskfs --enable-quilt"; \
191         else \
192                 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-ldiskfs"; \
193         fi; \
194         if echo "$${DEB_BUILD_PROFILES}" | grep -q "o2ib"; then \
195                 export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=$${O2IB_SRC}"; \
196         fi; \
197         options="gss crypto pinger checksum flock health_write lru-resize"; \
198         options="$${options} mindf fail-alloc invariants lu_ref pgstate-track"; \
199         options="$${options} libcfs-cdebug libcfs-trace libcfs-assert"; \
200         options="$${options} panic_dumplog readline libpthread"; \
201         options="$${options} backoff gni efence"; \
202         for option in $${options}; do \
203                 if echo "$${DEB_BUILD_PROFILES}" | grep -qw "$${option}"; then \
204                         export EXTRAFLAGS="$${EXTRAFLAGS} --enable-$${option}"; \
205                 elif echo "$${DEB_BUILD_PROFILES}" | grep -qw "no$${option}"; then \
206                         export EXTRAFLAGS="$${EXTRAFLAGS} --disable-$${option}"; \
207                 fi; \
208         done; \
209         if [ -f "$${CONFIG_CACHE_FILE}" ]; then \
210                 export TMP_CACHE_FILE=$$(mktemp); \
211                 sed -e "/ac_cv_env/d" \
212                     -e "/am_cv_CC_dependencies_compiler_type/d" \
213                     -e "/lb_cv_mpi_tests/d" \
214                        "$${CONFIG_CACHE_FILE}" > $${TMP_CACHE_FILE}; \
215                 export EXTRAFLAGS="$${EXTRAFLAGS} --cache-file=$${TMP_CACHE_FILE}"; \
216         fi; \
217         echo "Final value of EXTRAFLAGS: $${EXTRAFLAGS}"; \
218         ( cd $(BUILDDIR) && \
219                 $(SRCDIR)/configure --disable-dependency-tracking \
220                         --with-linux=$${KERNEL_SRC} \
221                         --with-linux-obj=$${KERNEL_OBJ} \
222                         --enable-quota \
223                         $${EXTRAFLAGS} \
224                         $(EXTRA_OPTIONS) \
225         ); \
226         touch $@
227
228 build-arch build-indep: build
229
230 build: build-stamp
231 build-stamp: patch-stamp configure-stamp
232         dh_testdir
233         $(MAKE) -C $(BUILDDIR) $(PMAKEARGS)
234         $(MAKE) -C $(BUILDDIR) DESTDIR=$(TOP_DIR)/debian/tmp install
235         # jump our lustre-[client|server]-modules into the control file if not using m-a
236         if ! $(USE_MA); then \
237                 (cat debian/control.main; sed -e '1,/^$$/d' -e "s/_KVERS_/$(KVER)/g" < debian/control.modules.in) > debian/control; \
238                 for file in debian/*_KVERS_*; do \
239                         newfile=$$(echo $$file | sed -e "s/_KVERS_/$(KVER)/g"); \
240                         cp $$file $$newfile; \
241                 done; \
242         fi
243         touch $@
244
245 # let's try and operate as close as the user would and not build modules
246 # here (for now)
247 # instead we will build the modules with m-a in the "make debs" target
248 # binary-arch: binary-$(UTILS_PKG) binary-$(TESTS_PKG) binary-$(DEV_PKG) \
249 # binary-$(MODS_PKG) binary-kern-mods
250 binary-arch: binary-$(UTILS_PKG) binary-$(DEV_PKG) \
251              binary-$(IOKIT_PKG) binary-$(TESTS_PKG) \
252              $(RESOURCE_TARGET)
253
254 binary-indep: binary-$(SOURCE_PKG) $(DKMS_TARGET)
255
256 binary: binary-indep binary-arch
257
258 binary-$(UTILS_PKG): build-stamp
259         dh_testdir
260         dh_testroot
261         dh_installdirs -p $(UTILS_PKG)
262         dh_installdocs -p  $(UTILS_PKG)
263         dh_installman -p $(UTILS_PKG)
264         dh_install -p $(UTILS_PKG)
265         rm -rf debian/$(UTILS_PKG)/usr/bin/iokit-* \
266                debian/$(UTILS_PKG)/usr/bin/*-survey \
267                debian/$(UTILS_PKG)/usr/bin/mcreate \
268                debian/$(UTILS_PKG)/usr/bin/statx \
269                debian/$(UTILS_PKG)/usr/sbin/wirecheck \
270                debian/$(UTILS_PKG)/usr/sbin/wiretest
271         dh_makeshlibs -p $(UTILS_PKG)
272         dh_installexamples -p $(UTILS_PKG)
273         dh_installchangelogs -p $(UTILS_PKG) lustre/ChangeLog
274         dh_compress -p $(UTILS_PKG)
275         dh_strip -p $(UTILS_PKG)
276         dh_installdeb -p $(UTILS_PKG)
277         dh_fixperms -p $(UTILS_PKG)
278         dh_gencontrol -p $(UTILS_PKG)
279         dh_md5sums -p $(UTILS_PKG)
280         dh_builddeb -p $(UTILS_PKG)
281
282 binary-$(RESOURCE_PKG): build-stamp
283         dh_testdir
284         dh_testroot
285         dh_installdirs -p $(RESOURCE_PKG)
286         dh_installdocs -p  $(RESOURCE_PKG)
287         dh_installman -p $(RESOURCE_PKG)
288         dh_install -p $(RESOURCE_PKG)
289         dh_makeshlibs -p $(RESOURCE_PKG)
290         dh_installexamples -p $(RESOURCE_PKG)
291         dh_installchangelogs -p $(RESOURCE_PKG) lustre/ChangeLog
292         dh_compress -p $(RESOURCE_PKG)
293         dh_strip -p $(RESOURCE_PKG)
294         dh_installdeb -p $(RESOURCE_PKG)
295         dh_fixperms -p $(RESOURCE_PKG)
296         dh_gencontrol -p $(RESOURCE_PKG)
297         dh_md5sums -p $(RESOURCE_PKG)
298         dh_builddeb -p $(RESOURCE_PKG)
299
300 binary-$(IOKIT_PKG): build-stamp
301         dh_testdir
302         dh_testroot
303         dh_installdirs -p $(IOKIT_PKG)
304         dh_installdocs -p  $(IOKIT_PKG)
305         dh_installman -p $(IOKIT_PKG)
306         dh_install -p $(IOKIT_PKG)
307         rm -rf debian/$(IOKIT_PKG)/usr/bin/lustre_req_history \
308                debian/$(IOKIT_PKG)/usr/bin/*ll*stat \
309                debian/$(IOKIT_PKG)/usr/bin/lfs-*
310         dh_makeshlibs -p $(IOKIT_PKG)
311         dh_installexamples -p $(IOKIT_PKG)
312         dh_installchangelogs -p $(IOKIT_PKG) lustre/ChangeLog
313         dh_compress -p $(IOKIT_PKG)
314         dh_strip -p $(IOKIT_PKG)
315         dh_installdeb -p $(IOKIT_PKG)
316         dh_fixperms -p $(IOKIT_PKG)
317         dh_gencontrol -p $(IOKIT_PKG)
318         dh_md5sums -p $(IOKIT_PKG)
319         dh_builddeb -p $(IOKIT_PKG)
320
321 binary-$(TESTS_PKG): build-stamp
322         dh_testdir
323         dh_testroot
324         dh_installdirs -p $(TESTS_PKG)
325         dh_installdocs -p  $(TESTS_PKG)
326         dh_installman -p $(TESTS_PKG)
327         dh_install -p $(TESTS_PKG)
328         dh_makeshlibs -p $(TESTS_PKG)
329         dh_installexamples -p $(TESTS_PKG)
330         dh_installchangelogs -p $(TESTS_PKG) lustre/ChangeLog
331         dh_compress -p $(TESTS_PKG)
332         dh_strip -p $(TESTS_PKG)
333         dh_installdeb -p $(TESTS_PKG)
334         dh_fixperms -p $(TESTS_PKG)
335         dh_gencontrol -p $(TESTS_PKG)
336         dh_md5sums -p $(TESTS_PKG)
337         dh_builddeb -p $(TESTS_PKG)
338
339 binary-$(DEV_PKG): build-stamp
340         dh_testdir
341         dh_testroot
342         dh_installdirs -p $(DEV_PKG)
343         dh_install -p $(DEV_PKG)
344         dh_installdocs -p $(DEV_PKG)
345         dh_installchangelogs -p $(DEV_PKG) lustre/ChangeLog
346         dh_compress -p $(DEV_PKG)
347         dh_installdeb -p $(DEV_PKG)
348         dh_fixperms -p $(DEV_PKG)
349         dh_gencontrol -p $(DEV_PKG)
350         dh_md5sums -p $(DEV_PKG)
351         dh_builddeb -p $(DEV_PKG)
352
353 binary-$(SOURCE_PKG): build-stamp
354         dh_testdir 
355         dh_testroot
356         # Copy everything 
357         dh_installdirs -p $(SOURCE_PKG) usr/src/modules/lustre/debian
358         rsync -av --exclude='debian/$(SOURCE_PKG)/*' \
359               --link-dest=$(PWD) \
360               . debian/$(SOURCE_PKG)/usr/src/modules/lustre
361         # Remove FULLCLEAN setting
362         rm debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/rules
363         cp -v debian/rules debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/rules
364         sed -i -e 's/FULLCLEAN=full-clean/FULLCLEAN=/' debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/rules
365         # clean up dest
366         rm -rf debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/patched \
367                debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/patches/* 
368         $(MAKE) -C debian/$(SOURCE_PKG)/usr/src/modules/lustre -f debian/rules clean
369         # Create the module-source tarball.
370         cd debian/$(SOURCE_PKG)/usr/src && tar --exclude-vcs -jcf lustre-$${SRC_GIT_HASH}.tar.bz2 modules
371         rm -rf debian/$(SOURCE_PKG)/usr/src/modules
372         dh_install -p$(SOURCE_PKG)
373         dh_installchangelogs -p $(SOURCE_PKG) lustre/ChangeLog
374         dh_installdocs -p $(SOURCE_PKG) 
375         dh_link -p $(SOURCE_PKG) /usr/share/modass/packages/default.sh /usr/share/modass/overrides/lustre-source
376         dh_compress -p $(SOURCE_PKG)
377         dh_installdeb -p $(SOURCE_PKG)
378         dh_fixperms -p $(SOURCE_PKG)
379         dh_gencontrol -p $(SOURCE_PKG)
380         dh_md5sums -p $(SOURCE_PKG)
381         dh_builddeb -p $(SOURCE_PKG)
382
383 binary-$(DKMS_PKG): build-stamp
384         dh_testdir
385         dh_testroot
386         # Create /usr/src/lustre-client-modules-<version>
387         dh_installdirs -p $(DKMS_PKG) usr/src/lustre-client-modules-$(UPVERSION)
388         # Copy the source
389         rsync -av --exclude='debian/$(DKMS_PKG)/*' --exclude='.git/' \
390                 --link-dest=$(PWD) \
391                 . debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION)
392         # Clean it up
393         $(MAKE) -C debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION) -f debian/rules clean
394
395         # Put the DKMS configuration file in place
396         sed -e 's/[@]UPVERSION[@]/$(UPVERSION)/' debian/dkms.conf.in > debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION)/dkms.conf
397         dh_install -p $(DKMS_PKG)
398         dh_installchangelogs -p $(DKMS_PKG) lustre/ChangeLog
399         dh_installdocs -p $(DKMS_PKG)
400         dh_compress -p $(DKMS_PKG)
401         dh_installdeb -p $(DKMS_PKG)
402         dh_strip -p $(DKMS_PKG)
403         dh_fixperms -p $(DKMS_PKG)
404         dh_gencontrol -p $(DKMS_PKG)
405         dh_md5sums -p $(DKMS_PKG)
406         dh_builddeb -p $(DKMS_PKG)
407
408 # if only we could use m-a for this, but this stupid "compliant.list"
409 # thing fouls that up
410 binary-kern-mods:
411         # Build client or server modules
412         mkdir -p debian/m-a_root/usr_src/modules
413         ln -s ../../../../ debian/m-a_root/usr_src/modules/lustre
414         m-a -t -u debian/m-a_root/ -d -v -k $(KSRC) build lustre
415         mv -f debian/m-a_root/*.deb ..
416
417 # an alternative (to module-assistant) method of building the kernel modules
418 binary-$(MODS_PKG): build-stamp
419         if ! $(USE_MA); then \
420                 cp debian/$(MODS_PKG).install debian/$(MODS_PKG)-$(KVER).install ; \
421                 dh_testdir; \
422                 dh_testroot; \
423                 dh_installdirs -p $(MODS_PKG)-$(KVER); \
424                 dh_installdocs -p $(MODS_PKG)-$(KVER); \
425                 dh_install -p $(MODS_PKG)-$(KVER); \
426                 dh_makeshlibs -p $(MODS_PKG)-$(KVER); \
427                 dh_installchangelogs -p $(MODS_PKG)-$(KVER) lustre/ChangeLog; \
428                 dh_compress -p $(MODS_PKG)-$(KVER); \
429                 dh_installdeb -p $(MODS_PKG)-$(KVER); \
430                 dh_strip -p $(MODS_PKG)-$(KVER); \
431                 dh_fixperms -p $(MODS_PKG)-$(KVER); \
432                 dh_gencontrol -p $(MODS_PKG)-$(KVER); \
433                 dh_md5sums -p $(MODS_PKG)-$(KVER); \
434                 dh_builddeb -p $(MODS_PKG)-$(KVER); \
435         fi
436
437
438 ###
439 ### For module-assistant
440 ###
441
442 # the kdist_clean target is called by make-kpkg modules_clean and from
443 # kdist* rules. It is responsible for cleaning up any changes that have
444 # been made by the other kdist_commands (except for the .deb files created)
445
446 kdist_clean: 
447         # can't dh_clean here or we remove the build artifacts for the other packages
448         # still in progress
449         #dh_clean
450         #-$(MAKE) $(MFLAGS) -f debian/rules clean
451         # put the userspace tools' control file back
452         cp debian/control.main debian/control
453
454
455 # module assistant calculates all needed things for us and sets
456 # # following variables:
457 # # KSRC (kernel source directory), KVERS (kernel version string), KDREV
458 # # (revision of the Debian kernel-image package), CC (the correct
459 # # compiler), VERSION (the final package version string), PKGNAME (full
460 # # package name with KVERS included), DEB_DESTDIR (path to store DEBs)
461 #
462 # # The kdist_configure target is called by make-kpkg modules_config and
463 # # by kdist* rules by dependency. It should configure the module so it is
464 # # ready for compilation (mostly useful for calling configure).
465 # # prep-deb-files from module-assistant creates the neccessary debian/ 
466 kdist_config: prep-deb-files patch-stamp
467         #  Check build dependencies again, needs to be done since we just
468         # replaced the control file.
469         dpkg-checkbuilddeps
470         # Prepare the kernel to lustres' liking
471         # as non-root, we won't have permission for this
472         #-$(MAKE) -C $(KSRC) prepare scripts
473         # touch files to same date, to avoid auto*
474         find . -type f -print0 | xargs -0 touch -r COPYING \;
475         # Determine flags that are different between server/client module builds
476         # Note: It doesn't seem possible to *only* build modules.
477         echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"
478         if echo "$${DEB_BUILD_PROFILES}" | grep -q "server"; then \
479                 export EXTRAFLAGS="--enable-server"; \
480         else \
481                 export EXTRAFLAGS="--disable-server"; \
482         fi; \
483         if echo "$${DEB_BUILD_PROFILES}" | grep -q "zfs"; then \
484                 export EXTRAFLAGS="$${EXTRAFLAGS} --with-zfs=$${ZFS_SRC} --with-spl=$${SPL_SRC}"; \
485         else \
486                 export EXTRAFLAGS="$${EXTRAFLAGS} --without-zfs" ; \
487         fi; \
488         if echo "$${DEB_BUILD_PROFILES}" | grep -q "ldiskfs"; then \
489                 export EXTRAFLAGS="$${EXTRAFLAGS} \
490                         --enable-ldiskfs --enable-quilt"; \
491         else \
492                 export EXTRAFLAGS="$${EXTRAFLAGS} \
493                         --disable-ldiskfs --disable-quilt"; \
494         fi; \
495         if echo "$${DEB_BUILD_PROFILES}" | grep -q "o2ib"; then \
496                 export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=$${O2IB_SRC}"; \
497         fi; \
498         options="gss crypto pinger checksum flock health_write lru-resize"; \
499         options="$${options} mindf fail-alloc invariants lu_ref pgstate-track"; \
500         options="$${options} libcfs-cdebug libcfs-trace libcfs-assert"; \
501         options="$${options} panic_dumplog readline libpthread"; \
502         options="$${options} backoff gni efence"; \
503         for option in $${options}; do \
504                 if echo "$${DEB_BUILD_PROFILES}" | grep -qw "$${option}"; then \
505                         export EXTRAFLAGS="$${EXTRAFLAGS} --enable-$${option}"; \
506                 elif echo "$${DEB_BUILD_PROFILES}" | grep -qw "no$${option}"; then \
507                         export EXTRAFLAGS="$${EXTRAFLAGS} --disable-$${option}"; \
508                 fi; \
509         done; \
510         if [ -f "$${CONFIG_CACHE_FILE}" ]; then \
511                 export TMP_CACHE_FILE=$$(mktemp --tmpdir newconfig-XXXXXXXX.cache); \
512                 sed -e "/ac_cv_env/d" \
513                     -e "/am_cv_CC_dependencies_compiler_type/d" \
514                     -e "/lb_cv_mpi_tests/d" \
515                        "$${CONFIG_CACHE_FILE}" > $${TMP_CACHE_FILE}; \
516                 export EXTRAFLAGS="$${EXTRAFLAGS} --cache-file=$${TMP_CACHE_FILE}"; \
517         fi; \
518         echo "Final value of EXTRAFLAGS: $${EXTRAFLAGS}"; \
519         ./configure --with-linux=$(KSRC_TREE) \
520                 --with-linux-obj=$(KSRC) \
521                 --disable-dependency-tracking \
522                 --disable-doc  \
523                 --disable-iokit \
524                 --disable-tests \
525                 --enable-quota \
526                 --with-kmp-moddir=updates/kernel \
527                 $${EXTRAFLAGS} \
528                 $(EXTRA_OPTIONS)
529
530
531 kdist_configure: kdist_config
532
533 # the binary-modules rule is invoked by module-assistant while processing the
534 # kdist* targets. It is called by module-assistant or make-kpkg and *not*
535 # during a normal build
536 binary-modules: prep-deb-files
537         dh_testroot
538         dh_prep
539         $(MAKE) $(PMAKEARGS)
540         $(MAKE) install DESTDIR=$(CURDIR)/debian/$(PKGNAME)
541         # Remove stuff that doesn't belong (no module-only target)
542         cd $(CURDIR)/debian/$(PKGNAME) && rm -rf usr/bin usr/sbin usr/lib usr/share usr/include/lustre lib/systemd sbin etc
543         dh_installdocs -p$(PKGNAME)
544         dh_installchangelogs -p$(PKGNAME)
545         dh_installmodules -p $(PKGNAME)
546         dh_compress -p $(PKGNAME)
547         dh_fixperms -p $(PKGNAME)
548         sed "s/depmod -a/depmod -a $(KVERS)/" $(CURDIR)/debian/postinst > $(CURDIR)/debian/$(PKGNAME).postinst
549         sed "s/depmod -a/depmod -a $(KVERS)/" $(CURDIR)/debian/postrm > $(CURDIR)/debian/$(PKGNAME).postrm
550         chmod +x $(CURDIR)/debian/$(PKGNAME).postinst $(CURDIR)/debian/$(PKGNAME).postrm
551         dh_installdeb -p $(PKGNAME)
552         dh_gencontrol -- -v$(VERSION)
553         dh_md5sums -p $(PKGNAME)
554         dh_builddeb --destdir=$(DEB_DESTDIR) -p $(PKGNAME)
555         dh_prep -p $(PKGNAME)
556
557 clean:
558         dh_testdir
559         dh_testroot
560         dpatch deapply-all -v
561         -$(MAKE) distclean
562         rm -rf  debian/substvars debian/*.bak debian/*~ *~  *-stamp
563         ls -d debian/lustre-*-modules-* | grep -v _KVERS_ | grep -v dkms | xargs rm -f || true
564         # only remove this if the clean was not called from kdist_clean
565         if [ "$$MA_SOURCE_PKG" = "" ]; then \
566                 rm -rf  debian/m-a_root; \
567         fi
568         dh_clean
569         # make sure we have at least a basic control in place (see build-stamp)
570         rm -f debian/control
571         cp debian/control.main debian/control
572
573 patch: patch-stamp
574 patch-stamp:
575         dpatch apply-all -v
576         touch $@
577
578 unpatch:
579         dpatch deapply-all -v
580         rm -rf debian/patched patch-stamp
581
582 .PHONY: binary-arch clean source diff  binary binary-indep binary-arch install configure