Merge branch 'KASM-7194-modify-build-scripts-and-docker-image-for-faster-rebuilds-during-development' into 'master'

KASM-7194 Modify build scripts and docker image for faster rebuilds during development

Closes KASM-7194

See merge request kasm-technologies/internal/KasmVNC!170
This commit is contained in:
Matthew McClaskey 2025-04-22 11:47:53 +00:00
commit 3cc739adb3
22 changed files with 143 additions and 93 deletions

View File

@ -91,7 +91,7 @@ npm run build # <-- only run this on subsequent changes to front-end code
cd ..
# build dependencies
sudo builder/scripts/build-webp
sudo builder/scripts/build-build-libjpeg-turbo
sudo builder/scripts/build-libjpeg-turbo
# Build KasmVNC
builder/build.sh
```

View File

@ -242,8 +242,9 @@ if(ENABLE_NLS)
add_subdirectory(po)
endif()
####add_subdirectory(tests)
if (TESTS)
add_subdirectory(tests)
endif ()
include(cmake/BuildPackages.cmake)

View File

@ -44,28 +44,28 @@ if [[ "${XORG_VER}" == 21* ]]; then
else
XORG_PATCH=$(echo "$XORG_VER" | grep -Po '^\d.\d+' | sed 's#\.##')
fi
wget --no-check-certificate https://www.x.org/archive/individual/xserver/xorg-server-${XORG_VER}.tar.gz
TARBALL="xorg-server-${XORG_VER}.tar.gz"
if [ ! -f "$TARBALL" ]; then
wget --no-check-certificate https://www.x.org/archive/individual/xserver/"$TARBALL"
fi
#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
cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo . -DBUILD_VIEWER:BOOL=OFF \
-DENABLE_GNUTLS:BOOL=OFF
make -j5
make -j"$(nproc)"
tar -C unix/xserver -xf /tmp/xorg-server-${XORG_VER}.tar.gz --strip-components=1
if [ ! -d unix/xserver/include ]; then
tar -C unix/xserver -xf /tmp/"$TARBALL" --strip-components=1
cd unix/xserver
# Apply patches
patch -Np1 -i ../xserver${XORG_PATCH}.patch
patch -Np1 -i ../xserver"${XORG_PATCH}".patch
case "$XORG_VER" in
1.20.*)
patch -s -p0 < ../CVE-2022-2320-v1.20.patch
@ -110,33 +110,37 @@ fi
--with-sha1=libcrypto \
--with-xkb-bin-directory=/usr/bin \
--with-xkb-output=/var/lib/xkb \
--with-xkb-path=/usr/share/X11/xkb ${CONFIG_OPTIONS}
--with-xkb-path=/usr/share/X11/xkb "${CONFIG_OPTIONS}"
# remove array bounds errors for new versions of GCC
find . -name "Makefile" -exec sed -i 's/-Werror=array-bounds//g' {} \;
make -j5
fi
make -j"$(nproc)"
# modifications for the servertarball
cd /src
mkdir -p xorg.build/bin
cd xorg.build/bin/
ln -s /src/unix/xserver/hw/vnc/Xvnc Xvnc
ln -sfn /src/unix/xserver/hw/vnc/Xvnc Xvnc
cd ..
mkdir -p man/man1
touch man/man1/Xserver.1
cp /src/unix/xserver/hw/vnc/Xvnc.man man/man1/Xvnc.1
mkdir lib
mkdir -p lib
cd lib
if [ -d /usr/lib/x86_64-linux-gnu/dri ]; then
ln -s /usr/lib/x86_64-linux-gnu/dri dri
ln -sfn /usr/lib/x86_64-linux-gnu/dri dri
elif [ -d /usr/lib/aarch64-linux-gnu/dri ]; then
ln -s /usr/lib/aarch64-linux-gnu/dri dri
ln -sfn /usr/lib/aarch64-linux-gnu/dri dri
elif [ -d /usr/lib/arm-linux-gnueabihf/dri ]; then
ln -s /usr/lib/arm-linux-gnueabihf/dri dri
ln -sfn /usr/lib/arm-linux-gnueabihf/dri dri
elif [ -d /usr/lib/xorg/modules/dri ]; then
ln -s /usr/lib/xorg/modules/dri dri
ln -sfn /usr/lib/xorg/modules/dri dri
else
ln -s /usr/lib64/dri dri
ln -sfn /usr/lib64/dri dri
fi
cd /src

View File

@ -14,6 +14,7 @@ RUN \
bash \
ca-certificates \
cmake \
nasm \
coreutils \
curl \
eudev-dev \

View File

@ -14,6 +14,7 @@ RUN \
bash \
ca-certificates \
cmake \
nasm \
coreutils \
curl \
eudev-dev \

View File

@ -14,6 +14,7 @@ RUN \
bash \
ca-certificates \
cmake \
nasm \
coreutils \
curl \
eudev-dev \

View File

@ -14,6 +14,7 @@ RUN \
bash \
ca-certificates \
cmake \
nasm \
coreutils \
curl \
eudev-dev \

View File

@ -22,7 +22,7 @@ RUN apt-get update && \
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git libgnutls28-dev vim wget tightvncserver curl
RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver curl
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
ENV SCRIPTS_DIR=/tmp/scripts

View File

@ -12,7 +12,7 @@ RUN apt-get update && \
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install git libgnutls28-dev vim wget tightvncserver curl
RUN apt-get update && apt-get -y install ninja-build nasm git libgnutls28-dev vim wget tightvncserver curl
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
RUN CMAKE_URL="https://cmake.org/files/v3.22/cmake-3.22.0" && \

View File

@ -12,7 +12,7 @@ RUN apt-get update && \
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git libgnutls28-dev vim wget tightvncserver curl
RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver curl
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
ENV SCRIPTS_DIR=/tmp/scripts

View File

@ -16,6 +16,7 @@ RUN \
byacc \
bzip2 \
cmake \
nasm \
diffutils \
doxygen \
file \

View File

@ -17,6 +17,7 @@ RUN \
byacc \
bzip2 \
cmake \
nasm \
diffutils \
doxygen \
file \

View File

@ -16,6 +16,7 @@ RUN \
byacc \
bzip2 \
cmake \
nasm \
diffutils \
doxygen \
file \

View File

@ -13,7 +13,7 @@ RUN apt-get update && \
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install gcc g++ curl
RUN apt-get update && apt-get -y install cmake git libgnutls28-dev vim wget tightvncserver
RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
ENV SCRIPTS_DIR=/tmp/scripts

View File

@ -8,7 +8,9 @@ ENV XORG_VER 1.20.3
RUN zypper install -ny \
bdftopcf \
bigreqsproto-devel \
ninja \
cmake \
nasm \
curl \
ffmpeg-4-libavcodec-devel \
fonttosfnt \

View File

@ -11,7 +11,9 @@ RUN \
dnf install -y \
bzip2-devel \
ca-certificates \
ninja-build \
cmake \
nasm \
dnf-plugins-core \
gcc \
gcc-c++ \

View File

@ -11,7 +11,9 @@ RUN \
dnf install -y \
bzip2-devel \
ca-certificates \
ninja-build \
cmake \
nasm \
dnf-plugins-core \
gcc \
gcc-c++ \

View File

@ -12,13 +12,11 @@ RUN apt-get update && \
RUN apt-get update && apt-get install -y --no-install-recommends tzdata
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git vim wget curl
RUN apt-get update && apt-get -y install ninja-build nasm git vim wget curl
RUN apt-get update && apt-get -y install libtbb-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
ENV SCRIPTS_DIR=/tmp/scripts
COPY builder/scripts $SCRIPTS_DIR
RUN $SCRIPTS_DIR/build-webp
RUN $SCRIPTS_DIR/build-libjpeg-turbo
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
@ -35,6 +33,9 @@ RUN ARCH=$(arch) && \
(echo y; echo n) | bash cmake.sh --prefix=/usr/local --skip-license && \
rm cmake.sh
RUN $SCRIPTS_DIR/build-webp
RUN $SCRIPTS_DIR/build-libjpeg-turbo
COPY --chown=docker:docker . /src/
USER docker

View File

@ -12,7 +12,7 @@ RUN apt-get update && \
RUN apt-get update && apt-get install -y --no-install-recommends tzdata
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git libgnutls28-dev vim wget tightvncserver curl
RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget tightvncserver curl
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
ENV SCRIPTS_DIR=/tmp/scripts

View File

@ -12,12 +12,56 @@ USER root
RUN sed -i 's$# deb-src$deb-src$' /etc/apt/sources.list && \
apt update && \
apt install -y socat sudo libxfont-dev cmake git libgnutls28-dev vim wget tightvncserver curl libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev pkg-config libfreetype6-dev libxtst-dev autoconf automake libtool xutils-dev libpixman-1-dev libxshmfence-dev libxcvt-dev libxkbfile-dev x11proto-dev libgbm-dev inotify-tools && \
apt install -y \
ninja-build \
gdb \
valgrind \
rsync \
dos2unix \
socat \
sudo \
libxfont-dev \
cmake \
nasm \
git \
libgnutls28-dev \
vim \
wget \
tightvncserver \
curl \
libpng-dev \
libtiff-dev \
libgif-dev \
libavcodec-dev \
libssl-dev \
libxrandr-dev \
libxcursor-dev \
pkg-config \
libfreetype6-dev \
libxtst-dev \
autoconf \
automake \
libtool \
xutils-dev \
libpixman-1-dev \
libxshmfence-dev \
libxcvt-dev \
libxkbfile-dev \
x11proto-dev \
libgbm-dev \
inotify-tools && \
echo "kasm-user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
RUN apt install -y nodejs
COPY builder/scripts/build-webp /tmp
COPY builder/scripts/build-libjpeg-turbo /tmp
COPY builder/common.sh /tmp
RUN chmod +x /tmp/build-webp && /tmp/build-webp
RUN chmod +x /tmp/build-libjpeg-turbo && /tmp/build-libjpeg-turbo
USER 1000
WORKDIR /src

View File

@ -12,7 +12,7 @@ RUN apt-get update && \
RUN apt-get update && apt-get install -y --no-install-recommends tzdata
RUN apt-get update && apt-get -y build-dep xorg-server libxfont-dev
RUN apt-get update && apt-get -y install cmake git libgnutls28-dev vim wget curl
RUN apt-get update && apt-get -y install ninja-build cmake nasm git libgnutls28-dev vim wget curl
RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev
ENV SCRIPTS_DIR=/tmp/scripts

View File

@ -3,20 +3,8 @@
set -euo pipefail
build_and_install() {
export MAKEFLAGS=-j`nproc`
export CFLAGS="-fpic"
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -G"Unix Makefiles"
make
make install
}
install_build_dependencies() {
install_packages cmake gcc
ensure_libjpeg_is_fast
}
ensure_libjpeg_is_fast() {
install_packages nasm
cmake -B build -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_POSITION_INDEPENDENT_CODE=ON -GNinja .
ninja -C build install
}
prepare_libjpeg_source() {
@ -32,6 +20,5 @@ prepare_libjpeg_source() {
source_dir=$(dirname "$0")
. "$source_dir/common.sh"
install_build_dependencies
prepare_libjpeg_source
build_and_install