Skip to content

Commit 34e8283

Browse files
committed
feat(stacks): add rusts
1 parent 5583ef1 commit 34e8283

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_dist

stacks/rust/build.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# Load stack utils
4+
. /usr/bin/stack-utils
5+
6+
# Implement build function
7+
function build() {
8+
generate-stack-path
9+
case "$OS_ARCH" in
10+
'amd64')
11+
downloadUrl="https://static.rust-lang.org/dist/rust-${STACK_VERSION}-x86_64-unknown-linux-gnu.tar.gz";
12+
;;
13+
'arm64')
14+
downloadUrl="https://static.rust-lang.org/dist/rust-${STACK_VERSION}-aarch64-unknown-linux-gnu.tar.gz";
15+
;;
16+
*) echo >&2 "error: unsupported architecture: '$arch'"; exit 1 ;;
17+
esac;
18+
curl -fsSL -o rust.tar.gz "${downloadUrl}"
19+
tar -xvzf rust.tar.gz
20+
cd rust-${STACK_VERSION}-*-unknown-linux-gnu
21+
./install.sh --prefix=/opt/drycc/rust
22+
rm -rf /opt/drycc/rust/share /opt/drycc/rust/bin/rustdoc
23+
cp -rf /opt/drycc/rust/* "${DATA_DIR}"
24+
mkdir -p "${DATA_DIR}"/target "${DATA_DIR}"/env
25+
echo "/opt/drycc/rust/target" > "${DATA_DIR}"/env/CARGO_TARGET_DIR
26+
cd ..
27+
28+
rm -rf rust-${STACK_VERSION}-*-unknown-linux-gnu rust.tar.gz
29+
}
30+
31+
# call build stack
32+
build-stack "${1}"

0 commit comments

Comments
 (0)