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