]>
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) | |
16b165cc | 8 | |
5ccaeb5e NBS |
9 | export DEB_BUILD_MAINT_OPTIONS = hardening=+all |
10 | ||
2f30af71 TF |
11 | ifndef DEB_HOST_ARCH |
12 | DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH) | |
13 | endif | |
14 | ||
9436c4b5 | 15 | ifndef KVERS |
01d50ac8 | 16 | KVERS=$(shell uname -r) |
9436c4b5 | 17 | endif |
01d50ac8 | 18 | |
3d3fd67f | 19 | non_epoch_version=$(shell echo $(KVERS) | perl -pe 's/^\d+://') |
85751957 | 20 | pmodules = $(NAME)-modules-$(non_epoch_version) |
3d3fd67f | 21 | |
cc2a3926 | 22 | %: |
2de88715 | 23 | dh $@ --with dkms,autoreconf --parallel |
cc2a3926 | 24 | |
0fbe1fc0 | 25 | override_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 |
37 | override_dh_auto_test: |
38 | # scripts/check.sh tries insmod and rmmod, so it cannot | |
39 | # run in an unprivileged build environment. | |
40 | ||
41 | override_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 | 59 | override_dh_dkms: |
0fbe1fc0 | 60 | dh_dkms -V $(VERSION) |
a9655987 DH |
61 | |
62 | override_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 | ||
69 | override_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 | ||
77 | override_dh_configure_modules: override_dh_configure_modules_stamp | |
78 | override_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 | ||
84 | override_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 | |
97 | override_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} |