3 include /usr
/share
/dpkg
/default.mk
5 LSB_DISTRIBUTOR
:= $(shell lsb_release
-is
)
6 NAME
:= $(shell awk
'$$1 == "Name:" { print $$2; }' META
)
7 LINUX_MIN
:= $(shell awk
'/Linux-Minimum:/{print $$2}' META
)
8 LINUX_NEXT
:= $(shell awk
-F
'[ .]' '/Linux-Maximum:/{print $$2 "." $$3+1}' META
)
10 DKMSFILES
:= module
include config zfs.release.in autogen.sh copy-builtin META AUTHORS \
11 COPYRIGHT LICENSE README.md CODE_OF_CONDUCT.md NEWS NOTICE RELEASES.md
14 KVERS
=$(shell uname
-r
)
17 non_epoch_version
=$(shell echo
$(KVERS
) | perl
-pe
's/^\d+://')
19 pmodules
= $(PACKAGE
)-modules-
$(non_epoch_version
)
21 export DEB_BUILD_MAINT_OPTIONS
= hardening
=+all
23 NUM_CPUS
= $(shell nproc
2>/dev
/null
)
24 PARALLEL
= $(subst parallel
=,,$(filter parallel
=%,$(DEB_BUILD_OPTIONS
)))
25 NJOBS
= -j
$(or
$(PARALLEL
),$(NUM_CPUS
),1)
28 dh
$@
--with autoreconf
,dkms
,python3
,sphinxdoc
30 override_dh_autoreconf
:
31 @
# Embed the downstream version in the module.
32 @sed
-e
's/^Version:.*/Version: $(DEB_VERSION_UPSTREAM)/' -i.orig META
36 override_dh_auto_configure
:
37 @
# Build the userland, but don't build the kernel modules.
38 dh_auto_configure
-- @CFGOPTS@ \
41 --libdir=/lib
/"$(DEB_HOST_MULTIARCH)" \
42 --with-udevdir
=/lib
/udev \
43 --with-zfsexecdir
=/usr
/lib
/zfs-linux \
46 --with-python
=python3 \
47 --with-pammoduledir
='/lib/$(DEB_HOST_MULTIARCH)/security' \
48 --with-pkgconfigdir
='/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig' \
49 --with-systemdunitdir
=/lib
/systemd
/system \
50 --with-systemdpresetdir
=/lib
/systemd
/system-preset \
51 --with-systemdgeneratordir
=/lib
/systemd
/system-generators \
54 for i in
$(wildcard $(CURDIR
)/debian
/*.
install.in
) ; do \
55 basename "$$i" | grep _KVERS_
&& continue
; \
56 sed
's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' "$$i" > "$${i%%.in}" ; \
59 override_dh_gencontrol
:
60 dh_gencontrol
-- -Vlinux
:Recommends
="linux-libc-dev (<< $(LINUX_NEXT)~), linux-libc-dev (>= $(LINUX_MIN)~),"
62 override_dh_auto_build
:
63 @
# Get a bare copy of the source code for DKMS.
64 @
# This creates the $(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/ tree, which does not
65 @
# contain the userland sources. NB: Remove-userland-dist-rules.patch
70 override_dh_auto_install
:
71 @
# Install the utilities.
72 $(MAKE
) install DESTDIR
='$(CURDIR)/debian/tmp'
74 # Move from bin_dir to /usr/sbin
75 # Remove suffix (.py) as per policy 10.4 - Scripts
76 # https://www.debian.org/doc/debian-policy/ch-files.html#s-scripts
77 mkdir
-p
'$(CURDIR)/debian/tmp/usr/sbin/'
78 mv
'$(CURDIR)/debian/tmp/usr/bin/arc_summary' '$(CURDIR)/debian/tmp/usr/sbin/arc_summary'
79 mv
'$(CURDIR)/debian/tmp/usr/bin/arcstat' '$(CURDIR)/debian/tmp/usr/sbin/arcstat'
80 mv
'$(CURDIR)/debian/tmp/usr/bin/dbufstat' '$(CURDIR)/debian/tmp/usr/sbin/dbufstat'
81 mv
'$(CURDIR)/debian/tmp/usr/bin/zilstat' '$(CURDIR)/debian/tmp/usr/sbin/zilstat'
83 @
# Zed has dependencies outside of the system root.
84 mv
'$(CURDIR)/debian/tmp/sbin/zed' '$(CURDIR)/debian/tmp/usr/sbin/zed'
86 @
# Install the DKMS source.
87 @
# We only want the files needed to build the modules
88 install -D
-t
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/scripts' \
89 '$(CURDIR)/scripts/enum-extract.pl' \
90 '$(CURDIR)/scripts/dkms.postbuild'
91 $(foreach file
,$(DKMSFILES
),mv
'$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)' || exit
1;)
93 @
# Only ever build Linux modules
94 echo
'SUBDIRS = linux' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/include/os/Makefile.am'
97 @
# * Deletes from configure.ac the parts not needed for building the kernel module
98 @
# * It deletes from inside AC_CONFIG_FILES([]) everything except:
100 @
# - include/(Makefile|sys|os/(Makefile|linux))
103 @
# * Takes care of spaces and tabs
104 @
# * Remove reference to ZFS_AC_PACKAGE
105 awk
'/^AC_CONFIG_FILES\(\[/,/^\]\)/ {\
106 if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/(Makefile|sys|os\/(Makefile|linux))|module\/|Makefile([ \t]+)?$$|zfs\.release([ \t]+)?$$))/) \
108 '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac' | sed
'/ZFS_AC_PACKAGE/d' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/configure.ac'
109 @
# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
110 @
# Do not regenerate zfs_gitrev.h during dkms build
111 sed
'1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;/make_gitrev.sh/d' \
112 '$(CURDIR)/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am'
114 grep
-q
'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/Makefile.am'
115 sed
-i
'/rpm.Makefile/d' $(CURDIR
)/debian
/tmp
/usr
/src
/$(NAME
)-$(DEB_VERSION_UPSTREAM
)/Makefile.am
116 sed
-i
'/cmd.Makefile/d' $(CURDIR
)/debian
/tmp
/usr
/src
/$(NAME
)-$(DEB_VERSION_UPSTREAM
)/Makefile.am
117 sed
-i
'/contrib.Makefile/d' $(CURDIR
)/debian
/tmp
/usr
/src
/$(NAME
)-$(DEB_VERSION_UPSTREAM
)/Makefile.am
118 sed
-i
'/etc.Makefile/d' $(CURDIR
)/debian
/tmp
/usr
/src
/$(NAME
)-$(DEB_VERSION_UPSTREAM
)/Makefile.am
119 sed
-i
'/lib.Makefile/d' $(CURDIR
)/debian
/tmp
/usr
/src
/$(NAME
)-$(DEB_VERSION_UPSTREAM
)/Makefile.am
120 sed
-i
'/man.Makefile/d' $(CURDIR
)/debian
/tmp
/usr
/src
/$(NAME
)-$(DEB_VERSION_UPSTREAM
)/Makefile.am
121 sed
-i
'/scripts.Makefile/d' $(CURDIR
)/debian
/tmp
/usr
/src
/$(NAME
)-$(DEB_VERSION_UPSTREAM
)/Makefile.am
122 sed
-i
'/tests.Makefile/d' $(CURDIR
)/debian
/tmp
/usr
/src
/$(NAME
)-$(DEB_VERSION_UPSTREAM
)/Makefile.am
123 sed
-i
'/udev.Makefile/d' $(CURDIR
)/debian
/tmp
/usr
/src
/$(NAME
)-$(DEB_VERSION_UPSTREAM
)/Makefile.am
124 @
# Run autogen on the stripped source tree
125 cd
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)'; .
/autogen.sh
126 rm -fr
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(DEB_VERSION_UPSTREAM)/autom4te.cache'
128 for i in
`ls $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/*.so`; do \
129 ln
-s
'/lib/$(DEB_HOST_MULTIARCH)/'`readlink $${i}` '$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/'`basename $${i}`; \
133 chmod a-x
'$(CURDIR)/debian/tmp/etc/zfs/zfs-functions'
134 chmod a-x
'$(CURDIR)/debian/tmp/etc/default/zfs'
137 dh_python3
-p openzfs-python3-pyzfs
140 '$(CURDIR)/scripts/dkms.mkconf' -n
$(NAME
) -v
$(DEB_VERSION_UPSTREAM
) -f
'$(CURDIR)/scripts/zfs-dkms.dkms'
142 rm -f
'$(CURDIR)/scripts/zfs-dkms.dkms'
144 override_dh_makeshlibs
:
150 override_dh_auto_clean
:
151 rm -rf zfs-
$(DEB_VERSION_UPSTREAM
)
153 @if
test -e META.orig
; then mv META.orig META
; fi
156 find debian
/tmp
/lib
-name
'*.la' -delete
160 dh_missing
--fail-missing
162 override_dh_installinit
:
163 dh_installinit
-r
--no-restart-after-upgrade
--name zfs-import
164 dh_installinit
-r
--no-restart-after-upgrade
--name zfs-mount
165 dh_installinit
-r
--no-restart-after-upgrade
--name zfs-load-key
166 dh_installinit
-R
--name zfs-share
167 dh_installinit
-R
--name zfs-zed
169 override_dh_installsystemd
:
170 mkdir
-p debian
/openzfs-zfsutils
/lib
/systemd
/system
171 ln
-sr
/dev
/null debian
/openzfs-zfsutils
/lib
/systemd
/system
/zfs-import.service
172 dh_installsystemd
--no-stop-on-upgrade
-X zfs-zed.service
173 dh_installsystemd
--name zfs-zed
175 override_dh_installdocs
:
177 ifeq (,$(findstring nodoc
, $(DEB_BUILD_OPTIONS
)))
178 http_proxy
='127.0.0.1:9' sphinx-build
-N
-bhtml
"$(CURDIR)/contrib/pyzfs/docs/source/" debian
/openzfs-pyzfs-doc
/usr
/share
/doc
/openzfs-pyzfs-doc
/html
/
183 override_dh_prep-deb-files
:
184 for templ in
$(wildcard $(CURDIR
)/debian
/*_KVERS_
*.in
); do \
185 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)/' \
186 < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \
188 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' \
189 < debian
/control.modules.in
> debian
/control
191 override_dh_configure_modules
: override_dh_configure_modules_stamp
192 override_dh_configure_modules_stamp
:
193 .
/configure @CFGOPTS@ \
194 --with-config
=kernel \
195 --with-linux
=$(KSRC
) \
196 --with-linux-obj
=$(KOBJ
)
197 touch override_dh_configure_modules_stamp
199 override_dh_binary-modules
: override_dh_prep-deb-files override_dh_configure_modules
204 $(MAKE
) $(NJOBS
) -C
$(CURDIR
)/module modules
206 dh_install
-p
${pmodules}
207 dh_installdocs
-p
${pmodules}
208 dh_installchangelogs
-p
${pmodules}
209 dh_compress
-p
${pmodules}
210 dh_strip
-p
${pmodules}
211 dh_fixperms
-p
${pmodules}
212 dh_installdeb
-p
${pmodules}
213 dh_gencontrol
-p
${pmodules}
214 dh_md5sums
-p
${pmodules}
215 dh_builddeb
-p
${pmodules}
218 cme update dpkg-copyright
-file debian
/copyright.cme