3 NAME
:= $(shell awk
'$$1 == "Name:" { print $$2; }' META
)
4 VERSION
:= $(shell dpkg-parsechangelog \
5 | awk
'$$1 == "Version:" { print $$2; }' | cut
-d-
-f1
)
7 DKMSFILES
:= module
include config spl.release.in autogen.sh \
8 META AUTHORS DISCLAIMER
11 DEB_HOST_ARCH
= $(shell dpkg-architecture
-qDEB_HOST_ARCH
)
15 KVERS
=$(shell uname
-r
)
18 non_epoch_version
=$(shell echo
$(KVERS
) | perl
-pe
's/^\d+://')
20 pmodules
= $(PACKAGE
)-modules-
$(non_epoch_version
)
23 dh
$@
--with dkms
,autoreconf
--parallel
25 override_dh_auto_configure
:
26 @cp debian
/control.in debian
/control
28 @
# Embed the downstream version in the module.
29 @sed
-e
's/^Version:.*/Version: $(VERSION)/' -i.orig META
31 @
# Build the userland, but don't build the kernel modules.
32 dh_auto_configure
-- --with-config
=user
--disable-debug-kmem
34 override_dh_auto_test
:
35 # scripts/check.sh tries insmod and rmmod, so it cannot
36 # run in an unprivileged build environment.
38 override_dh_auto_install
:
39 @
# Install the utilities.
40 $(MAKE
) install DESTDIR
='$(CURDIR)/debian/tmp'
42 @
# Get a bare copy of the source code.
43 @
# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree.
46 # Install the DKMS source.
47 @
# We only want the files needed to build the modules
48 mkdir
-p
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'
49 $(foreach file
,$(DKMSFILES
),mv
'$(CURDIR)/$(NAME)-$(VERSION)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)' || exit
1;)
51 @
# * Deletes from configure.ac the parts not needed for building the kernel module
52 @
# * It deletes from inside AC_CONFIG_FILES([]) everything except:
53 @
# (Makefile$|include/|module/|*.release$)
54 @
# * Takes care of spaces and tabs
55 awk
'/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|spl\.release([ \t]+)?$$))/){next} } {print}' \
56 '$(CURDIR)/$(NAME)-$(VERSION)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/configure.ac'
57 @
# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
58 sed
'1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \
59 '$(CURDIR)/$(NAME)-$(VERSION)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
61 grep
-q
'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
62 @
# Run autogen on the stripped source tree
63 cd
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'; .
/autogen.sh
64 rm -fr
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/autom4te.cache'
66 @
# This shunt allows DKMS to install the Module.symvers and spl_config.h
67 @
# files to the ${dkms_tree} area through the POST_INSTALL directive.
68 echo
'#!/bin/sh' >'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
69 echo
'cp "$$@"' >>'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
70 chmod
755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
75 override_dh_auto_clean
:
77 @if
test -e META.orig
; then mv META.orig META
; fi
78 cp debian
/control.in debian
/control
82 override_dh_prep-deb-files
:
83 for templ in
$(wildcard $(CURDIR
)/debian
/*_KVERS_
*.in
); do \
84 sed
-e
's/##KVERS##/$(KVERS)/g ; s/#KVERS#/$(KVERS)/g ; s/_KVERS_/$(KVERS)/g ; s/##KDREV##/$(KDREV)/g ; s/#KDREV#/$(KDREV)/g ; s/_KDREV_/$(KDREV)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g' \
85 < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \
87 sed
-e
's/##KVERS##/$(KVERS)/g ; s/#KVERS#/$(KVERS)/g ; s/_KVERS_/$(KVERS)/g ; s/##KDREV##/$(KDREV)/g ; s/#KDREV#/$(KDREV)/g ; s/_KDREV_/$(KDREV)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g' \
88 < debian
/control.modules.in
> debian
/control
90 override_dh_configure_modules
: override_dh_configure_modules_stamp
91 override_dh_configure_modules_stamp
:
92 .
/configure
--with-config
=kernel
--with-linux
=$(KSRC
) \
93 --with-linux-obj
=$(KOBJ
) \
95 touch override_dh_configure_modules_stamp
97 override_dh_binary-modules-udeb
: override_dh_prep-deb-files override_dh_configure_modules
102 $(MAKE
) -C
$(CURDIR
)/module modules
104 dh_installdirs
-p
${pmodules}-di
105 dh_install
-p
${pmodules}-di
106 dh_gencontrol
-p
${pmodules}-di
108 dh_builddeb
-p
${pmodules}-di
110 override_dh_binary-modules
: override_dh_prep-deb-files override_dh_configure_modules
115 $(MAKE
) -C
$(CURDIR
)/module modules
117 dh_installdocs
-p
${pmodules}
118 dh_install
-p
${pmodules}
119 dh_installchangelogs
-p
${pmodules}
120 dh_compress
-p
${pmodules}
121 dh_strip
-p
${pmodules}
122 dh_fixperms
-p
${pmodules}
123 dh_installdeb
-p
${pmodules}
124 dh_gencontrol
-p
${pmodules}
125 dh_md5sums
-p
${pmodules}
127 dh_builddeb
-p
${pmodules}