Ports: Add libjxl :^)

This commit is contained in:
Lucas CHOLLET 2023-09-11 13:56:09 +02:00 committed by Tim Schumacher
parent 48a1fe8308
commit e62a4c169b
Notes: sideshowbarker 2024-07-17 06:33:00 +09:00
4 changed files with 80 additions and 0 deletions

View file

@ -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/ |

34
Ports/libjxl/package.sh Executable file
View file

@ -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
}

View file

@ -0,0 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lucas CHOLLET <lucas.chollet@free.fr>
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<const uint8_t> 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<boolean>(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<boolean>(params.optimize_coding);
if (cinfo.input_components == 3) {
JXL_RETURN_IF_ERROR(
SetChromaSubsampling(params.chroma_subsampling, &cinfo));

View file

@ -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.