]> git.proxmox.com Git - mirror_spl-debian.git/blob - debian/rules
Recommends: linux-libc-dev (< ${LINUX_NEXT})
[mirror_spl-debian.git] / debian / rules
1 #!/usr/bin/make -f
2
3 NAME := $(shell awk '$$1 == "Name:" { print $$2; }' META)
4 VERSION := $(shell dpkg-parsechangelog \
5 | awk '$$1 == "Version:" { print $$2; }' | cut -d- -f1)
6 REVISION := $(shell dpkg-parsechangelog \
7 | awk '$$1 == "Version:" { print $$2; }' | cut -d- -f2-)
8
9 ifndef DEB_HOST_ARCH
10 DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH)
11 endif
12
13 ifndef KVERS
14 KVERS=$(shell uname -r)
15 endif
16
17 non_epoch_version=$(shell echo $(KVERS) | perl -pe 's/^\d+://')
18 PACKAGE=spl
19 pmodules = $(PACKAGE)-modules-$(non_epoch_version)
20
21 %:
22 dh $@ --with dkms,autoreconf --parallel
23
24 override_dh_auto_configure:
25 sed "s/@LINUX_COMPAT@/linux-libc-dev \(< $(shell debian/get_next.sh)\)/" debian/control.in > debian/control
26
27 @# Embed the downstream version in the module.
28 @sed \
29 -e 's/^Version:.*/Version: $(VERSION)/' \
30 -e 's/^Release:.*/Release: $(REVISION)/' \
31 -i.orig META
32
33 @# Build the userland, but don't build the kernel modules.
34 dh_auto_configure -- --with-config=user --disable-debug-kmem
35
36 override_dh_auto_test:
37 # scripts/check.sh tries insmod and rmmod, so it cannot
38 # run in an unprivileged build environment.
39
40 override_dh_auto_install:
41 @# Install the utilities.
42 $(MAKE) install DESTDIR='$(CURDIR)/debian/tmp'
43
44 @# Get a bare copy of the source code.
45 @# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree.
46 $(MAKE) distdir
47
48 @# This shunt allows DKMS to install the Module.symvers and spl_config.h
49 @# files to the ${dkms_tree} area through the POST_INSTALL directive.
50 echo '#!/bin/sh' >'$(CURDIR)/$(NAME)-$(VERSION)/cp'
51 echo 'cp "$$@"' >>'$(CURDIR)/$(NAME)-$(VERSION)/cp'
52 chmod 755 '$(CURDIR)/$(NAME)-$(VERSION)/cp'
53
54 # Install the DKMS source.
55 mkdir -p '$(CURDIR)/debian/tmp/usr/src/'
56 mv '$(CURDIR)/$(NAME)-$(VERSION)' '$(CURDIR)/debian/tmp/usr/src/'
57
58 override_dh_dkms:
59 dh_dkms -V $(VERSION)
60
61 override_dh_auto_clean:
62 dh_auto_clean
63 @if test -e META.orig; then mv META.orig META; fi
64 sed "s/@LINUX_COMPAT@/linux-libc-dev \(< $(shell debian/get_next.sh)\)/" debian/control.in > debian/control
65
66 # ------------
67
68 override_dh_prep-deb-files:
69 for templ in $(wildcard $(CURDIR)/debian/*_KVERS_*.in); do \
70 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' \
71 < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \
72 done
73 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' \
74 < debian/control.modules.in > debian/control
75
76 override_dh_configure_modules: override_dh_configure_modules_stamp
77 override_dh_configure_modules_stamp:
78 ./configure --with-config=kernel --with-linux=$(KSRC) \
79 --with-linux-obj=$(KOBJ) \
80 --disable-debug-kmem
81 touch override_dh_configure_modules_stamp
82
83 override_dh_binary-modules-udeb: override_dh_prep-deb-files override_dh_configure_modules
84 dh_testdir
85 dh_testroot
86 dh_prep
87
88 $(MAKE) -C $(CURDIR)/module modules
89
90 dh_installdirs -p${pmodules}-di
91 dh_install -p${pmodules}-di
92 dh_gencontrol -p${pmodules}-di
93
94 dh_builddeb -p${pmodules}-di
95
96 override_dh_binary-modules: override_dh_prep-deb-files override_dh_configure_modules
97 dh_testdir
98 dh_testroot
99 dh_prep
100
101 $(MAKE) -C $(CURDIR)/module modules
102
103 dh_installdocs -p${pmodules}
104 dh_install -p${pmodules}
105 dh_installchangelogs -p${pmodules}
106 dh_compress -p${pmodules}
107 dh_strip -p${pmodules}
108 dh_fixperms -p${pmodules}
109 dh_installdeb -p${pmodules}
110 dh_gencontrol -p${pmodules}
111 dh_md5sums -p${pmodules}
112
113 dh_builddeb -p${pmodules}