5
0
mirror of git://git.proxmox.com/git/proxmox-backup-qemu.git synced 2025-02-25 01:57:34 +03:00
Wolfgang Bumiller b6e17373fd add api check
commit the current generated proxmox-backup-qemu.h as
'current-api.h' and run `diff -up` between the two in build
steps, so any changes to the C api are caught at build time.

cbindgen seems to be using a BTreeMap for the data, so it
should always come out sorted, so this should be a
stable-enough check.

Link: https://github.com/eqrion/cbindgen/issues/12
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-06-29 13:14:46 +02:00

64 lines
1.8 KiB
Makefile

include /usr/share/dpkg/default.mk
PACKAGE=libproxmox-backup-qemu0
ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
GITVERSION:=$(shell git rev-parse HEAD)
DEBS= \
${PACKAGE}_${DEB_VERSION}_${ARCH}.deb \
${PACKAGE}-dev_${DEB_VERSION}_${ARCH}.deb \
${PACKAGE}-dbgsym_${DEB_VERSION}_${ARCH}.deb
DESTDIR=
ifeq ($(BUILD_MODE), release)
CARGO_BUILD_ARGS += --release
endif
all:
ifneq ($(BUILD_MODE), skip)
cargo build $(CARGO_BUILD_ARGS)
diff -up current-api.h proxmox-backup-qemu.h
endif
# always re-create this dir
# but also copy the local target/ dir as a build-cache
.PHONY: build
build:
rm -rf build
cargo build --release
diff -up current-api.h proxmox-backup-qemu.h
rsync -a debian Makefile Cargo.toml Cargo.lock build.rs proxmox-backup-qemu.h src target current-api.h build/
.PHONY: install
install: target/release/libproxmox_backup_qemu.so
install -D -m 0755 target/release/libproxmox_backup_qemu.so ${DESTDIR}/usr/lib//libproxmox_backup_qemu.so.0
cd ${DESTDIR}/usr/lib/; ls *; ln -s libproxmox_backup_qemu.so.0 libproxmox_backup_qemu.so
.PHONY: deb
deb: $(DEBS)
$(DEBS): build
cd build; dpkg-buildpackage -b -us -uc --no-pre-clean
lintian $(DEBS)
simpletest: simpletest.c proxmox-backup-qemu.h
gcc simpletest.c -o simpletest -lc -Wl,-rpath=./target/$(BUILD_MODE) -L ./target/$(BUILD_MODE) -l proxmox_backup_qemu
distclean: clean
clean:
cargo clean
rm -rf *.deb *.dsc *.tar.gz *.buildinfo *.changes Cargo.lock proxmox-backup-qemu.h build
find . -name '*~' -exec rm {} ';'
.PHONY: dinstall
dinstall: ${DEBS}
dpkg -i ${DEBS}
.PHONY: upload
upload: ${DEBS}
# check if working directory is clean
git diff --exit-code --stat && git diff --exit-code --stat --staged
tar cf - ${DEBS} | ssh -X repoman@repo.proxmox.com upload --product pve --dist buster