]>
Commit | Line | Data |
---|---|---|
da0e1e40 | 1 | include /usr/share/dpkg/default.mk |
6285b251 | 2 | include defines.mk |
de779814 | 3 | |
e881b8a5 | 4 | PACKAGE := proxmox-backup |
da0e1e40 | 5 | ARCH := $(DEB_BUILD_ARCH) |
209bb433 | 6 | |
bb5c7707 | 7 | SUBDIRS := etc www docs |
13b77d10 | 8 | |
6285b251 WB |
9 | # Binaries usable by users |
10 | USR_BIN := \ | |
c9727044 | 11 | proxmox-backup-client \ |
76425d84 | 12 | proxmox-file-restore \ |
c9727044 | 13 | pxar \ |
cc2c5c77 | 14 | proxmox-tape \ |
4c209d6b DM |
15 | pmtx \ |
16 | pmt | |
6285b251 WB |
17 | |
18 | # Binaries usable by admins | |
b69b8af2 TL |
19 | USR_SBIN := \ |
20 | proxmox-backup-manager | |
6285b251 WB |
21 | |
22 | # Binaries for services: | |
23 | SERVICE_BIN := \ | |
24 | proxmox-backup-api \ | |
b69b8af2 | 25 | proxmox-backup-banner \ |
bc00289b | 26 | proxmox-backup-proxy \ |
b27c3282 | 27 | proxmox-daily-update |
6285b251 | 28 | |
dd9cef56 SR |
29 | # Single file restore daemon |
30 | RESTORE_BIN := \ | |
31 | proxmox-restore-daemon | |
32 | ||
01fd2447 | 33 | SUBCRATES := \ |
86fb3877 | 34 | pbs-api-types \ |
d420962f | 35 | pbs-buildcfg \ |
2b7f8dd5 | 36 | pbs-client \ |
f323e906 | 37 | pbs-datastore \ |
eb5e0ae6 | 38 | pbs-fuse-loop \ |
770a36e5 | 39 | pbs-runtime \ |
067dc06d | 40 | pbs-systemd \ |
b9c5cd82 | 41 | pbs-tools \ |
58a3fae7 WB |
42 | proxmox-backup-banner \ |
43 | pxar-bin | |
01fd2447 | 44 | |
13b77d10 WB |
45 | ifeq ($(BUILD_MODE), release) |
46 | CARGO_BUILD_ARGS += --release | |
6285b251 | 47 | COMPILEDIR := target/release |
13b77d10 WB |
48 | else |
49 | COMPILEDIR := target/debug | |
50 | endif | |
51 | ||
6f0069ae WB |
52 | ifeq ($(valgrind), yes) |
53 | CARGO_BUILD_ARGS += --features valgrind | |
54 | endif | |
55 | ||
da0e1e40 FG |
56 | CARGO ?= cargo |
57 | ||
6285b251 | 58 | COMPILED_BINS := \ |
dd9cef56 | 59 | $(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN) $(RESTORE_BIN)) |
6285b251 | 60 | |
1f6a4f58 TL |
61 | export DEB_VERSION DEB_VERSION_UPSTREAM |
62 | ||
10426c17 | 63 | SERVER_DEB=${PACKAGE}-server_${DEB_VERSION}_${ARCH}.deb |
3ec6e249 | 64 | SERVER_DBG_DEB=${PACKAGE}-server-dbgsym_${DEB_VERSION}_${ARCH}.deb |
10426c17 | 65 | CLIENT_DEB=${PACKAGE}-client_${DEB_VERSION}_${ARCH}.deb |
3ec6e249 | 66 | CLIENT_DBG_DEB=${PACKAGE}-client-dbgsym_${DEB_VERSION}_${ARCH}.deb |
a5322f3c TL |
67 | RESTORE_DEB=proxmox-backup-file-restore_${DEB_VERSION}_${ARCH}.deb |
68 | RESTORE_DBG_DEB=proxmox-backup-file-restore-dbgsym_${DEB_VERSION}_${ARCH}.deb | |
da0e1e40 | 69 | DOC_DEB=${PACKAGE}-docs_${DEB_VERSION}_all.deb |
36d74cd6 | 70 | |
76425d84 DC |
71 | DEBS=${SERVER_DEB} ${SERVER_DBG_DEB} ${CLIENT_DEB} ${CLIENT_DBG_DEB} \ |
72 | ${RESTORE_DEB} ${RESTORE_DBG_DEB} | |
10426c17 | 73 | |
e881b8a5 | 74 | DSC = rust-${PACKAGE}_${DEB_VERSION}.dsc |
209bb433 DM |
75 | |
76 | DESTDIR= | |
de779814 | 77 | |
314d360f WB |
78 | tests ?= --workspace |
79 | ||
424d2d68 | 80 | all: $(SUBDIRS) |
13b77d10 WB |
81 | |
82 | .PHONY: $(SUBDIRS) | |
83 | $(SUBDIRS): | |
84 | $(MAKE) -C $@ | |
de779814 | 85 | |
cd3b9a06 | 86 | test: |
cc119edb | 87 | #cargo test test_broadcast_future |
3dceb9b3 | 88 | #cargo test $(CARGO_BUILD_ARGS) |
c47a900c | 89 | $(CARGO) test $(tests) $(CARGO_BUILD_ARGS) |
f7dd683b | 90 | |
cd3b9a06 | 91 | doc: |
314d360f | 92 | $(CARGO) doc --workspace --no-deps $(CARGO_BUILD_ARGS) |
d78345bc | 93 | |
13b77d10 WB |
94 | # always re-create this dir |
95 | .PHONY: build | |
96 | build: | |
de779814 | 97 | rm -rf build |
01fd2447 WB |
98 | mkdir build |
99 | cp -a debian \ | |
a6eac535 | 100 | Cargo.toml src \ |
01fd2447 WB |
101 | $(SUBCRATES) \ |
102 | docs etc examples tests www zsh-completions \ | |
103 | defines.mk Makefile \ | |
104 | ./build/ | |
105 | rm -f build/Cargo.lock | |
e881b8a5 | 106 | find build/debian -name "*.hint" -delete |
b369f720 WB |
107 | $(foreach i,$(SUBDIRS), \ |
108 | $(MAKE) -C build/$(i) clean ;) | |
de779814 | 109 | |
e881b8a5 | 110 | |
720776b8 | 111 | .PHONY: proxmox-backup-docs |
37e53b4c TL |
112 | $(DOC_DEB) $(DEBS): proxmox-backup-docs |
113 | proxmox-backup-docs: build | |
720776b8 DM |
114 | cd build; dpkg-buildpackage -b -us -uc --no-pre-clean |
115 | lintian $(DOC_DEB) | |
116 | ||
da0e1e40 | 117 | # copy the local target/ dir as a build-cache |
13b77d10 | 118 | .PHONY: deb |
37e53b4c TL |
119 | $(DEBS): deb |
120 | deb: build | |
720776b8 | 121 | cd build; dpkg-buildpackage -b -us -uc --no-pre-clean --build-profiles=nodoc |
36d74cd6 | 122 | lintian $(DEBS) |
18fad344 | 123 | |
37e53b4c | 124 | .PHONY: deb-all |
a2c73c78 TL |
125 | deb-all: build |
126 | cd build; dpkg-buildpackage -b -us -uc --no-pre-clean | |
127 | lintian $(DEBS) $(DOC_DEB) | |
37e53b4c | 128 | |
18fad344 WB |
129 | .PHONY: dsc |
130 | dsc: $(DSC) | |
131 | $(DSC): build | |
132 | cd build; dpkg-buildpackage -S -us -uc -d -nc | |
133 | lintian $(DSC) | |
de779814 | 134 | |
1900d781 | 135 | .PHONY: clean distclean deb clean |
209bb433 | 136 | distclean: clean |
6b85671d | 137 | clean: clean-deb |
b369f720 WB |
138 | $(foreach i,$(SUBDIRS), \ |
139 | $(MAKE) -C $(i) clean ;) | |
da0e1e40 | 140 | $(CARGO) clean |
424d2d68 | 141 | rm -f .do-cargo-build |
d3cb69c4 DM |
142 | find . -name '*~' -exec rm {} ';' |
143 | ||
1900d781 TL |
144 | # allows one to avoid running cargo clean when one just wants to tidy up after a packgae build |
145 | clean-deb: | |
146 | rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes build/ | |
147 | ||
209bb433 | 148 | .PHONY: dinstall |
c287b287 TL |
149 | dinstall: ${SERVER_DEB} ${SERVER_DBG_DEB} ${CLIENT_DEB} ${CLIENT_DBG_DEB} |
150 | dpkg -i $^ | |
6285b251 | 151 | |
bb5c7707 | 152 | # make sure we build binaries before docs |
424d2d68 | 153 | docs: $(COMPILEDIR)/dump-catalog-shell-cli $(COMPILEDIR)/docgen |
bb5c7707 | 154 | |
13b77d10 | 155 | .PHONY: cargo-build |
cd3b9a06 | 156 | cargo-build: |
424d2d68 TL |
157 | rm -f .do-cargo-build |
158 | $(MAKE) $(COMPILED_BINS) | |
159 | ||
160 | $(COMPILED_BINS) $(COMPILEDIR)/dump-catalog-shell-cli $(COMPILEDIR)/docgen: .do-cargo-build | |
161 | .do-cargo-build: | |
991be99c | 162 | RUSTFLAGS="--cfg openid" $(CARGO) build $(CARGO_BUILD_ARGS) \ |
f726e1e0 TL |
163 | --bin proxmox-backup-api \ |
164 | --bin proxmox-backup-proxy \ | |
165 | --bin proxmox-backup-manager \ | |
166 | --bin docgen | |
991be99c | 167 | $(CARGO) build $(CARGO_BUILD_ARGS) \ |
b9c5cd82 WB |
168 | --package proxmox-backup-banner \ |
169 | --bin proxmox-backup-banner \ | |
58a3fae7 WB |
170 | --package pxar-bin \ |
171 | --bin pxar \ | |
b9c5cd82 | 172 | --package proxmox-backup \ |
991be99c TL |
173 | --bin dump-catalog-shell-cli \ |
174 | --bin pmt --bin pmtx \ | |
991be99c TL |
175 | --bin proxmox-backup-client \ |
176 | --bin proxmox-daily-update \ | |
177 | --bin proxmox-file-restore \ | |
178 | --bin proxmox-restore-daemon \ | |
179 | --bin proxmox-tape \ | |
180 | --bin pxar \ | |
181 | --bin sg-tape-cmd | |
424d2d68 | 182 | touch "$@" |
6285b251 | 183 | |
6285b251 | 184 | |
d1596102 WB |
185 | .PHONY: lint |
186 | lint: | |
187 | cargo clippy -- -A clippy::all -D clippy::correctness | |
188 | ||
6285b251 WB |
189 | install: $(COMPILED_BINS) |
190 | install -dm755 $(DESTDIR)$(BINDIR) | |
6dea60aa | 191 | install -dm755 $(DESTDIR)$(ZSH_COMPL_DEST) |
6285b251 | 192 | $(foreach i,$(USR_BIN), \ |
6dea60aa CE |
193 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ; \ |
194 | install -m644 zsh-completions/_$(i) $(DESTDIR)$(ZSH_COMPL_DEST)/ ;) | |
6285b251 WB |
195 | install -dm755 $(DESTDIR)$(SBINDIR) |
196 | $(foreach i,$(USR_SBIN), \ | |
6dea60aa CE |
197 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ; \ |
198 | install -m644 zsh-completions/_$(i) $(DESTDIR)$(ZSH_COMPL_DEST)/ ;) | |
304db5da | 199 | install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup |
dd9cef56 SR |
200 | install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/file-restore |
201 | $(foreach i,$(RESTORE_BIN), \ | |
202 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/file-restore/ ;) | |
b27c3282 | 203 | # install sg-tape-cmd as setuid binary |
df3a74d7 | 204 | install -m4755 -o root -g root $(COMPILEDIR)/sg-tape-cmd $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/sg-tape-cmd |
6285b251 | 205 | $(foreach i,$(SERVICE_BIN), \ |
304db5da | 206 | install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;) |
6285b251 | 207 | $(MAKE) -C www install |
bb5c7707 | 208 | $(MAKE) -C docs install |
b29292a8 | 209 | ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) |
7190cbf2 | 210 | $(MAKE) test # HACK, only test now to avoid clobbering build files with wrong config |
b29292a8 | 211 | endif |
729e38f4 DM |
212 | |
213 | .PHONY: upload | |
76425d84 | 214 | upload: ${SERVER_DEB} ${CLIENT_DEB} ${RESTORE_DEB} ${DOC_DEB} |
729e38f4 DM |
215 | # check if working directory is clean |
216 | git diff --exit-code --stat && git diff --exit-code --stat --staged | |
59648eac | 217 | tar cf - ${SERVER_DEB} ${SERVER_DBG_DEB} ${DOC_DEB} ${CLIENT_DEB} ${CLIENT_DBG_DEB} | \ |
d9d81741 TL |
218 | ssh -X repoman@repo.proxmox.com upload --product pbs --dist bullseye |
219 | tar cf - ${CLIENT_DEB} ${CLIENT_DBG_DEB} | ssh -X repoman@repo.proxmox.com upload --product "pve,pmg,pbs-client" --dist bullseye | |
220 | tar cf - ${RESTORE_DEB} ${RESTORE_DBG_DEB} | ssh -X repoman@repo.proxmox.com upload --product "pve" --dist bullseye |