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