Skip to content

Commit

Permalink
docker: enable ccache for libjxl
Browse files Browse the repository at this point in the history
Pass -DCMAKE_<LANG>_COMPILER_LAUNCHER=ccache
to libjxl to make it use ccache as well,
and put that cache in the rsync cache daemon
along with the other cache.
  • Loading branch information
pjonsson committed Oct 12, 2024
1 parent 2a0c558 commit 4ca5a6b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
21 changes: 19 additions & 2 deletions docker/ubuntu-full/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,31 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
. /buildscripts/bh-set-envvars.sh \
&& apt-get update -y \
&& apt-get install -y --fix-missing --no-install-recommends libgflags-dev${APT_ARCH_SUFFIX}
RUN git clone https://github.com/libjxl/libjxl.git --recursive \
RUN --mount=type=cache,id=ubuntu-full-libjxl,target=$HOME/.cache \
git clone https://github.com/libjxl/libjxl.git --recursive \
&& if [ -n "${RSYNC_REMOTE:-}" ]; then \
echo "Downloading cache..."; \
rsync -ra "${RSYNC_REMOTE}/libjxl/${GCC_ARCH}/" "$HOME/.cache/"; \
echo "Finished"; \
fi \
&& if [ -n "${WITH_CCACHE:-}" ]; then \
ccache -M 100M; \
fi \
&& cd libjxl \
&& mkdir build \
&& cd build \
&& cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DJPEGXL_ENABLE_JPEGLI_LIBJPEG=OFF -DBUILD_TESTING=OFF -DJPEGXL_ENABLE_TOOLS=OFF -DJPEGXL_ENABLE_BENCHMARK=OFF .. \
&& cmake -G Ninja $CCACHE_PARAM -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DJPEGXL_ENABLE_JPEGLI_LIBJPEG=OFF -DBUILD_TESTING=OFF -DJPEGXL_ENABLE_TOOLS=OFF -DJPEGXL_ENABLE_BENCHMARK=OFF .. \
&& ninja \
&& ninja install \
&& DESTDIR="/build_thirdparty" ninja install \
&& if [ -n "${RSYNC_REMOTE:-}" ]; then \
echo "Uploading cache..."; \
rsync -ra --delete "$HOME/.cache/" "${RSYNC_REMOTE}/libjxl/${GCC_ARCH}/"; \
echo "Finished"; \
fi \
&& if [ -n "${WITH_CCACHE:-}" ]; then \
ccache -s; \
fi \
&& rm -f /lib/${GCC_ARCH}-linux-gnu/libjxl*.a \
&& rm -f /build_thirdparty/lib/${GCC_ARCH}-linux-gnu/libjxl*.a \
&& cd ../.. \
Expand Down
1 change: 1 addition & 0 deletions docker/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ else
mkdir -p "${HOST_CACHE_DIR}/${TARGET_IMAGE}/proj/"{x86_64,aarch64}
mkdir -p "${HOST_CACHE_DIR}/${TARGET_IMAGE}/gdal/"{x86_64,aarch64}
mkdir -p "${HOST_CACHE_DIR}/${TARGET_IMAGE}/kealib/"{x86_64,aarch64}
mkdir -p "${HOST_CACHE_DIR}/${TARGET_IMAGE}/libjxl/"{x86_64,aarch64}
mkdir -p "${HOST_CACHE_DIR}/${TARGET_IMAGE}/libqb3/"{x86_64,aarch64}
mkdir -p "${HOST_CACHE_DIR}/${TARGET_IMAGE}/"mongo-{c,cxx}-driver/{x86_64,aarch64}
mkdir -p "${HOST_CACHE_DIR}/${TARGET_IMAGE}/spatialite"
Expand Down

0 comments on commit 4ca5a6b

Please sign in to comment.