-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-tools.sh
executable file
·115 lines (95 loc) · 4.97 KB
/
install-tools.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/env bash
if [ -z "$RUSTUP_TOOLCHAIN" ]; then
export RUSTUP_TOOLCHAIN="stable" # "stable" or "nightly"
fi
if [ -z "$RUSTUP_PROFILE" ]; then
export RUSTUP_PROFILE="release" # "debug" or "release"
fi
if [ -z "$REINSTALL_TOOLS" ]; then
export REINSTALL_TOOLS="false" # "true" or "false"
fi
if [ -z "$BUILD_PLATFORM" ]; then
export BUILD_PLATFORM="x86_64" # "x86_64" or "i686" or "armhf" or "aarch64"
fi
# Build Time Autovars
SCRIPT=`realpath "$0"`
SCRIPT_DIR=`dirname "$SCRIPT"`
PROJECT_ROOT=$SCRIPT_DIR
# Install Vars
WASM_BINDGEN_VERSION=`cat $PROJECT_ROOT/Cargo.toml | grep '^wasm-bindgen' | head -n1 | cut -d'"' -f2 | tr -d '\n'`
echo "Project Root: $PROJECT_ROOT"
echo "Toolchain: $RUSTUP_TOOLCHAIN - Build Profile: $RUSTUP_PROFILE"
echo "This will install tools as if it's continuous integration..."
echo "This, however, will not install things from your package manager like python's \`pip\`..."
if [[ "$(read -e -p 'Continue? [y/N]> '; echo $REPLY)" == [Yy]* ]]; then
cd $PROJECT_ROOT
FORCE_FLAG=""
if [ $REINSTALL_TOOLS == "true" ]; then
FORCE_FLAG="--force"
fi
echo "Install Rust..."
mkdir -p $PROJECT_ROOT/.tools
curl --proto '=https' --tlsv1.2 --silent --show-error --fail --location https://sh.rustup.rs > $PROJECT_ROOT/.tools/rust.sh
chmod +x $PROJECT_ROOT/.tools/rust.sh
$PROJECT_ROOT/.tools/rust.sh -y
source "$HOME/.cargo/env"
echo "Install Rust Targets..."
rustup target add --toolchain $RUSTUP_TOOLCHAIN x86_64-unknown-linux-gnu
rustup target add --toolchain $RUSTUP_TOOLCHAIN x86_64-pc-windows-gnu
rustup target add --toolchain $RUSTUP_TOOLCHAIN wasm32-unknown-unknown
rustup target add --toolchain $RUSTUP_TOOLCHAIN x86_64-unknown-linux-musl
rustup target add --toolchain $RUSTUP_TOOLCHAIN armv7-linux-androideabi
rustup target add --toolchain $RUSTUP_TOOLCHAIN aarch64-linux-android
rustup target add --toolchain $RUSTUP_TOOLCHAIN i686-linux-android
rustup target add --toolchain $RUSTUP_TOOLCHAIN x86_64-linux-android
echo "Attempt Install Specified Rust Targets..."
rustup target add --toolchain $RUSTUP_TOOLCHAIN $BUILD_PLATFORM-unknown-linux-gnu
rustup target add --toolchain $RUSTUP_TOOLCHAIN $BUILD_PLATFORM-pc-windows-gnu
rustup target add --toolchain $RUSTUP_TOOLCHAIN $BUILD_PLATFORM-unknown-linux-musl
echo "Install Wasm-Bindgen Tools..."
if [ $RUSTUP_PROFILE == "release" ]; then
cargo +$RUSTUP_TOOLCHAIN install wasm-bindgen-cli --version $WASM_BINDGEN_VERSION $FORCE_FLAG
else
cargo +$RUSTUP_TOOLCHAIN install wasm-bindgen-cli --version $WASM_BINDGEN_VERSION --debug $FORCE_FLAG
fi
echo "Install Wasm Optimization Tools..."
if [ $RUSTUP_PROFILE == "release" ]; then
cargo +$RUSTUP_TOOLCHAIN install wasm-opt $FORCE_FLAG
else
cargo +$RUSTUP_TOOLCHAIN install wasm-opt --debug $FORCE_FLAG
fi
echo "Install Wasm Source Mapping Tools..."
if [ $RUSTUP_PROFILE == "release" ]; then
cargo +$RUSTUP_TOOLCHAIN install cargo-wasm2map $FORCE_FLAG
else
cargo +$RUSTUP_TOOLCHAIN install cargo-wasm2map --debug $FORCE_FLAG
fi
echo "Install Customized AppImage Tool..."
curl --proto '=https' --tlsv1.2 --silent --show-error --fail --location https://github.com/foxgirl-labs/appimagetool/releases/download/continuous/appimagetool-$BUILD_PLATFORM.AppImage > $PROJECT_ROOT/.tools/appimagetool
chmod +x $PROJECT_ROOT/.tools/appimagetool
echo "Install Customized Cargo AppImage Tool..."
if [ $RUSTUP_PROFILE == "release" ]; then
cargo +$RUSTUP_TOOLCHAIN install --git https://github.com/foxgirl-labs/cargo-appimage $FORCE_FLAG
else
cargo +$RUSTUP_TOOLCHAIN install --git https://github.com/foxgirl-labs/cargo-appimage --debug $FORCE_FLAG
fi
echo "Install AppImage Runtime..."
if [ $RUSTUP_PROFILE == "release" ]; then
curl --proto '=https' --tlsv1.2 --silent --show-error --fail --location https://github.com/AppImage/type2-runtime/releases/download/continuous/runtime-$BUILD_PLATFORM > $PROJECT_ROOT/.tools/runtime-$BUILD_PLATFORM
else
curl --proto '=https' --tlsv1.2 --silent --show-error --fail --location https://github.com/AppImage/type2-runtime/releases/download/continuous/runtime-$BUILD_PLATFORM.debug > $PROJECT_ROOT/.tools/runtime-$BUILD_PLATFORM
fi
chmod +x $PROJECT_ROOT/.tools/runtime-$BUILD_PLATFORM
echo "Install Cargo NDK Tools..."
if [ $RUSTUP_PROFILE == "release" ]; then
cargo +$RUSTUP_TOOLCHAIN install cargo-ndk $FORCE_FLAG
else
cargo +$RUSTUP_TOOLCHAIN install cargo-ndk --debug $FORCE_FLAG
fi
# echo "Install Pre-Commit Checks..."
# pip install pre-commit
# pre-commit install
echo "Install Itch.io Butler"
curl --proto '=https' --tlsv1.2 --silent --show-error --fail --location https://broth.itch.zone/butler/linux-amd64/LATEST/archive/default > $PROJECT_ROOT/.tools/butler-linux-amd64.zip
unzip -o $PROJECT_ROOT/.tools/butler-linux-amd64.zip -d $PROJECT_ROOT/.tools/butler
fi