2 # SPDX-License-Identifier: NOASSERTION
5 # This file is part of Lustre, http://www.lustre.org/
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)
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
20 # Uncomment this to turn on verbose mode.
23 DEB_BUILD_GNU_SYSTEM = $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM)
24 DEB_BUILD_GNU_CPU = $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU)
27 # whether to use module-assistant to build the kernel modules or not
30 # Whether to build the DKMS packages
33 ifeq ($(BUILD_DKMS),true)
34 DKMS_TARGET = binary-$(DKMS_PKG)
40 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
46 # This is the debhelper compatibility version to use.
49 # Module-assistant stuff
50 ifneq (,$(findstring server,$(DEB_BUILD_PROFILES)))
51 PACKAGE=lustre-server-modules
53 PACKAGE=lustre-client-modules
55 MA_DIR ?= /usr/share/modass
56 -include $(MA_DIR)/include/generic.make
57 -include $(MA_DIR)/include/common-rules.make
59 ARCH=$(shell dpkg --print-architecture)
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/-[^-]*$$//')
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
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
76 EXTRA_OPTIONS?=$(IB_OPTIONS)
78 ifneq ($(SYSTEMD_OPTIONS),)
79 EXTRA_OPTIONS += $(SYSTEMD_OPTIONS)
82 # Packages provided for both client and server builds
84 SOURCE_PKG=lustre-source
86 ifneq (,$(findstring notests,$(DEB_BUILD_PROFILES)))
90 TESTS_PKG=lustre-tests
91 BINARY_TESTS_PKG=binary-$(TESTS_PKG)
94 ifneq (,$(findstring noiokit,$(DEB_BUILD_PROFILES)))
98 IOKIT_PKG=lustre-iokit
99 BINARY_IOKIT_PKG=binary-$(IOKIT_PKG)
102 # Packages that are only built for server OR client builds
103 # The difference is that server build contain more modules & utils
104 ifneq (,$(findstring server,$(DEB_BUILD_PROFILES)))
105 ifneq (,$(findstring noutils,$(DEB_BUILD_PROFILES)))
109 UTILS_PKG=lustre-server-utils
110 BINARY_UTILS_PKG=binary-$(UTILS_PKG)
112 MODS_PKG=lustre-server-modules
113 RESOURCE_PKG=lustre-resource-agents
114 RESOURCE_TARGET=binary-$(RESOURCE_PKG)
117 ifneq (,$(findstring noutils,$(DEB_BUILD_PROFILES)))
121 UTILS_PKG=lustre-client-utils
122 BINARY_UTILS_PKG=binary-$(UTILS_PKG)
124 MODS_PKG=lustre-client-modules
127 DKMS_PKG=lustre-client-modules-dkms
131 #BUILDDIR=debian/build
133 # I'm afraid we seem to have broken the BUILDDIR concept in Lustre's
138 AVAIL_CPUS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
139 ifneq ($(AVAIL_CPUS),1)
140 PMAKEARGS := -j $(AVAIL_CPUS)
143 autogen: autogen-stamp
144 autogen-stamp: patch-stamp
145 # see if any patches requires us to run autogen
146 # (for a distribution release tarball, it is expected that if
147 # downstream adds any patches that requires autogen.sh to be
148 # run, a patch will be added by downstream to install the
149 # needed autogen.sh scripts
150 # see https://bugzilla.lustre.org/attachment.cgi?id=27156
152 if grep -e "^--- .*\/autoconf\/" \
153 -e "^--- .*\/autoMakefile\.am" \
154 -e "^--- .*\/Makefile\.am" \
155 -e "^--- .*\/configure\.ac" \
156 -e "^--- .*\/configure\.in" \
157 debian/patches/*; then \
158 if [ ! -f build/autogen.sh ]; then \
159 echo "You have patches which require autogen.sh to be run, but it doesn't exist"; \
160 echo "Please see https://bugzilla.lustre.org/attachment.cgi?id=27156"; \
163 cp /usr/share/misc/config.sub config.sub; \
164 cp /usr/share/misc/config.sub ldiskfs/config.sub; \
165 cp /usr/share/misc/config.guess config.guess; \
166 cp /usr/share/misc/config.guess ldiskfs/config.guess; \
167 bash build/autogen.sh; \
171 # This section configures the lustre-utilities packages.
173 # Both client and server builds are quite similar, as the utilities build
174 # must create the modules too, to produce the "osd_<fstype>.so" libraries.
176 # The main difference is that the utilities build does not archive the
177 # modules, whereas the modules build omits the utilities, to create two
178 # neatly separated debian files.
180 # Note: KERNEL_SRC, KERNEL_OBJ, ZFS_SRC and SPL_SRC need to be set from the
181 # outside. This is done by "make debs". As such, invoking "debuild" or such
182 # direct debian build tools will lead to a client-only build.
183 configure: configure-stamp
184 configure-stamp: autogen-stamp debian/control.main debian/control.modules.in
186 # touch files to same date, to avoid auto*
187 find . -type f -print0 | xargs -0 touch -r COPYING; \
188 if [ "$(BUILDDIR)" != "." ]; then \
189 mkdir -p $(BUILDDIR)/build $(BUILDDIR)/lustre/contrib; \
190 cp build/Makefile $(BUILDDIR)/build/; \
192 # Determine flags that are different between server/client module builds
193 echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"
194 if echo "$${DEB_BUILD_PROFILES}" | grep -q "server"; then \
195 export EXTRAFLAGS="--enable-server"; \
196 if echo "$${DEB_BUILD_PROFILES}" | grep -q "systemd"; then \
197 systemd_dir=$$(echo $${SYSTEMD_OPTIONS} | \
198 sed -e "s/--with-systemdsystemunitdir=\///g" \
199 -e "s/\//\\\\\//g"); \
200 sed "s/lib\/systemd\/system/$${systemd_dir}/g" \
201 debian/lustre-server-utils.install.in \
202 > debian/lustre-server-utils.install; \
204 sed /systemd/d debian/lustre-server-utils.install.in \
205 > debian/lustre-server-utils.install; \
208 export EXTRAFLAGS="--disable-server"; \
209 if echo "$${DEB_BUILD_PROFILES}" | grep -q "systemd"; then \
210 systemd_dir=$$(echo $${SYSTEMD_OPTIONS} | \
211 sed -e "s/--with-systemdsystemunitdir=\///g" \
212 -e "s/\//\\\\\//g"); \
213 sed "s/lib\/systemd\/system/$${systemd_dir}/g" \
214 debian/lustre-client-utils.install.in \
215 > debian/lustre-client-utils.install; \
217 sed /systemd/d debian/lustre-client-utils.install.in \
218 > debian/lustre-client-utils.install; \
221 if echo "$${DEB_BUILD_PROFILES}" | grep -q "nompi"; then \
222 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-mpitests" ; \
224 if echo "$${DEB_BUILD_PROFILES}" | grep -q "notests"; then \
225 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-tests"; \
227 if echo "$${DEB_BUILD_PROFILES}" | grep -q "noutils"; then \
228 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-utils"; \
230 if echo "$${DEB_BUILD_PROFILES}" | grep -q "noiokit"; then \
231 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-iokit"; \
233 if echo "$${DEB_BUILD_PROFILES}" | grep -q "zfs"; then \
234 export EXTRAFLAGS="$${EXTRAFLAGS} --with-zfs=$${ZFS_SRC} --with-spl=$${SPL_SRC}"; \
236 export EXTRAFLAGS="$${EXTRAFLAGS} --without-zfs" ; \
238 if echo "$${DEB_BUILD_PROFILES}" | grep -q "ldiskfs"; then \
239 export EXTRAFLAGS="$${EXTRAFLAGS} \
240 --enable-ldiskfs --enable-quilt"; \
242 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-ldiskfs"; \
244 if echo "$${DEB_BUILD_PROFILES}" | grep -q "multiple-lnds"; then \
245 export EXTRAFLAGS="$${EXTRAFLAGS} --enable-multiple-lnds"; \
247 if echo "$${DEB_BUILD_PROFILES}" | grep -q "ext_o2ib"; then \
248 export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=$${O2IB_SRC}"; \
249 elif echo "$${DEB_BUILD_PROFILES}" | grep -q "int_o2ib"; then \
250 export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=yes"; \
252 export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=no"; \
254 if echo "$${DEB_BUILD_PROFILES}" | grep -q "gnilnd"; then \
255 export EXTRAFLAGS="$${EXTRAFLAGS} --enable-gni"; \
257 if echo "$${DEB_BUILD_PROFILES}" | grep -q "kfilnd"; then \
258 export EXTRAFLAGS="$${EXTRAFLAGS} --with-kfi=/usr/src/kfabric"; \
260 options="gss crypto pinger checksum flock lru-resize"; \
261 options="$${options} mindf fail-alloc invariants lu_ref pgstate-track"; \
262 options="$${options} libcfs-cdebug libcfs-trace libcfs-assert"; \
263 options="$${options} panic_dumplog readline libpthread"; \
264 options="$${options} backoff gni efence"; \
265 for option in $${options}; do \
266 if echo "$${DEB_BUILD_PROFILES}" | grep -qw "$${option}"; then \
267 export EXTRAFLAGS="$${EXTRAFLAGS} --enable-$${option}"; \
268 elif echo "$${DEB_BUILD_PROFILES}" | grep -qw "no$${option}"; then \
269 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-$${option}"; \
272 if [ -f "$${CONFIG_CACHE_FILE}" ]; then \
273 export TMP_CACHE_FILE=$$(mktemp); \
274 sed -e "/ac_cv_env/d" \
275 -e "/am_cv_CC_dependencies_compiler_type/d" \
276 -e "/lb_cv_mpi_tests/d" \
277 "$${CONFIG_CACHE_FILE}" > $${TMP_CACHE_FILE}; \
278 export EXTRAFLAGS="$${EXTRAFLAGS} --cache-file=$${TMP_CACHE_FILE}"; \
280 echo "Final value of EXTRAFLAGS: $${EXTRAFLAGS}"; \
281 ( cd $(BUILDDIR) && \
282 $(SRCDIR)/configure --disable-dependency-tracking \
283 --with-linux=$${KERNEL_SRC} \
284 --with-linux-obj=$${KERNEL_OBJ} \
286 --with-kmp-moddir=updates/kernel \
292 build-arch build-indep: build
295 build-stamp: patch-stamp configure-stamp
297 $(MAKE) -C $(BUILDDIR) $(PMAKEARGS)
298 $(MAKE) -C $(BUILDDIR) DESTDIR=$(TOP_DIR)/debian/tmp install
299 # jump our lustre-[client|server]-modules into the control file if not using m-a
300 if ! $(USE_MA); then \
301 (cat debian/control.main; sed -e '1,/^$$/d' -e "s/_KVERS_/$(KVER)/g" < debian/control.modules.in) > debian/control; \
302 for file in debian/*_KVERS_*; do \
303 newfile=$$(echo $$file | sed -e "s/_KVERS_/$(KVER)/g"); \
304 cp $$file $$newfile; \
309 # let's try and operate as close as the user would and not build modules
311 # instead we will build the modules with m-a in the "make debs" target
312 # binary-arch: binary-$(UTILS_PKG) binary-$(TESTS_PKG) binary-$(DEV_PKG) \
313 # binary-$(MODS_PKG) binary-kern-mods
314 binary-arch: binary-$(DEV_PKG) \
315 $(BINARY_UTILS_PKG) $(BINARY_IOKIT_PKG) $(BINARY_TESTS_PKG) \
318 binary-indep: binary-$(SOURCE_PKG) $(DKMS_TARGET)
320 binary: binary-indep binary-arch
322 binary-$(UTILS_PKG): build-stamp
325 dh_installdirs -p $(UTILS_PKG)
326 dh_installdocs -p $(UTILS_PKG)
327 dh_installman -p $(UTILS_PKG)
328 dh_install -p $(UTILS_PKG)
329 rm -rf debian/$(UTILS_PKG)/usr/bin/iokit-* \
330 debian/$(UTILS_PKG)/usr/bin/*-survey \
331 debian/$(UTILS_PKG)/usr/bin/mcreate \
332 debian/$(UTILS_PKG)/usr/bin/statx \
333 debian/$(UTILS_PKG)/usr/sbin/wirecheck \
334 debian/$(UTILS_PKG)/usr/sbin/wiretest
335 dh_makeshlibs -p $(UTILS_PKG)
336 dh_installexamples -p $(UTILS_PKG)
337 dh_installchangelogs -p $(UTILS_PKG) lustre/ChangeLog
338 dh_compress -p $(UTILS_PKG)
339 dh_strip -p $(UTILS_PKG)
340 dh_installdeb -p $(UTILS_PKG)
341 dh_fixperms -p $(UTILS_PKG)
342 dh_gencontrol -p $(UTILS_PKG)
343 dh_md5sums -p $(UTILS_PKG)
344 dh_builddeb -p $(UTILS_PKG)
346 binary-$(RESOURCE_PKG): build-stamp
349 dh_installdirs -p $(RESOURCE_PKG)
350 dh_installdocs -p $(RESOURCE_PKG)
351 dh_installman -p $(RESOURCE_PKG)
352 dh_install -p $(RESOURCE_PKG)
353 dh_makeshlibs -p $(RESOURCE_PKG)
354 dh_installexamples -p $(RESOURCE_PKG)
355 dh_installchangelogs -p $(RESOURCE_PKG) lustre/ChangeLog
356 dh_compress -p $(RESOURCE_PKG)
357 dh_strip -p $(RESOURCE_PKG)
358 dh_installdeb -p $(RESOURCE_PKG)
359 dh_fixperms -p $(RESOURCE_PKG)
360 dh_gencontrol -p $(RESOURCE_PKG)
361 dh_md5sums -p $(RESOURCE_PKG)
362 dh_builddeb -p $(RESOURCE_PKG)
364 binary-$(IOKIT_PKG): build-stamp
367 dh_installdirs -p $(IOKIT_PKG)
368 dh_installdocs -p $(IOKIT_PKG)
369 dh_installman -p $(IOKIT_PKG)
370 dh_install -p $(IOKIT_PKG)
371 rm -rf debian/$(IOKIT_PKG)/usr/bin/lustre_req_history \
372 debian/$(IOKIT_PKG)/usr/bin/*ll*stat \
373 debian/$(IOKIT_PKG)/usr/bin/lfs-*
374 dh_makeshlibs -p $(IOKIT_PKG)
375 dh_installexamples -p $(IOKIT_PKG)
376 dh_installchangelogs -p $(IOKIT_PKG) lustre/ChangeLog
377 dh_compress -p $(IOKIT_PKG)
378 dh_strip -p $(IOKIT_PKG)
379 dh_installdeb -p $(IOKIT_PKG)
380 dh_fixperms -p $(IOKIT_PKG)
381 dh_gencontrol -p $(IOKIT_PKG)
382 dh_md5sums -p $(IOKIT_PKG)
383 dh_builddeb -p $(IOKIT_PKG)
385 binary-$(TESTS_PKG): build-stamp
388 dh_installdirs -p $(TESTS_PKG)
389 dh_installdocs -p $(TESTS_PKG)
390 dh_installman -p $(TESTS_PKG)
391 dh_install -p $(TESTS_PKG)
392 dh_makeshlibs -p $(TESTS_PKG)
393 dh_installexamples -p $(TESTS_PKG)
394 dh_installchangelogs -p $(TESTS_PKG) lustre/ChangeLog
395 dh_compress -p $(TESTS_PKG)
396 dh_strip -p $(TESTS_PKG)
397 dh_installdeb -p $(TESTS_PKG)
398 dh_fixperms -p $(TESTS_PKG)
399 dh_gencontrol -p $(TESTS_PKG)
400 dh_md5sums -p $(TESTS_PKG)
401 dh_builddeb -p $(TESTS_PKG)
403 binary-$(DEV_PKG): build-stamp
406 dh_installdirs -p $(DEV_PKG)
407 dh_install -p $(DEV_PKG)
408 dh_installdocs -p $(DEV_PKG)
409 dh_installchangelogs -p $(DEV_PKG) lustre/ChangeLog
410 dh_compress -p $(DEV_PKG)
411 dh_installdeb -p $(DEV_PKG)
412 dh_fixperms -p $(DEV_PKG)
413 dh_gencontrol -p $(DEV_PKG)
414 dh_md5sums -p $(DEV_PKG)
415 dh_builddeb -p $(DEV_PKG)
417 binary-$(SOURCE_PKG): build-stamp
421 dh_installdirs -p $(SOURCE_PKG) usr/src/modules/lustre/debian
422 rsync -av --exclude='debian/$(SOURCE_PKG)/*' \
424 . debian/$(SOURCE_PKG)/usr/src/modules/lustre
425 # Remove FULLCLEAN setting
426 rm debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/rules
427 cp -v debian/rules debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/rules
428 sed -i -e 's/FULLCLEAN=full-clean/FULLCLEAN=/' debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/rules
430 rm -rf debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/patched \
431 debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/patches/*
432 $(MAKE) -C debian/$(SOURCE_PKG)/usr/src/modules/lustre -f debian/rules clean
433 # Create the module-source tarball.
434 cd debian/$(SOURCE_PKG)/usr/src && tar --exclude-vcs -jcf lustre-$${SRC_GIT_HASH}.tar.bz2 modules
435 rm -rf debian/$(SOURCE_PKG)/usr/src/modules
436 dh_install -p$(SOURCE_PKG)
437 dh_installchangelogs -p $(SOURCE_PKG) lustre/ChangeLog
438 dh_installdocs -p $(SOURCE_PKG)
439 dh_link -p $(SOURCE_PKG) /usr/share/modass/packages/default.sh /usr/share/modass/overrides/lustre-source
440 dh_compress -p $(SOURCE_PKG)
441 dh_installdeb -p $(SOURCE_PKG)
442 dh_fixperms -p $(SOURCE_PKG)
443 dh_gencontrol -p $(SOURCE_PKG)
444 dh_md5sums -p $(SOURCE_PKG)
445 dh_builddeb -p $(SOURCE_PKG)
447 binary-$(DKMS_PKG): build-stamp
450 # Create /usr/src/lustre-client-modules-<version>
451 dh_installdirs -p $(DKMS_PKG) usr/src/lustre-client-modules-$(UPVERSION)
453 rsync -av --exclude='debian/$(DKMS_PKG)/*' --exclude='.git/' \
455 . debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION)
457 $(MAKE) -C debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION) -f debian/rules clean
459 $(MAKE) install -C lustre/include DESTDIR=$(CURDIR)/debian/$(DKMS_PKG)
460 $(MAKE) install -C lnet/include DESTDIR=$(CURDIR)/debian/$(DKMS_PKG)
461 rm -rf $(CURDIR)/debian/$(DKMS_PKG)/usr/include/lustre
463 # Put the DKMS configuration file in place
464 sed -e 's/[@]UPVERSION[@]/$(UPVERSION)/' debian/dkms.conf.in > debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION)/dkms.conf
465 dh_install -p $(DKMS_PKG)
466 dh_installchangelogs -p $(DKMS_PKG) lustre/ChangeLog
467 dh_installdocs -p $(DKMS_PKG)
468 dh_compress -p $(DKMS_PKG)
469 dh_installdeb -p $(DKMS_PKG)
470 dh_strip -p $(DKMS_PKG)
471 dh_fixperms -p $(DKMS_PKG)
472 dh_gencontrol -p $(DKMS_PKG)
473 dh_md5sums -p $(DKMS_PKG)
474 dh_builddeb -p $(DKMS_PKG)
476 # if only we could use m-a for this, but this stupid "compliant.list"
477 # thing fouls that up
479 # Build client or server modules
480 mkdir -p debian/m-a_root/usr_src/modules
481 ln -s ../../../../ debian/m-a_root/usr_src/modules/lustre
482 CC=$(CC) RELAX_CC_CHECK=$(CC) \
483 m-a -t -u debian/m-a_root/ -d -v -k $(KSRC) build lustre
484 mv -f debian/m-a_root/*.deb ..
486 # an alternative (to module-assistant) method of building the kernel modules
487 binary-$(MODS_PKG): build-stamp
488 if ! $(USE_MA); then \
489 cp debian/$(MODS_PKG).install debian/$(MODS_PKG)-$(KVER).install ; \
492 dh_installdirs -p $(MODS_PKG)-$(KVER); \
493 dh_installdocs -p $(MODS_PKG)-$(KVER); \
494 dh_install -p $(MODS_PKG)-$(KVER); \
495 dh_makeshlibs -p $(MODS_PKG)-$(KVER); \
496 dh_installchangelogs -p $(MODS_PKG)-$(KVER) lustre/ChangeLog; \
497 dh_compress -p $(MODS_PKG)-$(KVER); \
498 dh_installdeb -p $(MODS_PKG)-$(KVER); \
499 dh_strip -p $(MODS_PKG)-$(KVER); \
500 dh_fixperms -p $(MODS_PKG)-$(KVER); \
501 dh_gencontrol -p $(MODS_PKG)-$(KVER); \
502 dh_md5sums -p $(MODS_PKG)-$(KVER); \
503 dh_builddeb -p $(MODS_PKG)-$(KVER); \
508 ### For module-assistant
511 # the kdist_clean target is called by make-kpkg modules_clean and from
512 # kdist* rules. It is responsible for cleaning up any changes that have
513 # been made by the other kdist_commands (except for the .deb files created)
516 # can't dh_clean here or we remove the build artifacts for the other packages
519 #-$(MAKE) $(MFLAGS) -f debian/rules clean
520 # put the userspace tools' control file back
521 cp debian/control.main debian/control
524 # module assistant calculates all needed things for us and sets
525 # # following variables:
526 # # KSRC (kernel source directory), KVERS (kernel version string), KDREV
527 # # (revision of the Debian kernel-image package), CC (the correct
528 # # compiler), VERSION (the final package version string), PKGNAME (full
529 # # package name with KVERS included), DEB_DESTDIR (path to store DEBs)
531 # # The kdist_configure target is called by make-kpkg modules_config and
532 # # by kdist* rules by dependency. It should configure the module so it is
533 # # ready for compilation (mostly useful for calling configure).
534 # # prep-deb-files from module-assistant creates the neccessary debian/
535 kdist_config: prep-deb-files patch-stamp
536 # Check build dependencies again, needs to be done since we just
537 # replaced the control file.
539 # Prepare the kernel to lustres' liking
540 # as non-root, we won't have permission for this
541 #-$(MAKE) -C $(KSRC) prepare scripts
542 # touch files to same date, to avoid auto*
543 find . -type f -print0 | xargs -0 touch -r COPYING \;
544 # Determine flags that are different between server/client module builds
545 # Note: It doesn't seem possible to *only* build modules.
546 echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"
547 if echo "$${DEB_BUILD_PROFILES}" | grep -q "server"; then \
548 export EXTRAFLAGS="--enable-server"; \
550 export EXTRAFLAGS="--disable-server"; \
552 if echo "$${DEB_BUILD_PROFILES}" | grep -q "nompi"; then \
553 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-mpitests" ; \
555 if echo "$${DEB_BUILD_PROFILES}" | grep -q "notests"; then \
556 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-tests"; \
558 if echo "$${DEB_BUILD_PROFILES}" | grep -q "noutils"; then \
559 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-utils"; \
561 if echo "$${DEB_BUILD_PROFILES}" | grep -q "noiokit"; then \
562 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-iokit"; \
564 if echo "$${DEB_BUILD_PROFILES}" | grep -q "zfs"; then \
565 export EXTRAFLAGS="$${EXTRAFLAGS} --with-zfs=$${ZFS_SRC} --with-spl=$${SPL_SRC}"; \
567 export EXTRAFLAGS="$${EXTRAFLAGS} --without-zfs" ; \
569 if echo "$${DEB_BUILD_PROFILES}" | grep -q "ldiskfs"; then \
570 export EXTRAFLAGS="$${EXTRAFLAGS} \
571 --enable-ldiskfs --enable-quilt"; \
573 export EXTRAFLAGS="$${EXTRAFLAGS} \
574 --disable-ldiskfs --disable-quilt"; \
576 if echo "$${DEB_BUILD_PROFILES}" | grep -q "multiple-lnds"; then \
577 export EXTRAFLAGS="$${EXTRAFLAGS} --enable-multiple-lnds"; \
579 if echo "$${DEB_BUILD_PROFILES}" | grep -q "ext_o2ib"; then \
580 export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=$${O2IB_SRC}"; \
581 elif echo "$${DEB_BUILD_PROFILES}" | grep -q "int_o2ib"; then \
582 export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=yes"; \
584 export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=no"; \
586 if echo "$${DEB_BUILD_PROFILES}" | grep -q "gnilnd"; then \
587 export EXTRAFLAGS="$${EXTRAFLAGS} --enable-gni"; \
589 if echo "$${DEB_BUILD_PROFILES}" | grep -q "kfilnd"; then \
590 export EXTRAFLAGS="$${EXTRAFLAGS} --with-kfi=/usr/src/kfabric"; \
592 options="gss crypto pinger checksum flock lru-resize"; \
593 options="$${options} mindf fail-alloc invariants lu_ref pgstate-track"; \
594 options="$${options} libcfs-cdebug libcfs-trace libcfs-assert"; \
595 options="$${options} panic_dumplog readline libpthread"; \
596 options="$${options} backoff gni efence"; \
597 for option in $${options}; do \
598 if echo "$${DEB_BUILD_PROFILES}" | grep -qw "$${option}"; then \
599 export EXTRAFLAGS="$${EXTRAFLAGS} --enable-$${option}"; \
600 elif echo "$${DEB_BUILD_PROFILES}" | grep -qw "no$${option}"; then \
601 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-$${option}"; \
604 if echo "$${DEB_BUILD_PROFILES}" | grep -q "notests"; then \
605 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-tests"; \
607 if [ -f "$${CONFIG_CACHE_FILE}" ]; then \
608 export TMP_CACHE_FILE=$$(mktemp --tmpdir newconfig-XXXXXXXX.cache); \
609 sed -e "/ac_cv_env/d" \
610 -e "/am_cv_CC_dependencies_compiler_type/d" \
611 -e "/lb_cv_mpi_tests/d" \
612 "$${CONFIG_CACHE_FILE}" > $${TMP_CACHE_FILE}; \
613 export EXTRAFLAGS="$${EXTRAFLAGS} --cache-file=$${TMP_CACHE_FILE}"; \
615 echo "Final value of EXTRAFLAGS: $${EXTRAFLAGS}"; \
616 ./configure --with-linux=$(KSRC_TREE) \
617 --with-linux-obj=$(KSRC) \
618 --disable-dependency-tracking \
622 --with-kmp-moddir=updates/kernel \
627 kdist_configure: kdist_config
629 # the binary-modules rule is invoked by module-assistant while processing the
630 # kdist* targets. It is called by module-assistant or make-kpkg and *not*
631 # during a normal build
632 binary-modules: prep-deb-files
636 $(MAKE) install DESTDIR=$(CURDIR)/debian/$(PKGNAME)
637 # Remove stuff that doesn't belong (no module-only target)
638 cd $(CURDIR)/debian/$(PKGNAME) && rm -rf usr/bin usr/sbin usr/lib usr/share usr/include/lustre lib/systemd sbin etc
639 dh_installdocs -p$(PKGNAME)
640 dh_installchangelogs -p$(PKGNAME)
641 dh_installmodules -p $(PKGNAME)
642 dh_compress -p $(PKGNAME)
643 dh_fixperms -p $(PKGNAME)
644 sed "s/depmod -a/depmod -a $(KVERS)/" $(CURDIR)/debian/postinst > $(CURDIR)/debian/$(PKGNAME).postinst
645 sed "s/depmod -a/depmod -a $(KVERS)/" $(CURDIR)/debian/postrm > $(CURDIR)/debian/$(PKGNAME).postrm
646 chmod +x $(CURDIR)/debian/$(PKGNAME).postinst $(CURDIR)/debian/$(PKGNAME).postrm
647 dh_installdeb -p $(PKGNAME)
648 dh_gencontrol -- -v$(VERSION)
649 dh_md5sums -p $(PKGNAME)
650 dh_builddeb --destdir=$(DEB_DESTDIR) -p $(PKGNAME)
651 dh_prep -p $(PKGNAME)
657 rm -rf debian/substvars debian/*.bak debian/*~ *~ *-stamp
658 ls -d debian/lustre-*-modules-* | grep -v _KVERS_ | grep -v dkms | xargs rm -f || true
659 # only remove this if the clean was not called from kdist_clean
660 if [ "$$MA_SOURCE_PKG" = "" ]; then \
661 rm -rf debian/m-a_root; \
664 # make sure we have at least a basic control in place (see build-stamp)
666 cp debian/control.main debian/control
673 rm -rf debian/patched patch-stamp
675 .PHONY: binary-arch clean source diff binary binary-indep binary-arch install configure