appdwarf/apps/mkrust

23 lines
527 B
Bash
Executable file

#!/bin/bash
PATH=$(dirname $(readlink -f "${0}"))/..:$PATH
DIR=/tmp/dwarf-portable-executable
mkdir -p $DIR
LINK=https://static.rust-lang.org/dist/rust-nightly-x86_64-unknown-linux-gnu.tar.gz
curl -L $LINK | tar xz -C$DIR
mkdir $DIR/rust
cp -r $DIR/rust*/{cargo,rustc,rust-std*}/* $DIR/rust
cat > $DIR/rust/AppRun << 'EOF'
#!/bin/sh
HERE=$(dirname $(readlink -f "${0}"))
export PATH="${HERE}/bin":$PATH
"${HERE}"/bin/$APPDWARF_CMD $@
EOF
chmod +x $DIR/rust/AppRun
appdwarf $DIR/rust
mv $DIR/rust.sh cargo
rm -rf $DIR/rust*