]>
Commit | Line | Data |
---|---|---|
328c390e DM |
1 | #!/usr/bin/make -f |
2 | ||
3 | # Uncomment this to turn on verbose mode. | |
4 | #export DH_VERBOSE=1 | |
5 | ||
6 | # These are used for cross-compiling and for saving the configure script | |
7 | # from having to guess our platform (since we know it already) | |
8 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) | |
9 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) | |
10 | OS_DEB_VERSION ?= $(shell cat /etc/debian_version) | |
11 | VZCTL_DEBVERSION ?= $(shell dpkg-parsechangelog | grep ^Version | sed "s/Version: //") | |
12 | VZCTL_VERSION ?= $(shell echo $(VZCTL_DEBVERSION) | cut -d '-' -f 1) | |
13 | ||
14 | ifneq "$(wildcard /usr/share/quilt/quilt.make)" "" | |
15 | include /usr/share/quilt/quilt.make | |
16 | endif | |
17 | ||
18 | CFLAGS = -Wall -g | |
19 | ||
20 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) | |
21 | CFLAGS += -O0 | |
22 | else | |
23 | CFLAGS += -O2 | |
24 | endif | |
25 | ||
26 | config.status: configure | |
27 | dh_testdir | |
28 | sed -i "s/'$(VZCTL_VERSION)'/'$(VZCTL_DEBVERSION)'/g" configure | |
29 | ./configure \ | |
508802f8 | 30 | --without-ploop \ |
328c390e DM |
31 | --host=$(DEB_HOST_GNU_TYPE) \ |
32 | --build=$(DEB_BUILD_GNU_TYPE) \ | |
33 | --prefix=/usr \ | |
34 | --sysconfdir=/etc \ | |
508802f8 DM |
35 | --libdir=/usr/lib \ |
36 | --libexecdir=/usr/lib \ | |
328c390e DM |
37 | --localstatedir=/var \ |
38 | --enable-bashcomp \ | |
39 | --enable-logrotate \ | |
40 | CFLAGS="$(CFLAGS)" | |
41 | ||
42 | build: patch build-stamp | |
43 | build-stamp: config.status | |
44 | dh_testdir | |
45 | $(MAKE) vzdir=/var/lib/vz | |
46 | touch $@ | |
47 | ||
48 | clean: unpatch | |
49 | dh_testdir | |
50 | dh_testroot | |
51 | rm -f build-stamp | |
52 | -$(MAKE) distclean | |
53 | dh_clean | |
54 | ||
55 | install: build | |
56 | dh_testdir | |
57 | dh_testroot | |
58 | dh_clean -k | |
59 | dh_installdirs | |
60 | $(MAKE) DESTDIR=$(CURDIR)/debian/vzctl \ | |
61 | install \ | |
62 | install-debian \ | |
63 | vzdir=/var/lib/vz | |
10975143 | 64 | |
328c390e DM |
65 | # debianize vz.conf |
66 | sed -i \ | |
67 | -e 's/\/vz\//\/var\/lib\/vz\//' \ | |
68 | $(CURDIR)/debian/vzctl/etc/vz/vz.conf | |
10975143 | 69 | |
328c390e DM |
70 | # set default dist-script to debian |
71 | install -m 644 $(CURDIR)/etc/dists/debian.conf $(CURDIR)/debian/vzctl/etc/vz/dists/default | |
10975143 | 72 | |
328c390e DM |
73 | # rename the bash_completion.d/vzctl.sh for debian to vzctl |
74 | mv $(CURDIR)/debian/vzctl/etc/bash_completion.d/vzctl.sh $(CURDIR)/debian/vzctl/etc/bash_completion.d/vzctl | |
10975143 | 75 | |
328c390e DM |
76 | |
77 | # Remove unused file from libtool | |
78 | rm -rf $(CURDIR)/debian/vzctl/usr/lib/*.la | |
79 | rm -rf $(CURDIR)/debian/vzctl/usr/lib/*.a | |
10975143 | 80 | |
328c390e DM |
81 | # unset Debian Version on vzctl |
82 | sed -i "s/'$(VZCTL_DEBVERSION)'/'$(VZCTL_VERSION)'/g" configure | |
83 | ||
84 | # install sysctl file | |
85 | install -m 644 $(CURDIR)/debian/sysctl $(CURDIR)/debian/vzctl/etc/sysctl.d/vzctl.conf | |
86 | ||
87 | # lintian overrides | |
88 | install -m 644 $(CURDIR)/debian/vzctl.override $(CURDIR)/debian/vzctl/usr/share/lintian/overrides/vzctl | |
89 | ||
10975143 DM |
90 | # remove files in /etc/pve/openvz |
91 | rm -rf $(CURDIR)/debian/vzctl/etc/pve/openvz | |
92 | rmdir $(CURDIR)/debian/vzctl/etc/pve | |
93 | ||
7dc0704b DM |
94 | # remove files in /etc/vz/conf (symlink to /etc/pve/openvz) |
95 | rm -rf $(CURDIR)/debian/vzctl/etc/vz/conf | |
96 | # we create the symlink to /etc/pve/openvz inside the preinst script | |
97 | ||
98 | ||
10975143 | 99 | |
328c390e DM |
100 | # Build architecture-independent files here. |
101 | binary-indep: build install | |
102 | ||
103 | # Build architecture-dependent files here. | |
104 | binary-arch: build install | |
105 | dh_testdir | |
106 | dh_testroot | |
107 | dh_installchangelogs ChangeLog | |
108 | dh_installdocs | |
109 | dh_installexamples | |
110 | dh_installman | |
111 | dh_link | |
112 | dh_strip | |
113 | dh_compress | |
114 | dh_fixperms | |
115 | dh_makeshlibs | |
116 | dh_installdeb | |
117 | dh_shlibdeps | |
118 | dh_gencontrol | |
119 | dh_md5sums | |
120 | dh_builddeb | |
121 | ||
122 | binary: binary-indep binary-arch | |
123 | .PHONY: build clean binary-indep binary-arch binary install |