Elffuss BraidHub

utopia-ia/elffuss-braid public

52e22f93c9da · 952 B · executableRawPermalink
1#!/usr/bin/env bash
2# SPDX-License-Identifier: Apache-2.0
3# Copyright (c) 2026 UtopiaIA
4#
5# Builds the release binary with every build path remapped, then checks that
6# the home directory does not appear anywhere inside it. Published binaries are
7# built by CI; use this for local release builds.
8set -euo pipefail
9cd "$(dirname "$0")/.."
10
11cargo_home="${CARGO_HOME:-$HOME/.cargo}"
12rustup_home="${RUSTUP_HOME:-$HOME/.rustup}"
13# When several prefixes match, rustc applies the last one, so the most general
14# goes first.
15export RUSTFLAGS="${RUSTFLAGS:-} --remap-path-prefix=$HOME=~ --remap-path-prefix=$rustup_home=/rustup --remap-path-prefix=$cargo_home=/cargo --remap-path-prefix=$PWD=."
16
17cargo build --release --locked -p elffuss-braid-cli
18
19bin=target/release/braid
20if strings "$bin" | grep -qF "$HOME"; then
21 echo "build-release: $bin still contains the home directory path" >&2
22 exit 1
23fi
24echo "build-release: $bin contains no home-directory path"