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
14 override_dh_auto_configure
:
15 @
# Embed the downstream version in the module.
16 @sed
-e
's/^Version:.*/Version: $(VERSION)/' -i.orig META
18 @
# Create the makefiles and configure script.
21 @
# Build the userland, but don't build the kernel modules.
24 --libexecdir
=/usr
/libexec \
26 --includedir=/usr
/include \
27 --datarootdir
=/usr
/share \
30 override_dh_auto_test
:
31 # The dh_auto_test rule is disabled because
32 # `make check` cannot run in an unprivileged build environment.
34 override_dh_auto_install
:
35 @
# Install the utilities.
36 $(MAKE
) install DESTDIR
='$(CURDIR)/debian/tmp'
38 @
# Get a bare copy of the source code for DKMS.
39 @
# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree, which does not
40 @
# contain the userland sources. NB: Remove-userland-dist-rules.patch
43 @
# Install the DKMS source.
44 @
# We only want the files needed to build the modules
45 mkdir
-p
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'
46 $(foreach file
,$(DKMSFILES
),mv
'$(CURDIR)/$(NAME)-$(VERSION)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)' || exit
1;)
48 @
# * Deletes from configure.ac the parts not needed for building the kernel module
49 @
# * It deletes from inside AC_CONFIG_FILES([]) everything except:
50 @
# (Makefile$|include/|module/|*.release$)
51 @
# * Takes care of spaces and tabs
52 awk
'/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|zfs\.release([ \t]+)?$$))/){next} } {print}' \
53 '$(CURDIR)/$(NAME)-$(VERSION)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/configure.ac'
54 @
# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
55 sed
'1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \
56 '$(CURDIR)/$(NAME)-$(VERSION)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
58 grep
-q
'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
59 @
# Run autogen on the stripped source tree
60 cd
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'; .
/autogen.sh
61 rm -fr
'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/autom4te.cache'
63 @
# This shunt allows DKMS to install the Module.symvers and zfs_config.h
64 @
# files to the ${dkms_tree} area through the POST_INSTALL directive.
65 echo
'#!/bin/sh' >'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
66 echo
'cp "$$@"' >>'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
67 chmod
755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
69 override_dh_installinit
:
70 @
# Install the /etc/default/zfs options file.
71 dh_installinit
--name
=zfs
73 @
# Install the /etc/init.d/zfs-mount script.
74 ifeq ($(LSB_DISTRIBUTOR
),Debian
)
75 @
# Debian runs local mounts at sysv sequences [10..12] [08..09].
76 dh_installinit
--name
=zfs-mount \
77 --no-restart-on-upgrade
--no-start
-- defaults
13 07
79 dh_installinit
--name
=zfs-mount \
80 --no-restart-on-upgrade
--no-start
83 @
# Install the /etc/init.d/zfs-share script.
84 ifeq ($(LSB_DISTRIBUTOR
),Debian
)
85 @
# Debian runs nfs-kernel-server at sysv sequence 17 01.
86 dh_installinit
--name
=zfs-share \
87 --no-restart-on-upgrade
--no-start
-- defaults
18 00
88 else ifeq ($(LSB_DISTRIBUTOR
),Ubuntu
)
89 @
# Ubuntu runs nfs-kernel-server at sysv sequence 20 80.
90 dh_installinit
--name
=zfs-share \
91 --no-restart-on-upgrade
--no-start
-- defaults
21 79
93 dh_installinit
--name
=zfs-share \
94 --no-restart-on-upgrade
--no-start
100 override_dh_shlibdeps
:
101 @
# Suppress libtool dependency_libs warnings that are caused by
102 @
# inter-library dependencies. (eg: zfs -> libzfs -> libuuid)
103 @
# @TODO: Add pkgconfig support instead.
104 dh_shlibdeps
-- --warnings
=0
107 dh_strip
-plibnvpair1
--dbg-package
=libnvpair1-dbg
108 dh_strip
-plibuutil1
--dbg-package
=libuutil1-dbg
109 dh_strip
-plibzfs1
--dbg-package
=libzfs1-dbg
110 dh_strip
-plibzpool1
--dbg-package
=libzpool1-dbg
111 dh_strip
-pzfsutils
--dbg-package
=zfsutils-dbg
113 override_dh_auto_clean
:
115 @if
test -e META.orig
; then mv META.orig META
; fi