]>
Commit | Line | Data |
---|---|---|
0fbe1fc0 DH |
1 | #!/usr/bin/make -f |
2 | ||
85751957 NBS |
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) | |
73bbc486 | 8 | LINUX_NEXT := $(shell awk -F. '{print $$1 "." $$2+1}' debian/linux_compat) |
16b165cc | 9 | |
5ccaeb5e NBS |
10 | export DEB_BUILD_MAINT_OPTIONS = hardening=+all |
11 | ||
2f30af71 TF |
12 | ifndef DEB_HOST_ARCH |
13 | DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH) | |
14 | endif | |
15 | ||
9436c4b5 | 16 | ifndef KVERS |
01d50ac8 | 17 | KVERS=$(shell uname -r) |
9436c4b5 | 18 | endif |
01d50ac8 | 19 | |
3d3fd67f | 20 | non_epoch_version=$(shell echo $(KVERS) | perl -pe 's/^\d+://') |
85751957 | 21 | pmodules = $(NAME)-modules-$(non_epoch_version) |
3d3fd67f | 22 | |
cc2a3926 | 23 | %: |
2de88715 | 24 | dh $@ --with dkms,autoreconf --parallel |
cc2a3926 | 25 | |
0fbe1fc0 | 26 | override_dh_auto_configure: |
f68b1fea | 27 | sed "s/@LINUX_COMPAT@/linux-libc-dev \(<< $(LINUX_NEXT)~\)/" debian/control.in > debian/control |
3d3fd67f | 28 | |
a9655987 | 29 | @# Embed the downstream version in the module. |
635ac713 AX |
30 | @sed \ |
31 | -e 's/^Version:.*/Version: $(VERSION)/' \ | |
32 | -e 's/^Release:.*/Release: $(REVISION)/' \ | |
33 | -i.orig META | |
a9655987 | 34 | |
a9655987 | 35 | @# Build the userland, but don't build the kernel modules. |
2de88715 | 36 | dh_auto_configure -- --with-config=user --disable-debug-kmem |
d05a66da | 37 | |
0fbe1fc0 DH |
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: | |
a9655987 | 43 | @# Install the utilities. |
489c31a0 | 44 | $(MAKE) install DESTDIR='$(CURDIR)/debian/tmp' |
0fbe1fc0 | 45 | |
a9655987 DH |
46 | @# Get a bare copy of the source code. |
47 | @# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree. | |
489c31a0 | 48 | $(MAKE) distdir |
0fbe1fc0 | 49 | |
a9655987 DH |
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. | |
635ac713 AX |
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/' | |
0fbe1fc0 | 59 | |
cc2a3926 | 60 | override_dh_dkms: |
0fbe1fc0 | 61 | dh_dkms -V $(VERSION) |
a9655987 DH |
62 | |
63 | override_dh_auto_clean: | |
64 | dh_auto_clean | |
65 | @if test -e META.orig; then mv META.orig META; fi | |
f68b1fea | 66 | sed "s/@LINUX_COMPAT@/linux-libc-dev \(<< $(LINUX_NEXT)~\)/" debian/control.in > debian/control |
3d3fd67f AX |
67 | |
68 | # ------------ | |
69 | ||
70 | override_dh_prep-deb-files: | |
71 | for templ in $(wildcard $(CURDIR)/debian/*_KVERS_*.in); do \ | |
2f30af71 TF |
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$$//'` ; \ | |
3d3fd67f | 74 | done |
2f30af71 | 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' \ |
3d3fd67f AX |
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) \ | |
72e64659 AX |
81 | --with-linux-obj=$(KOBJ) \ |
82 | --disable-debug-kmem | |
3d3fd67f AX |
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 | |
c3ea64f7 | 88 | dh_prep |
3d3fd67f AX |
89 | |
90 | $(MAKE) -C $(CURDIR)/module modules | |
91 | ||
2f30af71 TF |
92 | dh_installdirs -p${pmodules}-di |
93 | dh_install -p${pmodules}-di | |
94 | dh_gencontrol -p${pmodules}-di | |
3d3fd67f | 95 | |
51caf985 | 96 | dh_builddeb -p${pmodules}-di |
3d3fd67f AX |
97 | |
98 | override_dh_binary-modules: override_dh_prep-deb-files override_dh_configure_modules | |
99 | dh_testdir | |
100 | dh_testroot | |
c3ea64f7 | 101 | dh_prep |
3d3fd67f AX |
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} | |
8779fc7a | 112 | dh_gencontrol -p${pmodules} |
3d3fd67f AX |
113 | dh_md5sums -p${pmodules} |
114 | ||
51caf985 | 115 | dh_builddeb -p${pmodules} |