-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
activate.sh
executable file
·51 lines (39 loc) · 2.19 KB
/
activate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
export CARGO_HOME=${CONDA_PREFIX}/.cargo
export CARGO_CONFIG=${CARGO_HOME}/config
export RUSTUP_HOME=${CARGO_HOME}/rustup
[[ -d ${CARGO_HOME} ]] || mkdir -p ${CARGO_HOME}
export CARGO_TARGET_@rust_arch_env_build@_LINKER=${CC_FOR_BUILD:-${CONDA_PREFIX}/bin/@rust_default_cc_build@}
export CARGO_TARGET_@rust_arch_env@_LINKER=${CC:-${CONDA_PREFIX}/bin/@rust_default_cc@}
export CARGO_BUILD_TARGET=@rust_arch@
export CONDA_RUST_HOST=@rust_arch_env_build@
export CONDA_RUST_TARGET=@rust_arch_env@
export PKG_CONFIG_PATH_@rust_arch_env_build@=${CONDA_PREFIX}/lib/pkgconfig
export PKG_CONFIG_PATH_@rust_arch_env@=${PREFIX:-${CONDA_PREFIX}}/lib/pkgconfig
export CC_@CONDA_RUST_HOST_LOWER@="${CC_FOR_BUILD:-${CONDA_PREFIX}/bin/@rust_default_cc_build@}"
if [[ "@cross_target_platform@" == linux* ]]; then
export CARGO_BUILD_RUSTFLAGS="-C link-arg=-Wl,-rpath-link,${PREFIX:-${CONDA_PREFIX}}/lib -C link-arg=-Wl,-rpath,${PREFIX:-${CONDA_PREFIX}}/lib"
elif [[ "@cross_target_platform@" == win* ]]; then
export CARGO_TARGET_@rust_arch_env@_LINKER=${CONDA_PREFIX}/bin/lld-link
# some rust crates need a linux gnu c compiler at buildtime
# thus we need to create custom cflags since the default ones are for clang
export AR_@CONDA_RUST_HOST_LOWER@="${AR}"
export AR_@CONDA_RUST_TARGET_LOWER@=$CONDA_PREFIX/bin/llvm-lib
export CFLAGS_@CONDA_RUST_HOST_LOWER@=""
export CFLAGS_@CONDA_RUST_TARGET_LOWER@="${CFLAGS}"
export CPPFLAGS_@CONDA_RUST_TARGET_LOWER@="${CPPFLAGS}"
export CPPFLAGS_@CONDA_RUST_HOST_LOWER@=""
export CXXFLAGS_@CONDA_RUST_TARGET_LOWER@="${CXXFLAGS}"
export CXXFLAGS_@CONDA_RUST_HOST_LOWER@=""
export CC_@CONDA_RUST_TARGET_LOWER@=$CONDA_PREFIX/bin/clang-cl
export CXX_@CONDA_RUST_TARGET_LOWER@=$CONDA_PREFIX/bin/clang-cl
export LDFLAGS="$LDFLAGS -manifest:no"
# Setup CMake Toolchain
export CMAKE_GENERATOR=Ninja
elif [[ "@cross_target_platform@" == osx* ]]; then
export CARGO_BUILD_RUSTFLAGS="-C link-arg=-Wl,-rpath,${PREFIX:-${CONDA_PREFIX}}/lib"
if [[ "${CONDA_BUILD:-}" != "" ]]; then
export CARGO_BUILD_RUSTFLAGS="$CARGO_BUILD_RUSTFLAGS -C link-arg=-Wl,-headerpad_max_install_names -C link-arg=-Wl,-dead_strip_dylibs"
fi
fi
export PATH=${CARGO_HOME}/bin:${PATH}