mirror of
https://gitlab.freedesktop.org/pipewire/helvum
synced 2026-03-15 19:46:10 +08:00
cargo.sh previously used bash features but only used `sh` in the shebang, and also did not properly quote some variables to avoid splitting/globbing from happening. Also, `-euo pilefail` is now set to avoid other errors that might come up.
22 lines
539 B
Bash
22 lines
539 B
Bash
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
export MESON_BUILD_ROOT="$1"
|
|
export MESON_SOURCE_ROOT="$2"
|
|
export CARGO_TARGET_DIR="$MESON_BUILD_ROOT"/target
|
|
export CARGO_HOME="$MESON_BUILD_ROOT"/cargo-home
|
|
|
|
if [[ $4 = "development" ]]
|
|
then
|
|
echo "DEBUG MODE"
|
|
cargo build --manifest-path \
|
|
"$MESON_SOURCE_ROOT/Cargo.toml" && \
|
|
cp "$CARGO_TARGET_DIR/debug/$5" "$3"
|
|
else
|
|
echo "RELEASE MODE"
|
|
cargo build --manifest-path \
|
|
"$MESON_SOURCE_ROOT/Cargo.toml" --release && \
|
|
cp "$CARGO_TARGET_DIR/release/$5" "$3"
|
|
fi
|