summaryrefslogtreecommitdiff
path: root/tools/bin/prerequisites-rpm.sh
blob: 76ede948ac325758a31844a01ea46ba95d77753f (plain)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/bin/sh -e
# @file
## $Id$
# Fetches prerequisites for RPM based GNU/Linux systems.
#

#
# Copyright (C) 2018-2023 Oracle and/or its affiliates.
#
# This file is part of VirtualBox base platform packages, as
# available from https://www.virtualbox.org.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, in version 3 of the
# License.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://www.gnu.org/licenses>.
#
# SPDX-License-Identifier: GPL-3.0-only
#

# What this script does:
usage_msg="\
Usage: `basename ${0}` [--with-docs]

Install the dependencies needed for building VirtualBox on an RPM-based Linux
system.  Additional distributions will be added as needed.  There are no plans
to add support for or to accept patches for distributions we do not package.
The \`--with-docs\' parameter is to install the packages needed for building
documentation.  It will also be implemented per distribution as needed."

# To repeat: there are no plans to add support for or to accept patches
# for distributions we do not package.

usage()
{
    echo "${usage_msg}"
    exit "${1}"
}

unset WITHDOCS

while test -n "${1}"; do
    case "${1}" in
    --with-docs)
        WITHDOCS=1
        shift ;;
    -h|--help)
        usage 0 ;;
    *)
        echo "Unknown parameter ${1}" >&2
        usage 1 ;;
    esac
done

export LC_ALL=C
PATH=/sbin:/usr/sbin:$PATH

# This list is valid for openSUSE 15.0
PACKAGES_OPENSUSE="\
bzip2 gcc-c++ glibc-devel gzip libcap-devel libcurl-devel libidl-devel \
libxslt-devel libvpx-devel libXmu-devel make libopenssl-devel  zlib-devel \
pam-devel libpulse-devel python-devel rpm-build libSDL_ttf-devel \
device-mapper-devel wget kernel-default-devel tar glibc-devel-32bit \
libstdc++-devel-32bit libpng16-devel libqt5-qtx11extras-devel \
libXcursor-devel libXinerama-devel libXrandr-devel alsa-devel gcc-c++-32bit \
libQt5Widgets-devel libQt5OpenGL-devel libQt5PrintSupport-devel \
libqt5-linguist libopus-devel"

if test -f /etc/SUSE-brand; then
    zypper install -y ${PACKAGES_OPENSUSE}
    exit 0
fi

PACKAGES_EL="bzip2 gcc-c++ glibc-devel gzip libcap-devel libIDL-devel \
    libxslt-devel libXmu-devel make openssl-devel pam-devel python-devel \
    rpm-build wget kernel kernel-devel tar libpng-devel libXcursor-devel \
    libXinerama-devel libXrandr-devel which"
PACKAGES_EL5="curl-devel SDL-devel libstdc++-devel.i386 openssh-clients \
    which gcc44-c++"
PACKAGES_EPEL5_ARCH="/usr/bin/python2.6:python26-2.6.8-2.el5 \
    /usr/bin/python2.6:python26-libs-2.6.8-2.el5 \
    /usr/bin/python2.6:python26-devel-2.6.8-2.el5 \
    /usr/bin/python2.6:libffi-3.0.5-1.el5 \
    /usr/share/doc/SDL_ttf-2.0.8/README:SDL_ttf-2.0.8-3.el5 \
    /usr/share/doc/SDL_ttf-2.0.8/README:SDL_ttf-devel-2.0.8-3.el5"
LOCAL_EL5="\
    /usr/local/include/pulse:\
https://freedesktop.org/software/pulseaudio/releases/pulseaudio-11.1.tar.gz"
PACKAGES_EL6_PLUS="libcurl-devel libstdc++-static libvpx-devel \
    pulseaudio-libs-devel SDL-static device-mapper-devel glibc-static \
    zlib-static glibc-devel.i686 libstdc++.i686 qt5-qttools-devel \
    qt5-qtx11extras-devel"
PACKAGES_EL7_PLUS="opus-devel"
PACKAGE_LIBNSL_X86="libnsl.i686"
DOCS_EL="texlive-latex texlive-latex-bin texlive-ec texlive-pdftex-def \
    texlive-fancybox"

if test -f /etc/redhat-release; then
    read elrelease < /etc/redhat-release
    case "${elrelease}" in
    *"release 5."*|*"release 6."*|*"release 7."*)
        INSTALL="yum install -y" ;;
    *)
        INSTALL="dnf install -y" ;;
    esac
    case "`uname -m`" in
    x86_64) ARCH=x86_64 ;;
    *) ARCH=i386 ;;
    esac
    egrepignore=\
"Setting up Install Process|already installed and latest version\
|Nothing to do"
    ${INSTALL} ${PACKAGES_EL} | egrep -v  "${egrepignore}"
    case "${elrelease}" in
    *"release 5."*)
        # Packages missing in EL5
        ${INSTALL} ${PACKAGES_EL5} | egrep -v  "${egrepignore}"
        for i in ${PACKAGES_EPEL5_ARCH}; do
            if test ! -r "${i%%:*}"; then
                wget "http://archives.fedoraproject.org/pub/archive/epel/5/\
${ARCH}/${i#*:}.${ARCH}.rpm" -P /tmp
                rpm -i "/tmp/${i#*:}.${ARCH}.rpm"
                rm "/tmp/${i#*:}.${ARCH}.rpm"
            fi
        done
        for i in ${LOCAL_EL5}; do
            if test ! -r "${i%%:*}"; then
                {
                    ARCHIVE="${i#*:}"
                    TMPNAME=`/tmp/date +'%s'`
                    mkdir -p "${TMPNAME}"
                    cd "${TMPNAME}"
                    wget "${ARCHIVE}"
                    case "${ARCHIVE}" in
                    *.tar.gz)
                        tar xzf "${ARCHIVE}" --strip-components 1 ;;
                    *)
                        echo Error: unknown archive type "${ARCHIVE}"
                        exit 1
                    esac
                    ./configure
                    make
                    make install
                    cd /tmp
                    rm -r "${TMPNAME}"
                }
            fi
        done ;;
    *)
        ${INSTALL} ${PACKAGES_EL6_PLUS} | egrep -v  "${egrepignore}"
        case "${elrelease}" in
        *"release 6."*) ;;
        *)
            ${INSTALL} ${PACKAGES_EL7_PLUS} | egrep -v  "${egrepignore}"
            test -n "${WITHDOCS}" &&
                ${INSTALL} ${DOCS_EL} | egrep -v  "${egrepignore}"
        esac
    esac
    test -e /usr/lib/libnsl.so.1 ||
        ${INSTALL} ${PACKAGE_LIBNSL_X86} | egrep -v  "${egrepignore}" || true
fi