From 6a16b2856df977732b24d8f915a454dd4f897eb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Novomesk=C3=BD?= <52529860+novomesk@users.noreply.github.com> Date: Thu, 18 Nov 2021 23:19:16 +0100 Subject: [PATCH] kimageformats: build libjxl and JXL Qt plug-in (#6854) --- projects/kimageformats/Dockerfile | 1 + projects/kimageformats/build.sh | 10 +++++++++- projects/kimageformats/kimgio_fuzzer.cc | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/projects/kimageformats/Dockerfile b/projects/kimageformats/Dockerfile index e082c75f3..5addc4f78 100644 --- a/projects/kimageformats/Dockerfile +++ b/projects/kimageformats/Dockerfile @@ -26,6 +26,7 @@ RUN git clone --depth 1 -b v3.2.0 https://aomedia.googlesource.com/aom RUN git clone --depth 1 -b v0.9.3 https://github.com/AOMediaCodec/libavif.git RUN git clone --depth 1 https://github.com/strukturag/libde265.git RUN git clone --depth 1 https://github.com/strukturag/libheif.git +RUN git clone --depth=1 --branch v0.6.x --recursive https://github.com/libjxl/libjxl.git COPY build.sh $SRC COPY kimgio_fuzzer.cc $SRC WORKDIR kimageformats diff --git a/projects/kimageformats/build.sh b/projects/kimageformats/build.sh index 537056e47..39b8f891a 100644 --- a/projects/kimageformats/build.sh +++ b/projects/kimageformats/build.sh @@ -83,11 +83,19 @@ cmake -DBUILD_SHARED_LIBS=OFF -DWITH_AOM=ON -DWITH_DAV1D=OFF -DWITH_EXAMPLES=OFF make -j$(nproc) make install -j$(nproc) +cd $SRC +cd libjxl +mkdir build +cd build +CXXFLAGS="$CXXFLAGS -DHWY_COMPILE_ONLY_SCALAR" cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DJPEGXL_BUNDLE_SKCMS=ON -DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_ENABLE_EXAMPLES=OFF -DJPEGXL_ENABLE_JNI=OFF -DJPEGXL_ENABLE_MANPAGES=OFF -DJPEGXL_ENABLE_OPENEXR=OFF -DJPEGXL_ENABLE_PLUGINS=OFF -DJPEGXL_ENABLE_SJPEG=OFF -DJPEGXL_ENABLE_SKCMS=ON -DJPEGXL_ENABLE_TCMALLOC=OFF -DJPEGXL_ENABLE_TOOLS=OFF .. +make -j$(nproc) jxl-static jxl_threads-static + cd $SRC cd kimageformats HANDLER_TYPES="ANIHandler ani QAVIFHandler avif HEIFHandler heif + QJpegXLHandler jxl KraHandler kra OraHandler ora PCXHandler pcx @@ -103,7 +111,7 @@ echo "$HANDLER_TYPES" | while read class format; do fuzz_target_name=kimgio_${format}_fuzzer $SRC/qtbase/bin/moc $SRC/kimageformats/src/imageformats/$format.cpp -o $format.moc - $CXX $CXXFLAGS -fPIC -DHANDLER=$class -std=c++17 $SRC/kimgio_fuzzer.cc $SRC/kimageformats/src/imageformats/$format.cpp -o $OUT/$fuzz_target_name -I $SRC/qtbase/include/QtCore/ -I $SRC/qtbase/include/ -I $SRC/qtbase/include//QtGui -I $SRC/kimageformats/src/imageformats/ -I $SRC/karchive/src/ -I $SRC/qtbase/mkspecs/linux-clang-libc++/ -I $SRC/libavif/include/ -I . -L $SRC/qtbase/lib $SRC/libavif/build/libavif.a /usr/local/lib/libheif.a /usr/local/lib/liblibde265.a $SRC/aom/build.libavif/libaom.a -lQt5Gui -lQt5Core -lqtlibpng -lqtharfbuzz -lm -lqtpcre2 -ldl -lpthread $LIB_FUZZING_ENGINE /usr/local/lib/libzip.a /usr/local/lib/libz.a -lKF5Archive /usr/local/lib/libz.a + $CXX $CXXFLAGS -fPIC -DHANDLER=$class -std=c++17 $SRC/kimgio_fuzzer.cc $SRC/kimageformats/src/imageformats/$format.cpp -o $OUT/$fuzz_target_name -DJXL_STATIC_DEFINE -DJXL_THREADS_STATIC_DEFINE -I $SRC/qtbase/include/QtCore/ -I $SRC/qtbase/include/ -I $SRC/qtbase/include//QtGui -I $SRC/kimageformats/src/imageformats/ -I $SRC/karchive/src/ -I $SRC/qtbase/mkspecs/linux-clang-libc++/ -I $SRC/libavif/include/ -I $SRC/libjxl/build/lib/include/ -I $SRC/libjxl/lib/include/ -I . -L $SRC/qtbase/lib $SRC/libavif/build/libavif.a /usr/local/lib/libheif.a /usr/local/lib/liblibde265.a $SRC/aom/build.libavif/libaom.a $SRC/libjxl/build/lib/libjxl_threads.a $SRC/libjxl/build/lib/libjxl.a $SRC/libjxl/build/third_party/highway/libhwy.a $SRC/libjxl/build/third_party/brotli/libbrotlidec-static.a $SRC/libjxl/build/third_party/brotli/libbrotlienc-static.a $SRC/libjxl/build/third_party/brotli/libbrotlicommon-static.a -lQt5Gui -lQt5Core -lqtlibpng -lqtharfbuzz -lm -lqtpcre2 -ldl -lpthread $LIB_FUZZING_ENGINE /usr/local/lib/libzip.a /usr/local/lib/libz.a -lKF5Archive /usr/local/lib/libz.a find . -name "*.${format}" | zip -q $OUT/${fuzz_target_name}_seed_corpus.zip -@ ) diff --git a/projects/kimageformats/kimgio_fuzzer.cc b/projects/kimageformats/kimgio_fuzzer.cc index 5fe9cc6b5..368176622 100644 --- a/projects/kimageformats/kimgio_fuzzer.cc +++ b/projects/kimageformats/kimgio_fuzzer.cc @@ -20,7 +20,7 @@ Usage: python infra/helper.py build_image kimageformats python infra/helper.py build_fuzzers --sanitizer undefined|address|memory kimageformats - python infra/helper.py run_fuzzer kimageformats kimgio_[ani|avif|heif|kra|ora|pcx|pic|psd|ras|rgb|tga|xcf]_fuzzer + python infra/helper.py run_fuzzer kimageformats kimgio_[ani|avif|heif|jxl|kra|ora|pcx|pic|psd|ras|rgb|tga|xcf]_fuzzer */ @@ -31,6 +31,7 @@ #include "ani_p.h" #include "avif_p.h" #include "heif_p.h" +#include "jxl_p.h" #include "kra.h" #include "ora.h" #include "pcx_p.h"