1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
|
#!/usr/bin/make -f
DEB_RELEASE=$(shell dpkg-parsechangelog -SVersion | sed 's/[^-]\+-//')
DEB_BUILDDATE=$(shell dpkg-parsechangelog -SDate)
DEB_BUILDUSER=$(shell dpkg-parsechangelog -SMaintainer)
NULL=
ifneq (,$(findstring $(DEB_HOST_ARCH_OS), linux))
ifneq (,$(findstring $(DEB_HOST_ARCH), i386 amd64))
WITH_VBOX = --with-vbox
FAIL_CHECK = 1
else
WITH_VBOX = --without-vbox
endif
ifneq (,$(findstring $(DEB_HOST_ARCH), i386 amd64 armhf arm64))
MAKE_CHECK = 1
WITH_XEN = --with-xen
WITH_LIBXL = --with-libxl
XEN_ENABLED = 1
else
WITH_XEN = --without-xen
WITH_LIBXL = --without-libxl
endif
WITH_STORAGE_LVM = --with-storage-lvm
WITH_STORAGE_ISCSI = --with-storage-iscsi
WITH_STORAGE_DISK = --with-storage-disk
WITH_STORAGE_RBD = --with-storage-rbd
WITH_STORAGE_ZFS = --with-storage-zfs
WITH_STORAGE_GLUSTER = --with-storage-gluster
WITH_UDEV = --with-udev
WITH_CAPNG = --with-capng
WITH_MACVTAP = --with-macvtap
WITH_NETWORK = --with-network
WITH_OPENVZ = --with-openvz
WITH_NETCF = --with-netcf
WITH_SANLOCK = --with-sanlock
WITH_INIT_SCRIPT = --with-init-script=systemd
WITH_SYSTEMD = --with-systemd-daemon
WITH_FIREWALLD = --with-firewalld
WITH_AUDIT = --with-audit
WITH_SELINUX = --with-selinux --with-secdriver-selinux --with-selinux-mount=/sys/fs/selinux
WITH_APPARMOR = --with-apparmor --with-secdriver-apparmor --with-apparmor-profiles
WITH_NSS_PLUGIN = --with-nss-plugin
ifneq (,$(findstring $(DEB_HOST_ARCH), amd64 armel armhf i386 ia64 powerpc s390))
WITH_DTRACE = --with-dtrace
else
WITH_DTRACE = --without-dtrace
endif
ifneq (,$(findstring $(DEB_HOST_ARCH), amd64 arm64 i386 ia64 mips mipsel powerpc ppc64el))
WITH_NUMA = --with-numactl --with-numad
else
WITH_NUMA = --without-numactl --without-numad
endif
ifneq (,$(findstring $(DEB_HOST_ARCH), ia64))
WITH_LXC = --without-lxc
else
WITH_LXC = --with-lxc
endif
else
ifneq (,$(findstring $(DEB_HOST_ARCH_OS), linux))
WITH_STORAGE_ZFS = --with-storage-zfs
endif
WITH_STORAGE_LVM = --without-storage-lvm
WITH_STORAGE_ISCSI = --without-storage-iscsi
WITH_STORAGE_DISK = --without-storage-disk
WITH_STORAGE_RBD = --without-storage-rbd
WITH_UDEV = --without-udev
WITH_CAPNG = --without-capng
WITH_MACVTAP = --without-macvtap
WITH_NETWORK = --without-network
WITH_LXC = --without-lxc
WITH_NUMA = --without-numactl --without-numad
WITH_NETCF = --without-netcf
WITH_INIT_SCRIPT = --with-init-script=none
WITH_SYSTEMD = --without-systemd-daemon
WITH_FIREWALLD = --without-firewalld
WITH_AUDIT = --without-audit
WITH_SELINUX = --without-selinux
WITH_APPARMOR = --without-apparmor
WITH_NSS_PLUGIN = --without-nss-plugin
WITH_DTRACE = --without-dtrace
WITH_XEN = --without-xen
WITH_LIBXL = --without-libxl
WITH_VBOX = --without-vbox
endif
DEB_CONFIGURE_EXTRA_ARGS := \
--with-packager="$(DEB_BUILDUSER) $(DEB_BUILDDATE)" \
--with-packager-version="$(DEB_RELEASE)" \
--with-default-editor="sensible-editor" \
--disable-silent-rules \
--disable-rpath \
--with-qemu \
--with-qemu-user=libvirt-qemu \
--with-qemu-group=libvirt-qemu \
$(WITH_OPENVZ) \
--with-avahi \
--with-sasl \
--with-yajl \
--with-ssh2 \
--with-polkit \
$(WITH_UDEV) \
--with-storage-fs \
--with-storage-dir \
$(WITH_STORAGE_LVM) \
$(WITH_STORAGE_ISCSI) \
$(WITH_STORAGE_DISK) \
--without-storage-sheepdog \
$(WITH_STORAGE_RBD) \
$(WITH_STORAGE_GLUSTER) \
$(WITH_STORAGE_ZFS) \
$(WITH_INIT_SCRIPT) \
$(WITH_NUMA) \
$(WITH_SELINUX) \
$(WITH_APPARMOR) \
--with-esx \
--without-phyp \
$(WITH_CAPNG) \
--enable-debug \
$(WITH_MACVTAP) \
$(WITH_NETWORK) \
$(WITH_NETCF) \
$(WITH_XEN) \
$(WITH_LIBXL) \
$(WITH_VBOX) \
$(WITH_LXC) \
$(WITH_DTRACE) \
$(WITH_AUDIT) \
--without-hal \
$(WITH_FIREWALLD) \
--without-attr \
$(WITH_NSS_PLUGIN) \
--with-wireshark-dissector \
$(NULL)
LIBVIRT_SYSTEM_SERVICES = \
libvirt-guests.service \
virtlogd.socket \
virtlogd-admin.socket \
virtlogd.service \
virtlockd.socket \
virtlockd-admin.socket \
virtlockd.service \
$(NULL)
DEB_BUILDDIR := $(CURDIR)/debian/build
LOGROTATE = $(basename $(basename $(notdir $(wildcard src/remote/libvirtd*.logrotate.in))))
EXAMPLES_DIR = $(CURDIR)/debian/libvirt-doc/usr/share/doc/libvirt-doc/examples/
%:
dh $@ --builddirectory=$(DEB_BUILDDIR) --parallel --with autoreconf --with systemd
override_dh_auto_configure:
IPTABLES_PATH=/usr/sbin/iptables \
IP6TABLES_PATH=/usr/sbin/ip6tables \
EBTABLES_PATH=/usr/sbin/ebtables \
dh_auto_configure -- $(DEB_CONFIGURE_EXTRA_ARGS) $(shell dpkg-buildflags --export=configure)
mkdir -p debian/build/docs/internals
override_dh_auto_test:
export LD_PRELOAD=""; \
export VIR_TEST_DEBUG=1; \
[ -n "$(MAKE_CHECK)" ] || exit 0; \
if ! dh_auto_test -O--builddirectory=$(DEB_BUILDDIR); then \
cat ./debian/build/gnulib/tests/test-suite.log \
./debian/build/tests/test-suite.log; \
[ -z "$(FAIL_CHECK)" ] || exit 1; \
fi
override_dh_install-arch:
# Multiarch:
# don't configure with --libdir, but move the files manually, because
# we don't want to change other places in /usr/lib/
mkdir -p debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)
mv debian/tmp/usr/lib/lib*a \
debian/tmp/usr/lib/lib*.so* \
debian/tmp/usr/lib/pkgconfig \
debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)
dh_install
# Copy upstream files to debian/ so dh_* can find them
cp debian/tmp/usr/lib/libvirt/libvirt-guests.sh \
debian/libvirt-daemon-system.libvirt-guests.init
cp tools/libvirt-guests.sysconf \
debian/libvirt-daemon-system.libvirt-guests.default
cp src/logging/virtlogd.sysconf \
debian/libvirt-daemon-system.virtlogd.default
cp src/locking/virtlockd.sysconf \
debian/libvirt-daemon-system.virtlockd.default
# Add our backward compat polkit rule
cp debian/polkit/60-libvirt.pkla \
debian/libvirt-daemon-system/var/lib/polkit-1/localauthority/10-vendor.d/
ifneq (,$(findstring $(DEB_HOST_ARCH_OS), linux))
# Linux supports more nice things:
dh_install -p libvirt-daemon-system usr/lib/systemd/system lib/systemd/
dh_install -p libvirt-daemon-system usr/lib/libvirt/virt-aa-helper
dh_install -p libvirt-daemon-system etc/apparmor.d
dh_apparmor -p libvirt-daemon-system --profile-name=usr.lib.libvirt.virt-aa-helper
dh_apparmor -p libvirt-daemon-system --profile-name=usr.sbin.libvirtd
# Not all linux arches have systemtap yet
mkdir -p debian/tmp/usr/share/systemtap
dh_install -p libvirt-daemon-system usr/share/systemtap
dh_install -p libvirt-daemon-system etc/libvirt/lxc.conf
dh_install -p libvirt-daemon-system etc/libvirt/qemu-sanlock.conf
dh_install -p libvirt-daemon-system etc/libvirt/qemu/networks/
dh_install -p libvirt-daemon-system etc/libvirt/nwfilter/
dh_install -p libvirt-clients etc/libvirt/virt-login-shell.conf
dh_install -p libnss-libvirt \
usr/lib/$(DEB_HOST_MULTIARCH)/libnss_libvirt.so.2 \
lib/$(DEB_HOST_MULTIARCH)/
endif
ifeq ($(XEN_ENABLED), 1)
dh_install -p libvirt-daemon-system etc/libvirt/libxl.conf
dh_install -p libvirt-daemon-system etc/libvirt/libxl-lockd.conf
endif
set -e; for l in $(LOGROTATE); do \
cp $(CURDIR)/debian/tmp/etc/logrotate.d/$$l \
debian/libvirt-daemon-system.$$l.logrotate; \
dh_installlogrotate --name=$$l; \
done
# Don't ship any la files
rm debian/libvirt-daemon/usr/lib/libvirt/connection-driver/*.la
rm debian/libvirt-wireshark/usr/lib/*/wireshark/plugins/*/*.la
# Don't ship any files that are managed by the user only
rm debian/libvirt-daemon-system/etc/apparmor.d/local/*
# executable-not-elf-or-script
chmod 644 debian/libvirt-daemon/usr/share/bash-completion/completions/vsh
override_dh_installinit:
dh_installinit -p libvirt-daemon-system --name=virtlogd --no-restart-on-upgrade
dh_installinit -p libvirt-daemon-system --name=libvirtd --restart-after-upgrade -- defaults 28 72
dh_installinit -p libvirt-daemon-system --name=libvirt-guests --no-restart-on-upgrade -- defaults 29 71
override_dh_systemd_start:
dh_systemd_start -p libvirt-daemon-system --restart-after-upgrade libvirtd.service
dh_systemd_start -p libvirt-daemon-system --no-restart-on-upgrade $(LIBVIRT_SYSTEM_SERVICES)
override_dh_installdocs:
dh_installdocs
# Remove binaries and object files examples
[ ! -d $(EXAMPLES_DIR) ] || find $(EXAMPLES_DIR) -name "*.o" -type f -delete -o -name .libs -type d -exec rm -rf {} \;
rm -f $(EXAMPLES_DIR)domain-events/events-c/event-test \
$(EXAMPLES_DIR)dominfo/info1 \
$(EXAMPLES_DIR)domsuspend/suspend \
$(EXAMPLES_DIR)hellolibvirt/hellolibvirt \
$(EXAMPLES_DIR)apparmor/* \
$(NULL)
override_dh_auto_clean:
[ ! -f Makefile ] || dh_auto_clean
rm -f $(CURDIR)/debian/libvirt-daemon-system.libvirt-guests.init \
$(CURDIR)/debian/libvirt-daemon-system.libvirt-guests.default \
$(CURDIR)/debian/libvirt-daemon-system.*.logrotate \
$(CURDIR)/debian/*.service \
$(CURDIR)/debian/libvirt-daemon-system.virtlogd.default \
$(CURDIR)/debian/libvirt-daemon-system.virtlockd.default \
$(NULL)
rm -rf $(DEB_BUILDDIR)
override_dh_installchangelogs:
dh_installchangelogs -plibvirt0
dh_installchangelogs -Nlibvirt0 -XChangeLog
override_dh_missing:
dh_missing --list-missing
|