From 7089f1ed477c3d3d8d39d91b1c543302f947d57d Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 10 Nov 2023 13:34:35 -0600 Subject: [PATCH] v1.17: Add --release-with-debug option to cargo-install-all.sh (backport of #33383) (#33978) Add --release-with-debug option to cargo-install-all.sh (#33383) * Add --canary option to cargo-install-all for building with separate debug symbols * lint * Remove debug-assertions * switch flag from --canary to --release-with-debug (cherry picked from commit 87b4dc64e3fc8026515e4186c92ff4325e2ab5a7) Co-authored-by: Will Hickey --- scripts/cargo-install-all.sh | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/scripts/cargo-install-all.sh b/scripts/cargo-install-all.sh index 583ba6508f917d..4aceef69a4fe73 100755 --- a/scripts/cargo-install-all.sh +++ b/scripts/cargo-install-all.sh @@ -28,22 +28,29 @@ usage() { echo "Error: $*" fi cat <] [--debug] [--validator-only] +usage: $0 [+] [--debug] [--validator-only] [--release-with-debug] EOF exit $exitcode } maybeRustVersion= installDir= -buildVariant=release -maybeReleaseFlag=--release +# buildProfileArg and buildProfile duplicate some information because cargo +# doesn't allow '--profile debug' but we still need to know that the binaries +# will be in target/debug +buildProfileArg='--profile release' +buildProfile='release' validatorOnly= while [[ -n $1 ]]; do if [[ ${1:0:1} = - ]]; then if [[ $1 = --debug ]]; then - maybeReleaseFlag= - buildVariant=debug + buildProfileArg= # the default cargo profile is 'debug' + buildProfile='debug' + shift + elif [[ $1 = --release-with-debug ]]; then + buildProfileArg='--profile release-with-debug' + buildProfile='release-with-debug' shift elif [[ $1 = --validator-only ]]; then validatorOnly=true @@ -68,7 +75,7 @@ fi installDir="$(mkdir -p "$installDir"; cd "$installDir"; pwd)" mkdir -p "$installDir/bin/deps" -echo "Install location: $installDir ($buildVariant)" +echo "Install location: $installDir ($buildProfile)" cd "$(dirname "$0")"/.. @@ -138,7 +145,7 @@ mkdir -p "$installDir/bin" ( set -x # shellcheck disable=SC2086 # Don't want to double quote $rust_version - "$cargo" $maybeRustVersion build $maybeReleaseFlag "${binArgs[@]}" + "$cargo" $maybeRustVersion build $buildProfileArg "${binArgs[@]}" # Exclude `spl-token` binary for net.sh builds if [[ -z "$validatorOnly" ]]; then @@ -152,7 +159,7 @@ mkdir -p "$installDir/bin" ) for bin in "${BINS[@]}"; do - cp -fv "target/$buildVariant/$bin" "$installDir"/bin + cp -fv "target/$buildProfile/$bin" "$installDir"/bin done if [[ -d target/perf-libs ]]; then @@ -206,7 +213,7 @@ fi set -x # deps dir can be empty shopt -s nullglob - for dep in target/"$buildVariant"/deps/libsolana*program.*; do + for dep in target/"$buildProfile"/deps/libsolana*program.*; do cp -fv "$dep" "$installDir/bin/deps" done )