Skip to content

Instantly share code, notes, and snippets.

@wx257osn2
Last active September 10, 2022 21:23
Show Gist options
  • Save wx257osn2/0de9c8f2ef5c609d600a0adf5c4fcdfc to your computer and use it in GitHub Desktop.
Save wx257osn2/0de9c8f2ef5c609d600a0adf5c4fcdfc to your computer and use it in GitHub Desktop.
#!/bin/bash
# Prerequisites:
# git
# curl
# unzip
# make
# g++ (11 or newer)
# clang++ (7 or newer)
# bzip2
# zlib
# libssl
# libgmp
# If you use Ubuntu 22.04, you can install them like:
# sudo apt install git curl unzip make g++ clang bzip2 zlib1g-dev libssl-dev libgmp-dev ca-certificates --no-install-recommends
set -u
commit_hash=${COMMIT_HASH:-9fed7ba0c2d833d63bf50d3a6cdaecd67ef5cff6}
[ ! -e langs-bench-dijkstra ]; first_time=$?
set -e
export HOME=${PWD}/langs-bench-dijkstra
if [ $first_time -eq 0 ]; then
git clone https://github.com/reki2000/langs-bench-dijkstra --recursive
cd langs-bench-dijkstra
mkdir .asdf
pushd .asdf
git init
git remote add origin https://github.com/asdf-vm/asdf
git fetch --depth 1 origin v0.10.2
git reset --hard FETCH_HEAD
popd
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | \
GHCUP_USE_XDG_DIRS=1 XDG_DATA_HOME="${PWD}/.ghcup_local/share" XDG_CACHE_HOME="${PWD}/.ghcup_cache" \
XDG_BIN_HOME="${PWD}/.ghcup_local/bin" XDG_CONFIG_HOME="${PWD}/.ghcup_config" \
BOOTSTRAP_HASKELL_GHC_VERSION=9.2.4 BOOTSTRAP_HASKELL_CABAL_VERSION=3.8.1.0 BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh
curl -L https://ndownloader.figshare.com/files/3663336 > /tmp/tokyo.zip
unzip /tmp/tokyo.zip -d data
rm /tmp/tokyo.zip
else
cd langs-bench-dijkstra
fi
git fetch
git checkout ${commit_hash}
git submodule update --recursive
export ASDF_DIR="${PWD}/.asdf"
export ASDF_DATA_DIR=$ASDF_DIR
ASDF_BIN="${ASDF_DIR}/bin"
ASDF_USER_SHIMS="${ASDF_DATA_DIR}/shims"
PATH="${ASDF_BIN}:${ASDF_USER_SHIMS}:${PATH}"
set +e
. "${ASDF_DIR}/lib/asdf.sh"
while read lang plugin dummy; do
asdf plugin add $plugin
(cd $lang; asdf install)
done <<EOT
go golang
python python
cython python
pypy python
kotlin java
kotlin kotlin
rust rust
julia julia
javascript nodejs
dart dart
EOT
asdf reshim
set -e
export GHCUP_USE_XDG_DIRS=1
export XDG_DATA_HOME="${PWD}/.ghcup_local/share"
export XDG_CACHE_HOME="${PWD}/.ghcup_cache"
export XDG_BIN_HOME="${PWD}/.ghcup_local/bin"
export XDG_CONFIG_HOME="${PWD}/.ghcup_config"
PATH="${XDG_BIN_HOME}:${PATH}"
ghcup upgrade
ghcup install ghc 9.2.4 --set
ghcup install cabal 3.8.1.0 --set
cat python/.tool-versions >> .tool-versions
cat rust/.tool-versions >> .tool-versions
pip install numpy matplotlib
cargo install hyperfine
rust_version=($(cat rust/.tool-versions))
export PATH="${ASDF_DATA_DIR}/installs/${rust_version[0]}/${rust_version[1]}/bin:$PATH"
rustup default stable
./run.sh $@
rm -f .tool-versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment