From 23676ab3b3928e5e7bde3162e24fd58369d7a25e Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Thu, 19 Jan 2023 01:35:36 +1300 Subject: [PATCH] Support newest libjpeg-turbo on Centos --- builder/dockerfile.centos_core.build | 10 +++++++--- builder/scripts/build-libjpeg-turbo | 16 +++++++++++++++- builder/scripts/common.sh | 13 +++++++++++++ 3 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 builder/scripts/common.sh diff --git a/builder/dockerfile.centos_core.build b/builder/dockerfile.centos_core.build index 476c1e4..cb6d4fa 100644 --- a/builder/dockerfile.centos_core.build +++ b/builder/dockerfile.centos_core.build @@ -5,11 +5,11 @@ ENV KASMVNC_BUILD_OS_CODENAME core RUN yum install -y ca-certificates RUN yum install -y build-dep xorg-server libxfont-dev sudo -RUN yum install -y gcc cmake git libjpeg-dev libgnutls28-dev vim wget tightvncserver -RUN yum install -y libjpeg-dev libpng-dev libtiff-dev libgif-dev libavcodec-dev openssl-devel +RUN yum install -y gcc cmake git libgnutls28-dev vim wget tightvncserver +RUN yum install -y libpng-dev libtiff-dev libgif-dev libavcodec-dev openssl-devel RUN yum install -y make RUN yum group install -y "Development Tools" -RUN yum install -y xorg-x11-server-devel zlib-devel libjpeg-turbo-devel +RUN yum install -y xorg-x11-server-devel zlib-devel RUN yum install -y libxkbfile-devel libXfont2-devel xorg-x11-font-utils \ xorg-x11-xtrans-devel xorg-x11-xkb-utils-devel libXrandr-devel pam-devel \ gnutls-devel libX11-devel libXtst-devel libXcursor-devel @@ -23,6 +23,10 @@ RUN cd /tmp/libwebp-1.0.2 && \ ./configure --enable-static --disable-shared && \ make && make install +ENV SCRIPTS_DIR=/tmp/scripts +COPY builder/scripts $SCRIPTS_DIR +RUN $SCRIPTS_DIR/build-libjpeg-turbo + RUN useradd -m docker && echo "docker:docker" | chpasswd COPY --chown=docker:docker . /src/ diff --git a/builder/scripts/build-libjpeg-turbo b/builder/scripts/build-libjpeg-turbo index dc5bff8..49d7871 100755 --- a/builder/scripts/build-libjpeg-turbo +++ b/builder/scripts/build-libjpeg-turbo @@ -4,19 +4,30 @@ set -euo pipefail build_and_install() { export MAKEFLAGS=-j`nproc` - export CFLAGS="-fno-semantic-interposition -fpic -flto" + export CFLAGS="-fpic -flto" cmake -DCMAKE_INSTALL_PREFIX=/usr/local -G"Unix Makefiles" make make install } install_build_dependencies() { + if [ "$DISTRO" = centos ]; then + yum install -y cmake gcc + ensure_libjpeg_is_fast + return + fi + apt-get update apt-get install -y cmake gcc ensure_libjpeg_is_fast } ensure_libjpeg_is_fast() { + if [ "$DISTRO" = centos ]; then + yum install -y nasm + return + fi + apt-get install -y nasm } @@ -25,6 +36,9 @@ prepare_libjpeg_source() { cd libjpeg-turbo } +source_dir=$(dirname "$0") +. "$source_dir/common.sh" + install_build_dependencies prepare_libjpeg_source build_and_install diff --git a/builder/scripts/common.sh b/builder/scripts/common.sh new file mode 100644 index 0000000..1196a1b --- /dev/null +++ b/builder/scripts/common.sh @@ -0,0 +1,13 @@ +detect_distro() { + if [ -f /etc/centos-release ]; then + DISTRO=centos + elif [ -f /etc/oracle-release ]; then + DISTRO=oracle7 + elif [ -f /usr/bin/zypper ]; then + DISTRO=opensuse + else + DISTRO=debian + fi +} + +detect_distro