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
11 export SHLIB_MAJOR
= 1
18 DEB_HOST_ARCH
= $(shell dpkg-architecture
-qDEB_HOST_ARCH
)
22 KVERS
=$(shell uname
-r
)
26 SPL
=/usr
/src
/spl-
$(VERSION
)
29 non_epoch_version
=$(shell echo
$(KVERS
) | perl
-pe
's/^\d+://')
31 pmodules
= $(PACKAGE
)-modules-
$(non_epoch_version
)
33 export DEB_BUILD_MAINT_OPTIONS
= hardening
=+all
36 dh
$@
--with autoreconf
,dkms
--parallel
38 override_dh_auto_configure
:
39 @cp debian
/control.in debian
/control
40 ifeq ($(BUILD_UDEB
), true
)
41 cat debian
/control.udeb.in
>> debian
/control
44 @
# Embed the downstream version in the module.
45 @sed
-e
's/^Version:.*/Version: $(VERSION)/' -i.orig META
47 @
# Build the userland, but don't build the kernel modules.
48 dh_auto_configure
-- \
52 --with-udevdir
=/lib
/udev \
55 override_dh_auto_test
:
56 # The dh_auto_test rule is disabled because
57 # `make check` cannot run in an unprivileged build environment.
59 override_dh_auto_install
:
60 @
# Install the utilities.
61 $(MAKE
) install DESTDIR
='$(CURDIR)/debian/tmp'
63 @
# Get a bare copy of the source code for DKMS.
64 @
# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree, which does not
65 @
# contain the userland sources. NB: Remove-userland-dist-rules.patch
68 @
# Install the DKMS source.
69 @
# We only want the files needed to build the modules
70 mkdir
-p
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'
71 $(foreach file
,$(DKMSFILES
),mv
'$(CURDIR)/$(NAME)-$(VERSION)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)' || exit
1;)
73 @
# * Deletes from configure.ac the parts not needed for building the kernel module
74 @
# * It deletes from inside AC_CONFIG_FILES([]) everything except:
75 @
# (Makefile$|include/|module/|*.release$)
76 @
# * Takes care of spaces and tabs
77 awk
'/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|zfs\.release([ \t]+)?$$))/){next} } {print}' \
78 '$(CURDIR)/$(NAME)-$(VERSION)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/configure.ac'
79 @
# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
80 sed
'1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \
81 '$(CURDIR)/$(NAME)-$(VERSION)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
83 grep
-q
'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
84 @
# Run autogen on the stripped source tree
85 cd
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'; .
/autogen.sh
86 rm -fr
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/autom4te.cache'
88 @
# This shunt allows DKMS to install the Module.symvers and zfs_config.h
89 @
# files to the ${dkms_tree} area through the POST_INSTALL directive.
90 echo
'#!/bin/sh' >'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
91 echo
'cp "$$@"' >>'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
92 chmod
755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
94 mkdir
-p
$(CURDIR
)/debian
/tmp
/usr
/lib
95 for i in
`ls $(CURDIR)/debian/tmp/lib/*.so`; do \
96 ln
-s
/lib
/`readlink $${i}` $(CURDIR
)/debian
/tmp
/usr
/lib
/`basename $${i}`; \
101 dh_dkms
-V
$(VERSION
)
103 override_dh_makeshlibs
:
105 ifeq ($(BUILD_UDEB
), true
)
106 dh_makeshlibs
-plibnvpair
$(SHLIB_MAJOR
) --add-udeb
=libnvpair
$(SHLIB_MAJOR
)-udeb
107 dh_makeshlibs
-plibuutil
$(SHLIB_MAJOR
) --add-udeb
=libuutil
$(SHLIB_MAJOR
)-udeb
108 dh_makeshlibs
-plibzfs
$(SHLIB_MAJOR
) --add-udeb
=libzfs
$(SHLIB_MAJOR
)-udeb
109 dh_makeshlibs
-plibzpool
$(SHLIB_MAJOR
) --add-udeb
=libzpool
$(SHLIB_MAJOR
)-udeb
110 dh_makeshlibs
-pzfsutils
--add-udeb
=zfsutils-udeb
114 dh_strip
--dbg-package
=zfs-dbg
115 ifeq ($(BUILD_UDEB
), true
)
116 dh_strip
-plibnvpair
$(SHLIB_MAJOR
)-udeb
117 dh_strip
-plibuutil
$(SHLIB_MAJOR
)-udeb
118 dh_strip
-plibzfs
$(SHLIB_MAJOR
)-udeb
119 dh_strip
-plibzpool
$(SHLIB_MAJOR
)-udeb
120 dh_strip
-pzfsutils-udeb
123 override_dh_auto_clean
:
126 @if
test -e META.orig
; then mv META.orig META
; fi
127 cp debian
/control.in debian
/control
128 ifeq ($(BUILD_UDEB
), true
)
129 cat debian
/control.udeb.in
>> debian
/control
133 find .
-name lib
*.la
-delete
134 dh_install
--list-missing
138 override_dh_prep-deb-files
:
139 for templ in
$(wildcard $(CURDIR
)/debian
/*_KVERS_
*.in
); do \
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)/' \
141 < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \
143 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' \
144 < debian
/control.modules.in
> debian
/control
146 override_dh_configure_modules_udeb
: override_dh_configure_modules_udeb_stamp
147 override_dh_configure_modules_udeb_stamp
:
150 --with-config
=kernel \
151 --with-linux
=$(KSRC
) \
152 --with-linux-obj
=$(KOBJ
) \
154 touch override_dh_configure_modules_udeb_stamp
156 override_dh_configure_modules
: override_dh_configure_modules_stamp
157 override_dh_configure_modules_stamp
:
159 --with-config
=kernel \
160 --with-linux
=$(KSRC
) \
161 --with-linux-obj
=$(KOBJ
) \
163 touch override_dh_configure_modules_stamp
165 override_dh_binary-modules-udeb
: override_dh_prep-deb-files override_dh_configure_modules_udeb
170 $(MAKE
) -C
$(CURDIR
)/module modules
172 dh_installdirs
-p
${pmodules}-di
173 dh_install
-p
${pmodules}-di
174 dh_gencontrol
-p
${pmodules}-di
176 dh_builddeb
-p
${pmodules}-di
178 override_dh_binary-modules
: override_dh_prep-deb-files override_dh_configure_modules
183 $(MAKE
) -C
$(CURDIR
)/module modules
185 dh_install
-p
${pmodules}
186 dh_installdocs
-p
${pmodules}
187 dh_installchangelogs
-p
${pmodules}
188 dh_compress
-p
${pmodules}
189 dh_strip
-p
${pmodules}
190 dh_fixperms
-p
${pmodules}
191 dh_installdeb
-p
${pmodules}
192 dh_gencontrol
-p
${pmodules}
193 dh_md5sums
-p
${pmodules}
194 dh_builddeb
-p
${pmodules}