forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-dependencies
executable file
·98 lines (74 loc) · 2.51 KB
/
install-dependencies
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env bash
# On Linux systems, this script needs to be run with root rights.
if [ `uname` != "Darwin" ] && [ $UID -ne 0 ]; then
sudo $0
exit 0
fi
declare -ga PACKAGES
function printNotSupportedMessageAndExit() {
echo
echo "Currently this script only works for distributions supporting apt-get, dnf, pacman and brew."
echo "Please add support for your distribution: http://webkit.org/b/110693"
echo
exit 1
}
function guessPackageManager() {
local ret
if apt-get --version &>/dev/null; then
# apt-get - Debian based distributions
ret="apt"
elif [[ $(uname) == "Darwin" ]]; then
if brew &>/dev/null; then
echo "Please install HomeBrew. Instructions on http://brew.sh"
exit 1
fi
ret="brew"
elif dnf --version &>/dev/null; then
# dnf - Fedora
ret="dnf"
elif pacman -Ss &>/dev/null; then
# pacman - Arch Linux
# pacman --version and pacman --help both return non-0
ret="pacman"
else
printNotSupportedMessageAndExit
fi
echo $ret
}
function installDependencies {
local packageManager
packageManager=$(guessPackageManager)
source "$(dirname "$0")/dependencies/$packageManager"
installDependenciesWith${packageManager^}
}
function installDependenciesWithApt {
apt-get install -y --no-install-recommends ${PACKAGES[@]}
# Ubuntu Bionic doesn't ship pipenv. So fallback to the pip3 install path.
if apt-cache show pipenv &>/dev/null; then
apt-get install -y --no-install-recommends pipenv
else
apt-get install -y --no-install-recommends python3-pip
pip3 install pipenv
fi
}
function installDependenciesWithBrew {
brew install ${PACKAGES[@]}
}
function installDependenciesWithDnf {
dnf install ${PACKAGES[@]}
}
function installDependenciesWithPacman {
pacman -S --needed ${PACKAGES[@]}
cat <<-EOF
The following packages are available from AUR, and needed for running tests:
ruby-json ruby-highline
Instructions on how to use the AUR can be found on the Arch Wiki:
https://wiki.archlinux.org/index.php/Arch_User_Repository
You will also need to follow the instructions on the wiki to make 'python'
call python2 in the WebKit folder:
https://wiki.archlinux.org/index.php/Python#Dealing_with_version_problem_in_build_scripts
Alternatively, you may use a Python 2.x virtualenv while hacking on WebKitGTK:
https://wiki.archlinux.org/index.php/Python/Virtual_environment
EOF
}
installDependencies