3 include /usr
/share
/dpkg
/default.mk
5 LSB_DISTRIBUTOR
:= $(shell lsb_release
-is
)
6 NAME
:= $(shell awk
'$$1 == "Name:" { print $$2; }' META
)
7 VERSION
:= $(shell dpkg-parsechangelog \
8 | awk
'$$1 == "Version:" { print $$2; }' | cut
-d-
-f1
)
10 DKMSFILES
:= module
include config zfs.release.in autogen.sh META AUTHORS \
11 DISCLAIMER COPYRIGHT OPENSOLARIS.LICENSE README.markdown
18 DEB_HOST_ARCH
= $(shell dpkg-architecture
-qDEB_HOST_ARCH
)
22 KVERS
=$(shell uname
-r
)
26 SPL
=/usr
/src
/spl-
$(VERSION
)
30 SPLOBJ
=/var
/lib
/dkms
/spl
/$(VERSION
)/$(KVERS
)/$(shell dpkg-architecture
-qDEB_TARGET_GNU_CPU
)
33 non_epoch_version
=$(shell echo
$(KVERS
) | perl
-pe
's/^\d+://')
35 pmodules
= $(PACKAGE
)-modules-
$(non_epoch_version
)
37 export DEB_BUILD_MAINT_OPTIONS
= hardening
=+all
40 dh
$@
--with autoreconf
,dkms
,python3
,systemd
--parallel
42 override_dh_auto_configure
:
43 @cp debian
/control.in debian
/control
44 ifeq ($(BUILD_UDEB
), true
)
45 cat debian
/control.udeb.in
>> debian
/control
48 @
# Embed the downstream version in the module.
49 @sed
-e
's/^Version:.*/Version: $(VERSION)/' -i.orig META
51 @
# Build the userland, but don't build the kernel modules.
52 dh_auto_configure
-- \
56 --with-udevdir
=/lib
/udev \
57 --with-systemdunitdir
=/lib
/systemd
/system \
58 --with-systemdpresetdir
=/lib
/systemd
/system-preset \
61 override_dh_auto_test
:
62 # The dh_auto_test rule is disabled because
63 # `make check` cannot run in an unprivileged build environment.
65 override_dh_auto_install
:
66 @
# Install the utilities.
67 $(MAKE
) install DESTDIR
='$(CURDIR)/debian/tmp'
70 # Move from bin_dir to /usr/sbin
71 # Remove suffix (.py) as per policy 10.4 - Scripts
72 # https://www.debian.org/doc/debian-policy/ch-files.html#s-scripts
73 mkdir
-p
'$(CURDIR)/debian/tmp/usr/sbin/'
74 mv
'$(CURDIR)/debian/tmp/usr/bin/arc_summary.py' '$(CURDIR)/debian/tmp/usr/sbin/arc_summary'
75 mv
'$(CURDIR)/debian/tmp/usr/bin/arcstat.py' '$(CURDIR)/debian/tmp/usr/sbin/arcstat'
76 mv
'$(CURDIR)/debian/tmp/usr/bin/dbufstat.py' '$(CURDIR)/debian/tmp/usr/sbin/dbufstat'
78 @
# Zed has dependencies outside of the system root.
79 $(INSTALL
) -d
'$(CURDIR)/debian/tmp/usr/sbin/'
80 mv
'$(CURDIR)/debian/tmp/sbin/zed' '$(CURDIR)/debian/tmp/usr/sbin/zed'
82 @
# Get a bare copy of the source code for DKMS.
83 @
# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree, which does not
84 @
# contain the userland sources. NB: Remove-userland-dist-rules.patch
87 @
# Install the DKMS source.
88 @
# We only want the files needed to build the modules
89 mkdir
-p
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'
90 $(foreach file
,$(DKMSFILES
),mv
'$(CURDIR)/$(NAME)-$(VERSION)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)' || exit
1;)
92 @
# * Deletes from configure.ac the parts not needed for building the kernel module
93 @
# * It deletes from inside AC_CONFIG_FILES([]) everything except:
94 @
# (Makefile$|include/|module/|*.release$)
95 @
# * Takes care of spaces and tabs
96 awk
'/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|zfs\.release([ \t]+)?$$))/){next} } {print}' \
97 '$(CURDIR)/$(NAME)-$(VERSION)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/configure.ac'
98 @
# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
99 sed
'1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \
100 '$(CURDIR)/$(NAME)-$(VERSION)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
102 grep
-q
'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
103 @
# Run autogen on the stripped source tree
104 cd
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'; .
/autogen.sh
105 rm -fr
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/autom4te.cache'
107 @
# This shunt allows DKMS to install the Module.symvers and zfs_config.h
108 @
# files to the ${dkms_tree} area through the POST_INSTALL directive.
109 printf
'#!/bin/sh\ncp "$$@"\n' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
110 chmod
755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
112 mkdir
-p
$(CURDIR
)/debian
/tmp
/usr
/lib
113 for i in
`ls $(CURDIR)/debian/tmp/lib/*.so`; do \
114 ln
-s
/lib
/`readlink $${i}` $(CURDIR
)/debian
/tmp
/usr
/lib
/`basename $${i}`; \
118 chmod a-x
$(CURDIR
)/debian
/tmp
/etc
/zfs
/zfs-functions
119 chmod a-x
$(CURDIR
)/debian
/tmp
/etc
/default
/zfs
122 dh_dkms
-V
$(VERSION
)
124 override_dh_makeshlibs
:
126 ifeq ($(BUILD_UDEB
), true
)
127 dh_makeshlibs
-plibnvpair1linux
--add-udeb
=libnvpair1-udeb
128 dh_makeshlibs
-plibuutil1linux
--add-udeb
=libuutil1-udeb
129 dh_makeshlibs
-plibzfs2linux
--add-udeb
=libzfs2-udeb
130 dh_makeshlibs
-plibzpool2linux
--add-udeb
=libzpool2-udeb
131 dh_makeshlibs
-pzfsutils-linux
--add-udeb
=zfsutils-udeb
135 dh_strip
--dbg-package
=zfs-dbg
136 ifeq ($(BUILD_UDEB
), true
)
137 dh_strip
-plibnvpair1-udeb
138 dh_strip
-plibuutil1-udeb
139 dh_strip
-plibzfs2-udeb
140 dh_strip
-plibzpool2-udeb
141 dh_strip
-pzfsutils-udeb
144 override_dh_auto_clean
:
145 find .
-name .gitignore
-delete
146 rm -rf zfs-
$(VERSION
)
149 @if
test -e META.orig
; then mv META.orig META
; fi
150 cp debian
/control.in debian
/control
151 ifeq ($(BUILD_UDEB
), true
)
152 cat debian
/control.udeb.in
>> debian
/control
156 find .
-name lib
*.la
-delete
157 dh_install
--fail-missing
161 override_dh_prep-deb-files
:
162 for templ in
$(wildcard $(CURDIR
)/debian
/*_KVERS_
*.in
); do \
163 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)/' \
164 < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \
166 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' \
167 < debian
/control.modules.in
> debian
/control
169 override_dh_configure_modules_udeb
: override_dh_configure_modules_udeb_stamp
170 override_dh_configure_modules_udeb_stamp
:
173 --with-config
=kernel \
174 --with-linux
=$(KSRC
) \
175 --with-linux-obj
=$(KOBJ
) \
177 --with-spl-obj
=$(SPLOBJ
)
178 touch override_dh_configure_modules_udeb_stamp
180 override_dh_configure_modules
: override_dh_configure_modules_stamp
181 override_dh_configure_modules_stamp
:
183 --with-config
=kernel \
184 --with-linux
=$(KSRC
) \
185 --with-linux-obj
=$(KOBJ
) \
187 --with-spl-obj
=$(SPLOBJ
)
188 touch override_dh_configure_modules_stamp
190 override_dh_binary-modules-udeb
: override_dh_prep-deb-files override_dh_configure_modules_udeb
195 $(MAKE
) -C
$(CURDIR
)/module modules
197 dh_installdirs
-p
${pmodules}-di
198 dh_install
-p
${pmodules}-di
199 dh_gencontrol
-p
${pmodules}-di
201 dh_builddeb
-p
${pmodules}-di
203 override_dh_binary-modules
: override_dh_prep-deb-files override_dh_configure_modules
208 $(MAKE
) -C
$(CURDIR
)/module modules
210 dh_install
-p
${pmodules}
211 dh_installdocs
-p
${pmodules}
212 dh_installchangelogs
-p
${pmodules}
213 dh_compress
-p
${pmodules}
214 dh_strip
-p
${pmodules}
215 dh_fixperms
-p
${pmodules}
216 dh_installdeb
-p
${pmodules}
217 dh_gencontrol
-p
${pmodules}
218 dh_md5sums
-p
${pmodules}
219 dh_builddeb
-p
${pmodules}
222 cme update dpkg-copyright
-file debian
/copyright.cme