Last active
January 23, 2018 10:23
-
-
Save ffflorian/97281d696da9426ba21feac2d218f43c to your computer and use it in GitHub Desktop.
Build coax on Debian
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Build script for https://github.com/wireapp/coax | |
set -e | |
RUSTUP_SCRIPT_REMOTE="https://sh.rustup.rs" | |
RUSTUP_SCRIPT_LOCAL="install_rust.sh" | |
COAX_REPO="https://github.com/wireapp/coax.git" | |
_command_exist() { | |
command -v "${1}" > /dev/null | |
} | |
_cleanup() { | |
rm -rf "${TEMP_DIR}" | |
} | |
trap _cleanup 0 | |
_install_rustup() { | |
TEMP_DIR="$(mktemp -d)" | |
if _command_exist "curl"; then | |
curl -o "${TEMP_DIR}/${RUSTUP_SCRIPT_LOCAL}" -sf "${RUSTUP_SCRIPT_REMOTE}" | |
elif _command_exist "wget"; then | |
wget -O "${TEMP_DIR}/${RUSTUP_SCRIPT_LOCAL}" "${RUSTUP_SCRIPT_REMOTE}" | |
else | |
sudo apt-get install -y "curl" | |
curl -o "${TEMP_DIR}/${RUSTUP_SCRIPT_LOCAL}" -sf "${RUSTUP_SCRIPT_REMOTE}" | |
fi | |
chmod +x "${TEMP_DIR}/${RUSTUP_SCRIPT_LOCAL}" | |
sh "${TEMP_DIR}/${RUSTUP_SCRIPT_LOCAL}" -y | |
source "${HOME}/.cargo/env" | |
} | |
if ! _command_exist "rustc"; then | |
_install_rustup | |
fi | |
rustup install nightly | |
rustup default nightly | |
sudo apt-get install -y libssl-dev libsodium-dev libgtk-3-dev libcairo2-dev libatk1.0-dev \ | |
libpango1.0-dev libgdk-pixbuf2.0-dev libsqlite3-dev libgtk-3-dev | |
cd "${HOME}" || exit | |
git clone "${COAX_REPO}" | |
cd "coax/coax-gtk/" || exit | |
make install | |
echo -e "\\nDone! Coax is now available in ${HOME}/.cargo/coax-gtk" | |
read -r -p "Would you like to delete the sources? [y/N] " RESPONSE | |
case "${RESPONSE}" in | |
[yY][eE][sS]|[yY] ) rm -rf "${HOME}/coax" ;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment