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
11 export SHLIB_MAJOR
= 1
14 DEB_HOST_ARCH
= $(shell dpkg-architecture
-qDEB_HOST_ARCH
)
18 KVERS
=$(shell uname
-r
)
21 non_epoch_version
=$(shell echo
$(KVERS
) | perl
-pe
's/^\d+://')
23 pmodules
= $(PACKAGE
)-modules-
$(non_epoch_version
)
28 override_dh_auto_configure
:
29 @cp debian
/control.in debian
/control
31 @
# Embed the downstream version in the module.
32 @sed
-e
's/^Version:.*/Version: $(VERSION)/' -i.orig META
34 @
# Create the makefiles and configure script.
37 @
# Build the userland, but don't build the kernel modules.
40 --libexecdir
=/usr
/libexec \
42 --includedir=/usr
/include \
43 --datarootdir
=/usr
/share \
46 override_dh_auto_test
:
47 # The dh_auto_test rule is disabled because
48 # `make check` cannot run in an unprivileged build environment.
50 override_dh_auto_install
:
51 @
# Install the utilities.
52 $(MAKE
) install DESTDIR
='$(CURDIR)/debian/tmp'
54 @
# Get a bare copy of the source code for DKMS.
55 @
# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree, which does not
56 @
# contain the userland sources. NB: Remove-userland-dist-rules.patch
59 @
# Install the DKMS source.
60 @
# We only want the files needed to build the modules
61 mkdir
-p
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'
62 $(foreach file
,$(DKMSFILES
),mv
'$(CURDIR)/$(NAME)-$(VERSION)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)' || exit
1;)
64 @
# * Deletes from configure.ac the parts not needed for building the kernel module
65 @
# * It deletes from inside AC_CONFIG_FILES([]) everything except:
66 @
# (Makefile$|include/|module/|*.release$)
67 @
# * Takes care of spaces and tabs
68 awk
'/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|zfs\.release([ \t]+)?$$))/){next} } {print}' \
69 '$(CURDIR)/$(NAME)-$(VERSION)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/configure.ac'
70 @
# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
71 sed
'1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \
72 '$(CURDIR)/$(NAME)-$(VERSION)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
74 grep
-q
'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
75 @
# Run autogen on the stripped source tree
76 cd
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'; .
/autogen.sh
77 rm -fr
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/autom4te.cache'
79 @
# This shunt allows DKMS to install the Module.symvers and zfs_config.h
80 @
# files to the ${dkms_tree} area through the POST_INSTALL directive.
81 echo
'#!/bin/sh' >'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
82 echo
'cp "$$@"' >>'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
83 chmod
755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
85 override_dh_installinit
:
86 @
# Install the /etc/default/zfs options file.
87 dh_installinit
--name
=zfs
89 @
# Install the /etc/init.d/zfs-mount script.
90 ifeq ($(LSB_DISTRIBUTOR
),Debian
)
91 @
# Debian runs local mounts at sysv sequences [10..12] [08..09].
92 dh_installinit
--name
=zfs-mount \
93 --no-restart-on-upgrade
--no-start
-- defaults
13 07
95 dh_installinit
--name
=zfs-mount \
96 --no-restart-on-upgrade
--no-start
99 @
# Install the /etc/init.d/zfs-share script.
100 ifeq ($(LSB_DISTRIBUTOR
),Debian
)
101 @
# Debian runs nfs-kernel-server at sysv sequence 17 01.
102 dh_installinit
--name
=zfs-share \
103 --no-restart-on-upgrade
--no-start
-- defaults
18 00
104 else ifeq ($(LSB_DISTRIBUTOR
),Ubuntu
)
105 @
# Ubuntu runs nfs-kernel-server at sysv sequence 20 80.
106 dh_installinit
--name
=zfs-share \
107 --no-restart-on-upgrade
--no-start
-- defaults
21 79
109 dh_installinit
--name
=zfs-share \
110 --no-restart-on-upgrade
--no-start
114 dh_dkms
-V
$(VERSION
)
116 override_dh_makeshlibs
:
118 dh_makeshlibs
-plibnvpair
$(SHLIB_MAJOR
) --add-udeb
=libnvpair
$(SHLIB_MAJOR
)-udeb
119 dh_makeshlibs
-plibuutil
$(SHLIB_MAJOR
) --add-udeb
=libuutil
$(SHLIB_MAJOR
)-udeb
120 dh_makeshlibs
-plibzfs
$(SHLIB_MAJOR
) --add-udeb
=libzfs
$(SHLIB_MAJOR
)-udeb
121 dh_makeshlibs
-plibzpool
$(SHLIB_MAJOR
) --add-udeb
=libzpool
$(SHLIB_MAJOR
)-udeb
122 dh_makeshlibs
-pzfsutils
--add-udeb
=zfsutils-udeb
124 override_dh_shlibdeps
:
125 @
# Suppress libtool dependency_libs warnings that are caused by
126 @
# inter-library dependencies. (eg: zfs -> libzfs -> libuuid)
127 @
# @TODO: Add pkgconfig support instead.
128 dh_shlibdeps
-- --warnings
=0
131 dh_strip
-plibnvpair1
--dbg-package
=libnvpair1-dbg
132 dh_strip
-plibuutil1
--dbg-package
=libuutil1-dbg
133 dh_strip
-plibzfs1
--dbg-package
=libzfs1-dbg
134 dh_strip
-plibzpool1
--dbg-package
=libzpool1-dbg
135 dh_strip
-pzfsutils
--dbg-package
=zfsutils-dbg
137 dh_strip
-plibnvpair
$(SHLIB_MAJOR
)-udeb
138 dh_strip
-plibuutil
$(SHLIB_MAJOR
)-udeb
139 dh_strip
-plibzfs
$(SHLIB_MAJOR
)-udeb
140 dh_strip
-plibzpool
$(SHLIB_MAJOR
)-udeb
141 dh_strip
-pzfsutils-udeb
143 override_dh_auto_clean
:
145 @if
test -e META.orig
; then mv META.orig META
; fi
148 find .
-name lib
*.la
-delete
153 override_dh_prep-deb-files
:
154 for templ in
$(wildcard $(CURDIR
)/debian
/*_KVERS_
*.in
); do \
155 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)/' \
156 < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \
158 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' \
159 < debian
/control.modules.in
> debian
/control
161 override_dh_configure_modules
: override_dh_configure_modules_stamp
162 override_dh_configure_modules_stamp
:
163 .
/configure
--with-config
=kernel
--with-linux
=$(KSRC
) \
164 --with-linux-obj
=$(KOBJ
)
165 touch override_dh_configure_modules_stamp
167 override_dh_binary-modules-udeb
: override_dh_prep-deb-files override_dh_configure_modules
172 $(MAKE
) -C
$(CURDIR
)/module modules
174 dh_installdirs
-p
${pmodules}-di
175 dh_install
-p
${pmodules}-di
176 dh_gencontrol
-p
${pmodules}-di
178 dh_builddeb
-p
${pmodules}-di
--destdir
=$(DEB_DESTDIR
)
180 override_dh_binary-modules
: override_dh_prep-deb-files override_dh_configure_modules
185 $(MAKE
) -C
$(CURDIR
)/module modules
187 dh_install
-p
${pmodules}
188 dh_installdocs
-p
${pmodules}
189 dh_installchangelogs
-p
${pmodules}
190 dh_compress
-p
${pmodules}
191 dh_strip
-p
${pmodules}
192 dh_fixperms
-p
${pmodules}
193 dh_installdeb
-p
${pmodules}
194 dh_gencontrol
-p
${pmodules} -- -v
$(VERSION
)
195 dh_md5sums
-p
${pmodules}
197 dh_builddeb
-p
${pmodules} --destdir
=$(DEB_DESTDIR
)