not quite banishing build.rs, but better
This commit is contained in:
13
build.rs
13
build.rs
@ -1,15 +1,22 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("cargo:rustc-link-search=native=.");
|
println!("cargo:rerun-if-changed=target/perf-libs");
|
||||||
if !env::var("CARGO_FEATURE_CUDA").is_err() {
|
|
||||||
|
let cuda = !env::var("CARGO_FEATURE_CUDA").is_err();
|
||||||
|
let erasure = !env::var("CARGO_FEATURE_ERASURE").is_err();
|
||||||
|
|
||||||
|
if cuda || erasure {
|
||||||
|
println!("cargo:rustc-link-search=native=target/perf-libs");
|
||||||
|
}
|
||||||
|
if cuda {
|
||||||
println!("cargo:rustc-link-lib=static=cuda_verify_ed25519");
|
println!("cargo:rustc-link-lib=static=cuda_verify_ed25519");
|
||||||
println!("cargo:rustc-link-search=native=/usr/local/cuda/lib64");
|
println!("cargo:rustc-link-search=native=/usr/local/cuda/lib64");
|
||||||
println!("cargo:rustc-link-lib=dylib=cudart");
|
println!("cargo:rustc-link-lib=dylib=cudart");
|
||||||
println!("cargo:rustc-link-lib=dylib=cuda");
|
println!("cargo:rustc-link-lib=dylib=cuda");
|
||||||
println!("cargo:rustc-link-lib=dylib=cudadevrt");
|
println!("cargo:rustc-link-lib=dylib=cudadevrt");
|
||||||
}
|
}
|
||||||
if !env::var("CARGO_FEATURE_ERASURE").is_err() {
|
if erasure {
|
||||||
println!("cargo:rustc-link-lib=dylib=Jerasure");
|
println!("cargo:rustc-link-lib=dylib=Jerasure");
|
||||||
println!("cargo:rustc-link-lib=dylib=gf_complete");
|
println!("cargo:rustc-link-lib=dylib=gf_complete");
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ fi
|
|||||||
export RUST_BACKTRACE=1
|
export RUST_BACKTRACE=1
|
||||||
|
|
||||||
./fetch-perf-libs.sh
|
./fetch-perf-libs.sh
|
||||||
export LD_LIBRARY_PATH+=:$PWD
|
export LD_LIBRARY_PATH=$PWD/target/perf-libs:$LD_LIBRARY_PATH
|
||||||
|
|
||||||
export RUST_LOG=multinode=info
|
export RUST_LOG=multinode=info
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ fi
|
|||||||
export RUST_BACKTRACE=1
|
export RUST_BACKTRACE=1
|
||||||
|
|
||||||
./fetch-perf-libs.sh
|
./fetch-perf-libs.sh
|
||||||
export LD_LIBRARY_PATH=$PWD:/usr/local/cuda/lib64
|
export LD_LIBRARY_PATH=$PWD/target/perf-libs:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
|
||||||
export PATH=$PATH:/usr/local/cuda/bin
|
export PATH=$PATH:/usr/local/cuda/bin
|
||||||
|
|
||||||
_() {
|
_() {
|
||||||
|
@ -10,14 +10,15 @@ if [[ $(uname -m) != x86_64 ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mkdir -p target/perf-libs
|
||||||
(
|
(
|
||||||
|
cd target/perf-libs
|
||||||
|
(
|
||||||
set -x
|
set -x
|
||||||
curl -o solana-perf.tgz \
|
curl https://solana-perf.s3.amazonaws.com/master/x86_64-unknown-linux-gnu/solana-perf.tgz | tar zxvf -
|
||||||
https://solana-perf.s3.amazonaws.com/master/x86_64-unknown-linux-gnu/solana-perf.tgz
|
)
|
||||||
tar zxvf solana-perf.tgz
|
|
||||||
)
|
|
||||||
|
|
||||||
if [[ -r /usr/local/cuda/version.txt && -r cuda-version.txt ]]; then
|
if [[ -r /usr/local/cuda/version.txt && -r cuda-version.txt ]]; then
|
||||||
if ! diff /usr/local/cuda/version.txt cuda-version.txt > /dev/null; then
|
if ! diff /usr/local/cuda/version.txt cuda-version.txt > /dev/null; then
|
||||||
echo ==============================================
|
echo ==============================================
|
||||||
echo Warning: possible CUDA version mismatch
|
echo Warning: possible CUDA version mismatch
|
||||||
@ -26,12 +27,13 @@ if [[ -r /usr/local/cuda/version.txt && -r cuda-version.txt ]]; then
|
|||||||
echo "Detected version: $(cat /usr/local/cuda/version.txt)"
|
echo "Detected version: $(cat /usr/local/cuda/version.txt)"
|
||||||
echo ==============================================
|
echo ==============================================
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo ==============================================
|
echo ==============================================
|
||||||
echo Warning: unable to validate CUDA version
|
echo Warning: unable to validate CUDA version
|
||||||
echo ==============================================
|
echo ==============================================
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Downloaded solana-perf version: $(cat solana-perf-HEAD.txt)"
|
echo "Downloaded solana-perf version: $(cat solana-perf-HEAD.txt)"
|
||||||
|
)
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -80,7 +80,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Locate perf libs downloaded by |./fetch-perf-libs.sh|
|
# Locate perf libs downloaded by |./fetch-perf-libs.sh|
|
||||||
LD_LIBRARY_PATH=$(cd "$here" && dirname "$PWD"):$LD_LIBRARY_PATH
|
LD_LIBRARY_PATH=$(cd "$here" && dirname "$PWD"/target/perf-libs):$LD_LIBRARY_PATH
|
||||||
export LD_LIBRARY_PATH
|
export LD_LIBRARY_PATH
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -108,8 +108,8 @@ parts:
|
|||||||
rm -rf $SNAPCRAFT_PART_INSTALL/bin/*
|
rm -rf $SNAPCRAFT_PART_INSTALL/bin/*
|
||||||
mv $SNAPCRAFT_PART_INSTALL/solana-fullnode $SNAPCRAFT_PART_INSTALL/bin/solana-fullnode-cuda
|
mv $SNAPCRAFT_PART_INSTALL/solana-fullnode $SNAPCRAFT_PART_INSTALL/bin/solana-fullnode-cuda
|
||||||
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/lib/
|
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/lib/
|
||||||
cp -f libJerasure.so $SNAPCRAFT_PART_INSTALL/usr/lib/libJerasure.so.2
|
cp -f target/perf-libs/libJerasure.so $SNAPCRAFT_PART_INSTALL/usr/lib/libJerasure.so.2
|
||||||
cp -f libgf_complete.so $SNAPCRAFT_PART_INSTALL/usr/lib/libgf_complete.so.1
|
cp -f target/perf-libs/libgf_complete.so $SNAPCRAFT_PART_INSTALL/usr/lib/libgf_complete.so.1
|
||||||
|
|
||||||
# Build/install all other programs
|
# Build/install all other programs
|
||||||
cargo install --root $SNAPCRAFT_PART_INSTALL --bins
|
cargo install --root $SNAPCRAFT_PART_INSTALL --bins
|
||||||
|
Reference in New Issue
Block a user