packaging: remap build paths out of the binary (fix $srcdir reference warning)
makepkg warned that usr/bin/peerspeak referenced $srcdir: Rust bakes source paths into panic/backtrace metadata that survives stripping. Add --remap-path-prefix=$srcdir=/ in build() so neither our sources nor the vendored deps under CARGO_HOME leave the build dir embedded in the package. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,11 @@ build() {
|
|||||||
export CARGO_HOME="$srcdir/cargo-home"
|
export CARGO_HOME="$srcdir/cargo-home"
|
||||||
export RUSTUP_TOOLCHAIN=stable
|
export RUSTUP_TOOLCHAIN=stable
|
||||||
export CARGO_TARGET_DIR=target
|
export CARGO_TARGET_DIR=target
|
||||||
|
# Strip the build directory out of paths embedded in the binary (Rust bakes
|
||||||
|
# source paths into panic/backtrace metadata that survives stripping), so the
|
||||||
|
# package doesn't reference $srcdir. One remap covers our sources and the
|
||||||
|
# vendored deps, since CARGO_HOME lives under $srcdir too.
|
||||||
|
export RUSTFLAGS="${RUSTFLAGS:-} --remap-path-prefix=$srcdir=/"
|
||||||
cargo build --frozen --release --bin "$_pkgname"
|
cargo build --frozen --release --bin "$_pkgname"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user