-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·45 lines (37 loc) · 1.32 KB
/
configure
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
# Even when `cargo` is on `PATH`, `rustc` might not be in some cases. This adds
# ~/.cargo/bin to PATH to address such cases. Note that is not always available
# (e.g. or on Ubuntu with Rust installed via APT).
if [ -d "${HOME}/.cargo/bin" ]; then
export PATH="${PATH}:${HOME}/.cargo/bin"
fi
CARGO_VERSION="$(cargo --version)"
if [ $? -ne 0 ]; then
echo "-------------- ERROR: CONFIGURATION FAILED --------------------"
echo ""
echo "The cargo command is not available. To install Rust, please refer"
echo "to the official instruction:"
echo ""
echo "https://www.rust-lang.org/tools/install"
echo ""
echo "---------------------------------------------------------------"
exit 1
fi
# There's a little chance that rustc is not available on PATH while cargo is.
# So, just ignore the error case.
RUSTC_VERSION="$(rustc --version || true)"
# Report the version of Rustc to comply with the CRAN policy
echo "using Rust package manager: '${CARGO_VERSION}'"
echo "using Rust compiler: '${RUSTC_VERSION}'"
if [ "$(uname)" = "Emscripten" ]; then
TARGET="wasm32-unknown-emscripten"
fi
# catch DEBUG envvar, which is passed from pkgbuild::compile_dll()
if [ "${DEBUG}" = "true" ]; then
PROFILE=dev
else
PROFILE=release
fi
sed \
-e "s/@TARGET@/${TARGET}/" \
-e "s/@PROFILE@/${PROFILE}/" \
src/Makevars.in > src/Makevars