2018-12-11 22:50:42 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# |cargo install| of the top-level crate will not install binaries for
|
2018-12-19 10:30:24 -08:00
|
|
|
# other workspace crates or native program crates.
|
2018-12-11 22:50:42 -08:00
|
|
|
set -e
|
2018-12-19 10:30:24 -08:00
|
|
|
|
2019-03-14 19:41:05 -07:00
|
|
|
export rust_version=
|
|
|
|
if [[ $1 =~ \+ ]]; then
|
|
|
|
export rust_version=$1
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
2018-12-19 10:30:24 -08:00
|
|
|
if [[ -z $1 ]]; then
|
|
|
|
echo Install directory not specified
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-03-14 19:41:05 -07:00
|
|
|
|
2018-12-19 10:30:24 -08:00
|
|
|
installDir="$(mkdir -p "$1"; cd "$1"; pwd)"
|
2019-09-13 23:46:21 -07:00
|
|
|
cargo=cargo
|
2019-09-26 13:36:51 -07:00
|
|
|
debugBuild="$2"
|
2019-09-19 20:50:34 -07:00
|
|
|
|
2019-09-13 23:46:21 -07:00
|
|
|
buildVariant=release
|
|
|
|
maybeReleaseFlag=--release
|
|
|
|
if [[ -n "$debugBuild" ]]; then
|
|
|
|
maybeReleaseFlag=
|
|
|
|
buildVariant=debug
|
2019-08-23 19:31:18 -06:00
|
|
|
fi
|
|
|
|
|
2019-09-13 23:46:21 -07:00
|
|
|
echo "Install location: $installDir ($buildVariant)"
|
2018-12-19 10:30:24 -08:00
|
|
|
|
|
|
|
cd "$(dirname "$0")"/..
|
2019-09-26 13:36:51 -07:00
|
|
|
./fetch-perf-libs.sh
|
2018-12-11 22:50:42 -08:00
|
|
|
|
2018-12-13 21:11:09 -08:00
|
|
|
SECONDS=0
|
|
|
|
|
2018-12-19 10:30:24 -08:00
|
|
|
(
|
|
|
|
set -x
|
2019-05-18 14:48:53 -07:00
|
|
|
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
|
2019-09-19 23:30:08 -07:00
|
|
|
$cargo $rust_version build $maybeReleaseFlag
|
2019-10-29 17:14:07 -07:00
|
|
|
|
|
|
|
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
|
|
|
|
$cargo $rust_version build $maybeReleaseFlag --manifest-path programs/move_loader_program/Cargo.toml
|
2018-12-19 10:30:24 -08:00
|
|
|
)
|
|
|
|
|
2019-09-13 23:46:21 -07:00
|
|
|
BINS=(
|
2019-09-19 20:50:34 -07:00
|
|
|
solana
|
|
|
|
solana-bench-exchange
|
|
|
|
solana-bench-tps
|
2019-09-13 23:46:21 -07:00
|
|
|
solana-drone
|
|
|
|
solana-gossip
|
|
|
|
solana-install
|
|
|
|
solana-install-init
|
|
|
|
solana-keygen
|
|
|
|
solana-ledger-tool
|
2019-10-21 11:29:37 -06:00
|
|
|
solana-archiver
|
2019-09-13 23:46:21 -07:00
|
|
|
solana-validator
|
2018-12-13 21:11:09 -08:00
|
|
|
)
|
2018-12-19 10:30:24 -08:00
|
|
|
|
2019-09-06 21:00:24 -06:00
|
|
|
#XXX: Ensure `solana-genesis` is built LAST!
|
|
|
|
# See https://github.com/solana-labs/solana/issues/5826
|
2019-09-13 23:46:21 -07:00
|
|
|
BINS+=(solana-genesis)
|
2019-09-06 21:00:24 -06:00
|
|
|
|
2019-09-13 23:46:21 -07:00
|
|
|
binArgs=()
|
|
|
|
for bin in "${BINS[@]}"; do
|
|
|
|
binArgs+=(--bin "$bin")
|
|
|
|
done
|
|
|
|
|
|
|
|
(
|
|
|
|
set -x
|
|
|
|
# shellcheck disable=SC2086 # Don't want to double quote $rust_version
|
2019-09-19 20:50:34 -07:00
|
|
|
$cargo $rust_version build $maybeReleaseFlag "${binArgs[@]}"
|
2019-09-13 23:46:21 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
mkdir -p "$installDir/bin"
|
|
|
|
for bin in "${BINS[@]}"; do
|
|
|
|
cp -fv "target/$buildVariant/$bin" "$installDir"/bin
|
2018-12-13 21:11:09 -08:00
|
|
|
done
|
|
|
|
|
2019-09-26 13:36:51 -07:00
|
|
|
if [[ -d target/perf-libs ]]; then
|
|
|
|
cp -a target/perf-libs "$installDir"/bin/perf-libs
|
2019-09-19 20:50:34 -07:00
|
|
|
fi
|
|
|
|
|
2019-04-17 15:05:49 -06:00
|
|
|
for dir in programs/*; do
|
2019-09-13 23:46:21 -07:00
|
|
|
for program in echo target/$buildVariant/deps/libsolana_"$(basename "$dir")".{so,dylib,dll}; do
|
2018-12-19 10:30:24 -08:00
|
|
|
if [[ -f $program ]]; then
|
|
|
|
mkdir -p "$installDir/bin/deps"
|
|
|
|
rm -f "$installDir/bin/deps/$(basename "$program")"
|
|
|
|
cp -v "$program" "$installDir"/bin/deps
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2018-12-13 21:11:09 -08:00
|
|
|
echo "Done after $SECONDS seconds"
|