Whamcloud - gitweb
LU-5950 mgc: add nid iteration
[fs/lustre-release.git] / debian / rules
index aa03070..a59795f 100755 (executable)
@@ -63,7 +63,6 @@ PATCH_PKG=linux-patch-lustre
 UTILS_PKG=lustre-utils
 TESTS_PKG=lustre-tests
 DEV_PKG=lustre-dev
-LIB_PKG=liblustre
 SOURCE_PKG=lustre-source
 MODS_PKG=lustre-client-modules
 
@@ -75,19 +74,38 @@ MODS_PKG=lustre-client-modules
 BUILDDIR=.
 SRCDIR=.
 
+AVAIL_CPUS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
+ifneq ($(AVAIL_CPUS),1)
+      PMAKEARGS := -j $(AVAIL_CPUS)
+endif
+
 autogen: autogen-stamp
 autogen-stamp: patch-stamp
-       # There is really no reason to run this unless somebody adds a
-       # patch that patches the autoconf system, in which case they can
-       # include a patch for autogen.sh and uncomment this stuff.
-       #cp /usr/share/misc/config.sub config.sub
-       #cp /usr/share/misc/config.sub libsysio/config.sub
-       #cp /usr/share/misc/config.sub ldiskfs/config.sub
-       #cp /usr/share/misc/config.guess config.guess
-       #cp /usr/share/misc/config.guess libsysio/config.guess
-       #cp /usr/share/misc/config.guess ldiskfs/config.guess
-       #sh ./autogen.sh
-       #touch $@
+       # see if any patches requires us to run autogen
+       # (for a distribution release tarball, it is expected that if
+       #  downstream adds any patches that requires autogen.sh to be
+       #  run, a patch will be added by downstream to install the
+       #  needed autogen.sh scripts
+       #  see https://bugzilla.lustre.org/attachment.cgi?id=27156
+       #  for an example)
+       if grep -e "^--- .*\/autoconf\/" \
+               -e "^--- .*\/autoMakefile\.am" \
+               -e "^--- .*\/Makefile\.am" \
+               -e "^--- .*\/configure\.ac" \
+               -e "^--- .*\/configure\.in" \
+           debian/patches/*; then \
+               if [ ! -f build/autogen.sh ]; then \
+                       echo "You have patches which require autogen.sh to be run, but it doesn't exist"; \
+                       echo "Please see https://bugzilla.lustre.org/attachment.cgi?id=27156"; \
+                       exit 1; \
+               fi; \
+               cp /usr/share/misc/config.sub config.sub; \
+               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; \
+       fi; \
+       touch $@
 
 configure: configure-stamp
 configure-stamp: autogen-stamp debian/control.main debian/control.modules.in
@@ -95,10 +113,9 @@ configure-stamp: autogen-stamp debian/control.main debian/control.modules.in
        # touch files to same date, to avoid auto*
        find . -type f -print0 | xargs -0 touch -r COPYING; \
        if [ "$(BUILDDIR)" != "." ]; then \
-               mkdir -p $(BUILDDIR)/build $(BUILDDIR)/lustre/contrib $(BUILDDIR)/libsysio; \
+               mkdir -p $(BUILDDIR)/build $(BUILDDIR)/lustre/contrib; \
                cp build/Makefile $(BUILDDIR)/build/; \
                cp lustre/contrib/mpich-*.patch $(BUILDDIR)/lustre/contrib/; \
-               ln -s ../../../libsysio/include $(BUILDDIR)/libsysio/; \
        fi
        ( cd $(BUILDDIR) && \
         $(SRCDIR)/configure --disable-dependency-tracking \
@@ -114,7 +131,7 @@ build-arch build-indep: build
 build: build-stamp
 build-stamp: patch-stamp configure-stamp
        dh_testdir
-       $(MAKE) -C $(BUILDDIR)
+       $(MAKE) -C $(BUILDDIR) $(PMAKEARGS)
        $(MAKE) -C $(BUILDDIR) DESTDIR=$(TOP_DIR)/debian/tmp install
        # jump our lustre-client-modules into the control file if not using m-a
        if ! $(USE_MA); then \
@@ -129,8 +146,9 @@ build-stamp: patch-stamp configure-stamp
 # let's try and operate as close as the user would and not build modules
 # here (for now)
 # instead we will build the modules with m-a in the "make debs" target
-# binary-arch: binary-$(UTILS_PKG) binary-$(TESTS_PKG) binary-$(DEV_PKG) binary-$(LIB_PKG) binary-$(MODS_PKG) binary-kern-mods
-binary-arch: binary-$(UTILS_PKG) binary-$(TESTS_PKG) binary-$(DEV_PKG) binary-$(LIB_PKG)
+# binary-arch: binary-$(UTILS_PKG) binary-$(TESTS_PKG) binary-$(DEV_PKG) \
+# binary-$(MODS_PKG) binary-kern-mods
+binary-arch: binary-$(UTILS_PKG) binary-$(TESTS_PKG) binary-$(DEV_PKG)
 
 binary-indep: binary-$(PATCH_PKG) binary-$(SOURCE_PKG)
 
@@ -182,7 +200,6 @@ binary-$(UTILS_PKG): build-stamp
        dh_installman -p $(UTILS_PKG)
        dh_install -p $(UTILS_PKG)
        dh_makeshlibs -p $(UTILS_PKG)
-       dh_shlibdeps -L $(LIB_PKG) -l debian/$(LIB_PKG)/usr/lib
        dh_installexamples -p $(UTILS_PKG)
        dh_installchangelogs -p $(UTILS_PKG) lustre/ChangeLog
        dh_compress -p $(UTILS_PKG)
@@ -201,7 +218,6 @@ binary-$(TESTS_PKG): build-stamp
        dh_installman -p $(TESTS_PKG)
        dh_install -p $(TESTS_PKG)
        dh_makeshlibs -p $(TESTS_PKG)
-       dh_shlibdeps -L $(LIB_PKG) -l debian/$(LIB_PKG)/usr/lib
        dh_installexamples -p $(TESTS_PKG)
        dh_installchangelogs -p $(TESTS_PKG) lustre/ChangeLog
        dh_compress -p $(TESTS_PKG)
@@ -226,23 +242,6 @@ binary-$(DEV_PKG): build-stamp
        dh_md5sums -p $(DEV_PKG)
        dh_builddeb -p $(DEV_PKG)
 
-binary-$(LIB_PKG): build-stamp
-       dh_testdir
-       dh_testroot
-       dh_installdirs -p $(LIB_PKG)
-       dh_installdocs -p $(LIB_PKG)
-       dh_install -p $(LIB_PKG)
-       dh_makeshlibs -p $(LIB_PKG)
-       dh_shlibdeps -L $(LIB_PKG) -l debian/$(LIB_PKG)/usr/lib
-       dh_installchangelogs -p $(LIB_PKG) lustre/ChangeLog
-       dh_compress -p $(LIB_PKG)
-       dh_installdeb -p $(LIB_PKG)
-       dh_strip -p $(LIB_PKG)
-       dh_fixperms -p $(LIB_PKG)
-       dh_gencontrol -p $(LIB_PKG)
-       dh_md5sums -p $(LIB_PKG)
-       dh_builddeb -p $(LIB_PKG)
-
 binary-$(SOURCE_PKG): build-stamp
        dh_testdir 
        dh_testroot
@@ -290,7 +289,6 @@ binary-$(MODS_PKG): build-stamp
                dh_installdocs -p $(MODS_PKG)-$(KVER); \
                dh_install -p $(MODS_PKG)-$(KVER); \
                dh_makeshlibs -p $(MODS_PKG)-$(KVER); \
-               dh_shlibdeps -L $(LIB_PKG) -l debian/$(LIB_PKG)/usr/lib; \
                dh_installchangelogs -p $(MODS_PKG)-$(KVER) lustre/ChangeLog; \
                dh_compress -p $(MODS_PKG)-$(KVER); \
                dh_installdeb -p $(MODS_PKG)-$(KVER); \
@@ -340,18 +338,17 @@ kdist_config: prep-deb-files patch-stamp
        find . -type f -print0 | xargs -0 touch -r COPYING \;
        # Doesn't seem possible to only build modules...
        ./configure --with-linux=$(KSRC) \
+                   --disable-server \
                    --disable-quilt  \
                    --disable-dependency-tracking \
                    --disable-doc  \
                    --disable-utils \
-                   --disable-liblustre \
                    --disable-snmp \
-                   --enable-ldiskfs \
                    --disable-zerocopy \
                    --disable-tests \
                    --enable-quota
 
-kdist_configure: kdist_config 
+kdist_configure: kdist_config
 
 # the binary-modules rule is invoked by module-assistant while processing the
 # kdist* targets. It is called by module-assistant or make-kpkg and *not*
@@ -359,7 +356,7 @@ kdist_configure: kdist_config
 binary-modules: prep-deb-files
        dh_testroot
        dh_clean -k
-       $(MAKE)
+       $(MAKE) $(PMAKEARGS)
        $(MAKE) install DESTDIR=$(CURDIR)/debian/$(PKGNAME)
        # Remove stuff that doesn't belong (no module-only target)
        cd $(CURDIR)/debian/$(PKGNAME) && rm -rf usr sbin etc
@@ -377,7 +374,7 @@ binary-modules: prep-deb-files
 clean:
        dh_testdir
        dh_testroot
-       dpatch deapply-all
+       dpatch deapply-all -v
        -$(MAKE) distclean
        rm -rf  debian/substvars debian/*.bak debian/*~ *~  *-stamp debian/$(PATCH_PKG)
        ls -d debian/lustre-client-modules-* | grep -v _KVERS_ | xargs rm -f || true
@@ -392,11 +389,11 @@ clean:
 
 patch: patch-stamp
 patch-stamp:
-       dpatch apply-all
+       dpatch apply-all -v
        touch $@
 
 unpatch:
-       dpatch deapply-all
+       dpatch deapply-all -v
        rm -rf debian/patched patch-stamp
 
 .PHONY: binary-arch clean source diff  binary binary-indep binary-arch install configure