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 KVERS
=$(shell uname
-r
)
20 SPL
=/usr
/src
/spl-
$(DEB_VERSION_UPSTREAM
)
24 SPLOBJ
=/var
/lib
/dkms
/spl
/$(DEB_VERSION_UPSTREAM
)/$(KVERS
)/$(DEB_TARGET_GNU_CPU
)
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
,python3
,systemd
--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: $(DEB_VERSION_UPSTREAM)/' -i.orig META
45 @
# Build the userland, but don't build the kernel modules.
46 dh_auto_configure
-- \
50 --with-udevdir
=/lib
/udev \
51 --with-systemdunitdir
=/lib
/systemd
/system \
52 --with-systemdpresetdir
=/lib
/systemd
/system-preset \
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'
64 # Move from bin_dir to /usr/sbin
65 # Remove suffix (.py) as per policy 10.4 - Scripts
66 # https://www.debian.org/doc/debian-policy/ch-files.html#s-scripts
67 mkdir
-p
'$(CURDIR)/debian/tmp/usr/sbin/'
68 mv
'$(CURDIR)/debian/tmp/usr/bin/arc_summary.py' '$(CURDIR)/debian/tmp/usr/sbin/arc_summary'
69 mv
'$(CURDIR)/debian/tmp/usr/bin/arcstat.py' '$(CURDIR)/debian/tmp/usr/sbin/arcstat'
70 mv
'$(CURDIR)/debian/tmp/usr/bin/dbufstat.py' '$(CURDIR)/debian/tmp/usr/sbin/dbufstat'
72 @
# Zed has dependencies outside of the system root.
73 $(INSTALL
) -d
'$(CURDIR)/debian/tmp/usr/sbin/'
74 mv
'$(CURDIR)/debian/tmp/sbin/zed' '$(CURDIR)/debian/tmp/usr/sbin/zed'
76 @
# Get a bare copy of the source code for DKMS.
77 @
# This creates the $(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/ tree, which does not
78 @
# contain the userland sources. NB: Remove-userland-dist-rules.patch
81 @
# Install the DKMS source.
82 @
# We only want the files needed to build the modules
83 mkdir
-p
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)'
84 $(foreach file
,$(DKMSFILES
),mv
'$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)' || exit
1;)
86 @
# * Deletes from configure.ac the parts not needed for building the kernel module
87 @
# * It deletes from inside AC_CONFIG_FILES([]) everything except:
88 @
# (Makefile$|include/|module/|*.release$)
89 @
# * Takes care of spaces and tabs
90 awk
'/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|zfs\.release([ \t]+)?$$))/){next} } {print}' \
91 '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac'
92 @
# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
93 sed
'1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \
94 '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am'
96 grep
-q
'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am'
97 @
# Run autogen on the stripped source tree
98 cd
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)'; .
/autogen.sh
99 rm -fr
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/autom4te.cache'
101 @
# This shunt allows DKMS to install the Module.symvers and zfs_config.h
102 @
# files to the ${dkms_tree} area through the POST_INSTALL directive.
103 printf
'#!/bin/sh\ncp "$$@"\n' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/cp'
104 chmod
755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/cp'
106 mkdir
-p
$(CURDIR
)/debian
/tmp
/usr
/lib
107 for i in
`ls $(CURDIR)/debian/tmp/lib/*.so`; do \
108 ln
-s
/lib
/`readlink $${i}` $(CURDIR
)/debian
/tmp
/usr
/lib
/`basename $${i}`; \
112 chmod a-x
$(CURDIR
)/debian
/tmp
/etc
/zfs
/zfs-functions
113 chmod a-x
$(CURDIR
)/debian
/tmp
/etc
/default
/zfs
116 dh_dkms
-V
$(DEB_VERSION_UPSTREAM
)
118 override_dh_makeshlibs
:
120 ifeq ($(BUILD_UDEB
), true
)
121 dh_makeshlibs
-V
-plibnvpair1linux
--add-udeb
=libnvpair1-udeb
122 dh_makeshlibs
-V
-plibuutil1linux
--add-udeb
=libuutil1-udeb
123 dh_makeshlibs
-V
-plibzfs2linux
--add-udeb
=libzfs2-udeb
124 dh_makeshlibs
-V
-plibzpool2linux
--add-udeb
=libzpool2-udeb
125 dh_makeshlibs
-V
-pzfsutils-linux
--add-udeb
=zfsutils-udeb
129 dh_strip
--dbg-package
=zfs-dbg
130 ifeq ($(BUILD_UDEB
), true
)
131 dh_strip
-plibnvpair1-udeb
132 dh_strip
-plibuutil1-udeb
133 dh_strip
-plibzfs2-udeb
134 dh_strip
-plibzpool2-udeb
135 dh_strip
-pzfsutils-udeb
138 override_dh_auto_clean
:
139 find .
-name .gitignore
-delete
140 rm -rf zfs-
$(DEB_VERSION_UPSTREAM
)
143 @if
test -e META.orig
; then mv META.orig META
; fi
144 cp debian
/control.in debian
/control
145 ifeq ($(BUILD_UDEB
), true
)
146 cat debian
/control.udeb.in
>> debian
/control
150 find .
-name lib
*.la
-delete
151 dh_install
--fail-missing
155 override_dh_prep-deb-files
:
156 for templ in
$(wildcard $(CURDIR
)/debian
/*_KVERS_
*.in
); do \
157 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)/' \
158 < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \
160 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' \
161 < debian
/control.modules.in
> debian
/control
163 override_dh_configure_modules_udeb
: override_dh_configure_modules_udeb_stamp
164 override_dh_configure_modules_udeb_stamp
:
167 --with-config
=kernel \
168 --with-linux
=$(KSRC
) \
169 --with-linux-obj
=$(KOBJ
) \
171 --with-spl-obj
=$(SPLOBJ
)
172 touch override_dh_configure_modules_udeb_stamp
174 override_dh_configure_modules
: override_dh_configure_modules_stamp
175 override_dh_configure_modules_stamp
:
177 --with-config
=kernel \
178 --with-linux
=$(KSRC
) \
179 --with-linux-obj
=$(KOBJ
) \
181 --with-spl-obj
=$(SPLOBJ
)
182 touch override_dh_configure_modules_stamp
184 override_dh_binary-modules-udeb
: override_dh_prep-deb-files override_dh_configure_modules_udeb
189 $(MAKE
) -C
$(CURDIR
)/module modules
191 dh_installdirs
-p
${pmodules}-di
192 dh_install
-p
${pmodules}-di
193 dh_gencontrol
-p
${pmodules}-di
195 dh_builddeb
-p
${pmodules}-di
197 override_dh_binary-modules
: override_dh_prep-deb-files override_dh_configure_modules
202 $(MAKE
) -C
$(CURDIR
)/module modules
204 dh_install
-p
${pmodules}
205 dh_installdocs
-p
${pmodules}
206 dh_installchangelogs
-p
${pmodules}
207 dh_compress
-p
${pmodules}
208 dh_strip
-p
${pmodules}
209 dh_fixperms
-p
${pmodules}
210 dh_installdeb
-p
${pmodules}
211 dh_gencontrol
-p
${pmodules}
212 dh_md5sums
-p
${pmodules}
213 dh_builddeb
-p
${pmodules}
216 cme update dpkg-copyright
-file debian
/copyright.cme