libjxl: Use own libhwy package, fix RISC-V build

This commit is contained in:
Zhaofeng Li 2022-01-08 17:59:14 -08:00
parent e7239d0e8a
commit ad7c7d6323

View file

@ -8,6 +8,7 @@
, giflib , giflib
, gperftools , gperftools
, gtest , gtest
, libhwy
, libjpeg , libjpeg
, libpng , libpng
, libwebp , libwebp
@ -37,19 +38,16 @@ stdenv.mkDerivation rec {
url = "https://github.com/libjxl/libjxl/commit/88fe3fff3dc70c72405f57c69feffd9823930034.patch"; url = "https://github.com/libjxl/libjxl/commit/88fe3fff3dc70c72405f57c69feffd9823930034.patch";
sha256 = "1419fyiq4srpj72cynwyvqy8ldi7vn9asvkp5fsbmiqkyhb15jpk"; sha256 = "1419fyiq4srpj72cynwyvqy8ldi7vn9asvkp5fsbmiqkyhb15jpk";
}) })
];
postPatch = ''
# "robust statistics" have been removed in upstream mainline as they are # "robust statistics" have been removed in upstream mainline as they are
# conidered to cause "interoperability problems". sure enough the tests # conidered to cause "interoperability problems". sure enough the tests
# fail with precision issues on aarch64. # fail with precision issues on aarch64.
sed -i '/robust_statistics_test.cc/d' lib/{jxl_tests.cmake,lib.gni} (fetchpatch {
'' + lib.optionalString stdenv.isDarwin '' name = "remove-robust-and-descriptive-statistics.patch";
# hydra's darwin machines run into https://github.com/libjxl/libjxl/issues/408 url = "https://github.com/libjxl/libjxl/commit/204f87a5e4d684544b13900109abf040dc0b402b.patch";
# unless we disable highway's tests sha256 = "sha256-DoAaYWLmQ+R9GZbHMTYGe0gBL9ZesgtB+2WhmbARna8=";
substituteInPlace third_party/highway/CMakeLists.txt \ })
--replace 'if(BUILD_TESTING)' 'if(false)' ];
'';
nativeBuildInputs = [ nativeBuildInputs = [
asciidoc # for docs asciidoc # for docs
@ -81,6 +79,7 @@ stdenv.mkDerivation rec {
brotli brotli
giflib giflib
gperftools # provides `libtcmalloc` gperftools # provides `libtcmalloc`
libhwy
libjpeg libjpeg
libpng libpng
libwebp libwebp
@ -96,6 +95,9 @@ stdenv.mkDerivation rec {
# using the vendorered ones is easier. # using the vendorered ones is easier.
"-DJPEGXL_FORCE_SYSTEM_BROTLI=ON" "-DJPEGXL_FORCE_SYSTEM_BROTLI=ON"
# Use our version of highway, though it is still statically linked in
"-DJPEGXL_FORCE_SYSTEM_HWY=ON"
# TODO: Update this package to enable this (overridably via an option): # TODO: Update this package to enable this (overridably via an option):
# Viewer tools for evaluation. # Viewer tools for evaluation.
# "-DJPEGXL_ENABLE_VIEWERS=ON" # "-DJPEGXL_ENABLE_VIEWERS=ON"
@ -107,6 +109,8 @@ stdenv.mkDerivation rec {
# "-DJPEGXL_ENABLE_PLUGINS=ON" # "-DJPEGXL_ENABLE_PLUGINS=ON"
]; ];
LDFLAGS = lib.optionalString stdenv.hostPlatform.isRiscV "-latomic";
doCheck = true; doCheck = true;
# The test driver runs a test `LibraryCLinkageTest` which without # The test driver runs a test `LibraryCLinkageTest` which without