]> git.proxmox.com Git - mirror_zfs-debian.git/blobdiff - debian/rules
Pedantic format change
[mirror_zfs-debian.git] / debian / rules
index 3bd7c03df71bb9f82414f20b6d132ca0a6efd7ec..003b9950d0d03771f1a731580f8ce5313380aeb5 100755 (executable)
@@ -8,31 +8,46 @@ VERSION := $(shell dpkg-parsechangelog \
 DKMSFILES := module include config zfs.release.in autogen.sh META AUTHORS \
                DISCLAIMER COPYRIGHT OPENSOLARIS.LICENSE README.markdown
 
-export SHLIB_MAJOR = 1
+ifndef BUILD_UDEB
+BUILD_UDEB=false
+endif
+
+ifndef DEB_HOST_ARCH
+DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH)
+endif
+
+ifndef KVERS
+KVERS=$(shell uname -r)
+endif
+
+ifndef SPL
+SPL=/usr/src/spl-$(VERSION)
+endif
 
 non_epoch_version=$(shell echo $(KVERS) | perl -pe 's/^\d+://')
 PACKAGE=zfs
 pmodules = $(PACKAGE)-modules-$(non_epoch_version)
 
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+
 %:
-       dh $@ --with dkms
+       dh $@ --with autoreconf,dkms --parallel
 
 override_dh_auto_configure:
        @cp debian/control.in debian/control
+ifeq ($(BUILD_UDEB), true)
+       cat debian/control.udeb.in >> debian/control
+endif
 
        @# 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 \
+       dh_auto_configure -- \
+         --bindir=/bin \
+         --sbindir=/sbin \
          --libdir=/lib \
-         --includedir=/usr/include \
-         --datarootdir=/usr/share \
+         --with-udevdir=/lib/udev \
          --with-config=user
 
 override_dh_auto_test:
@@ -70,109 +85,97 @@ override_dh_auto_install:
 
        @# 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)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
-       echo 'cp "$$@"'  >>'$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
+       printf '#!/bin/sh\ncp "$$@"\n' > '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
        chmod 755 '$(CURDIR)/debian/tmp/usr/src/$(NAME)-$(VERSION)/cp'
 
-override_dh_installinit:
-       @# 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
+       mkdir -p $(CURDIR)/debian/tmp/usr/lib
+       for i in `ls $(CURDIR)/debian/tmp/lib/*.so`; do \
+               ln -s /lib/`readlink $${i}` $(CURDIR)/debian/tmp/usr/lib/`basename $${i}`; \
+               rm $${i}; \
+       done
 
 override_dh_dkms:
        dh_dkms -V $(VERSION)
 
 override_dh_makeshlibs:
        dh_makeshlibs -a
-       dh_makeshlibs -plibnvpair$(SHLIB_MAJOR) --add-udeb=libnvpair$(SHLIB_MAJOR)-udeb
-       dh_makeshlibs -plibuutil$(SHLIB_MAJOR) --add-udeb=libuutil$(SHLIB_MAJOR)-udeb
-       dh_makeshlibs -plibzfs$(SHLIB_MAJOR) --add-udeb=libzfs$(SHLIB_MAJOR)-udeb
-       dh_makeshlibs -plibzpool$(SHLIB_MAJOR) --add-udeb=libzpool$(SHLIB_MAJOR)-udeb
-       dh_makeshlibs -pzfsutils --add-udeb=zfsutils-udeb
-
-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
+ifeq ($(BUILD_UDEB), true)
+       dh_makeshlibs -plibnvpair1linux --add-udeb=libnvpair1-udeb
+       dh_makeshlibs -plibuutil1linux --add-udeb=libuutil1-udeb
+       dh_makeshlibs -plibzfs2linux --add-udeb=libzfs2-udeb
+       dh_makeshlibs -plibzpool2linux --add-udeb=libzpool2-udeb
+       dh_makeshlibs -pzfsutils-linux --add-udeb=zfsutils-udeb
+endif
 
 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
-
-       dh_strip -plibnvpair$(SHLIB_MAJOR)-udeb
-       dh_strip -plibuutil$(SHLIB_MAJOR)-udeb
-       dh_strip -plibzfs$(SHLIB_MAJOR)-udeb
-       dh_strip -plibzpool$(SHLIB_MAJOR)-udeb
+       dh_strip --dbg-package=zfs-dbg
+ifeq ($(BUILD_UDEB), true)
+       dh_strip -plibnvpair1-udeb
+       dh_strip -plibuutil1-udeb
+       dh_strip -plibzfs2-udeb
+       dh_strip -plibzpool2-udeb
        dh_strip -pzfsutils-udeb
+endif
 
 override_dh_auto_clean:
        dh_auto_clean
+       debconf-updatepo
        @if test -e META.orig; then mv META.orig META; fi
+       cp debian/control.in debian/control
+ifeq ($(BUILD_UDEB), true)
+       cat debian/control.udeb.in >> debian/control
+endif
 
 override_dh_install:
        find . -name lib*.la -delete
-       dh_install
+       dh_install --list-missing
 
 # ------------
 
 override_dh_prep-deb-files:
        for templ in $(wildcard $(CURDIR)/debian/*_KVERS_*.in); do \
-               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  ' \
-               < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g' -e 's/\.in$$//'` ; \
+               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)/' \
+               < $$templ > `echo $$templ | sed -e 's/_KVERS_/$(KVERS)/g ; s/_ARCH_/$(DEB_HOST_ARCH)/g ; s/\.in$$//'` ; \
        done
-       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  ' \
+       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' \
        < debian/control.modules.in > debian/control
 
+override_dh_configure_modules_udeb: override_dh_configure_modules_udeb_stamp
+override_dh_configure_modules_udeb_stamp:
+       ./configure \
+               --without-selinux \
+               --with-config=kernel \
+               --with-linux=$(KSRC) \
+               --with-linux-obj=$(KOBJ) \
+               --with-spl=$(SPL)
+       touch override_dh_configure_modules_udeb_stamp
+
 override_dh_configure_modules: override_dh_configure_modules_stamp
 override_dh_configure_modules_stamp:
-       ./configure --with-config=kernel --with-linux=$(KSRC) \
-               --with-linux-obj=$(KOBJ)
+       ./configure \
+               --with-config=kernel \
+               --with-linux=$(KSRC) \
+               --with-linux-obj=$(KOBJ) \
+               --with-spl=$(SPL)
        touch override_dh_configure_modules_stamp
 
-override_dh_binary-modules-udeb: override_dh_prep-deb-files override_dh_configure_modules
+override_dh_binary-modules-udeb: override_dh_prep-deb-files override_dh_configure_modules_udeb
        dh_testdir
        dh_testroot
-       dh_clean -k
+       dh_prep
 
        $(MAKE) -C $(CURDIR)/module modules
 
-       dh_installdirs -p${pmodules}-amd64-di
-       dh_install -p${pmodules}-amd64-di
-       dh_gencontrol -p${pmodules}-amd64-di
+       dh_installdirs -p${pmodules}-di
+       dh_install -p${pmodules}-di
+       dh_gencontrol -p${pmodules}-di
 
-       dh_builddeb -p${pmodules}-amd64-di --destdir=$(DEB_DESTDIR)
+       dh_builddeb -p${pmodules}-di
 
 override_dh_binary-modules: override_dh_prep-deb-files override_dh_configure_modules
        dh_testdir
        dh_testroot
-       dh_clean -k
+       dh_prep
 
        $(MAKE) -C $(CURDIR)/module modules
 
@@ -183,7 +186,6 @@ override_dh_binary-modules: override_dh_prep-deb-files override_dh_configure_mod
        dh_strip -p${pmodules}
        dh_fixperms -p${pmodules}
        dh_installdeb -p${pmodules}
-       dh_gencontrol -p${pmodules} -- -v$(VERSION)
+       dh_gencontrol -p${pmodules}
        dh_md5sums -p${pmodules}
-
-       dh_builddeb -p${pmodules} --destdir=$(DEB_DESTDIR)
+       dh_builddeb -p${pmodules}