-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathinstall_deps
executable file
·67 lines (64 loc) · 2.41 KB
/
install_deps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env sh
set -e
DEPS="wget tar make diffutils texinfo"
RCDEPS="$DEPS gcc g++ lua5.3 zlib jansson libusb-1.0 libgmp"
PKM=""
echo Checking platform...
if type yum >/dev/null 2>&1; then
echo Found yum, assuming Red Hat.
DEPS="$DEPS gcc gcc-c++ lua-devel zlib-devel jansson-devel libusb-devel gmp-devel"
PKM="yum"
elif type zypper >/dev/null 2>&1; then
echo Found zypper, assuming openSUSE.
DEPS="$DEPS gcc gcc-c++ lua53 zlib-devel libjansson-devel libusb-1_0-devel gmp-devel"
PKM="zypper"
elif type emerge >/dev/null 2>&1; then
echo Found emerge, assuming Gentoo.
if type equo >/dev/null 2>&1; then
read -p "Warning: Also found equo. If you're running Sabayon, then this will probably not work. Continue? (y/n) " yn
case "$yn" in [Yy]*) ;; *) exit;; esac
fi
DEPS="$DEPS gcc lua:5.3 zlib jansson libusb gmp"
PKM="emerge"
elif type pkg >/dev/null 2>&1; then
echo Found pkg, assuming FreeBSD.
echo Note: Configure with 'CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib'.
echo Note: gsed needs to be in your PATH as 'sed'.
echo Note: Make with gmake.
DEPS="texinfo lua53 zlib jansson gmake gsed gmp"
PKM="pkg"
elif type brew >/dev/null 2>&1; then
echo Found brew, assuming macOS.
echo Note: gsed needs to be in your PATH as 'sed'.
DEPS="lua zlib jansson libusb gnu-sed gmp"
PKM="brew"
elif type apt >/dev/null 2>&1; then
echo Found apt, assuming Debian.
DEPS="$DEPS gcc g++ liblua5.3-dev zlib1g-dev libjansson-dev libusb-1.0-0-dev libgmp-dev"
PKM="apt"
elif type pacman >/dev/null 2>&1; then
if test "x`uname -o`" = xMsys; then
echo Found pacman with \`uname -o\` = "Msys", assuming MSYS2.
DEPS="$DEPS mingw-w64-i686-gcc mingw-w64-i686-lua mingw-w64-i686-zlib mingw-w64-i686-jansson mingw-w64-i686-libusb mingw-w64-i686-gmp"
PKM="pacman"
else
echo Found pacman, assuming Arch.
DEPS="$DEPS gcc lua zlib jansson libusb"
PKM="pacman"
fi
fi
if test -z "$PKM"; then
echo Unrecognized platform, skipping automatic package installation.
echo Make sure these packages are installed: $RCDEPS
else
echo Installing dependencies...
case "$PKM" in
yum) yum install -y $DEPS;;
zypper) zypper install -y $DEPS;;
emerge) emerge -n --autounmask-write $DEPS || ( dispatch-conf && emerge -n $DEPS );;
pkg) pkg install $DEPS;;
brew) brew install $DEPS;;
apt) apt install -y $DEPS;;
pacman) pacman -S --needed --noconfirm $DEPS;;
esac
fi