3 LSB_DISTRIBUTOR
:= $(shell lsb_release
-is
)
4 NAME
:= $(shell awk
'$$1 == "Name:" { print $$2; }' META
)
5 VERSION
:= $(shell dpkg-parsechangelog \
6 | awk
'$$1 == "Version:" { print $$2; }' | cut
-d-
-f1
)
8 DKMSFILES
:= module
include config zfs.release.in autogen.sh META AUTHORS \
9 DISCLAIMER COPYRIGHT OPENSOLARIS.LICENSE README.markdown
16 DEB_HOST_ARCH
= $(shell dpkg-architecture
-qDEB_HOST_ARCH
)
20 KVERS
=$(shell uname
-r
)
24 SPL
=/usr
/src
/spl-
$(VERSION
)
27 non_epoch_version
=$(shell echo
$(KVERS
) | perl
-pe
's/^\d+://')
29 pmodules
= $(PACKAGE
)-modules-
$(non_epoch_version
)
31 export DEB_BUILD_MAINT_OPTIONS
= hardening
=+all
34 dh
$@
--with autoreconf
,dkms
--parallel
36 override_dh_auto_configure
:
37 @cp debian
/control.in debian
/control
38 ifeq ($(BUILD_UDEB
), true
)
39 cat debian
/control.udeb.in
>> debian
/control
42 @
# Embed the downstream version in the module.
43 @sed
-e
's/^Version:.*/Version: $(VERSION)/' -i.orig META
45 @
# Build the userland, but don't build the kernel modules.
46 dh_auto_configure
-- \
50 --with-udevdir
=/lib
/udev \
53 override_dh_auto_test
:
54 # The dh_auto_test rule is disabled because
55 # `make check` cannot run in an unprivileged build environment.
57 override_dh_auto_install
:
58 @
# Install the utilities.
59 $(MAKE
) install DESTDIR
='$(CURDIR)/debian/tmp'
61 @
# Get a bare copy of the source code for DKMS.
62 @
# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree, which does not
63 @
# contain the userland sources. NB: Remove-userland-dist-rules.patch
66 @
# Install the DKMS source.
67 @
# We only want the files needed to build the modules
68 mkdir
-p
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'
69 $(foreach file
,$(DKMSFILES
),mv
'$(CURDIR)/$(NAME)-$(VERSION)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)' || exit
1;)
71 @
# * Deletes from configure.ac the parts not needed for building the kernel module
72 @
# * It deletes from inside AC_CONFIG_FILES([]) everything except:
73 @
# (Makefile$|include/|module/|*.release$)
74 @
# * Takes care of spaces and tabs
75 awk
'/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|zfs\.release([ \t]+)?$$))/){next} } {print}' \
76 '$(CURDIR)/$(NAME)-$(VERSION)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/configure.ac'
77 @
# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
78 sed
'1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \
79 '$(CURDIR)/$(NAME)-$(VERSION)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
81 grep
-q
'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
82 @
# Run autogen on the stripped source tree
83 cd
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'; .
/autogen.sh
84 rm -fr
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/autom4te.cache'
86 @
# This shunt allows DKMS to install the Module.symvers and zfs_config.h
87 @
# files to the ${dkms_tree} area through the POST_INSTALL directive.
88 printf
'#!/bin/sh\ncp "$$@"\n' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
89 chmod
755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
91 mkdir
-p
$(CURDIR
)/debian
/tmp
/usr
/lib
92 for i in
`ls $(CURDIR)/debian/tmp/lib/*.so`; do \
93 ln
-s
/lib
/`readlink $${i}` $(CURDIR
)/debian
/tmp
/usr
/lib
/`basename $${i}`; \
100 override_dh_makeshlibs
:
102 ifeq ($(BUILD_UDEB
), true
)
103 dh_makeshlibs
-plibnvpair1linux
--add-udeb
=libnvpair1-udeb
104 dh_makeshlibs
-plibuutil1linux
--add-udeb
=libuutil1-udeb
105 dh_makeshlibs
-plibzfs2linux
--add-udeb
=libzfs2-udeb
106 dh_makeshlibs
-plibzpool2linux
--add-udeb
=libzpool2-udeb
107 dh_makeshlibs
-pzfsutils-linux
--add-udeb
=zfsutils-udeb
111 dh_strip
--dbg-package
=zfs-dbg
112 ifeq ($(BUILD_UDEB
), true
)
113 dh_strip
-plibnvpair1-udeb
114 dh_strip
-plibuutil1-udeb
115 dh_strip
-plibzfs2-udeb
116 dh_strip
-plibzpool2-udeb
117 dh_strip
-pzfsutils-udeb
120 override_dh_auto_clean
:
123 @if
test -e META.orig
; then mv META.orig META
; fi
124 cp debian
/control.in debian
/control
125 ifeq ($(BUILD_UDEB
), true
)
126 cat debian
/control.udeb.in
>> debian
/control
130 find .
-name lib
*.la
-delete
131 dh_install
--list-missing
135 override_dh_prep-deb-files
:
136 for templ in
$(wildcard $(CURDIR
)/debian
/*_KVERS_
*.in
); do \
137 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)/' \
138 < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \
140 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' \
141 < debian
/control.modules.in
> debian
/control
143 override_dh_configure_modules_udeb
: override_dh_configure_modules_udeb_stamp
144 override_dh_configure_modules_udeb_stamp
:
147 --with-config
=kernel \
148 --with-linux
=$(KSRC
) \
149 --with-linux-obj
=$(KOBJ
) \
151 touch override_dh_configure_modules_udeb_stamp
153 override_dh_configure_modules
: override_dh_configure_modules_stamp
154 override_dh_configure_modules_stamp
:
156 --with-config
=kernel \
157 --with-linux
=$(KSRC
) \
158 --with-linux-obj
=$(KOBJ
) \
160 touch override_dh_configure_modules_stamp
162 override_dh_binary-modules-udeb
: override_dh_prep-deb-files override_dh_configure_modules_udeb
167 $(MAKE
) -C
$(CURDIR
)/module modules
169 dh_installdirs
-p
${pmodules}-di
170 dh_install
-p
${pmodules}-di
171 dh_gencontrol
-p
${pmodules}-di
173 dh_builddeb
-p
${pmodules}-di
175 override_dh_binary-modules
: override_dh_prep-deb-files override_dh_configure_modules
180 $(MAKE
) -C
$(CURDIR
)/module modules
182 dh_install
-p
${pmodules}
183 dh_installdocs
-p
${pmodules}
184 dh_installchangelogs
-p
${pmodules}
185 dh_compress
-p
${pmodules}
186 dh_strip
-p
${pmodules}
187 dh_fixperms
-p
${pmodules}
188 dh_installdeb
-p
${pmodules}
189 dh_gencontrol
-p
${pmodules}
190 dh_md5sums
-p
${pmodules}
191 dh_builddeb
-p
${pmodules}