Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 7089f1e

Browse files
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 87b4dc6) Co-authored-by: Will Hickey <[email protected]>
1 parent 956eacb commit 7089f1e

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

scripts/cargo-install-all.sh

+16-9
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,29 @@ usage() {
2828
echo "Error: $*"
2929
fi
3030
cat <<EOF
31-
usage: $0 [+<cargo version>] [--debug] [--validator-only] <install directory>
31+
usage: $0 [+<cargo version>] [--debug] [--validator-only] [--release-with-debug] <install directory>
3232
EOF
3333
exit $exitcode
3434
}
3535

3636
maybeRustVersion=
3737
installDir=
38-
buildVariant=release
39-
maybeReleaseFlag=--release
38+
# buildProfileArg and buildProfile duplicate some information because cargo
39+
# doesn't allow '--profile debug' but we still need to know that the binaries
40+
# will be in target/debug
41+
buildProfileArg='--profile release'
42+
buildProfile='release'
4043
validatorOnly=
4144

4245
while [[ -n $1 ]]; do
4346
if [[ ${1:0:1} = - ]]; then
4447
if [[ $1 = --debug ]]; then
45-
maybeReleaseFlag=
46-
buildVariant=debug
48+
buildProfileArg= # the default cargo profile is 'debug'
49+
buildProfile='debug'
50+
shift
51+
elif [[ $1 = --release-with-debug ]]; then
52+
buildProfileArg='--profile release-with-debug'
53+
buildProfile='release-with-debug'
4754
shift
4855
elif [[ $1 = --validator-only ]]; then
4956
validatorOnly=true
@@ -68,7 +75,7 @@ fi
6875
installDir="$(mkdir -p "$installDir"; cd "$installDir"; pwd)"
6976
mkdir -p "$installDir/bin/deps"
7077

71-
echo "Install location: $installDir ($buildVariant)"
78+
echo "Install location: $installDir ($buildProfile)"
7279

7380
cd "$(dirname "$0")"/..
7481

@@ -138,7 +145,7 @@ mkdir -p "$installDir/bin"
138145
(
139146
set -x
140147
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
141-
"$cargo" $maybeRustVersion build $maybeReleaseFlag "${binArgs[@]}"
148+
"$cargo" $maybeRustVersion build $buildProfileArg "${binArgs[@]}"
142149

143150
# Exclude `spl-token` binary for net.sh builds
144151
if [[ -z "$validatorOnly" ]]; then
@@ -152,7 +159,7 @@ mkdir -p "$installDir/bin"
152159
)
153160

154161
for bin in "${BINS[@]}"; do
155-
cp -fv "target/$buildVariant/$bin" "$installDir"/bin
162+
cp -fv "target/$buildProfile/$bin" "$installDir"/bin
156163
done
157164

158165
if [[ -d target/perf-libs ]]; then
@@ -206,7 +213,7 @@ fi
206213
set -x
207214
# deps dir can be empty
208215
shopt -s nullglob
209-
for dep in target/"$buildVariant"/deps/libsolana*program.*; do
216+
for dep in target/"$buildProfile"/deps/libsolana*program.*; do
210217
cp -fv "$dep" "$installDir/bin/deps"
211218
done
212219
)

0 commit comments

Comments
 (0)