]> git.proxmox.com Git - mirror_zfs-debian.git/blob - debian/rules
Explicity select what is copied inside the DKMS source tree
[mirror_zfs-debian.git] / debian / rules
1 #!/usr/bin/make -f
2
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)
7
8 DKMSFILES := module include config Makefile.in autogen.sh dkms.conf.in \
9 zfs.release.in META zfs_config.h AUTHORS COPYRIGHT DISCLAIMER \
10 OPENSOLARIS.LICENSE
11
12 %:
13 dh $@ --with dkms
14
15 override_dh_auto_configure:
16 @# Embed the downstream version in the module.
17 @sed -e 's/^Version:.*/Version: $(VERSION)/' -i.orig META
18
19 @# Create the $(MAKE)files and configure script.
20 ./autogen.sh
21
22 @# Build the userland, but don't build the kernel modules.
23 ./configure \
24 --prefix='' \
25 --libexecdir=/usr/libexec \
26 --libdir=/lib \
27 --includedir=/usr/include \
28 --datarootdir=/usr/share \
29 --with-config=user
30
31 override_dh_auto_test:
32 # The dh_auto_test rule is disabled because
33 # `make check` cannot run in an unprivileged build environment.
34
35 override_dh_auto_install:
36 @# Install the utilities.
37 $(MAKE) install DESTDIR='$(CURDIR)/debian/tmp'
38
39 @# Get a bare copy of the source code for DKMS.
40 @# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree, which does not
41 @# contain the userland sources. NB: Remove-userland-dist-rules.patch
42 $(MAKE) distdir
43
44 @# Install the DKMS source.
45 @# We only want the files needed to build the modules
46 mkdir -p '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'
47 $(foreach file,$(DKMSFILES),mv '$(CURDIR)/$(NAME)-$(VERSION)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)';)
48 @# Hellish awk line:
49 @# * Deletes from configure.ac the parts not needed for building the kernel module
50 @# * It deletes from inside AC_CONFIG_FILES([]) everything except:
51 @# (Makefile$|include/|module/|*.release$|dkms.conf$)
52 @# * Takes care of spaces and tabs
53 awk '/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|zfs\.release([ \t]+)?$$|dkms\.conf([ \t]+)?$$))/){next} } {print}' \
54 '$(CURDIR)/$(NAME)-$(VERSION)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/configure.ac'
55 cp '$(CURDIR)/autogen.sh' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'
56 cd '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'; ./autogen.sh
57 rm -fr '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/autom4te.cache'
58
59 @# This shunt allows DKMS to install the Module.symvers and zfs_config.h
60 @# files to the ${dkms_tree} area through the POST_INSTALL directive.
61 echo '#!/bin/sh' >'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
62 echo 'cp "$$@"' >>'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
63 chmod 755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
64
65 override_dh_installinit:
66 @# Install the /etc/default/zfs options file.
67 dh_installinit --name=zfs
68
69 @# Install the /etc/init.d/zfs-mount script.
70 ifeq ($(LSB_DISTRIBUTOR),Debian)
71 @# Debian runs local mounts at sysv sequences [10..12] [08..09].
72 dh_installinit --name=zfs-mount \
73 --no-restart-on-upgrade --no-start -- defaults 13 07
74 else
75 dh_installinit --name=zfs-mount \
76 --no-restart-on-upgrade --no-start
77 endif
78
79 @# Install the /etc/init.d/zfs-share script.
80 ifeq ($(LSB_DISTRIBUTOR),Debian)
81 @# Debian runs nfs-kernel-server at sysv sequence 17 01.
82 dh_installinit --name=zfs-share \
83 --no-restart-on-upgrade --no-start -- defaults 18 00
84 else ifeq ($(LSB_DISTRIBUTOR),Ubuntu)
85 @# Ubuntu runs nfs-kernel-server at sysv sequence 20 80.
86 dh_installinit --name=zfs-share \
87 --no-restart-on-upgrade --no-start -- defaults 21 79
88 else
89 dh_installinit --name=zfs-share \
90 --no-restart-on-upgrade --no-start
91 endif
92
93 override_dh_dkms:
94 dh_dkms -V $(VERSION)
95
96 override_dh_fixperms:
97 @# Ubuntu 10.04 LTS Lucid Lynx, et al, compatibility.
98 @# (>= debhelper-8.0.0) does this automatically.
99 dh_fixperms
100 chmod 0440 debian/zfsutils/etc/sudoers.d/zfs
101
102 override_dh_shlibdeps:
103 @# Suppress libtool dependency_libs warnings that are caused by
104 @# inter-library dependencies. (eg: zfs -> libzfs -> libuuid)
105 @# @TODO: Add pkgconfig support instead.
106 dh_shlibdeps -- --warnings=0
107
108 override_dh_strip:
109 dh_strip -plibnvpair1 --dbg-package=libnvpair1-dbg
110 dh_strip -plibuutil1 --dbg-package=libuutil1-dbg
111 dh_strip -plibzfs1 --dbg-package=libzfs1-dbg
112 dh_strip -plibzpool1 --dbg-package=libzpool1-dbg
113 dh_strip -pzfsutils --dbg-package=zfsutils-dbg
114
115 override_dh_auto_clean:
116 dh_auto_clean
117 @if test -e META.orig; then mv META.orig META; fi
118