build-sys: Use --frozen if Rust library was already built
The main rationale here is avoiding any Cargo internet access during `sudo make install` type flows. Closes: #1444 Approved by: jlebon
This commit is contained in:
parent
2894d61fbf
commit
30ccaa4db6
@ -88,11 +88,16 @@ endif
|
|||||||
|
|
||||||
if ENABLE_RUST
|
if ENABLE_RUST
|
||||||
librpmostree_rust_path = @abs_top_builddir@/target/@RUST_TARGET_SUBDIR@/librpmostree_rust.a
|
librpmostree_rust_path = @abs_top_builddir@/target/@RUST_TARGET_SUBDIR@/librpmostree_rust.a
|
||||||
|
# If the target directory exists, use --frozen; we don't
|
||||||
|
# want to (by default) touch the Internet during builds here.
|
||||||
|
# One reason is that we want to support `make && sudo make install`,
|
||||||
|
# and we don't want to do `sudo cargo` there.
|
||||||
LIBRPMOSTREE_RUST_SRCS = $(wildcard rust/src/*.rs)
|
LIBRPMOSTREE_RUST_SRCS = $(wildcard rust/src/*.rs)
|
||||||
$(librpmostree_rust_path): Makefile $(LIBRPMOSTREE_RUST_SRCS)
|
$(librpmostree_rust_path): Makefile $(LIBRPMOSTREE_RUST_SRCS)
|
||||||
cd $(top_srcdir)/rust && \
|
cd $(top_srcdir)/rust && \
|
||||||
CARGO_TARGET_DIR=@abs_top_builddir@/target \
|
export CARGO_TARGET_DIR=@abs_top_builddir@/target && \
|
||||||
$(cargo) build --verbose $(CARGO_RELEASE_ARGS)
|
if test -d @abs_top_builddir@/target/@RUST_TARGET_SUBDIR@; then frozen=--frozen; fi && \
|
||||||
|
$(cargo) build --verbose $${frozen} $(CARGO_RELEASE_ARGS)
|
||||||
EXTRA_DIST += $(LIBRPMOSTREE_RUST_SRCS) rust/Cargo.lock
|
EXTRA_DIST += $(LIBRPMOSTREE_RUST_SRCS) rust/Cargo.lock
|
||||||
|
|
||||||
rpm_ostree_CFLAGS += -Irust/include
|
rpm_ostree_CFLAGS += -Irust/include
|
||||||
|
Loading…
Reference in New Issue
Block a user