]> git.proxmox.com Git - mirror_zfs-debian.git/blame - debian/rules
Updated Danish debconf translation by Joe Hansen.
[mirror_zfs-debian.git] / debian / rules
CommitLineData
7e4739a2
DH
1#!/usr/bin/make -f
2
fb579137 3LSB_DISTRIBUTOR := $(shell lsb_release -is)
5cc6dd58
DH
4NAME := $(shell awk '$$1 == "Name:" { print $$2; }' META)
5VERSION := $(shell dpkg-parsechangelog \
6 | awk '$$1 == "Version:" { print $$2; }' | cut -d- -f1)
7e4739a2 7
66bbd7ad
CALP
8DKMSFILES := module include config zfs.release.in autogen.sh META AUTHORS \
9 DISCLAIMER COPYRIGHT OPENSOLARIS.LICENSE README.markdown
e6fd8d0f 10
042e58d4 11ifndef BUILD_UDEB
6d1b4acf 12BUILD_UDEB=false
042e58d4
AX
13endif
14
a20a40e3
TF
15ifndef DEB_HOST_ARCH
16DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH)
17endif
18
9c581c9d
AX
19ifndef KVERS
20KVERS=$(shell uname -r)
21endif
22
c2b155ae
TF
23ifndef SPL
24SPL=/usr/src/spl-$(VERSION)
25endif
26
8aa69748
AX
27ifndef SPLOBJ
28SPLOBJ=/var/lib/dkms/spl/$(VERSION)/$(KVERS)/$(shell dpkg-architecture -qDEB_TARGET_GNU_CPU)
29endif
30
a81c790e
AX
31non_epoch_version=$(shell echo $(KVERS) | perl -pe 's/^\d+://')
32PACKAGE=zfs
7640dd28 33pmodules = $(PACKAGE)-modules-$(non_epoch_version)
a81c790e 34
30f59abc
RL
35export DEB_BUILD_MAINT_OPTIONS = hardening=+all
36
505714c7 37%:
81441311 38 dh $@ --with autoreconf,dkms,python2,systemd --parallel
505714c7 39
7e4739a2 40override_dh_auto_configure:
a81c790e 41 @cp debian/control.in debian/control
042e58d4
AX
42ifeq ($(BUILD_UDEB), true)
43 cat debian/control.udeb.in >> debian/control
44endif
a81c790e 45
5cc6dd58
DH
46 @# Embed the downstream version in the module.
47 @sed -e 's/^Version:.*/Version: $(VERSION)/' -i.orig META
48
37316e2f 49 @# Build the userland, but don't build the kernel modules.
4b4a7a4c
DH
50 dh_auto_configure -- \
51 --bindir=/bin \
52 --sbindir=/sbin \
44bb78ce 53 --libdir=/lib \
4b4a7a4c 54 --with-udevdir=/lib/udev \
37316e2f
DH
55 --with-config=user
56
7e4739a2 57override_dh_auto_test:
37316e2f 58 # The dh_auto_test rule is disabled because
7e4739a2
DH
59 # `make check` cannot run in an unprivileged build environment.
60
61override_dh_auto_install:
37316e2f 62 @# Install the utilities.
661c4a4b 63 $(MAKE) install DESTDIR='$(CURDIR)/debian/tmp'
7e4739a2 64
37316e2f
DH
65 @# Get a bare copy of the source code for DKMS.
66 @# This creates the $(CURDIR)/$(NAME)-$(VERSION)/ tree, which does not
67 @# contain the userland sources. NB: Remove-userland-dist-rules.patch
661c4a4b 68 $(MAKE) distdir
7e4739a2 69
e6fd8d0f
CALP
70 @# Install the DKMS source.
71 @# We only want the files needed to build the modules
72 mkdir -p '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'
66bbd7ad 73 $(foreach file,$(DKMSFILES),mv '$(CURDIR)/$(NAME)-$(VERSION)/$(file)' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)' || exit 1;)
e6fd8d0f
CALP
74 @# Hellish awk line:
75 @# * Deletes from configure.ac the parts not needed for building the kernel module
76 @# * It deletes from inside AC_CONFIG_FILES([]) everything except:
66bbd7ad 77 @# (Makefile$|include/|module/|*.release$)
e6fd8d0f 78 @# * Takes care of spaces and tabs
66bbd7ad 79 awk '/^AC_CONFIG_FILES\(\[/,/^\]\)/ { if ($$0 !~ /^(AC_CONFIG_FILES\(\[([ \t]+)?$$|\]\)([ \t]+)?$$|([ \t]+)?(include\/|module\/|Makefile([ \t]+)?$$|zfs\.release([ \t]+)?$$))/){next} } {print}' \
e6fd8d0f 80 '$(CURDIR)/$(NAME)-$(VERSION)/configure.ac' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/configure.ac'
66bbd7ad
CALP
81 @# Set "SUBDIRS = module include" for CONFIG_KERNEL and remove SUBDIRS for all other configs.
82 sed '1,/CONFIG_KERNEL/s/SUBDIRS.*=.*//g;s/SUBDIRS.*=.*/SUBDIRS = module include/g;' \
83 '$(CURDIR)/$(NAME)-$(VERSION)/Makefile.am' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
84 @# Sanity test
85 grep -q 'SUBDIRS = module include' '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/Makefile.am'
86 @# Run autogen on the stripped source tree
e6fd8d0f
CALP
87 cd '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)'; ./autogen.sh
88 rm -fr '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/autom4te.cache'
89
37316e2f
DH
90 @# This shunt allows DKMS to install the Module.symvers and zfs_config.h
91 @# files to the ${dkms_tree} area through the POST_INSTALL directive.
ea1ac941 92 printf '#!/bin/sh\ncp "$$@"\n' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
e6fd8d0f 93 chmod 755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
7e4739a2 94
a0d08c54 95 mkdir -p $(CURDIR)/debian/tmp/usr/lib
3f2148a9
AX
96 for i in `ls $(CURDIR)/debian/tmp/lib/*.so`; do \
97 ln -s /lib/`readlink $${i}` $(CURDIR)/debian/tmp/usr/lib/`basename $${i}`; \
98 rm $${i}; \
99 done
100
97487d06
AX
101 chmod -x $(CURDIR)/debian/tmp/etc/zfs/zfs-functions
102 chmod -x $(CURDIR)/debian/tmp/etc/default/zfs
103
505714c7
CALP
104override_dh_dkms:
105 dh_dkms -V $(VERSION)
106
a81c790e
AX
107override_dh_makeshlibs:
108 dh_makeshlibs -a
042e58d4 109ifeq ($(BUILD_UDEB), true)
0b24fb47
AX
110 dh_makeshlibs -plibnvpair1linux --add-udeb=libnvpair1-udeb
111 dh_makeshlibs -plibuutil1linux --add-udeb=libuutil1-udeb
112 dh_makeshlibs -plibzfs2linux --add-udeb=libzfs2-udeb
113 dh_makeshlibs -plibzpool2linux --add-udeb=libzpool2-udeb
3dce9963 114 dh_makeshlibs -pzfsutils-linux --add-udeb=zfsutils-udeb
0aa4ec8e 115endif
a81c790e 116
47ba6fdb 117override_dh_strip:
4365121d 118 dh_strip --dbg-package=zfs-dbg
042e58d4 119ifeq ($(BUILD_UDEB), true)
0b24fb47
AX
120 dh_strip -plibnvpair1-udeb
121 dh_strip -plibuutil1-udeb
122 dh_strip -plibzfs2-udeb
123 dh_strip -plibzpool2-udeb
a81c790e 124 dh_strip -pzfsutils-udeb
042e58d4 125endif
a81c790e 126
5cc6dd58 127override_dh_auto_clean:
b3671465
AX
128 find . -name .gitignore -delete
129 rm -rf zfs-$(VERSION)
5cc6dd58 130 dh_auto_clean
4c8f5221 131 debconf-updatepo
5cc6dd58 132 @if test -e META.orig; then mv META.orig META; fi
98675f09 133 cp debian/control.in debian/control
042e58d4
AX
134ifeq ($(BUILD_UDEB), true)
135 cat debian/control.udeb.in >> debian/control
136endif
5cc6dd58 137
9d521a01
AX
138override_dh_install:
139 find . -name lib*.la -delete
2097931f 140 dh_install --list-missing
a81c790e
AX
141
142# ------------
143
144override_dh_prep-deb-files:
145 for templ in $(wildcard $(CURDIR)/debian/*_KVERS_*.in); do \
a20a40e3
TF
146 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)/' \
147 < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \
a81c790e 148 done
a20a40e3 149 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' \
a81c790e
AX
150 < debian/control.modules.in > debian/control
151
6766f188
AX
152override_dh_configure_modules_udeb: override_dh_configure_modules_udeb_stamp
153override_dh_configure_modules_udeb_stamp:
154 ./configure \
155 --without-selinux \
156 --with-config=kernel \
157 --with-linux=$(KSRC) \
c2b155ae 158 --with-linux-obj=$(KOBJ) \
8aa69748
AX
159 --with-spl=$(SPL) \
160 --with-spl-obj=$(SPLOBJ)
6766f188
AX
161 touch override_dh_configure_modules_udeb_stamp
162
a81c790e
AX
163override_dh_configure_modules: override_dh_configure_modules_stamp
164override_dh_configure_modules_stamp:
6766f188
AX
165 ./configure \
166 --with-config=kernel \
167 --with-linux=$(KSRC) \
c2b155ae 168 --with-linux-obj=$(KOBJ) \
8aa69748
AX
169 --with-spl=$(SPL) \
170 --with-spl-obj=$(SPLOBJ)
a81c790e
AX
171 touch override_dh_configure_modules_stamp
172
6766f188 173override_dh_binary-modules-udeb: override_dh_prep-deb-files override_dh_configure_modules_udeb
a81c790e
AX
174 dh_testdir
175 dh_testroot
1dd633c6 176 dh_prep
a81c790e
AX
177
178 $(MAKE) -C $(CURDIR)/module modules
179
a20a40e3
TF
180 dh_installdirs -p${pmodules}-di
181 dh_install -p${pmodules}-di
182 dh_gencontrol -p${pmodules}-di
a81c790e 183
959e5456 184 dh_builddeb -p${pmodules}-di
a81c790e
AX
185
186override_dh_binary-modules: override_dh_prep-deb-files override_dh_configure_modules
187 dh_testdir
188 dh_testroot
1dd633c6 189 dh_prep
a81c790e
AX
190
191 $(MAKE) -C $(CURDIR)/module modules
192
193 dh_install -p${pmodules}
194 dh_installdocs -p${pmodules}
195 dh_installchangelogs -p${pmodules}
196 dh_compress -p${pmodules}
197 dh_strip -p${pmodules}
198 dh_fixperms -p${pmodules}
199 dh_installdeb -p${pmodules}
a878da18 200 dh_gencontrol -p${pmodules}
a81c790e 201 dh_md5sums -p${pmodules}
959e5456 202 dh_builddeb -p${pmodules}
0fc76429
PR
203
204debian-copyright:
205 cme update dpkg-copyright -file debian/copyright.cme