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