Add official debian tree
[ganeti-local] / debian / rules
1 #!/usr/bin/make -f
2
3 # Uncomment this to turn on verbose mode.
4 #export DH_VERBOSE=1
5
6 GNT_USERGROUP_PREFIX="gnt-"
7
8 %:
9         dh $@ --with python2,sphinxdoc,bash_completion
10
11 override_dh_auto_configure:
12         ./configure \
13           --prefix=/usr \
14           --localstatedir=/var \
15           --sysconfdir=/etc \
16           --with-export-dir=/var/lib/ganeti/export \
17           --with-iallocator-search-path=/usr/local/lib/ganeti/iallocators,/usr/lib/ganeti/iallocators \
18           --with-os-search-path=/srv/ganeti/os,/usr/local/lib/ganeti/os,/usr/lib/ganeti/os,/usr/share/ganeti/os \
19           --docdir=/usr/share/doc/ganeti \
20           --enable-htools-rapi --enable-restricted-commands \
21           --with-user-prefix=$(GNT_USERGROUP_PREFIX) \
22           --with-group-prefix=$(GNT_USERGROUP_PREFIX)
23
24 override_dh_auto_clean:
25         [ ! -f Makefile ] || $(MAKE) distclean
26         # this is not removed by make distclean :(
27         rm -f ganeti
28
29         rm -f debian/ganeti.init
30         rm -f debian/ganeti.cron.d
31         rm -f debian/ganeti.default
32         rm -f debian/ganeti.postinst
33         rm -f debian/ganeti.postrm
34         if [ -d doc/html.orig ]; then \
35                 rm -rf doc/html; \
36                 mv doc/html.orig doc/html; \
37         fi
38         dh_auto_clean
39
40 override_dh_auto_build:
41         dh_auto_build
42         mv doc/html doc/html.orig
43         $(MAKE) doc/html
44         $(CURDIR)/debian/genscript.py postinst "$(CURDIR)" | \
45                 sed -f "$(CURDIR)/autotools/replace_vars.sed" >"$(CURDIR)/debian/ganeti.postinst"
46         $(CURDIR)/debian/genscript.py postrm "$(CURDIR)" >"$(CURDIR)/debian/ganeti.postrm"
47
48 # Add missing bits to ganeti and python-ganeti-rapi. We do not use
49 # override_dh_install (plain) because it will fail in binary-arch builds.
50 override_dh_install-indep:
51         dh_install -i -Xganeti-confd -Xmon-collector -Xhail -Xganeti-mond -Xganeti-luxid --fail-missing
52         cp $(CURDIR)/doc/examples/ganeti.initd $(CURDIR)/debian/ganeti.init
53         cp $(CURDIR)/doc/examples/ganeti.cron $(CURDIR)/debian/ganeti.cron.d
54         cp $(CURDIR)/doc/examples/ganeti.default $(CURDIR)/debian/ganeti.default
55         
56         # Dummy Python module for the RAPI client
57         touch $(CURDIR)/debian/python-ganeti-rapi/usr/share/pyshared/ganeti/__init__.py
58         touch $(CURDIR)/debian/python-ganeti-rapi/usr/share/pyshared/ganeti/rapi/__init__.py
59
60 override_dh_installinit:
61         dh_installinit --error-handler=true -i -- defaults 20 80
62
63 # Disable dh_sphinxdoc for binary-arch, as it will raise an error
64 override_dh_sphinxdoc-arch:
65
66 # Disable the test suite, as it requires the daemon users to be present
67 # at build time.
68 override_dh_auto_test:
69
70
71 .PHONY: override_dh_auto_configure override_dh_auto_clean override_dh_auto_build \
72         override_dh_installinit override_dh_install-indep override_dh_sphinxdoc-arch \
73         override_dh_auto_test