-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathconfigure
executable file
·38 lines (33 loc) · 879 Bytes
/
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
#!/usr/bin/env bash
# buildapi-variable-no-builddir
set -eu
PREFIX=/usr
while test $# -gt 0; do
case "$1" in
--prefix*)
PREFIX=`echo $1 | sed -e 's/^[^=]*=//g'`
echo "using prefix $PREFIX"
shift
;;
esac
done
failed=false
build_dist_args=''
if command -v rustup >/dev/null 2>&1; then
if [[ $(rustup toolchain list | grep -c stable) -eq 0 ]]; then
rustup install stable
else
rustup update stable
fi
elif command -v cargo >/dev/null 2>&1; then
echo 'will use default cargo, as rustup not available'
build_dist_args="--cargo-cmd=cargo $build_dist_args"
else
echo >&2 "'rustup' required for build"
failed=true
fi
if $failed; then exit 1; fi
sed "s|PREFIX = /usr|PREFIX = $PREFIX|" makefile.template > makefile
if [ -n "$build_dist_args" ]; then
sed -i "s|build_dist_args?=|build_dist_args?='$build_dist_args'|" makefile
fi