2022-09-07 12:11:06 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
2020-09-20 14:16:44 +02:00
|
|
|
|
2021-01-29 10:52:10 +01:00
|
|
|
detect_quilt() {
|
|
|
|
if which quilt 1>/dev/null; then
|
|
|
|
QUILT_PRESENT=1
|
|
|
|
export QUILT_PATCHES=debian/patches
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-02-11 15:57:25 +01:00
|
|
|
ensure_crashpad_can_fetch_line_number_by_address() {
|
|
|
|
if [ ! -f /etc/centos-release ]; then
|
|
|
|
export LDFLAGS="$LDFLAGS -no-pie"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-09-07 12:11:06 +02:00
|
|
|
|
|
|
|
fail_on_gcc_12() {
|
|
|
|
if [[ -n "$CC" && -n "$CXX" ]]; then
|
|
|
|
return;
|
|
|
|
fi
|
|
|
|
|
|
|
|
if gcc --version | head -1 | grep -q 12; then
|
|
|
|
cat >&2 <<EOF
|
|
|
|
|
|
|
|
Error: gcc 12 detected. It has a bug causing the build to fall because of a
|
|
|
|
-Warray-bounds bug. Please use gcc 11 in the build Dockerfile:
|
|
|
|
ENV CC=gcc-11
|
|
|
|
ENV CXX=g++-11
|
|
|
|
RUN <install gcc 11>
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-09-20 14:16:44 +02:00
|
|
|
# For build-dep to work, the apt sources need to have the source server
|
|
|
|
#sudo apt-get build-dep xorg-server
|
|
|
|
|
|
|
|
#sudo apt-get install cmake git libjpeg-dev libgnutls-dev
|
|
|
|
|
2022-09-07 12:11:06 +02:00
|
|
|
# Gcc12 builds fail due to bug
|
|
|
|
fail_on_gcc_12
|
|
|
|
|
2020-09-20 14:16:44 +02:00
|
|
|
# Ubuntu applies a million patches, but here we use upstream to simplify matters
|
|
|
|
cd /tmp
|
2020-12-24 20:54:58 +01:00
|
|
|
# default to the version of x in Ubuntu 18.04, otherwise caller will need to specify
|
|
|
|
XORG_VER=${XORG_VER:-"1.19.6"}
|
|
|
|
XORG_PATCH=$(echo "$XORG_VER" | grep -Po '^\d.\d+' | sed 's#\.##')
|
2022-08-19 19:54:11 +02:00
|
|
|
wget --no-check-certificate https://www.x.org/archive/individual/xserver/xorg-server-${XORG_VER}.tar.bz2
|
2020-09-20 14:16:44 +02:00
|
|
|
|
|
|
|
#git clone https://kasmweb@bitbucket.org/kasmtech/kasmvnc.git
|
|
|
|
#cd kasmvnc
|
|
|
|
#git checkout dynjpeg
|
|
|
|
cd /src
|
|
|
|
|
|
|
|
# We only want the server, so FLTK and manual tests aren't useful.
|
|
|
|
# Alternatively, install fltk 1.3 and its dev packages.
|
|
|
|
sed -i -e '/find_package(FLTK/s@^@#@' \
|
|
|
|
-e '/add_subdirectory(tests/s@^@#@' \
|
|
|
|
CMakeLists.txt
|
|
|
|
|
2022-07-08 16:13:05 +02:00
|
|
|
cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo . -DBUILD_VIEWER:BOOL=OFF \
|
|
|
|
-DENABLE_GNUTLS:BOOL=OFF
|
2020-09-20 14:16:44 +02:00
|
|
|
make -j5
|
|
|
|
|
2021-10-19 21:44:36 +02:00
|
|
|
tar -C unix/xserver -xf /tmp/xorg-server-${XORG_VER}.tar.bz2 --strip-components=1
|
2020-09-20 14:16:44 +02:00
|
|
|
|
|
|
|
cd unix/xserver
|
2020-12-24 20:54:58 +01:00
|
|
|
patch -Np1 -i ../xserver${XORG_PATCH}.patch
|
2021-10-19 21:44:36 +02:00
|
|
|
case "$XORG_VER" in
|
2022-02-11 15:57:25 +01:00
|
|
|
1.20.*)
|
2022-07-14 15:33:09 +02:00
|
|
|
patch -s -p0 < ../CVE-2022-2320-v1.20.patch
|
2021-10-19 21:44:36 +02:00
|
|
|
if [ -f ../xserver120.7.patch ]; then
|
|
|
|
patch -Np1 -i ../xserver120.7.patch
|
|
|
|
fi ;;
|
2022-07-14 15:33:09 +02:00
|
|
|
1.19.*)
|
|
|
|
patch -s -p0 < ../CVE-2022-2320-v1.19.patch
|
|
|
|
;;
|
2021-10-19 21:44:36 +02:00
|
|
|
esac
|
2021-03-26 20:53:04 +01:00
|
|
|
|
2020-09-20 14:16:44 +02:00
|
|
|
autoreconf -i
|
|
|
|
# Configuring Xorg is long and has many distro-specific paths.
|
|
|
|
# The distro paths start after prefix and end with the font path,
|
|
|
|
# everything after that is based on BUILDING.txt to remove unneeded
|
|
|
|
# components.
|
2022-02-11 15:57:25 +01:00
|
|
|
ensure_crashpad_can_fetch_line_number_by_address
|
2022-04-04 18:31:55 +02:00
|
|
|
# remove gl check for opensuse
|
|
|
|
if [ "${KASMVNC_BUILD_OS}" == "opensuse" ]; then
|
|
|
|
sed -i 's/LIBGL="gl >= 7.1.0"/LIBGL="gl >= 1.1"/g' configure
|
|
|
|
fi
|
2020-09-20 14:16:44 +02:00
|
|
|
./configure --prefix=/opt/kasmweb \
|
|
|
|
--with-xkb-path=/usr/share/X11/xkb \
|
|
|
|
--with-xkb-output=/var/lib/xkb \
|
|
|
|
--with-xkb-bin-directory=/usr/bin \
|
|
|
|
--with-default-font-path="/usr/share/fonts/X11/misc,/usr/share/fonts/X11/cyrillic,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,built-ins" \
|
2022-07-08 16:13:05 +02:00
|
|
|
--with-sha1=libcrypto \
|
2022-02-11 15:57:25 +01:00
|
|
|
--without-dtrace --disable-dri \
|
2020-09-27 21:18:10 +02:00
|
|
|
--disable-static \
|
2020-09-20 14:16:44 +02:00
|
|
|
--disable-xinerama --disable-xvfb --disable-xnest --disable-xorg \
|
|
|
|
--disable-dmx --disable-xwin --disable-xephyr --disable-kdrive \
|
|
|
|
--disable-config-hal --disable-config-udev \
|
|
|
|
--disable-dri2 --enable-glx --disable-xwayland --disable-dri3
|
|
|
|
make -j5
|
|
|
|
|
|
|
|
# modifications for the servertarball
|
|
|
|
cd /src
|
|
|
|
mkdir -p xorg.build/bin
|
|
|
|
cd xorg.build/bin/
|
|
|
|
ln -s /src/unix/xserver/hw/vnc/Xvnc Xvnc
|
|
|
|
cd ..
|
|
|
|
mkdir -p man/man1
|
|
|
|
touch man/man1/Xserver.1
|
2021-02-19 10:58:38 +01:00
|
|
|
cp /src/unix/xserver/hw/vnc/Xvnc.man man/man1/Xvnc.1
|
2020-09-20 14:16:44 +02:00
|
|
|
mkdir lib
|
|
|
|
cd lib
|
2021-02-05 11:49:47 +01:00
|
|
|
if [ -d /usr/lib/x86_64-linux-gnu/dri ]; then
|
|
|
|
ln -s /usr/lib/x86_64-linux-gnu/dri dri
|
2021-10-19 21:44:36 +02:00
|
|
|
elif [ -d /usr/lib/aarch64-linux-gnu/dri ]; then
|
|
|
|
ln -s /usr/lib/aarch64-linux-gnu/dri dri
|
2021-02-05 11:49:47 +01:00
|
|
|
else
|
|
|
|
ln -s /usr/lib64/dri dri
|
|
|
|
fi
|
2020-09-20 14:16:44 +02:00
|
|
|
cd /src
|
|
|
|
|
2021-01-29 10:52:10 +01:00
|
|
|
detect_quilt
|
|
|
|
if [ -n "$QUILT_PRESENT" ]; then
|
|
|
|
quilt push -a
|
2022-04-07 15:01:14 +02:00
|
|
|
echo 'Patches applied!'
|
2021-01-29 10:52:10 +01:00
|
|
|
fi
|
2022-04-07 15:01:14 +02:00
|
|
|
|
2020-09-20 14:16:44 +02:00
|
|
|
make servertarball
|
|
|
|
|
2021-01-28 10:10:46 +01:00
|
|
|
cp kasmvnc*.tar.gz /build/kasmvnc.${KASMVNC_BUILD_OS}_${KASMVNC_BUILD_OS_CODENAME}.tar.gz
|
2021-09-07 14:11:21 +02:00
|
|
|
if [ "$BUILD_TAG" = "+libjpeg-turbo_latest" ]; then
|
|
|
|
mkdir -p /build/${KASMVNC_BUILD_OS_CODENAME}/
|
|
|
|
cp /libjpeg-turbo/libjpeg*.deb /build/${KASMVNC_BUILD_OS_CODENAME}/
|
|
|
|
fi
|