3 include /usr
/share
/dpkg
/default.mk
5 LSB_DISTRIBUTOR
:= $(shell lsb_release
-is
)
6 NAME
:= $(shell awk
'$$1 == "Name:" { print $$2; }' META
)
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-
$(DEB_VERSION_UPSTREAM
)
28 SPLOBJ
=/var
/lib
/dkms
/spl
/$(DEB_VERSION_UPSTREAM
)/$(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
,python3
,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: $(DEB_VERSION_UPSTREAM)/' -i.orig META
49 @
# Build the userland, but don't build the kernel modules.
50 dh_auto_configure
-- \
54 --with-udevdir
=/lib
/udev \
55 --with-systemdunitdir
=/lib
/systemd
/system \
56 --with-systemdpresetdir
=/lib
/systemd
/system-preset \
59 override_dh_auto_test
:
60 # The dh_auto_test rule is disabled because
61 # `make check` cannot run in an unprivileged build environment.
63 override_dh_auto_install
:
64 @
# Install the utilities.
65 $(MAKE
) install DESTDIR
='$(CURDIR)/debian/tmp'
68 # Move from bin_dir to /usr/sbin
69 # Remove suffix (.py) as per policy 10.4 - Scripts
70 # https://www.debian.org/doc/debian-policy/ch-files.html#s-scripts
71 mkdir
-p
'$(CURDIR)/debian/tmp/usr/sbin/'
72 mv
'$(CURDIR)/debian/tmp/usr/bin/arc_summary.py' '$(CURDIR)/debian/tmp/usr/sbin/arc_summary'
73 mv
'$(CURDIR)/debian/tmp/usr/bin/arcstat.py' '$(CURDIR)/debian/tmp/usr/sbin/arcstat'
74 mv
'$(CURDIR)/debian/tmp/usr/bin/dbufstat.py' '$(CURDIR)/debian/tmp/usr/sbin/dbufstat'
76 @
# Zed has dependencies outside of the system root.
77 $(INSTALL
) -d
'$(CURDIR)/debian/tmp/usr/sbin/'
78 mv
'$(CURDIR)/debian/tmp/sbin/zed' '$(CURDIR)/debian/tmp/usr/sbin/zed'
80 @
# Get a bare copy of the source code for DKMS.
81 @
# This creates the $(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/ tree, which does not
82 @
# contain the userland sources. NB: Remove-userland-dist-rules.patch
85 @
# Install the DKMS source.
86 @
# We only want the files needed to build the modules
87 mkdir
-p
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)'
88 $(foreach file
,$(DKMSFILES
),mv
'$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)' || exit
1;)
90 @
# * Deletes from configure.ac the parts not needed for building the kernel module
91 @
# * It deletes from inside AC_CONFIG_FILES([]) everything except:
92 @
# (Makefile$|include/|module/|*.release$)
93 @
# * Takes care of spaces and tabs
94 awk
'/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|zfs\.release([ \t]+)?$$))/){next} } {print}' \
95 '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac'
96 @
# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
97 sed
'1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \
98 '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am'
100 grep
-q
'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am'
101 @
# Run autogen on the stripped source tree
102 cd
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)'; .
/autogen.sh
103 rm -fr
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/autom4te.cache'
105 @
# This shunt allows DKMS to install the Module.symvers and zfs_config.h
106 @
# files to the ${dkms_tree} area through the POST_INSTALL directive.
107 printf
'#!/bin/sh\ncp "$$@"\n' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/cp'
108 chmod
755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/cp'
110 mkdir
-p
$(CURDIR
)/debian
/tmp
/usr
/lib
111 for i in
`ls $(CURDIR)/debian/tmp/lib/*.so`; do \
112 ln
-s
/lib
/`readlink $${i}` $(CURDIR
)/debian
/tmp
/usr
/lib
/`basename $${i}`; \
116 chmod a-x
$(CURDIR
)/debian
/tmp
/etc
/zfs
/zfs-functions
117 chmod a-x
$(CURDIR
)/debian
/tmp
/etc
/default
/zfs
120 dh_dkms
-V
$(DEB_VERSION_UPSTREAM
)
122 override_dh_makeshlibs
:
124 ifeq ($(BUILD_UDEB
), true
)
125 dh_makeshlibs
-plibnvpair1linux
--add-udeb
=libnvpair1-udeb
126 dh_makeshlibs
-plibuutil1linux
--add-udeb
=libuutil1-udeb
127 dh_makeshlibs
-plibzfs2linux
--add-udeb
=libzfs2-udeb
128 dh_makeshlibs
-plibzpool2linux
--add-udeb
=libzpool2-udeb
129 dh_makeshlibs
-pzfsutils-linux
--add-udeb
=zfsutils-udeb
133 dh_strip
--dbg-package
=zfs-dbg
134 ifeq ($(BUILD_UDEB
), true
)
135 dh_strip
-plibnvpair1-udeb
136 dh_strip
-plibuutil1-udeb
137 dh_strip
-plibzfs2-udeb
138 dh_strip
-plibzpool2-udeb
139 dh_strip
-pzfsutils-udeb
142 override_dh_auto_clean
:
143 find .
-name .gitignore
-delete
144 rm -rf zfs-
$(DEB_VERSION_UPSTREAM
)
147 @if
test -e META.orig
; then mv META.orig META
; fi
148 cp debian
/control.in debian
/control
149 ifeq ($(BUILD_UDEB
), true
)
150 cat debian
/control.udeb.in
>> debian
/control
154 find .
-name lib
*.la
-delete
155 dh_install
--fail-missing
159 override_dh_prep-deb-files
:
160 for templ in
$(wildcard $(CURDIR
)/debian
/*_KVERS_
*.in
); do \
161 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)/' \
162 < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \
164 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' \
165 < debian
/control.modules.in
> debian
/control
167 override_dh_configure_modules_udeb
: override_dh_configure_modules_udeb_stamp
168 override_dh_configure_modules_udeb_stamp
:
171 --with-config
=kernel \
172 --with-linux
=$(KSRC
) \
173 --with-linux-obj
=$(KOBJ
) \
175 --with-spl-obj
=$(SPLOBJ
)
176 touch override_dh_configure_modules_udeb_stamp
178 override_dh_configure_modules
: override_dh_configure_modules_stamp
179 override_dh_configure_modules_stamp
:
181 --with-config
=kernel \
182 --with-linux
=$(KSRC
) \
183 --with-linux-obj
=$(KOBJ
) \
185 --with-spl-obj
=$(SPLOBJ
)
186 touch override_dh_configure_modules_stamp
188 override_dh_binary-modules-udeb
: override_dh_prep-deb-files override_dh_configure_modules_udeb
193 $(MAKE
) -C
$(CURDIR
)/module modules
195 dh_installdirs
-p
${pmodules}-di
196 dh_install
-p
${pmodules}-di
197 dh_gencontrol
-p
${pmodules}-di
199 dh_builddeb
-p
${pmodules}-di
201 override_dh_binary-modules
: override_dh_prep-deb-files override_dh_configure_modules
206 $(MAKE
) -C
$(CURDIR
)/module modules
208 dh_install
-p
${pmodules}
209 dh_installdocs
-p
${pmodules}
210 dh_installchangelogs
-p
${pmodules}
211 dh_compress
-p
${pmodules}
212 dh_strip
-p
${pmodules}
213 dh_fixperms
-p
${pmodules}
214 dh_installdeb
-p
${pmodules}
215 dh_gencontrol
-p
${pmodules}
216 dh_md5sums
-p
${pmodules}
217 dh_builddeb
-p
${pmodules}
220 cme update dpkg-copyright
-file debian
/copyright.cme