Whamcloud - gitweb
LU-17065 build: Remove snmp support
[fs/lustre-release.git] / debian / rules
index d7b0ea3..1aabf7e 100755 (executable)
@@ -1,11 +1,21 @@
 #!/usr/bin/make -f
+# SPDX-License-Identifier: NOASSERTION
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# debian/rules
+#
+# Debian rules file
+#
+# Copying and modification is unlimited, provided that the modified
+# version is marked as being modified.
+# (This version has been modified from the original)
 #
 # Created 2009 by Brian J. Murrell based on work by
 # Alastair McKinstry, <alastair.mckinstry@ichec.ie>, <mckinstry@debian.org>
 # Patrick Winnertz, and the pkg-lustre Debian maintainers
 #
-# Copying and modification is unlimited, provided that the modified
-# version is marked as being modified.
 
 # Uncomment this to turn on verbose mode.
 # export DH_VERBOSE=1
@@ -33,13 +43,8 @@ else
         CFLAGS += -O2
 endif
 
-# We need the kernels to be built with gcc-3.3; suspect that gcc-4.1 uses too
-# much stack and crashes because of it.
-#CC?=gcc-3.3
-#export CC
-
 # This is the debhelper compatibility version to use.
-export DH_COMPAT=9
+export DH_COMPAT=11
 
 # Module-assistant stuff
 ifneq (,$(findstring server,$(DEB_BUILD_PROFILES)))
@@ -63,7 +68,7 @@ UPVERSION=$(shell echo $(VERSION) | sed -e 's/-[^-]*$$//')
 KVER?=$(LINUXRELEASE)
 
 # KVERS, KSRC are the kernel version and source to use when building lustre
-# Will be the default when building lustre-utils, etc but whatever module-assistant
+# Will be the default when building lustre-{server,client}-utils, etc but whatever module-assistant
 # supplied when building modules
 KVERS?=$(KVER)
 KSRC?=$(LINUX_OBJ)
@@ -129,7 +134,7 @@ autogen-stamp: patch-stamp
                cp /usr/share/misc/config.sub ldiskfs/config.sub; \
                cp /usr/share/misc/config.guess config.guess; \
                cp /usr/share/misc/config.guess ldiskfs/config.guess; \
-               sh build/autogen.sh; \
+               bash build/autogen.sh; \
        fi; \
        touch $@
 
@@ -158,8 +163,22 @@ configure-stamp: autogen-stamp debian/control.main debian/control.modules.in
        echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"
        if echo "$${DEB_BUILD_PROFILES}" | grep -q "server"; then \
                export EXTRAFLAGS="--enable-server"; \
+               if echo "$${DEB_BUILD_PROFILES}" | grep -q "systemd"; then \
+                       cp debian/lustre-server-utils.install.in \
+                               debian/lustre-server-utils.install; \
+               else \
+                       sed /systemd/d debian/lustre-server-utils.install.in \
+                               > debian/lustre-server-utils.install; \
+               fi; \
        else \
                export EXTRAFLAGS="--disable-server"; \
+               if echo "$${DEB_BUILD_PROFILES}" | grep -q "systemd"; then \
+                       cp debian/lustre-client-utils.install.in \
+                               debian/lustre-client-utils.install; \
+               else \
+                       sed /systemd/d debian/lustre-client-utils.install.in \
+                               > debian/lustre-client-utils.install; \
+               fi; \
        fi; \
        if echo "$${DEB_BUILD_PROFILES}" | grep -q "zfs"; then \
                export EXTRAFLAGS="$${EXTRAFLAGS} --with-zfs=$${ZFS_SRC} --with-spl=$${SPL_SRC}"; \
@@ -172,19 +191,37 @@ configure-stamp: autogen-stamp debian/control.main debian/control.modules.in
        else \
                export EXTRAFLAGS="$${EXTRAFLAGS} --disable-ldiskfs"; \
        fi; \
-       if echo "$${DEB_BUILD_PROFILES}" | grep -qw "gss"; then \
-               export EXTRAFLAGS="$${EXTRAFLAGS} --enable-gss"; \
-       elif echo "$${DEB_BUILD_PROFILES}" | grep -qw "nogss"; then \
-               export EXTRAFLAGS="$${EXTRAFLAGS} --disable-gss"; \
+       if echo "$${DEB_BUILD_PROFILES}" | grep -q "o2ib"; then \
+               export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=$${O2IB_SRC}"; \
+       fi; \
+       options="gss crypto pinger checksum flock health_write lru-resize"; \
+       options="$${options} mindf fail-alloc invariants lu_ref pgstate-track"; \
+       options="$${options} libcfs-cdebug libcfs-trace libcfs-assert"; \
+       options="$${options} panic_dumplog readline libpthread"; \
+       options="$${options} backoff gni efence"; \
+       for option in $${options}; do \
+               if echo "$${DEB_BUILD_PROFILES}" | grep -qw "$${option}"; then \
+                       export EXTRAFLAGS="$${EXTRAFLAGS} --enable-$${option}"; \
+               elif echo "$${DEB_BUILD_PROFILES}" | grep -qw "no$${option}"; then \
+                       export EXTRAFLAGS="$${EXTRAFLAGS} --disable-$${option}"; \
+               fi; \
+       done; \
+       if [ -f "$${CONFIG_CACHE_FILE}" ]; then \
+               export TMP_CACHE_FILE=$$(mktemp); \
+               sed -e "/ac_cv_env/d" \
+                   -e "/am_cv_CC_dependencies_compiler_type/d" \
+                   -e "/lb_cv_mpi_tests/d" \
+                      "$${CONFIG_CACHE_FILE}" > $${TMP_CACHE_FILE}; \
+               export EXTRAFLAGS="$${EXTRAFLAGS} --cache-file=$${TMP_CACHE_FILE}"; \
        fi; \
        echo "Final value of EXTRAFLAGS: $${EXTRAFLAGS}"; \
        ( cd $(BUILDDIR) && \
                $(SRCDIR)/configure --disable-dependency-tracking \
                        --with-linux=$${KERNEL_SRC} \
                        --with-linux-obj=$${KERNEL_OBJ} \
-                       --disable-snmp \
                        --enable-quota \
                        $${EXTRAFLAGS} \
+                       $(EXTRA_OPTIONS) \
        ); \
        touch $@
 
@@ -228,7 +265,7 @@ binary-$(UTILS_PKG): build-stamp
        rm -rf debian/$(UTILS_PKG)/usr/bin/iokit-* \
               debian/$(UTILS_PKG)/usr/bin/*-survey \
               debian/$(UTILS_PKG)/usr/bin/mcreate \
-              debian/$(UTILS_PKG)/usr/bin/munlink \
+              debian/$(UTILS_PKG)/usr/bin/statx \
               debian/$(UTILS_PKG)/usr/sbin/wirecheck \
               debian/$(UTILS_PKG)/usr/sbin/wiretest
        dh_makeshlibs -p $(UTILS_PKG)
@@ -323,13 +360,14 @@ binary-$(SOURCE_PKG): build-stamp
              . debian/$(SOURCE_PKG)/usr/src/modules/lustre
        # Remove FULLCLEAN setting
        rm debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/rules
-       sed -e 's/FULLCLEAN=full-clean/FULLCLEAN=/' < debian/rules > debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/rules
+       cp -v debian/rules debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/rules
+       sed -i -e 's/FULLCLEAN=full-clean/FULLCLEAN=/' debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/rules
        # clean up dest
        rm -rf debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/patched \
               debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/patches/* 
        $(MAKE) -C debian/$(SOURCE_PKG)/usr/src/modules/lustre -f debian/rules clean
        # Create the module-source tarball.
-       cd debian/$(SOURCE_PKG)/usr/src && tar jcf lustre.tar.bz2 modules 
+       cd debian/$(SOURCE_PKG)/usr/src && tar --exclude-vcs -jcf lustre-$${SRC_GIT_HASH}.tar.bz2 modules
        rm -rf debian/$(SOURCE_PKG)/usr/src/modules
        dh_install -p$(SOURCE_PKG)
        dh_installchangelogs -p $(SOURCE_PKG) lustre/ChangeLog
@@ -454,16 +492,38 @@ kdist_config: prep-deb-files patch-stamp
                export EXTRAFLAGS="$${EXTRAFLAGS} \
                        --disable-ldiskfs --disable-quilt"; \
        fi; \
+       if echo "$${DEB_BUILD_PROFILES}" | grep -q "o2ib"; then \
+               export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=$${O2IB_SRC}"; \
+       fi; \
+       options="gss crypto pinger checksum flock health_write lru-resize"; \
+       options="$${options} mindf fail-alloc invariants lu_ref pgstate-track"; \
+       options="$${options} libcfs-cdebug libcfs-trace libcfs-assert"; \
+       options="$${options} panic_dumplog readline libpthread"; \
+       options="$${options} backoff gni efence"; \
+       for option in $${options}; do \
+               if echo "$${DEB_BUILD_PROFILES}" | grep -qw "$${option}"; then \
+                       export EXTRAFLAGS="$${EXTRAFLAGS} --enable-$${option}"; \
+               elif echo "$${DEB_BUILD_PROFILES}" | grep -qw "no$${option}"; then \
+                       export EXTRAFLAGS="$${EXTRAFLAGS} --disable-$${option}"; \
+               fi; \
+       done; \
+       if [ -f "$${CONFIG_CACHE_FILE}" ]; then \
+               export TMP_CACHE_FILE=$$(mktemp --tmpdir newconfig-XXXXXXXX.cache); \
+               sed -e "/ac_cv_env/d" \
+                   -e "/am_cv_CC_dependencies_compiler_type/d" \
+                   -e "/lb_cv_mpi_tests/d" \
+                      "$${CONFIG_CACHE_FILE}" > $${TMP_CACHE_FILE}; \
+               export EXTRAFLAGS="$${EXTRAFLAGS} --cache-file=$${TMP_CACHE_FILE}"; \
+       fi; \
        echo "Final value of EXTRAFLAGS: $${EXTRAFLAGS}"; \
        ./configure --with-linux=$(KSRC_TREE) \
                --with-linux-obj=$(KSRC) \
                --disable-dependency-tracking \
                --disable-doc  \
                --disable-iokit \
-               --disable-snmp \
                --disable-tests \
                --enable-quota \
-               --with-kmp-moddir=updates \
+               --with-kmp-moddir=updates/kernel \
                $${EXTRAFLAGS} \
                $(EXTRA_OPTIONS)
 
@@ -485,6 +545,9 @@ binary-modules: prep-deb-files
        dh_installmodules -p $(PKGNAME)
        dh_compress -p $(PKGNAME)
        dh_fixperms -p $(PKGNAME)
+       sed "s/depmod -a/depmod -a $(KVERS)/" $(CURDIR)/debian/postinst > $(CURDIR)/debian/$(PKGNAME).postinst
+       sed "s/depmod -a/depmod -a $(KVERS)/" $(CURDIR)/debian/postrm > $(CURDIR)/debian/$(PKGNAME).postrm
+       chmod +x $(CURDIR)/debian/$(PKGNAME).postinst $(CURDIR)/debian/$(PKGNAME).postrm
        dh_installdeb -p $(PKGNAME)
        dh_gencontrol -- -v$(VERSION)
        dh_md5sums -p $(PKGNAME)