2019-02-18 10:43:36 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# This script will install all cargo workspace libraries found in
|
|
|
|
# `programDir` as native programs.
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Directory to install libraries into
|
|
|
|
installDir="$(mkdir -p "$1"; cd "$1"; pwd)"
|
|
|
|
|
|
|
|
# Where to find custom programs
|
|
|
|
programDir="$2"
|
|
|
|
|
|
|
|
(
|
|
|
|
set -x
|
|
|
|
cd "$programDir"
|
2019-09-19 20:50:34 -07:00
|
|
|
cargo build --release
|
2019-02-18 10:43:36 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
for dir in "$programDir"/*; do
|
|
|
|
for program in $programDir/target/release/deps/lib"$(basename "$dir")".{so,dylib,dll}; do
|
|
|
|
if [[ -f $program ]]; then
|
|
|
|
(
|
|
|
|
set -x
|
|
|
|
mkdir -p "$installDir/bin/deps"
|
|
|
|
rm -f "$installDir/bin/deps/$(basename "$program")"
|
|
|
|
cp -v "$program" "$installDir"/bin/deps
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|