mirror of
https://git.proxmox.com/git/proxmox-offline-mirror
synced 2025-04-28 21:31:43 +00:00
build: use cargo wrapper
for package builds to ensure all common flags are actually set. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
9ca8c35ab5
commit
2cd3578c0d
9
Makefile
9
Makefile
@ -19,10 +19,15 @@ DEBS = $(DEB) $(HELPER_DEB) $(DBG_DEB) $(HELPER_DBG_DEB) $(DOC_DEB)
|
||||
ifeq ($(BUILD_MODE), release)
|
||||
CARGO_BUILD_ARGS += --release
|
||||
COMPILEDIR := target/release
|
||||
else ifeq ($(BUILD_MODE), release-deb)
|
||||
CARGO_BUILD_ARGS += --release
|
||||
COMPILEDIR := target/$(DEB_HOST_RUST_TYPE)/release
|
||||
else
|
||||
COMPILEDIR := target/debug
|
||||
endif
|
||||
|
||||
CARGO ?= cargo
|
||||
|
||||
USR_BIN := \
|
||||
proxmox-offline-mirror \
|
||||
proxmox-offline-mirror-helper
|
||||
@ -34,7 +39,7 @@ all: cargo-build $(SUBDIRS)
|
||||
|
||||
.PHONY: cargo-build
|
||||
cargo-build:
|
||||
cargo build $(CARGO_BUILD_ARGS)
|
||||
$(CARGO) build $(CARGO_BUILD_ARGS)
|
||||
|
||||
.PHONY: $(SUBDIRS)
|
||||
$(SUBDIRS): cargo-build
|
||||
@ -98,7 +103,7 @@ distclean: clean
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
cargo clean
|
||||
$(CARGO) clean
|
||||
rm -f *.deb *.build *.buildinfo *.changes *.dsc rust-$(PACKAGE)*.tar*
|
||||
rm -rf $(PACKAGE)-[0-9]*/
|
||||
find . -name '*~' -exec rm {} ';'
|
||||
|
11
debian/rules
vendored
11
debian/rules
vendored
@ -3,13 +3,13 @@
|
||||
include /usr/share/dpkg/pkg-info.mk
|
||||
include /usr/share/rustc/architecture.mk
|
||||
|
||||
export BUILD_MODE=release
|
||||
export BUILD_MODE=release-deb
|
||||
|
||||
CARGO=/usr/share/cargo/bin/cargo
|
||||
export CARGO=/usr/share/cargo/bin/cargo
|
||||
|
||||
export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
|
||||
export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
|
||||
export CARGO_HOME = $(CURDIR)/debian/cargo_home
|
||||
export CARGO_HOME=$(CURDIR)/debian/cargo_home
|
||||
|
||||
export DEB_CARGO_CRATE=proxmox-offline-mirror_$(DEB_VERSION_UPSTREAM)
|
||||
export DEB_CARGO_PACKAGE=proxmox-offline-mirror
|
||||
@ -24,6 +24,11 @@ override_dh_auto_configure:
|
||||
@perl -ne 'if (/^version\s*=\s*"(\d+(?:\.\d+)+)"/) { my $$v_cargo = $$1; my $$v_deb = "$(DEB_VERSION_UPSTREAM)"; \
|
||||
die "ERROR: d/changelog <-> Cargo.toml version mismatch: $$v_cargo != $$v_deb\n" if $$v_cargo ne $$v_deb; exit(0); }' Cargo.toml
|
||||
$(CARGO) prepare-debian $(CURDIR)/debian/cargo_registry --link-from-system
|
||||
# `cargo build` and `cargo install` have different config precedence, symlink
|
||||
# the wrapper config into a place where `build` picks it up as well..
|
||||
# https://doc.rust-lang.org/cargo/commands/cargo-install.html#configuration-discovery
|
||||
mkdir -p $(CURDIR)/.cargo
|
||||
ln -s $(CARGO_HOME)/config.toml $(CURDIR)/.cargo/config.toml
|
||||
dh_auto_configure
|
||||
|
||||
override_dh_auto_test:
|
||||
|
@ -21,10 +21,10 @@ SPHINXBUILD = sphinx-build
|
||||
BUILDDIR = output
|
||||
|
||||
ifeq ($(BUILD_MODE), release)
|
||||
COMPILEDIR := ../target/release
|
||||
COMPILEDIR := ../target/$release
|
||||
SPHINXOPTS += -t release
|
||||
else ifeq ($(BUILD_MODE), release-deb)
|
||||
COMPILEDIR := ../target/$(DEB_TARGET_GNU_CPU)-unknown-$(DEB_TARGET_GNU_SYSTEM)/release
|
||||
COMPILEDIR := ../target/$(DEB_HOST_RUST_TYPE)/release
|
||||
SPHINXOPTS += -t release
|
||||
else
|
||||
COMPILEDIR := ../target/debug
|
||||
|
Loading…
Reference in New Issue
Block a user