]>
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 \ | |
30 | --host=$(DEB_HOST_GNU_TYPE) \ | |
31 | --build=$(DEB_BUILD_GNU_TYPE) \ | |
32 | --prefix=/usr \ | |
33 | --sysconfdir=/etc \ | |
34 | --localstatedir=/var \ | |
35 | --enable-bashcomp \ | |
36 | --enable-logrotate \ | |
37 | CFLAGS="$(CFLAGS)" | |
38 | ||
39 | build: patch build-stamp | |
40 | build-stamp: config.status | |
41 | dh_testdir | |
42 | $(MAKE) vzdir=/var/lib/vz | |
43 | touch $@ | |
44 | ||
45 | clean: unpatch | |
46 | dh_testdir | |
47 | dh_testroot | |
48 | rm -f build-stamp | |
49 | -$(MAKE) distclean | |
50 | dh_clean | |
51 | ||
52 | install: build | |
53 | dh_testdir | |
54 | dh_testroot | |
55 | dh_clean -k | |
56 | dh_installdirs | |
57 | $(MAKE) DESTDIR=$(CURDIR)/debian/vzctl \ | |
58 | install \ | |
59 | install-debian \ | |
60 | vzdir=/var/lib/vz | |
10975143 | 61 | |
328c390e DM |
62 | # debianize vz.conf |
63 | sed -i \ | |
64 | -e 's/\/vz\//\/var\/lib\/vz\//' \ | |
65 | $(CURDIR)/debian/vzctl/etc/vz/vz.conf | |
10975143 | 66 | |
328c390e DM |
67 | # set default dist-script to debian |
68 | install -m 644 $(CURDIR)/etc/dists/debian.conf $(CURDIR)/debian/vzctl/etc/vz/dists/default | |
10975143 | 69 | |
328c390e DM |
70 | # rename the bash_completion.d/vzctl.sh for debian to vzctl |
71 | mv $(CURDIR)/debian/vzctl/etc/bash_completion.d/vzctl.sh $(CURDIR)/debian/vzctl/etc/bash_completion.d/vzctl | |
10975143 | 72 | |
328c390e DM |
73 | |
74 | # Remove unused file from libtool | |
75 | rm -rf $(CURDIR)/debian/vzctl/usr/lib/*.la | |
76 | rm -rf $(CURDIR)/debian/vzctl/usr/lib/*.a | |
10975143 | 77 | |
328c390e DM |
78 | # unset Debian Version on vzctl |
79 | sed -i "s/'$(VZCTL_DEBVERSION)'/'$(VZCTL_VERSION)'/g" configure | |
80 | ||
81 | # install sysctl file | |
82 | install -m 644 $(CURDIR)/debian/sysctl $(CURDIR)/debian/vzctl/etc/sysctl.d/vzctl.conf | |
83 | ||
84 | # lintian overrides | |
85 | install -m 644 $(CURDIR)/debian/vzctl.override $(CURDIR)/debian/vzctl/usr/share/lintian/overrides/vzctl | |
86 | ||
10975143 DM |
87 | # remove files in /etc/pve/openvz |
88 | rm -rf $(CURDIR)/debian/vzctl/etc/pve/openvz | |
89 | rmdir $(CURDIR)/debian/vzctl/etc/pve | |
90 | ||
91 | ||
328c390e DM |
92 | # Build architecture-independent files here. |
93 | binary-indep: build install | |
94 | ||
95 | # Build architecture-dependent files here. | |
96 | binary-arch: build install | |
97 | dh_testdir | |
98 | dh_testroot | |
99 | dh_installchangelogs ChangeLog | |
100 | dh_installdocs | |
101 | dh_installexamples | |
102 | dh_installman | |
103 | dh_link | |
104 | dh_strip | |
105 | dh_compress | |
106 | dh_fixperms | |
107 | dh_makeshlibs | |
108 | dh_installdeb | |
109 | dh_shlibdeps | |
110 | dh_gencontrol | |
111 | dh_md5sums | |
112 | dh_builddeb | |
113 | ||
114 | binary: binary-indep binary-arch | |
115 | .PHONY: build clean binary-indep binary-arch binary install |