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