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
--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 @
# Create the makefiles and configure script.
34 @
# Build the userland, but don't build the kernel modules.
35 .
/configure
--prefix=/usr
--with-config
=user \
38 override_dh_auto_test
:
39 # scripts/check.sh tries insmod and rmmod, so it cannot
40 # run in an unprivileged build environment.
42 override_dh_auto_install
:
43 @
# Install the utilities.
44 $(MAKE
) install DESTDIR
='$(CURDIR)/debian/tmp'
46 @
# Get a bare copy of the source code.
47 @
# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree.
50 # Install the DKMS source.
51 @
# We only want the files needed to build the modules
52 mkdir
-p
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'
53 $(foreach file
,$(DKMSFILES
),mv
'$(CURDIR)/$(NAME)-$(VERSION)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)' || exit
1;)
55 @
# * Deletes from configure.ac the parts not needed for building the kernel module
56 @
# * It deletes from inside AC_CONFIG_FILES([]) everything except:
57 @
# (Makefile$|include/|module/|*.release$)
58 @
# * Takes care of spaces and tabs
59 awk
'/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|spl\.release([ \t]+)?$$))/){next} } {print}' \
60 '$(CURDIR)/$(NAME)-$(VERSION)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/configure.ac'
61 @
# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
62 sed
'1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \
63 '$(CURDIR)/$(NAME)-$(VERSION)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
65 grep
-q
'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
66 @
# Run autogen on the stripped source tree
67 cd
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'; .
/autogen.sh
68 rm -fr
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/autom4te.cache'
70 @
# This shunt allows DKMS to install the Module.symvers and spl_config.h
71 @
# files to the ${dkms_tree} area through the POST_INSTALL directive.
72 echo
'#!/bin/sh' >'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
73 echo
'cp "$$@"' >>'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
74 chmod
755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
79 override_dh_auto_clean
:
81 @if
test -e META.orig
; then mv META.orig META
; fi
82 cp debian
/control.in debian
/control
86 override_dh_prep-deb-files
:
87 for templ in
$(wildcard $(CURDIR
)/debian
/*_KVERS_
*.in
); do \
88 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' \
89 < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \
91 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' \
92 < debian
/control.modules.in
> debian
/control
94 override_dh_configure_modules
: override_dh_configure_modules_stamp
95 override_dh_configure_modules_stamp
:
96 .
/configure
--with-config
=kernel
--with-linux
=$(KSRC
) \
97 --with-linux-obj
=$(KOBJ
) \
99 touch override_dh_configure_modules_stamp
101 override_dh_binary-modules-udeb
: override_dh_prep-deb-files override_dh_configure_modules
106 $(MAKE
) -C
$(CURDIR
)/module modules
108 dh_installdirs
-p
${pmodules}-di
109 dh_install
-p
${pmodules}-di
110 dh_gencontrol
-p
${pmodules}-di
112 dh_builddeb
-p
${pmodules}-di
114 override_dh_binary-modules
: override_dh_prep-deb-files override_dh_configure_modules
119 $(MAKE
) -C
$(CURDIR
)/module modules
121 dh_installdocs
-p
${pmodules}
122 dh_install
-p
${pmodules}
123 dh_installchangelogs
-p
${pmodules}
124 dh_compress
-p
${pmodules}
125 dh_strip
-p
${pmodules}
126 dh_fixperms
-p
${pmodules}
127 dh_installdeb
-p
${pmodules}
128 dh_gencontrol
-p
${pmodules}
129 dh_md5sums
-p
${pmodules}
131 dh_builddeb
-p
${pmodules}