#!/bin/bash # This script needs to be run with root rights. if [ $UID -ne 0 ]; then sudo $0 exit 0 fi function printNotSupportedMessageAndExit() { echo echo "Currently this script only works for distributions supporting apt-get and yum." echo "Please add support for your distribution: http://webkit.org/b/110693" echo exit 1 } function checkInstaller { # apt-get - Debian based distributions apt-get --version &> /dev/null if [ $? -eq 0 ]; then installDependenciesWithApt exit 0 fi # dnf - Fedora dnf --version &> /dev/null if [ $? -eq 0 ]; then installDependenciesWithDnf exit 0 fi # pacman - Arch Linux # pacman --version and pacman --help both return non-0 pacman -Ss &> /dev/null if [ $? -eq 0 ]; then installDependenciesWithPacman exit 0 fi if [ `uname` -eq "Darwin" ]; then installDependenciesWithBrew exit 0 fi printNotSupportedMessageAndExit } function installDependenciesWithBrew { brew &> /dev/null if [ $? -gt 1 ]; then echo "Please install HomeBrew. Instructions on http://brew.sh" exit 1 fi brew install autoconf \ automake \ bison \ cmake \ enchant \ flex \ gettext \ gobject-introspection \ intltool \ itstool \ libcroco \ libgcrypt \ libgpg-error \ libtiff \ libtool \ ninja \ pango \ pkg-config \ sqlite \ webp \ xz } # If the package $1 is available, prints it. Otherwise prints $2. # Useful for handling when a package is renamed on new versions of Debian/Ubuntu. function aptIfElse { if apt-cache show $1 &>/dev/null; then echo $1 else echo $2 fi } function installDependenciesWithApt { # These are dependencies necessary for building WebKitGTK+. packages=" \ autoconf \ automake \ autopoint \ autotools-dev \ bison \ cmake \ flex \ gawk \ geoclue-2.0 \ gnome-common \ gperf \ gtk-doc-tools \ intltool \ itstool \ libatk1.0-dev \ libedit-dev \ libenchant-dev \ libfaad-dev \ $(aptIfElse libgcrypt20-dev libgcrypt11-dev) \ $(aptIfElse libgeoclue-2-dev libgeoclue-dev) \ libgirepository1.0-dev \ libgl1-mesa-dev \ libgl1-mesa-glx \ libgtk2.0-dev \ libgtk-3-dev \ libgstreamer1.0-dev \ libgstreamer-plugins-base1.0-dev \ libgudev-1.0-dev \ libhyphen-dev \ libjpeg-dev \ libmpg123-dev \ libnotify-dev \ libopus-dev \ libpango1.0-dev \ $(aptIfElse libpng-dev libpng12-dev) \ libpulse-dev \ librsvg2-dev \ libsecret-1-dev \ libsoup2.4-dev \ libsqlite3-dev \ libtheora-dev \ libtool \ libvorbis-dev \ libwebp-dev \ libxcomposite-dev \ libxt-dev \ libxtst-dev \ libxslt1-dev \ libwayland-dev \ ninja-build \ patch \ ruby \ xfonts-utils" # These are dependencies necessary for running tests. packages="$packages \ apache2 \ curl \ dbus-x11 \ gdb \ libapache2-mod-bw \ $(aptIfElse libapache2-mod-php7.0 libapache2-mod-php5) \ libgpg-error-dev \ psmisc \ pulseaudio-utils \ python-gi \ python-psutil \ ruby \ ruby-json \ ruby-highline \ weston \ xvfb" # These are dependencies necessary for building the jhbuild. packages="$packages \ git \ gobject-introspection \ gsettings-desktop-schemas-dev \ icon-naming-utils \ libcroco3-dev \ libdrm-dev \ libegl1-mesa-dev \ libepoxy-dev \ libevdev-dev \ libexpat1-dev \ libgbm-dev \ libgles2-mesa-dev \ libgnutls28-dev \ libgpg-error-dev \ libjson-glib-dev \ libinput-dev \ libmtdev-dev \ libp11-kit-dev \ libpciaccess-dev \ libproxy-dev \ libssl-dev \ libtiff5-dev \ libv4l-dev \ libxcb-composite0-dev \ libxcb-xfixes0-dev \ $(aptIfElse libxfont1-dev libxfont-dev) \ libxkbfile-dev \ libtool-bin \ libudev-dev \ python-dev \ ragel \ x11proto-bigreqs-dev \ x11proto-composite-dev \ x11proto-gl-dev \ x11proto-input-dev \ x11proto-randr-dev \ x11proto-resource-dev \ x11proto-scrnsaver-dev \ x11proto-video-dev \ x11proto-xcmisc-dev \ x11proto-xf86dri-dev \ xfonts-utils \ xtrans-dev \ xutils-dev \ yasm" # These are dependencies necessary for using webkit-patch packages="$packages \ git-svn \ subversion" apt-get install $packages } function installDependenciesWithPacman { # These are dependencies necessary for building WebKitGTK+. packages=" \ autoconf \ automake \ bison \ cmake \ libedit \ file \ findutils \ flex \ gawk \ gcc \ gettext \ gnome-common \ gperf \ grep \ groff \ gstreamer \ gst-plugins-base-libs \ gzip \ hyphen \ libtool \ m4 \ make \ patch \ pkg-config \ sed \ texinfo \ util-linux \ which \ gtk-doc \ intltool \ itstool \ atk \ enchant \ faad2 \ geoclue \ gobject-introspection \ mesa \ mesa-libgl \ gtk2 \ gtk3 \ libsystemd \ libjpeg-turbo \ mpg123 \ opus \ pango \ libgcrypt \ libnotify \ libpng \ libpulse \ librsvg \ libsecret \ libsoup \ sqlite \ libtheora \ libtool \ libvorbis \ libwebp \ libxcomposite \ libxt \ libxslt \ libxtst \ ninja \ ruby \ xorg-font-utils \ wayland" # These are dependencies necessary for running tests. # Note: apache-mod_bw is available in the AUR, but the main repos # could not find ruby-json packages="$packages \ apache \ curl \ gdb \ hunspell \ hunspell-en \ php-apache \ libgpg-error \ psmisc \ pulseaudio \ python-gobject \ python2-psutil \ ruby \ ruby-highline \ weston \ xorg-server-xvfb" # These are dependencies necessary for building the jhbuild. # Note: Could not find libegl-mesa packages="$packages \ expat \ git \ gnutls \ gobject-introspection \ gsettings-desktop-schemas \ icon-naming-utils \ libcroco \ libdrm \ libepoxy \ libevdev \ libgpg-error \ libinput \ p11-kit \ libpciaccess \ libproxy \ libtiff \ libxfixes \ libxfont \ libxcb \ libxkbfile \ mtdev \ python2 \ python2-lxml \ ragel \ bigreqsproto \ compositeproto \ glproto \ inputproto \ randrproto \ resourceproto \ scrnsaverproto \ videoproto \ xcmiscproto \ xf86driproto \ xorg-font-utils \ xorg-util-macros \ xtrans \ xorg-utils \ yasm" # These are dependencies necessary for using webkit-patch packages="$packages \ svn" pacman -S --needed $packages echo "You will also need to follow the instructions on the Arch Wiki to make" echo "'python' call python2 in the webkit folder" echo "https://wiki.archlinux.org/index.php/Python#Dealing_with_version_problem_in_build_scripts" } function installDependenciesWithDnf { # These are dependencies necessary for building WebKitGTK+. packages=" \ atk-devel \ autoconf \ automake \ bison \ cairo-devel \ cmake \ enchant-devel \ flex \ gcc-c++ \ geoclue2-devel \ gettext-devel \ gobject-introspection-devel \ gperf \ gstreamer1-devel \ gstreamer1-plugins-base-devel \ gtk-doc \ gtk2-devel \ gtk3-devel \ hyphen-devel \ intltool \ json-glib-devel \ libXt-devel \ libXtst-devel \ libxslt-devel \ libedit-devel \ libgcrypt-devel \ libgudev1-devel \ libjpeg-turbo-devel \ libnotify-devel \ libpng-devel \ libsecret-devel \ libsoup-devel \ libv4l-devel \ libwebp-devel \ libwayland-client-devel \ libwayland-server-devel \ mesa-libGL-devel \ ninja-build \ openssl-devel \ patch \ pcre-devel \ perl-Switch \ perl-version \ pulseaudio-libs-devel \ python-devel \ redhat-rpm-config \ ruby \ sqlite-devel" # These are dependencies necessary for running tests. packages="$packages \ curl \ dbus-x11 \ gdb \ hunspell-en \ httpd \ libgpg-error-devel \ mod_bw \ mod_ssl \ perl-CGI \ php \ psmisc \ pulseaudio-utils \ pygobject3-base \ python2-psutil \ ruby \ rubygem-json \ rubygem-highline \ weston-devel \ xorg-x11-server-Xvfb" # These are dependencies necessary for building the jhbuild. packages="$packages \ expat-devel \ docbook-utils \ docbook-utils-pdf \ git \ gobject-introspection \ gnutls-devel \ gsettings-desktop-schemas-devel \ icon-naming-utils \ itstool \ libXfont-devel \ libcroco-devel \ libdrm-devel \ libepoxy-devel \ libevdev-devel libgpg-error-devel \ libinput-devel \ libp11-devel \ libpciaccess-devel \ libproxy-devel \ libtiff-devel \ libxcb-devel \ libxkbfile-devel \ mesa-libEGL-devel \ mtdev-devel \ ragel \ systemd-devel \ xorg-x11-font-utils \ xorg-x11-proto-devel \ xorg-x11-util-macros \ xorg-x11-xtrans-devel \ yasm" # These are dependencies necessary for using webkit-patch packages="$packages git-svn \ subversion" dnf install $packages } checkInstaller