Build/install native programs within cargo-install-all.sh

This commit is contained in:
Michael Vines
2018-12-19 10:30:24 -08:00
committed by Grimes
parent 6e56e41461
commit c3c955b02e
6 changed files with 37 additions and 44 deletions

View File

@ -1,13 +1,27 @@
#!/usr/bin/env bash
#
# |cargo install| of the top-level crate will not install binaries for
# other workspace creates.
# other workspace crates or native program crates.
set -e
cd "$(dirname "$0")/.."
if [[ -z $1 ]]; then
echo Install directory not specified
exit 1
fi
installDir="$(mkdir -p "$1"; cd "$1"; pwd)"
cargoFeatures="$2"
echo "Install location: $installDir"
cd "$(dirname "$0")"/..
SECONDS=0
CRATES=(
(
set -x
cargo build --all --release --features="$cargoFeatures"
)
BIN_CRATES=(
drone
keygen
fullnode
@ -18,11 +32,23 @@ CRATES=(
ledger-tool
wallet
)
for crate in "${CRATES[@]}"; do
for crate in "${BIN_CRATES[@]}"; do
(
set -x
cargo install --path "$crate" "$@"
cargo install --force --path "$crate" --root "$installDir" --features="$cargoFeatures"
)
done
for dir in programs/native/*; do
for program in echo target/release/deps/lib{,solana_}"$(basename "$dir")"{,_program}.{so,dylib,dll}; do
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
du -a "$installDir"
echo "Done after $SECONDS seconds"

View File

@ -1,27 +0,0 @@
#!/usr/bin/env bash
#
# Installs native programs as |cargo install| doesn't know about them
#
set -e
here=$(dirname "$0")
SOLANA_ROOT="$(cd "$here"/..; pwd)"
installDir=$1
variant=${2:-release}
if [[ -z $installDir ]]; then
echo Install directory not specified
exit 1
fi
for dir in "$SOLANA_ROOT"/programs/native/*; do
for program in echo "$SOLANA_ROOT"/target/"$variant"/deps/lib{,solana_}"$(basename "$dir")"{,_program}.{so,dylib,dll}; do
if [[ -f $program ]]; then
mkdir -p "$installDir"
rm -f "$installDir/$(basename "$program")"
cp -v "$program" "$installDir"
fi
done
done