From 907e32187ce91b7c66261e2ce238b960e81359cd Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Wed, 18 Jan 2023 19:35:15 +1300 Subject: [PATCH] Staticly link libjpeg-turbo in Ubuntu Focal --- CMakeLists.txt | 2 ++ builder/dockerfile.ubuntu_focal.build | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab5725d..56f6336 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,6 +151,8 @@ find_package(ZLIB REQUIRED) # Check for libjpeg find_package(JPEG REQUIRED) +# Staticly link libjpeg-turbo +set(JPEG_LIBRARIES "-Wl,-Bstatic -lturbojpeg -Wl,-Bdynamic") # Warn if it doesn't seem to be the accelerated libjpeg that's found set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARIES}) set(CMAKE_REQUIRED_FLAGS -I${JPEG_INCLUDE_DIR}) diff --git a/builder/dockerfile.ubuntu_focal.build b/builder/dockerfile.ubuntu_focal.build index 5925c92..0645c0d 100644 --- a/builder/dockerfile.ubuntu_focal.build +++ b/builder/dockerfile.ubuntu_focal.build @@ -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 libjpeg-dev vim wget +RUN apt-get update && apt-get -y install cmake git vim wget RUN apt-get update && apt-get -y install libpng-dev libtiff-dev libgif-dev libavcodec-dev libssl-dev libxrandr-dev libxcursor-dev # Additions for webp @@ -22,6 +22,10 @@ RUN cd /tmp/libwebp-1.0.2 && \ ./configure --enable-static --disable-shared && \ make && make install +RUN apt-get update && apt-get install -y cmake nasm gcc +RUN git clone https://github.com/libjpeg-turbo/libjpeg-turbo.git +RUN export MAKEFLAGS=-j`nproc`; export CFLAGS="-fno-semantic-interposition -fpic -flto"; cd libjpeg-turbo && cmake -DCMAKE_INSTALL_PREFIX=/usr/ -G"Unix Makefiles" && make && make install + RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo COPY --chown=docker:docker . /src/