From e62a4c169b2611a94939f2e360bd29285c3bd74c Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Mon, 11 Sep 2023 13:56:09 +0200 Subject: [PATCH] Ports: Add libjxl :^) --- Ports/AvailablePorts.md | 1 + Ports/libjxl/package.sh | 34 +++++++++++++++++ .../0001-Explicitly-cast-to-boolean.patch | 37 +++++++++++++++++++ Ports/libjxl/patches/ReadMe.md | 8 ++++ 4 files changed, 80 insertions(+) create mode 100755 Ports/libjxl/package.sh create mode 100644 Ports/libjxl/patches/0001-Explicitly-cast-to-boolean.patch create mode 100644 Ports/libjxl/patches/ReadMe.md diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index f2ffb29ab1..b678167a3c 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -149,6 +149,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`libicu`](libicu/) | ICU | 69.1 | http://site.icu-project.org/ | | [`libjodycode`](libjodycode/) | libjodycode | 3.1 | https://github.com/jbruchon/libjodycode | | [`libjpeg`](libjpeg/) | libjpeg | 9e | https://ijg.org/ | +| [`libjxl`](libjxl/) | libjxl | 2023.09.11 | https://github.com/libjxl/libjxl | | [`libksba`](libksba/) | libksba | 1.5.1 | https://gnupg.org/software/libksba/index.html | | [`liblzf`](liblzf/) | LibLZF is a very small data compression library | 3.6 | http://software.schmorp.de/pkg/liblzf.html | | [`libmad`](libmad/) | libmad | 0.15.1b | https://www.underbit.com/products/mad/ | diff --git a/Ports/libjxl/package.sh b/Ports/libjxl/package.sh new file mode 100755 index 0000000000..9d73d4ac03 --- /dev/null +++ b/Ports/libjxl/package.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env -S bash ../.port_include.sh + +port='libjxl' +version='2023.09.11' +files=( + "git+https://github.com/libjxl/libjxl#ff8a9c1cd54d324137c1905017542ffedeacdef8" +) + +depends=( + 'brotli' + 'highway' + 'lcms2' + 'libpng' +) + +workdir='libjxl' + +configopts=( + "-DCMAKE_TOOLCHAIN_FILE=${SERENITY_BUILD_DIR}/CMakeToolchain.txt" + "-DCMAKE_BUILD_TYPE=Release" + "-DBUILD_TESTING=OFF" + "-DJPEGXL_ENABLE_BENCHMARK=OFF" + "-DJPEGXL_ENABLE_SKCMS=OFF" + "-DJPEGXL_ENABLE_SJPEG=OFF" +) +useconfigure='true' + +configure() { + run cmake "${configopts[@]}" . +} + +install() { + run make "${installopts[@]}" install +} diff --git a/Ports/libjxl/patches/0001-Explicitly-cast-to-boolean.patch b/Ports/libjxl/patches/0001-Explicitly-cast-to-boolean.patch new file mode 100644 index 0000000000..499f48ea70 --- /dev/null +++ b/Ports/libjxl/patches/0001-Explicitly-cast-to-boolean.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lucas CHOLLET +Date: Sun, 17 Sep 2023 23:18:14 +0200 +Subject: [PATCH] Explicitly cast to boolean + +This patch remove two warnings that stop the compilation. +--- + lib/extras/dec/jpg.cc | 2 +- + lib/extras/enc/jpg.cc | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/extras/dec/jpg.cc b/lib/extras/dec/jpg.cc +index 3c8a4bccfec5cf9ef6610bfcd3f621fe893b357c..8e7eed85b746922549e6abf9c982e46294ee70ab 100644 +--- a/lib/extras/dec/jpg.cc ++++ b/lib/extras/dec/jpg.cc +@@ -278,7 +278,7 @@ Status DecodeImageJPG(const Span bytes, + if (dparams && dparams->num_colors > 0) { + cinfo.quantize_colors = TRUE; + cinfo.desired_number_of_colors = dparams->num_colors; +- cinfo.two_pass_quantize = dparams->two_pass_quant; ++ cinfo.two_pass_quantize = static_cast(dparams->two_pass_quant); + cinfo.dither_mode = (J_DITHER_MODE)dparams->dither_mode; + } + +diff --git a/lib/extras/enc/jpg.cc b/lib/extras/enc/jpg.cc +index f1355bbcb7975882f37ccd7b8e5fb4b195b3f250..410a6425c521314a62fb122f3b9848df8c44c51a 100644 +--- a/lib/extras/enc/jpg.cc ++++ b/lib/extras/enc/jpg.cc +@@ -292,7 +292,7 @@ Status EncodeWithLibJpeg(const PackedImage& image, const JxlBasicInfo& info, + cinfo.input_components = info.num_color_channels; + cinfo.in_color_space = info.num_color_channels == 1 ? JCS_GRAYSCALE : JCS_RGB; + jpeg_set_defaults(&cinfo); +- cinfo.optimize_coding = params.optimize_coding; ++ cinfo.optimize_coding = static_cast(params.optimize_coding); + if (cinfo.input_components == 3) { + JXL_RETURN_IF_ERROR( + SetChromaSubsampling(params.chroma_subsampling, &cinfo)); diff --git a/Ports/libjxl/patches/ReadMe.md b/Ports/libjxl/patches/ReadMe.md new file mode 100644 index 0000000000..cc629c26d8 --- /dev/null +++ b/Ports/libjxl/patches/ReadMe.md @@ -0,0 +1,8 @@ +# Patches for libjxl on SerenityOS + +## `0001-Explicitly-cast-to-boolean.patch` + +Explicitly cast to boolean + +This patch remove two warnings that stop the compilation. +