[WPE] Add an install-dependencies script
authorclopez@igalia.com <clopez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Jun 2017 11:46:31 +0000 (11:46 +0000)
committerclopez@igalia.com <clopez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Jun 2017 11:46:31 +0000 (11:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=172948

Reviewed by Žan Doberšek.

It is based on the gtk/install-dependencies script.
Includes support for Debian based distrubutions, Fedora and Arch.
It has been tested on a minimal Debian 9 chroot.

* wpe/install-dependencies: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217825 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/wpe/install-dependencies [new file with mode: 0755]

index cac945e9d9381aa3547f57c666c90d6b3498ebc9..7ecee8c26481a37e59a47585e8fe16487f89e4e5 100644 (file)
@@ -1,3 +1,16 @@
+2017-06-06  Carlos Alberto Lopez Perez  <clopez@igalia.com>
+
+        [WPE] Add an install-dependencies script
+        https://bugs.webkit.org/show_bug.cgi?id=172948
+
+        Reviewed by Žan Doberšek.
+
+        It is based on the gtk/install-dependencies script.
+        Includes support for Debian based distrubutions, Fedora and Arch.
+        It has been tested on a minimal Debian 9 chroot.
+
+        * wpe/install-dependencies: Added.
+
 2017-06-05  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Refactor -[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:] to check readable types
diff --git a/Tools/wpe/install-dependencies b/Tools/wpe/install-dependencies
new file mode 100755 (executable)
index 0000000..cc01e77
--- /dev/null
@@ -0,0 +1,280 @@
+#!/bin/bash
+
+# This script needs to be run with root rights.
+if [ $UID -ne 0 ]; then
+    sudo $0
+    exit $?
+fi
+
+function printNotSupportedMessageAndExit() {
+    echo
+    echo "Currently this script only works for distributions supporting apt-get, dnf or pacman."
+    echo "Please add support for your distribution and submit the patch at https://bugs.webkit.org"
+    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
+
+    printNotSupportedMessageAndExit
+}
+
+
+# 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 WPE+.
+    packages=" \
+        autoconf \
+        automake \
+        autopoint \
+        autotools-dev \
+        bison \
+        cmake \
+        flex \
+        g++ \
+        gawk \
+        gcc \
+        gperf \
+        intltool \
+        itstool \
+        libgnutls28-dev \
+        libicu-dev \
+        libjpeg-dev \
+        $(aptIfElse libpng-dev libpng12-dev) \
+        libsqlite3-dev \
+        libtool \
+        libwebp-dev \
+        libxml2-dev \
+        libxslt1-dev \
+        ninja-build \
+        patch \
+        pkg-config \
+        ruby \
+        zlib1g-dev"
+
+    # These are dependencies necessary for running tests.
+    packages="$packages \
+        apache2 \
+        curl \
+        gdb \
+        libapache2-mod-bw \
+        $(aptIfElse libapache2-mod-php7.0 libapache2-mod-php5) \
+        libcgi-pm-perl \
+        psmisc \
+        pulseaudio-utils \
+        python-gi \
+        python-psutil \
+        ruby \
+        ruby-highline \
+        ruby-json"
+
+    # These are dependencies necessary for building the jhbuild.
+    packages="$packages \
+        git \
+        gsettings-desktop-schemas-dev \
+        libexpat1-dev \
+        libgbm-dev \
+        libgles2-mesa-dev \
+        libopus-dev \
+        liborc-0.4-dev \
+        libproxy-dev \
+        libpulse-dev \
+        libsrtp0-dev \
+        libtheora-dev \
+        libtool-bin \
+        libvorbis-dev \
+        libvpx-dev \
+        libxcb-xkb-dev"
+
+    # 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 \
+        file \
+        findutils \
+        flex \
+        gawk \
+        gcc \
+        gnutls \
+        gperf \
+        grep \
+        groff \
+        gzip \
+        icu \
+        intltool \
+        itstool \
+        libjpeg-turbo \
+        libpng \
+        libtool \
+        libwebp \
+        libxml2 \
+        libxslt \
+        m4 \
+        make \
+        ninja \
+        patch \
+        pkg-config \
+        ruby
+        sed \
+        sqlite \
+        texinfo \
+        which \
+        zlib"
+
+    # These are dependencies necessary for running tests.
+    # Note: apache-mod_bw and ruby-json is available in the AUR
+    packages="$packages \
+        apache \
+        curl \
+        gdb \
+        perl-cgi \
+        php-apache \
+        psmisc \
+        pulseaudio \
+        python2 \
+        python2-gobject \
+        python2-lxml \
+        python2-psutil \
+        ruby \
+        ruby-highline"
+
+    # These are dependencies necessary for building the jhbuild.
+    packages="$packages \
+        expat \
+        git \
+        gsettings-desktop-schemas \
+        libproxy \
+        libpulse \
+        libsrtp \
+        libtheora \
+        libv4l-dev \
+        libvorbis \
+        libvpx \
+        libxcb \
+        mesa \
+        mesa-libgl \
+        opus \
+        orc \
+        v4l-utils"
+
+    # 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=" \
+        autoconf \
+        automake \
+        bison \
+        cmake \
+        flex \
+        gcc-c++ \
+        gnutls-devel \
+        gperf \
+        intltool \
+        itstool \
+        libicu-devel \
+        libjpeg-turbo-devel \
+        libpng-devel \
+        libtool \
+        libwebp-devel \
+        libxml2-devel \
+        libxslt-devel \
+        ninja-build \
+        patch \
+        ruby
+        sqlite-devel \
+        zlib-devel"
+
+    # These are dependencies necessary for running tests.
+    packages="$packages \
+        curl \
+        gdb \
+        httpd \
+        mod_bw \
+        mod_ssl \
+        perl-CGI \
+        php \
+        psmisc \
+        pulseaudio-utils \
+        python2-psutil \
+        python-gobject-base
+        ruby \
+        rubygem-highline \
+        rubygem-json"
+
+    # These are dependencies necessary for building the jhbuild.
+    packages="$packages \
+        expat-devel \
+        git \
+        gsettings-desktop-schemas-devel \
+        libproxy-devel \
+        libsrtp-devel \
+        libtheora-devel \
+        libv4l-devel \
+        libvorbis-devel \
+        libvpx-devel \
+        libxcb-devel \
+        mesa-libgbm-devel \
+        mesa-libGLES-devel \
+        opus-devel \
+        orc-devel \
+        pulseaudio-libs-devel"
+
+    # These are dependencies necessary for using webkit-patch
+    packages="$packages
+        git-svn \
+        subversion"
+
+    dnf install $packages
+}
+
+checkInstaller