]> git.proxmox.com Git - mirror_spl-debian.git/blobdiff - debian/rules
Recommends: linux-libc-dev (< ${LINUX_NEXT})
[mirror_spl-debian.git] / debian / rules
index 81c0e43b3123fc1db626583852509caac1b51875..c7f26088d69294c8508d1b9556eace77eb0ebe7a 100755 (executable)
@@ -3,9 +3,8 @@
 NAME := $(shell awk '$$1 == "Name:" { print $$2; }' META)
 VERSION := $(shell dpkg-parsechangelog \
   | awk '$$1 == "Version:" { print $$2; }' | cut -d- -f1)
-
-DKMSFILES := module include config spl.release.in autogen.sh \
-               META AUTHORS DISCLAIMER
+REVISION := $(shell dpkg-parsechangelog \
+  | awk '$$1 == "Version:" { print $$2; }' | cut -d- -f2-)
 
 ifndef DEB_HOST_ARCH
 DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH)
@@ -20,20 +19,19 @@ PACKAGE=spl
 pmodules = $(PACKAGE)-modules-$(non_epoch_version)
 
 %:
-       dh $@ --with dkms
+       dh $@ --with dkms,autoreconf --parallel
 
 override_dh_auto_configure:
-       @cp debian/control.in debian/control
+       sed "s/@LINUX_COMPAT@/linux-libc-dev \(< $(shell debian/get_next.sh)\)/" debian/control.in > debian/control
 
        @# Embed the downstream version in the module.
-       @sed -e 's/^Version:.*/Version:      $(VERSION)/' -i.orig META
-
-       @# Create the makefiles and configure script.
-       ./autogen.sh
+       @sed \
+         -e 's/^Version:.*/Version:      $(VERSION)/' \
+         -e 's/^Release:.*/Release:      $(REVISION)/' \
+         -i.orig META
 
        @# Build the userland, but don't build the kernel modules.
-       ./configure --prefix=/usr --with-config=user \
-               --disable-debug-kmem
+       dh_auto_configure -- --with-config=user --disable-debug-kmem
 
 override_dh_auto_test:
        # scripts/check.sh tries insmod and rmmod, so it cannot
@@ -47,31 +45,15 @@ override_dh_auto_install:
        @# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree.
        $(MAKE) distdir
 
-       # Install the DKMS source.
-       @# We only want the files needed to build the modules
-       mkdir -p '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'
-       $(foreach file,$(DKMSFILES),mv '$(CURDIR)/$(NAME)-$(VERSION)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)' || exit 1;)
-       @# Hellish awk line:
-       @#  * Deletes from configure.ac the parts not needed for building the kernel module
-       @#     * It deletes from inside AC_CONFIG_FILES([]) everything except:
-       @#        (Makefile$|include/|module/|*.release$)
-       @#  * Takes care of spaces and tabs
-       awk '/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|spl\.release([ \t]+)?$$))/){next} } {print}' \
-               '$(CURDIR)/$(NAME)-$(VERSION)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/configure.ac'
-       @# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
-       sed '1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \
-               '$(CURDIR)/$(NAME)-$(VERSION)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
-       @# Sanity test
-       grep -q 'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
-       @# Run autogen on the stripped source tree
-       cd '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'; ./autogen.sh
-       rm -fr '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/autom4te.cache'
-
        @# This shunt allows DKMS to install the Module.symvers and spl_config.h
        @# files to the ${dkms_tree} area through the POST_INSTALL directive.
-       echo '#!/bin/sh'  >'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
-       echo 'cp "$$@"'  >>'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
-       chmod 755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
+       echo '#!/bin/sh'  >'$(CURDIR)/$(NAME)-$(VERSION)/cp'
+       echo 'cp "$$@"'  >>'$(CURDIR)/$(NAME)-$(VERSION)/cp'
+       chmod 755 '$(CURDIR)/$(NAME)-$(VERSION)/cp'
+
+       # Install the DKMS source.
+       mkdir -p '$(CURDIR)/debian/tmp/usr/src/'
+       mv '$(CURDIR)/$(NAME)-$(VERSION)' '$(CURDIR)/debian/tmp/usr/src/'
 
 override_dh_dkms:
        dh_dkms -V $(VERSION)
@@ -79,7 +61,7 @@ override_dh_dkms:
 override_dh_auto_clean:
        dh_auto_clean
        @if test -e META.orig; then mv META.orig META; fi
-       cp debian/control.in debian/control
+       sed "s/@LINUX_COMPAT@/linux-libc-dev \(< $(shell debian/get_next.sh)\)/" debian/control.in > debian/control
 
 # ------------