2019-12-20 08:34:14 +00:00
|
|
|
include /usr/share/dpkg/default.mk
|
2019-01-31 12:43:09 +00:00
|
|
|
include defines.mk
|
2018-11-30 12:39:40 +00:00
|
|
|
|
2020-01-15 09:29:57 +00:00
|
|
|
PACKAGE := proxmox-backup
|
2019-12-20 08:34:14 +00:00
|
|
|
ARCH := $(DEB_BUILD_ARCH)
|
2018-12-01 12:44:13 +00:00
|
|
|
|
2019-02-24 08:51:10 +00:00
|
|
|
SUBDIRS := etc www docs
|
2019-01-31 14:42:47 +00:00
|
|
|
|
2019-01-31 12:43:09 +00:00
|
|
|
# Binaries usable by users
|
|
|
|
USR_BIN := \
|
2021-01-27 10:31:26 +00:00
|
|
|
proxmox-backup-client \
|
2021-03-31 10:21:48 +00:00
|
|
|
proxmox-file-restore \
|
2021-01-27 10:31:26 +00:00
|
|
|
pxar \
|
2021-03-03 07:30:22 +00:00
|
|
|
proxmox-tape \
|
2021-02-05 10:12:52 +00:00
|
|
|
pmtx \
|
|
|
|
pmt
|
2019-01-31 12:43:09 +00:00
|
|
|
|
|
|
|
# Binaries usable by admins
|
2020-02-10 13:43:26 +00:00
|
|
|
USR_SBIN := \
|
2021-08-30 08:53:37 +00:00
|
|
|
proxmox-backup-manager \
|
|
|
|
proxmox-backup-debug \
|
2019-01-31 12:43:09 +00:00
|
|
|
|
|
|
|
# Binaries for services:
|
|
|
|
SERVICE_BIN := \
|
|
|
|
proxmox-backup-api \
|
2020-02-10 13:43:26 +00:00
|
|
|
proxmox-backup-banner \
|
2020-10-31 20:27:06 +00:00
|
|
|
proxmox-backup-proxy \
|
2020-12-28 10:10:25 +00:00
|
|
|
proxmox-daily-update
|
2019-01-31 12:43:09 +00:00
|
|
|
|
2021-03-31 10:21:52 +00:00
|
|
|
# Single file restore daemon
|
|
|
|
RESTORE_BIN := \
|
|
|
|
proxmox-restore-daemon
|
|
|
|
|
2021-07-06 12:45:55 +00:00
|
|
|
SUBCRATES := \
|
2021-07-07 07:04:09 +00:00
|
|
|
pbs-api-types \
|
2021-07-06 10:08:44 +00:00
|
|
|
pbs-buildcfg \
|
2021-07-19 08:50:18 +00:00
|
|
|
pbs-client \
|
2021-09-02 10:47:11 +00:00
|
|
|
pbs-config \
|
2021-07-06 10:49:10 +00:00
|
|
|
pbs-datastore \
|
2021-07-21 12:12:22 +00:00
|
|
|
pbs-fuse-loop \
|
2021-09-21 05:58:39 +00:00
|
|
|
proxmox-rest-server \
|
2021-10-06 05:06:17 +00:00
|
|
|
proxmox-rrd \
|
2021-09-13 09:54:24 +00:00
|
|
|
pbs-tape \
|
2021-07-12 08:45:09 +00:00
|
|
|
pbs-tools \
|
2021-07-19 13:53:43 +00:00
|
|
|
proxmox-backup-banner \
|
2021-08-26 09:00:37 +00:00
|
|
|
proxmox-backup-client \
|
2021-09-01 10:21:51 +00:00
|
|
|
proxmox-file-restore \
|
2021-09-21 05:58:52 +00:00
|
|
|
proxmox-restore-daemon \
|
2021-07-19 13:53:43 +00:00
|
|
|
pxar-bin
|
2021-07-06 12:45:55 +00:00
|
|
|
|
2019-01-31 14:42:47 +00:00
|
|
|
ifeq ($(BUILD_MODE), release)
|
|
|
|
CARGO_BUILD_ARGS += --release
|
2019-01-31 12:43:09 +00:00
|
|
|
COMPILEDIR := target/release
|
2019-01-31 14:42:47 +00:00
|
|
|
else
|
|
|
|
COMPILEDIR := target/debug
|
|
|
|
endif
|
|
|
|
|
2019-05-22 13:41:20 +00:00
|
|
|
ifeq ($(valgrind), yes)
|
|
|
|
CARGO_BUILD_ARGS += --features valgrind
|
|
|
|
endif
|
|
|
|
|
2019-12-20 08:34:14 +00:00
|
|
|
CARGO ?= cargo
|
|
|
|
|
2019-01-31 12:43:09 +00:00
|
|
|
COMPILED_BINS := \
|
2021-03-31 10:21:52 +00:00
|
|
|
$(addprefix $(COMPILEDIR)/,$(USR_BIN) $(USR_SBIN) $(SERVICE_BIN) $(RESTORE_BIN))
|
2019-01-31 12:43:09 +00:00
|
|
|
|
2020-07-04 15:51:56 +00:00
|
|
|
export DEB_VERSION DEB_VERSION_UPSTREAM
|
|
|
|
|
2020-03-03 09:56:07 +00:00
|
|
|
SERVER_DEB=${PACKAGE}-server_${DEB_VERSION}_${ARCH}.deb
|
2020-07-09 09:39:07 +00:00
|
|
|
SERVER_DBG_DEB=${PACKAGE}-server-dbgsym_${DEB_VERSION}_${ARCH}.deb
|
2020-03-03 09:56:07 +00:00
|
|
|
CLIENT_DEB=${PACKAGE}-client_${DEB_VERSION}_${ARCH}.deb
|
2020-07-09 09:39:07 +00:00
|
|
|
CLIENT_DBG_DEB=${PACKAGE}-client-dbgsym_${DEB_VERSION}_${ARCH}.deb
|
2021-04-12 10:52:19 +00:00
|
|
|
RESTORE_DEB=proxmox-backup-file-restore_${DEB_VERSION}_${ARCH}.deb
|
|
|
|
RESTORE_DBG_DEB=proxmox-backup-file-restore-dbgsym_${DEB_VERSION}_${ARCH}.deb
|
2019-12-20 08:34:14 +00:00
|
|
|
DOC_DEB=${PACKAGE}-docs_${DEB_VERSION}_all.deb
|
2019-11-11 07:35:33 +00:00
|
|
|
|
2021-03-31 10:21:48 +00:00
|
|
|
DEBS=${SERVER_DEB} ${SERVER_DBG_DEB} ${CLIENT_DEB} ${CLIENT_DBG_DEB} \
|
2021-09-02 08:32:29 +00:00
|
|
|
${RESTORE_DEB} ${RESTORE_DBG_DEB} ${DEBUG_DEB} ${DEBUG_DBG_DEB}
|
2020-03-03 09:56:07 +00:00
|
|
|
|
2020-01-15 09:29:57 +00:00
|
|
|
DSC = rust-${PACKAGE}_${DEB_VERSION}.dsc
|
2018-12-01 12:44:13 +00:00
|
|
|
|
|
|
|
DESTDIR=
|
2018-11-30 12:39:40 +00:00
|
|
|
|
2021-07-07 10:15:21 +00:00
|
|
|
tests ?= --workspace
|
|
|
|
|
2021-07-12 11:15:17 +00:00
|
|
|
all: $(SUBDIRS)
|
2019-01-31 14:42:47 +00:00
|
|
|
|
|
|
|
.PHONY: $(SUBDIRS)
|
|
|
|
$(SUBDIRS):
|
|
|
|
$(MAKE) -C $@
|
2018-11-30 12:39:40 +00:00
|
|
|
|
2019-03-07 10:44:48 +00:00
|
|
|
test:
|
2019-05-21 15:54:49 +00:00
|
|
|
#cargo test test_broadcast_future
|
2019-04-27 08:56:49 +00:00
|
|
|
#cargo test $(CARGO_BUILD_ARGS)
|
2020-07-20 08:22:13 +00:00
|
|
|
$(CARGO) test $(tests) $(CARGO_BUILD_ARGS)
|
2018-12-19 12:54:22 +00:00
|
|
|
|
2019-03-07 10:44:48 +00:00
|
|
|
doc:
|
2021-07-07 10:15:21 +00:00
|
|
|
$(CARGO) doc --workspace --no-deps $(CARGO_BUILD_ARGS)
|
2019-02-12 12:27:11 +00:00
|
|
|
|
2019-01-31 14:42:47 +00:00
|
|
|
# always re-create this dir
|
|
|
|
.PHONY: build
|
|
|
|
build:
|
2021-09-07 11:40:31 +00:00
|
|
|
@echo "Setting pkg-buildcfg version to: $(DEB_VERSION_UPSTREAM)"
|
|
|
|
sed -i -e 's/^version =.*$$/version = "$(DEB_VERSION_UPSTREAM)"/' \
|
|
|
|
pbs-buildcfg/Cargo.toml
|
2018-11-30 12:39:40 +00:00
|
|
|
rm -rf build
|
2021-07-06 12:45:55 +00:00
|
|
|
mkdir build
|
|
|
|
cp -a debian \
|
2021-07-19 13:54:53 +00:00
|
|
|
Cargo.toml src \
|
2021-07-06 12:45:55 +00:00
|
|
|
$(SUBCRATES) \
|
|
|
|
docs etc examples tests www zsh-completions \
|
|
|
|
defines.mk Makefile \
|
|
|
|
./build/
|
|
|
|
rm -f build/Cargo.lock
|
2020-01-15 09:29:57 +00:00
|
|
|
find build/debian -name "*.hint" -delete
|
2019-02-01 10:08:36 +00:00
|
|
|
$(foreach i,$(SUBDIRS), \
|
|
|
|
$(MAKE) -C build/$(i) clean ;)
|
2018-11-30 12:39:40 +00:00
|
|
|
|
2020-01-15 09:29:57 +00:00
|
|
|
|
2019-12-13 13:14:28 +00:00
|
|
|
.PHONY: proxmox-backup-docs
|
2020-07-14 10:31:17 +00:00
|
|
|
$(DOC_DEB) $(DEBS): proxmox-backup-docs
|
|
|
|
proxmox-backup-docs: build
|
2019-12-13 13:14:28 +00:00
|
|
|
cd build; dpkg-buildpackage -b -us -uc --no-pre-clean
|
|
|
|
lintian $(DOC_DEB)
|
|
|
|
|
2019-12-20 08:34:14 +00:00
|
|
|
# copy the local target/ dir as a build-cache
|
2019-01-31 14:42:47 +00:00
|
|
|
.PHONY: deb
|
2020-07-14 10:31:17 +00:00
|
|
|
$(DEBS): deb
|
|
|
|
deb: build
|
2019-12-13 13:14:28 +00:00
|
|
|
cd build; dpkg-buildpackage -b -us -uc --no-pre-clean --build-profiles=nodoc
|
2019-11-11 07:35:33 +00:00
|
|
|
lintian $(DEBS)
|
2019-02-01 09:07:22 +00:00
|
|
|
|
2020-07-14 10:31:17 +00:00
|
|
|
.PHONY: deb-all
|
2021-06-28 17:07:10 +00:00
|
|
|
deb-all: build
|
|
|
|
cd build; dpkg-buildpackage -b -us -uc --no-pre-clean
|
|
|
|
lintian $(DEBS) $(DOC_DEB)
|
2020-07-14 10:31:17 +00:00
|
|
|
|
2019-02-01 09:07:22 +00:00
|
|
|
.PHONY: dsc
|
|
|
|
dsc: $(DSC)
|
|
|
|
$(DSC): build
|
|
|
|
cd build; dpkg-buildpackage -S -us -uc -d -nc
|
|
|
|
lintian $(DSC)
|
2018-11-30 12:39:40 +00:00
|
|
|
|
2021-07-11 11:25:39 +00:00
|
|
|
.PHONY: clean distclean deb clean
|
2018-12-01 12:44:13 +00:00
|
|
|
distclean: clean
|
2021-07-12 06:08:25 +00:00
|
|
|
clean: clean-deb
|
2019-02-01 10:08:36 +00:00
|
|
|
$(foreach i,$(SUBDIRS), \
|
|
|
|
$(MAKE) -C $(i) clean ;)
|
2019-12-20 08:34:14 +00:00
|
|
|
$(CARGO) clean
|
2021-07-12 11:15:17 +00:00
|
|
|
rm -f .do-cargo-build
|
2018-11-30 16:09:50 +00:00
|
|
|
find . -name '*~' -exec rm {} ';'
|
|
|
|
|
2021-07-11 11:25:39 +00:00
|
|
|
# allows one to avoid running cargo clean when one just wants to tidy up after a packgae build
|
|
|
|
clean-deb:
|
|
|
|
rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes build/
|
|
|
|
|
2018-12-01 12:44:13 +00:00
|
|
|
.PHONY: dinstall
|
2021-09-02 08:32:29 +00:00
|
|
|
dinstall: ${SERVER_DEB} ${SERVER_DBG_DEB} ${CLIENT_DEB} ${CLIENT_DBG_DEB} \
|
|
|
|
${DEBUG_DEB} ${DEBUG_DBG_DEB}
|
2021-04-09 08:08:55 +00:00
|
|
|
dpkg -i $^
|
2019-01-31 12:43:09 +00:00
|
|
|
|
2019-02-24 08:51:10 +00:00
|
|
|
# make sure we build binaries before docs
|
2021-07-12 11:15:17 +00:00
|
|
|
docs: $(COMPILEDIR)/dump-catalog-shell-cli $(COMPILEDIR)/docgen
|
2019-02-24 08:51:10 +00:00
|
|
|
|
2019-01-31 14:42:47 +00:00
|
|
|
.PHONY: cargo-build
|
2019-03-07 10:44:48 +00:00
|
|
|
cargo-build:
|
2021-07-12 11:15:17 +00:00
|
|
|
rm -f .do-cargo-build
|
|
|
|
$(MAKE) $(COMPILED_BINS)
|
|
|
|
|
|
|
|
$(COMPILED_BINS) $(COMPILEDIR)/dump-catalog-shell-cli $(COMPILEDIR)/docgen: .do-cargo-build
|
|
|
|
.do-cargo-build:
|
2021-09-21 05:58:53 +00:00
|
|
|
$(CARGO) build $(CARGO_BUILD_ARGS) \
|
2021-07-12 08:45:09 +00:00
|
|
|
--package proxmox-backup-banner \
|
|
|
|
--bin proxmox-backup-banner \
|
2021-08-26 09:00:37 +00:00
|
|
|
--package proxmox-backup-client \
|
|
|
|
--bin proxmox-backup-client \
|
2021-09-22 14:25:07 +00:00
|
|
|
--bin dump-catalog-shell-cli \
|
2021-08-31 12:45:48 +00:00
|
|
|
--bin proxmox-backup-debug \
|
2021-09-01 10:21:51 +00:00
|
|
|
--package proxmox-file-restore \
|
|
|
|
--bin proxmox-file-restore \
|
2021-07-19 13:53:43 +00:00
|
|
|
--package pxar-bin \
|
|
|
|
--bin pxar \
|
2021-09-13 09:54:24 +00:00
|
|
|
--package pbs-tape \
|
|
|
|
--bin pmt \
|
|
|
|
--bin pmtx \
|
2021-09-21 05:58:52 +00:00
|
|
|
--package proxmox-restore-daemon \
|
|
|
|
--bin proxmox-restore-daemon \
|
2021-07-12 08:45:09 +00:00
|
|
|
--package proxmox-backup \
|
2021-09-22 14:27:37 +00:00
|
|
|
--bin docgen \
|
|
|
|
--bin proxmox-backup-api \
|
|
|
|
--bin proxmox-backup-manager \
|
|
|
|
--bin proxmox-backup-proxy \
|
2021-07-12 04:16:28 +00:00
|
|
|
--bin proxmox-daily-update \
|
|
|
|
--bin proxmox-file-restore \
|
|
|
|
--bin proxmox-tape \
|
|
|
|
--bin sg-tape-cmd
|
2021-07-12 11:15:17 +00:00
|
|
|
touch "$@"
|
2019-01-31 12:43:09 +00:00
|
|
|
|
|
|
|
|
2019-09-11 11:59:56 +00:00
|
|
|
.PHONY: lint
|
|
|
|
lint:
|
|
|
|
cargo clippy -- -A clippy::all -D clippy::correctness
|
|
|
|
|
2019-01-31 12:43:09 +00:00
|
|
|
install: $(COMPILED_BINS)
|
|
|
|
install -dm755 $(DESTDIR)$(BINDIR)
|
2020-02-25 12:56:39 +00:00
|
|
|
install -dm755 $(DESTDIR)$(ZSH_COMPL_DEST)
|
2019-01-31 12:43:09 +00:00
|
|
|
$(foreach i,$(USR_BIN), \
|
2020-02-25 12:56:39 +00:00
|
|
|
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ; \
|
|
|
|
install -m644 zsh-completions/_$(i) $(DESTDIR)$(ZSH_COMPL_DEST)/ ;)
|
2019-01-31 12:43:09 +00:00
|
|
|
install -dm755 $(DESTDIR)$(SBINDIR)
|
|
|
|
$(foreach i,$(USR_SBIN), \
|
2020-02-25 12:56:39 +00:00
|
|
|
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ; \
|
|
|
|
install -m644 zsh-completions/_$(i) $(DESTDIR)$(ZSH_COMPL_DEST)/ ;)
|
2019-02-01 09:05:14 +00:00
|
|
|
install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup
|
2021-03-31 10:21:52 +00:00
|
|
|
install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/file-restore
|
|
|
|
$(foreach i,$(RESTORE_BIN), \
|
|
|
|
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/file-restore/ ;)
|
2020-12-28 10:10:25 +00:00
|
|
|
# install sg-tape-cmd as setuid binary
|
2020-12-28 12:22:17 +00:00
|
|
|
install -m4755 -o root -g root $(COMPILEDIR)/sg-tape-cmd $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/sg-tape-cmd
|
2019-01-31 12:43:09 +00:00
|
|
|
$(foreach i,$(SERVICE_BIN), \
|
2019-02-01 09:05:14 +00:00
|
|
|
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;)
|
2019-01-31 12:43:09 +00:00
|
|
|
$(MAKE) -C www install
|
2019-02-24 08:51:10 +00:00
|
|
|
$(MAKE) -C docs install
|
2019-12-13 09:35:43 +00:00
|
|
|
|
|
|
|
.PHONY: upload
|
2021-09-02 08:32:29 +00:00
|
|
|
upload: ${SERVER_DEB} ${CLIENT_DEB} ${RESTORE_DEB} ${DOC_DEB} ${DEBUG_DEB}
|
2019-12-13 09:35:43 +00:00
|
|
|
# check if working directory is clean
|
|
|
|
git diff --exit-code --stat && git diff --exit-code --stat --staged
|
2021-09-02 08:32:29 +00:00
|
|
|
tar cf - ${SERVER_DEB} ${SERVER_DBG_DEB} ${DOC_DEB} ${CLIENT_DEB} \
|
|
|
|
${CLIENT_DBG_DEB} ${DEBUG_DEB} ${DEBUG_DBG_DEB} \
|
|
|
|
| ssh -X repoman@repo.proxmox.com upload --product pbs --dist bullseye
|
2021-06-28 17:10:26 +00:00
|
|
|
tar cf - ${CLIENT_DEB} ${CLIENT_DBG_DEB} | ssh -X repoman@repo.proxmox.com upload --product "pve,pmg,pbs-client" --dist bullseye
|
|
|
|
tar cf - ${RESTORE_DEB} ${RESTORE_DBG_DEB} | ssh -X repoman@repo.proxmox.com upload --product "pve" --dist bullseye
|