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
|
#!/bin/bash
# shellcheck disable=SC1091
###############################################################################
# Copyright (C) Intel Corporation
#
# SPDX-License-Identifier: MIT
###############################################################################
# Install dependencies.
#
# This script should not call other scripts in the repository so that it can
# potentialy be an argument to the COPY command in a Dockerfile
set -o errexit
if [ -f "/etc/os-release" ]; then
. /etc/os-release
fi
if [ -z "$ID_LIKE" ]; then
ID_LIKE="$ID"
fi
if [ "$ID_LIKE" == "debian" ]; then
apt-get update
# basic build tools
apt-get install -y --no-install-recommends \
build-essential \
cmake \
pkg-config
# tool build dependencies
apt-get install -y --no-install-recommends \
libdrm-dev \
libva-dev \
libx11-dev \
libx11-xcb-dev \
libxcb-present-dev \
libxcb-dri3-dev \
libwayland-dev \
wayland-protocols
# lint prerequisites
apt-get install -y --no-install-recommends \
git \
pipx
pipx ensurepath --force
pipx install pre-commit
elif [ "$ID_LIKE" == "fedora" ]; then
# Add media driver repositories
dnf install -y 'dnf-command(config-manager)'
dnf config-manager --add-repo \
https://repositories.intel.com/gpu/rhel/${VERSION_ID}/lts/2350/unified/intel-gpu-${VERSION_ID}.repo
dnf clean all && dnf makecache && dnf upgrade -y
# basic build tools
dnf install -y cmake gcc-c++
# prerequsites to build examples
dnf install -y libva-devel
dnf install -y libX11-devel
dnf install -y wayland-protocols-devel
dnf install -y python3-pip
# libdrm from source
dnf install -y python3-pip git
pip3 install meson ninja
pushd /tmp
if [ ! "$(pkg-config --modversion pciaccess)" = "0.17" ]; then
git clone -b libpciaccess-0.17 https://gitlab.freedesktop.org/xorg/lib/libpciaccess.git
pushd libpciaccess
meson builddir --prefix=/usr
ninja -C builddir install
popd
rm -rf /libpciaccess
fi
if [ ! "$(pkg-config --modversion libdrm)" = "2.4.113" ]; then
git clone -b libdrm-2.4.113 https://gitlab.freedesktop.org/mesa/drm.git
pushd drm
meson builddir --prefix=/usr
ninja -C builddir install
popd
rm -rf drm
fi
popd
# lint dependencies
pip3 install pre-commit
elif [ "$ID_LIKE" == "rhel fedora" ]; then
# basic build tools
yum install -y centos-release-scl
yum-config-manager --enable rhel-server-rhscl-7-rpms
yum install -y devtoolset-9
# cmake
if [ ! "$(cmake --version |head -1|cut -f3 -d' ')" = "3.22.1" ]; then
yum install -y openssl-devel
cd /tmp
rm -rf cmake-3.*
curl -O -L --retry 5 \
https://github.com/Kitware/CMake/releases/download/v3.22.1/cmake-3.22.1.tar.gz
tar zxvf cmake-3.*
cd cmake-3.*
source /opt/rh/devtoolset-9/enable
./bootstrap --prefix=/usr/local --parallel="$(nproc)"
make -j"$(nproc)"
make install
fi
# xcb and wayland
yum -y update
yum -y install wayland-devel libX11-devel libXext-devel libXfixes-devel libpciaccess-devel
if [ ! "$(pkg-config --modversion wayland-protocols)" = "1.15" ]; then
cd /tmp
rm -rf wayland-protocols-1.15
curl -O -L --retry 5 \
https://wayland.freedesktop.org/releases/wayland-protocols-1.15.tar.xz
tar -xJf wayland-protocols-1.15.tar.xz
cd wayland-protocols-1.15
./configure --prefix="/usr" --bindir="/usr/bin" --libdir="/usr/lib64"
make install
fi
# libva
yum install -y \
bzip2 \
libdrm-devel
if [ ! "$(pkg-config --variable=libva_version libva)" = "2.10.0" ]; then
cd /tmp
rm -rf libva-2.10.0
curl -O -L --retry 5 \
https://github.com/intel/libva/releases/download/2.10.0/libva-2.10.0.tar.bz2
tar xjf libva-2.10.0.tar.bz2
source /opt/rh/devtoolset-9/enable
cd libva-2.10.0
./configure --prefix="/usr" --enable-wayland --enable-x11 --bindir="/usr/bin" --libdir="/usr/lib64"
make
make install
fi
# pre-commit prerequisites
yum install -y git
yum install -y \
openssl-devel \
bzip2-devel \
libffi-devel \
sqlite-devel
if [ ! "$(python3 --version |head -1|cut -f2 -d' ')" == "3.8.9" ]; then
cd /tmp
rm -rf Python-3.*
curl -O -L --retry 5 \
https://www.python.org/ftp/python/3.8.9/Python-3.8.9.tgz
tar xvf Python-3.8.9.tgz
source /opt/rh/devtoolset-9/enable
cd Python-3.*/
./configure --enable-optimizations --enable-loadable-sqlite-extensions \
--prefix=/usr --with-openssl=/etc/pki/tls --with-openssl-rpath=auto
./configure --enable-optimizations --enable-loadable-sqlite-extensions
make install
fi
# lint dependencies
pip3 install pre-commit
else
if [ -z ${ID_LIKE+x} ]; then
echo "Error: unknown OS distribution"
else
echo "Error: unknown OS distribution '$ID_LIKE'"
fi
exit 1
fi
|