summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 54f30d819d59c89df6bef1fb14e2f598f2d7f233 (plain)
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
#!/usr/bin/make -f

export VIR_TEST_DEBUG=1

ifneq (,$(findstring $(DEB_HOST_ARCH_OS), linux))
  ifneq (,$(findstring $(DEB_HOST_ARCH), i386 amd64))
    WITH_XEN = --with-xen
    WITH_LIBXL = --with-libxl
    WITH_VBOX = --with-vbox
    MAKE_CHECK = 1
  else
    WITH_XEN            = --without-xen
    WITH_LIBXL          = --without-libxl
    WITH_VBOX           = --without-vbox
  endif
  WITH_STORAGE_LVM    = --with-storage-lvm
  WITH_STORAGE_ISCSI  = --with-storage-iscsi
  WITH_STORAGE_DISK   =	--with-storage-disk
  WITH_STORAGE_SHEEPDOG = --with-storage-sheepdog
  WITH_STORAGE_RADOS  = --with-storage-rados
  WITH_UDEV           = --with-udev --without-hal
  WITH_CAPNG          = --with-capng
  WITH_POLKIT         = --with-polkit
  WITH_MACVTAP        = --with-macvtap
  WITH_NETWORK        = --with-network
  WITH_QEMU           = --with-qemu
  WITH_OPENVZ         = --with-openvz
  WITH_NETCF          = --with-netcf
  WITH_SANLOCK        = --with-sanlock
  WITH_INIT_SCRIPT    =	--with-init-script=none
  WITH_AUDIT          = --with-audit
  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 i386 ia64 mips mipsel powerpc))
      WITH_NUMA       = --with-numactl
  else
      WITH_NUMA       = --without-numactl
  endif
  ifneq (,$(findstring $(DEB_HOST_ARCH), ia64))
      WITH_LXC        = --without-lxc
  else
      WITH_LXC        = --with-lxc
  endif
else
  WITH_STORAGE_LVM    = --without-storage-lvm
  WITH_STORAGE_ISCSI  = --without-storage-iscsi
  WITH_STORAGE_DISK   =	--without-storage-disk
  WITH_STORAGE_SHEEPDOG = --without-storage-sheepdog
  WITH_STORAGE_RADOS  = --without-storage-rados
  WITH_UDEV           = --without-udev --with-hal
  WITH_CAPNG          = --without-capng
  WITH_POLKIT         = --without-polkit
  WITH_MACVTAP        = --without-macvtap
  WITH_NETWORK        = --without-network
  WITH_QEMU           = --without-qemu
  WITH_LXC            = --without-lxc
  WITH_NUMA           = --without-numactl
  WITH_NETCF          = --without-netcf
  WITH_INIT_SCRIPT    =	--with-init-script=none
  WITH_AUDIT          = --without-audit
  WITH_DTRACE         = --without-dtrace
  WITH_XEN            = --without-xen
  WITH_LIBXL          = --without-libxl
  WITH_VBOX           = --without-vbox
endif

DEB_CONFIGURE_EXTRA_ARGS :=      \
	--disable-rpath          \
	$(WITH_QEMU)		 \
	--with-qemu-user=libvirt-qemu  \
	--with-qemu-group=libvirt-qemu \
        $(WITH_OPENVZ)		 \
	--with-avahi             \
	--with-sasl              \
	--with-yajl              \
	$(WITH_POLKIT)		 \
	$(WITH_UDEV)		 \
	--with-storage-fs        \
	$(WITH_STORAGE_LVM)	 \
	$(WITH_STORAGE_ISCSI)	 \
	$(WITH_STORAGE_DISK)	 \
	$(WITH_STORAGE_SHEEPDOG) \
	$(WITH_STORAGE_RADOS)    \
	$(WITH_INIT_SCRIPT)      \
	$(WITH_NUMA)             \
	--without-selinux        \
	--without-esx		 \
	--without-libssh2	 \
	$(WITH_CAPNG)		 \
	--enable-debug		 \
	$(WITH_MACVTAP)		 \
	$(WITH_NETWORK)		 \
	$(WITH_NETCF)		 \
	$(WITH_XEN)		 \
	$(WITH_LIBXL)		 \
	$(WITH_VBOX)		 \
	$(WITH_LXC)              \
	$(WITH_DTRACE)           \
	$(WITH_AUDIT)            \
	--without-firewalld

DEB_BUILDDIR := $(CURDIR)/debian/build
LOGROTATE = $(basename $(basename $(notdir $(wildcard daemon/libvirtd*.logrotate.in))))
EXAMPLES_DIR = $(CURDIR)/debian/libvirt-doc/usr/share/doc/libvirt-doc/examples/

%:
	dh $@ --builddirectory=$(DEB_BUILDDIR)

override_dh_auto_configure:
	NOCONFIGURE=yes GNULIB_SRCDIR=.gnulib ./autogen.sh --no-git
	dh_auto_configure -- $(DEB_CONFIGURE_EXTRA_ARGS)
	DEB_BUILDDIR=$(DEB_BUILDDIR) make -f debian/python.mk configure

override_dh_auto_install:
	dh_auto_install
	DEB_BUILDDIR=$(DEB_BUILDDIR) make -f debian/python.mk install
	# Add empty dirs so dh_install doesn't fail on kFreebsd until we have
	# Polkit/Systemd/systemtap support
	mkdir -p debian/tmp/usr/share/polkit-1 \
	         debian/tmp/lib/systemd/system \
	         debian/tmp/usr/share/systemtap

override_dh_auto_test:
	export LD_PRELOAD="";     \
	[ -z "$(MAKE_CHECK)" ] || \
	  dh_auto_test -O--builddirectory=$(DEB_BUILDDIR)

override_dh_install:
	dh_install
	# Copy upstream files to debian/ so dh_* can find them
	cp debian/tmp/usr/lib/libvirt/libvirt-guests.sh \
	    debian/libvirt-bin.libvirt-guests.init
	cp tools/libvirt-guests.sysconf \
	    debian/libvirt-bin.libvirt-guests.default

	for l in $(LOGROTATE); do \
		cp $(CURDIR)/debian/build/daemon/$$l.logrotate \
                   debian/libvirt-bin.$$l.logrotate; \
		dh_installlogrotate --name=$$l;     \
	done

	# Don't ship any la files
	rm debian/libvirt-bin/usr/lib/libvirt/connection-driver/*.la

override_dh_installinit:
	dh_installinit --name=libvirt-bin --no-restart-on-upgrade -- defaults 28 72
	dh_installinit --name=libvirt-guests --no-restart-on-upgrade -- defaults 29 71

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
	rm -f $(EXAMPLES_DIR)dominfo/info1
	rm -f $(EXAMPLES_DIR)domsuspend/suspend
	rm -f $(EXAMPLES_DIR)hellolibvirt/hellolibvirt

override_dh_strip:
	dh_strip --dbg-package=libvirt0-dbg

override_dh_auto_build:
	dh_auto_build -a -i
	DEB_BUILDDIR=$(DEB_BUILDDIR) make --parallel -f debian/python.mk build

override_dh_auto_clean:
	[ ! -f Makefile ] || dh_auto_clean
	rm -f $(CURDIR)/debian/libvirt-bin.libvirt-guests.init
	rm -f $(CURDIR)/debian/libvirt-bin.libvirt-guests.default
	rm -f $(CURDIR)/debian/libvirt-bin.*.logrotate
	rm -rf $(DEB_BUILDDIR)