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
)
28 SPLOBJ
=/var
/lib
/dkms
/spl
/$(VERSION
)/$(KVERS
)/$(shell dpkg-architecture
-qDEB_TARGET_GNU_CPU
)
31 non_epoch_version
=$(shell echo
$(KVERS
) | perl
-pe
's/^\d+://')
33 pmodules
= $(PACKAGE
)-modules-
$(non_epoch_version
)
35 export DEB_BUILD_MAINT_OPTIONS
= hardening
=+all
38 dh
$@
--with autoreconf
,dkms
,python2
,systemd
--parallel
40 override_dh_auto_configure
:
41 @cp debian
/control.in debian
/control
42 ifeq ($(BUILD_UDEB
), true
)
43 cat debian
/control.udeb.in
>> debian
/control
46 @
# Embed the downstream version in the module.
47 @sed
-e
's/^Version:.*/Version: $(VERSION)/' -i.orig META
49 @
# Build the userland, but don't build the kernel modules.
50 dh_auto_configure
-- \
54 --with-udevdir
=/lib
/udev \
57 override_dh_auto_test
:
58 # The dh_auto_test rule is disabled because
59 # `make check` cannot run in an unprivileged build environment.
61 override_dh_auto_install
:
62 @
# Install the utilities.
63 $(MAKE
) install DESTDIR
='$(CURDIR)/debian/tmp'
65 @
# Get a bare copy of the source code for DKMS.
66 @
# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree, which does not
67 @
# contain the userland sources. NB: Remove-userland-dist-rules.patch
70 @
# Install the DKMS source.
71 @
# We only want the files needed to build the modules
72 mkdir
-p
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'
73 $(foreach file
,$(DKMSFILES
),mv
'$(CURDIR)/$(NAME)-$(VERSION)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)' || exit
1;)
75 @
# * Deletes from configure.ac the parts not needed for building the kernel module
76 @
# * It deletes from inside AC_CONFIG_FILES([]) everything except:
77 @
# (Makefile$|include/|module/|*.release$)
78 @
# * Takes care of spaces and tabs
79 awk
'/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|zfs\.release([ \t]+)?$$))/){next} } {print}' \
80 '$(CURDIR)/$(NAME)-$(VERSION)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/configure.ac'
81 @
# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
82 sed
'1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \
83 '$(CURDIR)/$(NAME)-$(VERSION)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
85 grep
-q
'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
86 @
# Run autogen on the stripped source tree
87 cd
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'; .
/autogen.sh
88 rm -fr
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/autom4te.cache'
90 @
# This shunt allows DKMS to install the Module.symvers and zfs_config.h
91 @
# files to the ${dkms_tree} area through the POST_INSTALL directive.
92 printf
'#!/bin/sh\ncp "$$@"\n' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
93 chmod
755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
95 mkdir
-p
$(CURDIR
)/debian
/tmp
/usr
/lib
96 for i in
`ls $(CURDIR)/debian/tmp/lib/*.so`; do \
97 ln
-s
/lib
/`readlink $${i}` $(CURDIR
)/debian
/tmp
/usr
/lib
/`basename $${i}`; \
101 chmod
-x
$(CURDIR
)/debian
/tmp
/etc
/zfs
/zfs-functions
102 chmod
-x
$(CURDIR
)/debian
/tmp
/etc
/default
/zfs
105 dh_dkms
-V
$(VERSION
)
107 override_dh_makeshlibs
:
109 ifeq ($(BUILD_UDEB
), true
)
110 dh_makeshlibs
-plibnvpair1linux
--add-udeb
=libnvpair1-udeb
111 dh_makeshlibs
-plibuutil1linux
--add-udeb
=libuutil1-udeb
112 dh_makeshlibs
-plibzfs2linux
--add-udeb
=libzfs2-udeb
113 dh_makeshlibs
-plibzpool2linux
--add-udeb
=libzpool2-udeb
114 dh_makeshlibs
-pzfsutils-linux
--add-udeb
=zfsutils-udeb
118 dh_strip
--dbg-package
=zfs-dbg
119 ifeq ($(BUILD_UDEB
), true
)
120 dh_strip
-plibnvpair1-udeb
121 dh_strip
-plibuutil1-udeb
122 dh_strip
-plibzfs2-udeb
123 dh_strip
-plibzpool2-udeb
124 dh_strip
-pzfsutils-udeb
127 override_dh_auto_clean
:
128 find .
-name .gitignore
-delete
129 rm -rf zfs-
$(VERSION
)
132 @if
test -e META.orig
; then mv META.orig META
; fi
133 cp debian
/control.in debian
/control
134 ifeq ($(BUILD_UDEB
), true
)
135 cat debian
/control.udeb.in
>> debian
/control
139 find .
-name lib
*.la
-delete
140 dh_install
--list-missing
144 override_dh_prep-deb-files
:
145 for templ in
$(wildcard $(CURDIR
)/debian
/*_KVERS_
*.in
); do \
146 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)/' \
147 < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \
149 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' \
150 < debian
/control.modules.in
> debian
/control
152 override_dh_configure_modules_udeb
: override_dh_configure_modules_udeb_stamp
153 override_dh_configure_modules_udeb_stamp
:
156 --with-config
=kernel \
157 --with-linux
=$(KSRC
) \
158 --with-linux-obj
=$(KOBJ
) \
160 --with-spl-obj
=$(SPLOBJ
)
161 touch override_dh_configure_modules_udeb_stamp
163 override_dh_configure_modules
: override_dh_configure_modules_stamp
164 override_dh_configure_modules_stamp
:
166 --with-config
=kernel \
167 --with-linux
=$(KSRC
) \
168 --with-linux-obj
=$(KOBJ
) \
170 --with-spl-obj
=$(SPLOBJ
)
171 touch override_dh_configure_modules_stamp
173 override_dh_binary-modules-udeb
: override_dh_prep-deb-files override_dh_configure_modules_udeb
178 $(MAKE
) -C
$(CURDIR
)/module modules
180 dh_installdirs
-p
${pmodules}-di
181 dh_install
-p
${pmodules}-di
182 dh_gencontrol
-p
${pmodules}-di
184 dh_builddeb
-p
${pmodules}-di
186 override_dh_binary-modules
: override_dh_prep-deb-files override_dh_configure_modules
191 $(MAKE
) -C
$(CURDIR
)/module modules
193 dh_install
-p
${pmodules}
194 dh_installdocs
-p
${pmodules}
195 dh_installchangelogs
-p
${pmodules}
196 dh_compress
-p
${pmodules}
197 dh_strip
-p
${pmodules}
198 dh_fixperms
-p
${pmodules}
199 dh_installdeb
-p
${pmodules}
200 dh_gencontrol
-p
${pmodules}
201 dh_md5sums
-p
${pmodules}
202 dh_builddeb
-p
${pmodules}
205 cme update dpkg-copyright
-file debian
/copyright.cme