116 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
		
		
			
		
	
	
			116 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
|   | #!/usr/bin/make -f | ||
|  | 
 | ||
|  | CHMOD ?= chmod | ||
|  | INSTALL ?= install | ||
|  | MAKE ?= make | ||
|  | 
 | ||
|  | META_NAME := $(shell awk '$$1 == "Name:" { print $$2; }' META) | ||
|  | VERSION := $(shell dpkg-parsechangelog \ | ||
|  |   | awk '$$1 == "Version:" { print $$2; }' | cut -d- -f1) | ||
|  | REVISION := $(shell dpkg-parsechangelog \ | ||
|  |   | awk '$$1 == "Version:" { print $$2; }' | cut -d- -f2-) | ||
|  | 
 | ||
|  | META_DISTDIR := $(CURDIR)/$(META_NAME)-$(VERSION)/ | ||
|  | 
 | ||
|  | %: | ||
|  | 	dh $@ --with autoreconf,dkms | ||
|  | 
 | ||
|  | override_dh_auto_configure: | ||
|  | 	@# Embed the downstream version in the module. | ||
|  | 	@sed \ | ||
|  | 	  -e 's/^Version:.*/Version:      $(VERSION)/' \ | ||
|  | 	  -e 's/^Release:.*/Release:      $(REVISION)/' \ | ||
|  | 	  -i.orig META | ||
|  | 
 | ||
|  | 	@# Build the userland, but don't build the kernel modules. | ||
|  | 	dh_auto_configure -- \ | ||
|  | 	  --bindir=/bin \ | ||
|  | 	  --sbindir=/sbin \ | ||
|  | 	  --libdir=/lib \ | ||
|  | 	  --with-udevdir=/lib/udev \ | ||
|  | 	  --with-config=user | ||
|  | 
 | ||
|  | override_dh_auto_test: | ||
|  | 	# The dh_auto_test rule is disabled because | ||
|  | 	# `make check` cannot run in an unprivileged build environment. | ||
|  | 
 | ||
|  | override_dh_auto_install: | ||
|  | 	@# Install the utilities. | ||
|  | 	$(MAKE) install DESTDIR='$(CURDIR)/debian/tmp' | ||
|  | 
 | ||
|  | 	@# Get a bare copy of the source code for DKMS. | ||
|  | 	@# This creates the $(META_DISTDIR)/ tree. | ||
|  | 	$(MAKE) distdir | ||
|  | 
 | ||
|  | 	@# Delete components that are not required to build the kernel modules. | ||
|  | 	@# This prevents several lintian complaints, discourages users from | ||
|  | 	@# running `make install` in /usr/src, and reduces the installation | ||
|  | 	@# size by one third. The printf creates a dummy automake file. | ||
|  | 	umask 0111 && \ | ||
|  | 	cd '$(META_DISTDIR)' && \ | ||
|  | 	for ii in $$(find cmd dracut etc lib man rpm scripts udev -type f); do \ | ||
|  | 	  rm "$$ii"; \ | ||
|  | 	  test "$$ii" != "$${ii%.in}" && printf '%%:\n\t#\n' >"$$ii"; \ | ||
|  | 	  true; \ | ||
|  | 	done | ||
|  | 
 | ||
|  | 	@# This shunt allows DKMS to copy the Module.symvers and zfs_config.h | ||
|  | 	@# files into the ${dkms_tree} area through the POST_INSTALL directive. | ||
|  | 	printf '#!/bin/sh\ncp "$$@"\n' >'$(META_DISTDIR)/cp' | ||
|  | 	$(CHMOD) 755 '$(META_DISTDIR)/cp' | ||
|  | 
 | ||
|  | 	@# Install the DKMS source directly, avoiding dh_install. | ||
|  | 	$(INSTALL) -d '$(CURDIR)/debian/zfs-dkms/usr/src/' | ||
|  | 	mv '$(META_DISTDIR)' '$(CURDIR)/debian/zfs-dkms/usr/src/' | ||
|  | 
 | ||
|  | override_dh_dkms: | ||
|  | 	dh_dkms -V | ||
|  | 
 | ||
|  | override_dh_install: | ||
|  | 	@# Exclude the upstream /usr/lib/udev/rules.d files. | ||
|  | 	dh_install -X/rules.d/ | ||
|  | 
 | ||
|  | 	@# Ensure that /etc/zfs is in the zfsutils package | ||
|  | 	@# because git has difficulty tracking empty directories. | ||
|  | 	$(INSTALL) -d '$(CURDIR)/debian/zfsutils/etc/zfs/' | ||
|  | 
 | ||
|  | 	@# Resolve lintian errors regarding Debian Policy Manual Section 8.4 | ||
|  | 	@# by moving unversioned library links from /lib to /usr/lib in the | ||
|  | 	@# development package. Look at libc6-dev for a packaging example if | ||
|  | 	@# multiarch support ever becomes a concern here. | ||
|  | 	$(INSTALL) -d '$(CURDIR)/debian/libzfs-dev/usr/lib/' | ||
|  | 	cd '$(CURDIR)/debian/libzfs-dev/lib' && \ | ||
|  | 	for ii in $$(find -type l); do \ | ||
|  | 	  ln -s "../../lib/$$(readlink "$$ii")" "../usr/lib/$$(basename "$$ii")" \ | ||
|  | 	  && rm "$$ii"; \ | ||
|  | 	done | ||
|  | 
 | ||
|  | override_dh_installdocs: | ||
|  | 	dh_installdocs --link-doc=zfs-doc | ||
|  | 
 | ||
|  | override_dh_installinit: | ||
|  | 	@# Install debian/zfsutils.zfs.default as /etc/default/zfs. | ||
|  | 	dh_installinit --name=zfs | ||
|  | 
 | ||
|  | 	@# Install the /etc/init.d/zfs-mount script. | ||
|  | 	@# Debian runs local mounts at sysv sequences [10..12] [08..09]. | ||
|  | 	dh_installinit --name=zfs-mount \ | ||
|  | 	  --no-restart-on-upgrade --no-start -- defaults 13 07 | ||
|  | 
 | ||
|  | 	@# Debian runs nfs-kernel-server at sysv sequence 17 01, | ||
|  | 	@# iscsitarget at 02 01, and samba at 01 02. | ||
|  | 	dh_installinit --name=zfs-share \ | ||
|  | 	  --no-restart-on-upgrade --no-start -- defaults 18 00 | ||
|  | 
 | ||
|  | 
 | ||
|  | override_dh_installudev: | ||
|  | 	dh_installudev --name=zvol --priority=60 | ||
|  | 	dh_installudev --name=vdev --priority=69 | ||
|  | 
 | ||
|  | override_dh_strip: | ||
|  | 	dh_strip -plibnvpair1 --dbg-package=libnvpair1-dbg | ||
|  | 	dh_strip -plibuutil1 --dbg-package=libuutil1-dbg | ||
|  | 	dh_strip -plibzfs2 --dbg-package=libzfs2-dbg | ||
|  | 	dh_strip -plibzpool2 --dbg-package=libzpool2-dbg | ||
|  | 	dh_strip -pzfsutils --dbg-package=zfsutils-dbg |