#!/usr/bin/make -f LSB_DISTRIBUTOR := $(shell lsb_release -is) NAME := $(shell awk '$$1 == "Name:" { print $$2; }' META) VERSION := $(shell dpkg-parsechangelog \ | awk '$$1 == "Version:" { print $$2; }' | cut -d- -f1) override_dh_auto_configure: @# Embed the downstream version in the module. @sed -e 's/^Version:.*/Version: $(VERSION)/' -i.orig META @# Create the makefiles and configure script. ./autogen.sh @# Build the userland, but don't build the kernel modules. ./configure \ --prefix='' \ --libexecdir=/usr/libexec \ --libdir=/lib \ --includedir=/usr/include \ --datarootdir=/usr/share \ --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 $(CURDIR)/$(NAME)-$(VERSION)/ tree, which does not @# contain the userland sources. NB: Remove-userland-dist-rules.patch make distdir @# This shunt allows DKMS to install the Module.symvers and zfs_config.h @# files to the ${dkms_tree} area through the POST_INSTALL directive. echo '#!/bin/sh' >'$(CURDIR)/$(NAME)-$(VERSION)/cp' echo 'cp "$$@"' >>'$(CURDIR)/$(NAME)-$(VERSION)/cp' chmod 755 '$(CURDIR)/$(NAME)-$(VERSION)/cp' @# Install the DKMS source. mkdir -p '$(CURDIR)/debian/tmp/usr/src/' mv '$(CURDIR)/$(NAME)-$(VERSION)' '$(CURDIR)/debian/tmp/usr/src/' @# Process templates and install the dkms.conf file. dh_dkms -V $(VERSION) @# Install the /etc/default/zfs options file. dh_installinit --name=zfs @# Install the /etc/init.d/zfs-mount script. ifeq ($(LSB_DISTRIBUTOR),Debian) @# 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 else dh_installinit --name=zfs-mount \ --no-restart-on-upgrade --no-start endif @# Install the /etc/init.d/zfs-share script. ifeq ($(LSB_DISTRIBUTOR),Debian) @# Debian runs nfs-kernel-server at sysv sequence 17 01. dh_installinit --name=zfs-share \ --no-restart-on-upgrade --no-start -- defaults 18 00 else ifeq ($(LSB_DISTRIBUTOR),Ubuntu) @# Ubuntu runs nfs-kernel-server at sysv sequence 20 80. dh_installinit --name=zfs-share \ --no-restart-on-upgrade --no-start -- defaults 21 79 else dh_installinit --name=zfs-share \ --no-restart-on-upgrade --no-start endif override_dh_fixperms: @# Ubuntu 10.04 LTS Lucid Lynx, et al, compatibility. @# (>= debhelper-8.0.0) does this automatically. dh_fixperms chmod 0440 debian/zfsutils/etc/sudoers.d/zfs override_dh_shlibdeps: @# Suppress libtool dependency_libs warnings that are caused by @# inter-library dependencies. (eg: zfs -> libzfs -> libuuid) @# @TODO: Add pkgconfig support instead. dh_shlibdeps -- --warnings=0 override_dh_strip: dh_strip -plibnvpair1 --dbg-package=libnvpair1-dbg dh_strip -plibuutil1 --dbg-package=libuutil1-dbg dh_strip -plibzfs1 --dbg-package=libzfs1-dbg dh_strip -plibzpool1 --dbg-package=libzpool1-dbg dh_strip -pzfsutils --dbg-package=zfsutils-dbg override_dh_auto_clean: dh_auto_clean @if test -e META.orig; then mv META.orig META; fi %: dh $@