Add solana-crate-features workaround to avoid cargo feature thrashing (#5904)

automerge
This commit is contained in:
Michael Vines
2019-09-13 23:46:21 -07:00
committed by Grimes
parent 8135279335
commit e1f4e8a84a
10 changed files with 208 additions and 40 deletions

View File

@ -16,16 +16,18 @@ if [[ -z $1 ]]; then
fi
installDir="$(mkdir -p "$1"; cd "$1"; pwd)"
cargo=cargo
cargoFeatures="$2"
debugBuild="$3"
buildProfile="$3"
if [[ -n "$buildProfile" ]]; then
binTargetDir="release"
else
binTargetDir="debug"
buildVariant=release
maybeReleaseFlag=--release
if [[ -n "$debugBuild" ]]; then
maybeReleaseFlag=
buildVariant=debug
fi
echo "Install location: $installDir"
echo "Install location: $installDir ($buildVariant)"
cd "$(dirname "$0")"/..
@ -34,36 +36,45 @@ SECONDS=0
(
set -x
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
cargo $rust_version build --all $buildProfile --features="$cargoFeatures"
$cargo $rust_version build --all $maybeReleaseFlag --features="$cargoFeatures"
)
BIN_CRATES=(
drone
gossip
install
keygen
ledger-tool
replicator
validator
cli
bench-exchange
bench-tps
BINS=(
solana-drone
solana-gossip
solana-install
solana-install-init
solana-keygen
solana-ledger-tool
solana-replicator
solana-validator
solana
solana-bench-exchange
solana-bench-tps
)
#XXX: Ensure `solana-genesis` is built LAST!
# See https://github.com/solana-labs/solana/issues/5826
BIN_CRATES+=( "genesis" )
BINS+=(solana-genesis)
for crate in "${BIN_CRATES[@]}"; do
(
set -x
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
cargo $rust_version install --force --path "$crate" --root "$installDir" --features="$cargoFeatures"
)
binArgs=()
for bin in "${BINS[@]}"; do
binArgs+=(--bin "$bin")
done
(
set -x
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
$cargo $rust_version build $maybeReleaseFlag "${binArgs[@]}" --features="$cargoFeatures"
)
mkdir -p "$installDir/bin"
for bin in "${BINS[@]}"; do
cp -fv "target/$buildVariant/$bin" "$installDir"/bin
done
for dir in programs/*; do
for program in echo target/$binTargetDir/deps/libsolana_"$(basename "$dir")".{so,dylib,dll}; do
for program in echo target/$buildVariant/deps/libsolana_"$(basename "$dir")".{so,dylib,dll}; do
if [[ -f $program ]]; then
mkdir -p "$installDir/bin/deps"
rm -f "$installDir/bin/deps/$(basename "$program")"
@ -72,5 +83,4 @@ for dir in programs/*; do
done
done
du -a "$installDir"
echo "Done after $SECONDS seconds"