Skip to content

Instantly share code, notes, and snippets.

@numberoverzero
Created February 11, 2019 05:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save numberoverzero/1200cdfc457b04a0f607bccdd16018b8 to your computer and use it in GitHub Desktop.
Save numberoverzero/1200cdfc457b04a0f607bccdd16018b8 to your computer and use it in GitHub Desktop.
compile stockfish from github on RHEL into /opt/stockfish
#!/usr/bin/env bash
# assumes bmi2 arch: "x86 64-bit with pext support"
# compiled binary ends in /opt/stockfish/$MAJOR_VERSION/bin/stockfish
set -e
set -x
sudo yum update -y
sudo yum install -y git gcc gcc-c++
SF_GH="https://github.com/official-stockfish/Stockfish.git"
SF_DIR="/opt/stockfish"
TMP=$(mktemp -d)
pushd "$TMP"
git clone "$SF_GH" .
pushd src
make clean
make build ARCH=x86-64-bmi2 COMP=gcc
chmod +x stockfish
STOCKFISH_MV=$(echo "uci" | ./stockfish | head -n 1 | cut -d' ' -f2 | cut -c1-2)
STOCKFISH_BIN="$SF_DIR/$STOCKFISH_MV/bin"
sudo mkdir -p "$STOCKFISH_BIN"
sudo chown -R $USER:$USER "$STOCKFISH_BIN"
cp stockfish "$STOCKFISH_BIN"
popd
rm -rf "$TMP"
set +x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment