xrdp/scripts/install_xrdp_build_dependencies_with_apt.sh

153 lines
3.9 KiB
Bash
Raw Normal View History

2020-11-17 08:49:39 +03:00
#!/bin/sh
set -eufx
FEATURE_SET=min
ARCH=amd64
2020-11-17 08:49:39 +03:00
# See apt.conf(5)
DEBUG_OPTS=
#DEBUG_OPTS="$DEBUG_OPTS -oDebug::pkgProblemResolver=1"
# Given a list of i386 packages, this call makes sure the amd64 variants
# of the development libraries are not installed
remove_64bit_libdev_packages()
{
flags=$-
set +x ;# Disable tracing for this func
rlist=""
for p in $PACKAGES; do
# Identify packages starting with 'lib' and ending with '-dev:i386'
if [ "${p#lib}" != "$p" -a "${p%-dev:i386}" != "$p" ]; then
p64=${p%i386}amd64
if dpkg -s $p64 >/dev/null 2>&1 ; then
rlist="$rlist ${p%i386}amd64"
fi
fi
done
if [ -n "$rlist" ]; then
echo "** Some 64-bit development packages appear to clash with i386 packages"
echo "**$rlist"
apt-get remove $rlist || :
fi
# Restore tracing, if enabled on entry
set -$flags
}
# ----------------------------------------------------------------------------
# M A I N
# ----------------------------------------------------------------------------
if [ $# -ge 1 ]; then
FEATURE_SET="$1"
shift
2020-11-17 08:49:39 +03:00
fi
if [ $# -ge 1 ]; then
ARCH="$1"
shift
2020-11-17 08:49:39 +03:00
fi
APT_EXTRA_ARGS="$@"
2020-11-17 08:49:39 +03:00
# common build tools for all architectures and feature sets
PACKAGES=" \
autoconf \
automake \
clang \
gcc \
g++ \
libtool \
make \
nasm \
2021-03-29 00:55:19 +03:00
pkg-config \
check \
libcmocka-dev
2020-11-17 08:49:39 +03:00
"
# libfreetype-dev package was renamed from libfreetype6-dev in older
# versions
case `lsb_release -si`/`lsb_release -sr` in
Debian/10) LIBFREETYPE_DEV=libfreetype6-dev ;;
Ubuntu/18.*) LIBFREETYPE_DEV=libfreetype6-dev ;;
*) LIBFREETYPE_DEV=libfreetype-dev
esac
2020-11-17 08:49:39 +03:00
case "$ARCH"
in
amd64)
PACKAGES_AMD64_MIN=" \
libpam0g-dev \
libssl-dev \
libx11-dev \
libxrandr-dev \
libxfixes-dev"
2022-09-03 03:50:56 +03:00
2020-11-17 08:49:39 +03:00
case "$FEATURE_SET"
in
min)
PACKAGES="$PACKAGES $PACKAGES_AMD64_MIN"
;;
max)
PACKAGES="$PACKAGES \
$PACKAGES_AMD64_MIN \
$LIBFREETYPE_DEV \
2020-11-17 08:49:39 +03:00
libfuse-dev \
libjpeg-dev \
libmp3lame-dev \
libfdk-aac-dev \
2021-07-22 17:23:30 +03:00
libimlib2-dev \
2020-11-17 08:49:39 +03:00
libopus-dev \
libpixman-1-dev"
;;
*)
echo "unsupported feature set: $FEATURE_SET"
exit 1;
;;
esac
;;
i386)
# This list is not as complete as the amd64 list. It currently
# supports 32-bit CI building only, rather than being a generic
# build support tool.
# - Ubuntu 18.04 -> 20.04
# Removed fdk-aac-dev:i386 and libfuse-dev:i386
2020-11-17 08:49:39 +03:00
PACKAGES="$PACKAGES \
g++-multilib \
gcc-multilib \
$LIBFREETYPE_DEV:i386 \
2020-11-17 08:49:39 +03:00
libgl1-mesa-dev:i386 \
libglu1-mesa-dev:i386 \
libjpeg-dev:i386 \
2021-08-09 14:00:06 +03:00
libimlib2-dev:i386 \
2020-11-17 08:49:39 +03:00
libmp3lame-dev:i386 \
libopus-dev:i386 \
libpam0g-dev:i386 \
libssl-dev:i386 \
libx11-dev:i386 \
libxext-dev:i386 \
libxfixes-dev:i386 \
libxrandr-dev:i386 \
libxrender-dev:i386 \
libsubunit-dev:i386 \
check:i386 \
libcmocka-dev:i386"
2022-09-03 03:50:56 +03:00
2020-11-17 08:49:39 +03:00
dpkg --add-architecture i386
dpkg --print-architecture
dpkg --print-foreign-architectures
apt-get update
remove_64bit_libdev_packages $PACKAGES
2020-11-17 08:49:39 +03:00
;;
*)
echo "unsupported architecture: $ARCH"
exit 1;
;;
esac
apt-get update
apt-get upgrade
2020-11-17 08:49:39 +03:00
apt-get -yq \
--no-install-suggests \
--no-install-recommends \
$DEBUG_OPTS \
2020-11-17 08:49:39 +03:00
$APT_EXTRA_ARGS \
install $PACKAGES