From 7b1b5ea336ab7ed32fc7a7baea5954dcfe4186d7 Mon Sep 17 00:00:00 2001 From: "Tom A. Wagner" Date: Tue, 26 Oct 2021 10:01:01 +0200 Subject: [PATCH] build: fix and improve cargo.sh 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. --- build-aux/cargo.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/build-aux/cargo.sh b/build-aux/cargo.sh index 57662ae..23fc4b3 100644 --- a/build-aux/cargo.sh +++ b/build-aux/cargo.sh @@ -1,4 +1,6 @@ -#!/bin/sh +#!/bin/bash + +set -euo pipefail export MESON_BUILD_ROOT="$1" export MESON_SOURCE_ROOT="$2" @@ -9,12 +11,11 @@ if [[ $4 = "development" ]] then echo "DEBUG MODE" cargo build --manifest-path \ - "$MESON_SOURCE_ROOT"/Cargo.toml && \ - cp "$CARGO_TARGET_DIR"/debug/$5 $3 + "$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 + "$MESON_SOURCE_ROOT/Cargo.toml" --release && \ + cp "$CARGO_TARGET_DIR/release/$5" "$3" fi -