]> git.proxmox.com Git - mirror_zfs-debian.git/blame - debian/rules
Explicity select what is copied inside the DKMS source tree
[mirror_zfs-debian.git] / debian / rules
CommitLineData
7e4739a2
DH
1#!/usr/bin/make -f
2
fb579137 3LSB_DISTRIBUTOR := $(shell lsb_release -is)
5cc6dd58
DH
4NAME := $(shell awk '$$1 == "Name:" { print $$2; }' META)
5VERSION := $(shell dpkg-parsechangelog \
6 | awk '$$1 == "Version:" { print $$2; }' | cut -d- -f1)
7e4739a2 7
e6fd8d0f
CALP
8DKMSFILES := 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
505714c7
CALP
12%:
13 dh $@ --with dkms
14
7e4739a2 15override_dh_auto_configure:
5cc6dd58
DH
16 @# Embed the downstream version in the module.
17 @sed -e 's/^Version:.*/Version: $(VERSION)/' -i.orig META
18
661c4a4b 19 @# Create the $(MAKE)files and configure script.
2a9c6adc
DH
20 ./autogen.sh
21
37316e2f 22 @# Build the userland, but don't build the kernel modules.
ab520f13 23 ./configure \
4f023100 24 --prefix='' \
ab520f13 25 --libexecdir=/usr/libexec \
44bb78ce 26 --libdir=/lib \
ab520f13
DH
27 --includedir=/usr/include \
28 --datarootdir=/usr/share \
37316e2f
DH
29 --with-config=user
30
7e4739a2 31override_dh_auto_test:
37316e2f 32 # The dh_auto_test rule is disabled because
7e4739a2
DH
33 # `make check` cannot run in an unprivileged build environment.
34
35override_dh_auto_install:
37316e2f 36 @# Install the utilities.
661c4a4b 37 $(MAKE) install DESTDIR='$(CURDIR)/debian/tmp'
7e4739a2 38
37316e2f
DH
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
661c4a4b 42 $(MAKE) distdir
7e4739a2 43
e6fd8d0f
CALP
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
37316e2f
DH
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.
e6fd8d0f
CALP
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'
7e4739a2 64
f61f5bec 65override_dh_installinit:
fb579137 66 @# Install the /etc/default/zfs options file.
9e5db36f 67 dh_installinit --name=zfs
9b360ccf 68
fb579137
DH
69 @# Install the /etc/init.d/zfs-mount script.
70ifeq ($(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
74else
75 dh_installinit --name=zfs-mount \
76 --no-restart-on-upgrade --no-start
77endif
78
79 @# Install the /etc/init.d/zfs-share script.
80ifeq ($(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
84else 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
88else
89 dh_installinit --name=zfs-share \
90 --no-restart-on-upgrade --no-start
91endif
92
505714c7
CALP
93override_dh_dkms:
94 dh_dkms -V $(VERSION)
95
648b2e07
DH
96override_dh_fixperms:
97 @# Ubuntu 10.04 LTS Lucid Lynx, et al, compatibility.
98 @# (>= debhelper-8.0.0) does this automatically.
648b2e07 99 dh_fixperms
b9864321 100 chmod 0440 debian/zfsutils/etc/sudoers.d/zfs
648b2e07 101
9b360ccf 102override_dh_shlibdeps:
37316e2f
DH
103 @# Suppress libtool dependency_libs warnings that are caused by
104 @# inter-library dependencies. (eg: zfs -> libzfs -> libuuid)
105 @# @TODO: Add pkgconfig support instead.
9b360ccf 106 dh_shlibdeps -- --warnings=0
47ba6fdb
PF
107
108override_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
5cc6dd58
DH
114
115override_dh_auto_clean:
116 dh_auto_clean
117 @if test -e META.orig; then mv META.orig META; fi
118