pyo3/ci/travis/setup.sh

44 lines
1.2 KiB
Bash
Raw Normal View History

#!/bin/sh
2018-05-23 14:38:44 +00:00
set -e
2018-05-05 12:19:50 +00:00
# Find the installed version of a binary, if any
_installed() {
VERSION=$($@ --version 2>/dev/null || echo "$@ none")
echo $VERSION | rev | cut -d' ' -f1 | rev
}
# Find the latest available version of a binary on `crates.io`
_latest() {
VERSION=$(cargo search -q "$@" | grep "$@" | cut -f2 -d"\"")
echo $VERSION
}
### Setup Rust toolchain #######################################################
2018-08-04 17:14:41 +00:00
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=$TRAVIS_RUST_VERSION
export PATH=$PATH:$HOME/.cargo/bin
### Setup kcov #################################################################
if [ ! -f "$HOME/.cargo/bin/kcov" ]; then
if [ ! -d "$HOME/kcov/.git" ]; then
git clone --depth=1 https://github.com/SimonKagstrom/kcov "$HOME/kcov"
fi
cd $HOME/kcov
git pull
cmake .
make
install src/kcov $HOME/.cargo/bin/kcov
cd $TRAVIS_BUILD_DIR
fi
2018-07-08 21:37:44 +00:00
### Setup python linker flags ##################################################
2018-08-04 17:14:41 +00:00
PYTHON_LIB=$(python -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR'))")
2018-07-08 21:37:44 +00:00
2018-08-04 17:55:15 +00:00
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PYTHON_LIB:$HOME/rust/lib"
2018-07-08 21:37:44 +00:00
2018-08-04 17:14:41 +00:00
echo ${LD_LIBRARY_PATH}