| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- #!/bin/sh
- set -e
- if [ "$(id -u)" != 0 ]; then
- SUDO="${SUDO:-$(command -v sudo)}"
- else
- SUDO="${SUDO:-}"
- fi
- brew_sh="https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh"
- setup_mac() {
- if ! command -v brew >/dev/null; then
- echo "brew not found, installing..." >&2
- bash -c "$(curl -fL "${brew_sh}")" || return 1
- fi
- for i in cmake gcc pkgconf llvm@13; do
- echo "Installing $i with brew..." >&2
- brew install "$i" || return 1
- done
- }
- setup_apt() {
- apt_deps="git make gcc pkg-config libasound2-dev"
- $1 install $apt_deps || return 1
- }
- setup_pacman() {
- pacman_deps="git make gcc pkgconf alsa-lib"
- $1 -Sy $pacman_deps || return 1
- }
- setup_xbps() {
- xbps_deps="git make gcc pkg-config alsa-lib-devel"
- $1 -S $xbps_deps || return 1
- }
- setup_dnf() {
- dnf_deps="git make gcc pkg-config findutils lato-fonts"
- $1 install -y $dnf_deps || return 1
- }
- setup_apk() {
- apk_deps="git make gcc musl-dev pkgconfig alsa-lib-dev"
- $1 add $apk_deps || return 1
- }
- setup_zypper() {
- zypper_deps="git make gcc pkg-config findutils"
- $1 install -y $zypper_deps || return 1
- }
- setup_emerge() {
- emerge_deps="dev-vcs/git media-libs/alsa-lib"
- $1 $emerge_deps || return 1
- }
- setup_pkg() {
- pkg_deps="git bash gcc findutils cantarell-fonts gmake devel/automake"
- $1 install -y $pkg_deps || return 1
- }
- setup_pkg_add() {
- pkg_add_deps="git bash gcc-11.2.0p6 findutils cantarell-fonts gmake automake-1.15.1"
- $1 -I $pkg_add_deps || return 1
- }
- setup_pkgin() {
- pkgin_deps="git bash gcc12 findutils cantarell-fonts pkgconf gmake automake"
- $1 -y install $pkgin_deps || return 1
- }
- case "$(uname -s)" in
- Linux)
- if command -v apt >/dev/null; then
- echo "Setting up for apt" >&2
- setup_apt "$SUDO $(command -v apt)" || exit 1
- echo "Dependencies installed!" >&2
- exit 0
- fi
- if command -v apt-get >/dev/null; then
- echo "Setting up for apt-get" >&2
- setup_apt "$SUDO $(command -v apt-get)" || exit 1
- echo "Dependencies installed!" >&2
- exit 0
- fi
- if command -v pacman; then
- echo "Setting up for pacman" >&2
- setup_pacman "$SUDO $(command -v pacman)" || exit 1
- echo "Dependencies installed!" >&2
- exit 0
- fi
- if command -v xbps-install; then
- echo "Setting up for xbps" >&2
- setup_xbps "$SUDO $(command -v xbps-install)" || exit 1
- echo "Dependencies installed!" >&2
- exit 0
- fi
- if command -v dnf; then
- echo "Setting up for dnf" >&2
- setup_dnf "$SUDO $(command -v dnf)" || exit 1
- echo "Dependencies installed!" >&2
- exit 0
- fi
- if command -v apk; then
- echo "Setting up for apk" >&2
- setup_apk "$SUDO $(command -v apk)" || exit 1
- echo "Dependencies installed!" >&2
- exit 0
- fi
- if command -v zypper; then
- echo "Setting up for zypper" >&2
- setup_zypper "$SUDO $(command -v zypper)" || exit 1
- echo "Dependencies installed!" >&2
- exit 0
- fi
- if command -v emerge; then
- echo "Setting up for emerge" >&2
- setup_emerge "$SUDO $(command -v emerge)" || exit 1
- echo "Dependencies installed!" >&2
- exit 0
- fi
- echo "Error: Could not recognize your package manager." >&2
- exit 1
- ;;
- *BSD*)
- if command -v pkgin; then
- echo "Setting up for pkgin/NetBSD" >&2
- setup_pkgin "$SUDO $(command -v pkgin)" || exit 1
- elif command -v pkg; then
- echo "Setting up for pkg/FreeBSD" >&2
- setup_pkg "$SUDO $(command -v pkg)" || exit 1
- elif command -v pkg_add; then
- echo "Setting up for pkg_add/OpenBSD" >&2
- setup_pkg_add "$SUDO $(command -v pkg_add)" || exit 1
- echo "Rust support is not yet ready for OpenBSD, see https://github.com/rust-lang/rustup/issues/2168#issuecomment-1505185711"
- echo "You may try to compile rustc and cargo yourself or get the latest with:"
- echo "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain nightly --default-host x86_64-unknown-openbsd"
- fi
- echo "Error: Could not recognize your package manager." >&2
- exit 1
- ;;
- Darwin)
- echo "Setting up for OSX" >&2
- setup_mac || exit 1
- echo "Dependencies installed!" >&2
- exit 0
- ;;
- ""|*)
- echo "Unsupported OS, sorry." >&2
- exit 1
- ;;
- esac
|