]>
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) | |
0fbe1fc0 | 6 | |
d05a66da CALP |
7 | DKMSFILES := module include config spl.release.in autogen.sh \ |
8 | META AUTHORS DISCLAIMER | |
16b165cc | 9 | |
3d3fd67f AX |
10 | non_epoch_version=$(shell echo $(KVERS) | perl -pe 's/^\d+://') |
11 | PACKAGE=spl | |
12 | pmodules = $(PACKAGE)-modules-$(non_epoch_version) | |
13 | ||
cc2a3926 CALP |
14 | %: |
15 | dh $@ --with dkms | |
16 | ||
0fbe1fc0 | 17 | override_dh_auto_configure: |
3d3fd67f AX |
18 | @cp debian/control.in debian/control |
19 | ||
a9655987 DH |
20 | @# Embed the downstream version in the module. |
21 | @sed -e 's/^Version:.*/Version: $(VERSION)/' -i.orig META | |
22 | ||
23 | @# Create the makefiles and configure script. | |
287506cd DH |
24 | ./autogen.sh |
25 | ||
a9655987 | 26 | @# Build the userland, but don't build the kernel modules. |
0fbe1fc0 | 27 | ./configure --prefix=/usr --with-config=user |
d05a66da | 28 | |
0fbe1fc0 DH |
29 | override_dh_auto_test: |
30 | # scripts/check.sh tries insmod and rmmod, so it cannot | |
31 | # run in an unprivileged build environment. | |
32 | ||
33 | override_dh_auto_install: | |
a9655987 | 34 | @# Install the utilities. |
489c31a0 | 35 | $(MAKE) install DESTDIR='$(CURDIR)/debian/tmp' |
0fbe1fc0 | 36 | |
a9655987 DH |
37 | @# Get a bare copy of the source code. |
38 | @# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree. | |
489c31a0 | 39 | $(MAKE) distdir |
0fbe1fc0 | 40 | |
16b165cc CALP |
41 | # Install the DKMS source. |
42 | @# We only want the files needed to build the modules | |
43 | mkdir -p '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)' | |
d05a66da | 44 | $(foreach file,$(DKMSFILES),mv '$(CURDIR)/$(NAME)-$(VERSION)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)' || exit 1;) |
16b165cc CALP |
45 | @# Hellish awk line: |
46 | @# * Deletes from configure.ac the parts not needed for building the kernel module | |
47 | @# * It deletes from inside AC_CONFIG_FILES([]) everything except: | |
d05a66da | 48 | @# (Makefile$|include/|module/|*.release$) |
16b165cc | 49 | @# * Takes care of spaces and tabs |
d05a66da | 50 | awk '/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|spl\.release([ \t]+)?$$))/){next} } {print}' \ |
16b165cc | 51 | '$(CURDIR)/$(NAME)-$(VERSION)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/configure.ac' |
d05a66da CALP |
52 | @# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs. |
53 | sed '1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \ | |
54 | '$(CURDIR)/$(NAME)-$(VERSION)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am' | |
55 | @# Sanity test | |
56 | grep -q 'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am' | |
57 | @# Run autogen on the stripped source tree | |
16b165cc CALP |
58 | cd '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'; ./autogen.sh |
59 | rm -fr '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/autom4te.cache' | |
c30c9032 | 60 | |
a9655987 DH |
61 | @# This shunt allows DKMS to install the Module.symvers and spl_config.h |
62 | @# files to the ${dkms_tree} area through the POST_INSTALL directive. | |
16b165cc CALP |
63 | echo '#!/bin/sh' >'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp' |
64 | echo 'cp "$$@"' >>'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp' | |
65 | chmod 755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp' | |
0fbe1fc0 | 66 | |
cc2a3926 | 67 | override_dh_dkms: |
0fbe1fc0 | 68 | dh_dkms -V $(VERSION) |
a9655987 DH |
69 | |
70 | override_dh_auto_clean: | |
71 | dh_auto_clean | |
72 | @if test -e META.orig; then mv META.orig META; fi | |
3d3fd67f AX |
73 | |
74 | # ------------ | |
75 | ||
76 | override_dh_prep-deb-files: | |
77 | for templ in $(wildcard $(CURDIR)/debian/*_KVERS_*.in); do \ | |
78 | 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 ' \ | |
79 | < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g' -e 's/\.in$$//'` ; \ | |
80 | done | |
81 | 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 ' \ | |
82 | < debian/control.modules.in > debian/control | |
83 | ||
84 | override_dh_configure_modules: override_dh_configure_modules_stamp | |
85 | override_dh_configure_modules_stamp: | |
86 | ./configure --with-config=kernel --with-linux=$(KSRC) \ | |
87 | --with-linux-obj=$(KSRC) | |
88 | touch override_dh_configure_modules_stamp | |
89 | ||
90 | override_dh_binary-modules-udeb: override_dh_prep-deb-files override_dh_configure_modules | |
91 | dh_testdir | |
92 | dh_testroot | |
93 | dh_clean -k | |
94 | ||
95 | $(MAKE) -C $(CURDIR)/module modules | |
96 | ||
97 | dh_installdirs -p${pmodules}-amd64-di | |
98 | dh_install -p${pmodules}-amd64-di | |
99 | dh_gencontrol -p${pmodules}-amd64-di | |
100 | ||
101 | dh_builddeb -p${pmodules}-amd64-di --destdir=$(DEB_DESTDIR) | |
102 | ||
103 | override_dh_binary-modules: override_dh_prep-deb-files override_dh_configure_modules | |
104 | dh_testdir | |
105 | dh_testroot | |
106 | dh_clean -k | |
107 | ||
108 | $(MAKE) -C $(CURDIR)/module modules | |
109 | ||
110 | dh_installdocs -p${pmodules} | |
111 | dh_install -p${pmodules} | |
112 | dh_installchangelogs -p${pmodules} | |
113 | dh_compress -p${pmodules} | |
114 | dh_strip -p${pmodules} | |
115 | dh_fixperms -p${pmodules} | |
116 | dh_installdeb -p${pmodules} | |
117 | dh_gencontrol -p${pmodules} -- -v$(VERSION) | |
118 | dh_md5sums -p${pmodules} | |
119 | ||
120 | dh_builddeb -p${pmodules} --destdir=$(DEB_DESTDIR) |