6195c7b47b
The committed-upstream-but-unreleased patch cherry-picked by this commit fixes test failures on riscv64, ia64, and ppc64.
131 lines
3.6 KiB
Nix
131 lines
3.6 KiB
Nix
{ stdenv, lib, fetchFromGitHub
|
|
, fetchpatch
|
|
, brotli
|
|
, cmake
|
|
, giflib
|
|
, gperftools
|
|
, gtest
|
|
, libhwy
|
|
, libjpeg
|
|
, libpng
|
|
, libwebp
|
|
, openexr
|
|
, pkg-config
|
|
, zlib
|
|
, buildDocs ? true
|
|
, asciidoc
|
|
, graphviz
|
|
, doxygen
|
|
, python3
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "libjxl";
|
|
version = "0.7.0";
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "libjxl";
|
|
repo = "libjxl";
|
|
rev = "v${version}";
|
|
sha256 = "sha256-9DBLQ/gMyy2ZUm7PCWYJ7XOzkgQM0cAewJZzMNo8UPs=";
|
|
# There are various submodules in `third_party/`.
|
|
fetchSubmodules = true;
|
|
};
|
|
|
|
patches = [
|
|
# present in master
|
|
(fetchpatch {
|
|
name = "fix-test-failure-on-ia64-ppc64-riscv64";
|
|
url = "https://github.com/libjxl/libjxl/commit/bb8eac5d6acec223e44cf8cc72ae02f0816de311.patch";
|
|
hash = "sha256-DuUCStWEquhWo7bOss0RgZ7ouYE4FpWrIMFywYR424s=";
|
|
})
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
gtest
|
|
pkg-config
|
|
] ++ lib.optionals buildDocs [
|
|
asciidoc
|
|
doxygen
|
|
python3
|
|
];
|
|
|
|
depsBuildBuild = lib.optionals buildDocs [
|
|
graphviz
|
|
];
|
|
|
|
# Functionality not currently provided by this package
|
|
# that the cmake build can apparently use:
|
|
# OpenGL/GLUT (for Examples -> comparison with sjpeg)
|
|
# viewer (see `cmakeFlags`)
|
|
# plugins like for GDK and GIMP (see `cmakeFlags`)
|
|
|
|
# Vendored libraries:
|
|
# `libjxl` currently vendors many libraries as git submodules that they
|
|
# might patch often (e.g. test/gmock, see
|
|
# https://github.com/NixOS/nixpkgs/pull/103160#discussion_r519487734).
|
|
# When it has stabilised in the future, we may want to tell the build
|
|
# to use use nixpkgs system libraries.
|
|
|
|
# As of writing, libjxl does not point out all its dependencies
|
|
# conclusively in its README or otherwise; they can best be determined
|
|
# by checking the CMake output for "Could NOT find".
|
|
buildInputs = [
|
|
giflib
|
|
gperftools # provides `libtcmalloc`
|
|
libjpeg
|
|
libpng
|
|
libwebp
|
|
openexr
|
|
zlib
|
|
];
|
|
|
|
propagatedBuildInputs = [
|
|
brotli
|
|
libhwy
|
|
];
|
|
|
|
cmakeFlags = [
|
|
# For C dependencies like brotli, which are dynamically linked,
|
|
# we want to use the system libraries, so that we don't have to care about
|
|
# installing their .so files generated by this build.
|
|
# The other C++ dependencies are statically linked in, so there
|
|
# using the vendorered ones is easier.
|
|
"-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):
|
|
# Viewer tools for evaluation.
|
|
# "-DJPEGXL_ENABLE_VIEWERS=ON"
|
|
|
|
# TODO: Update this package to enable this (overridably via an option):
|
|
# Enable plugins, such as:
|
|
# * the `gdk-pixbuf` one, which allows applications like `eog` to load jpeg-xl files
|
|
# * the `gimp` one, which allows GIMP to load jpeg-xl files
|
|
# "-DJPEGXL_ENABLE_PLUGINS=ON"
|
|
] ++ lib.optionals stdenv.hostPlatform.isStatic [
|
|
"-DJPEGXL_STATIC=ON"
|
|
] ++ lib.optionals stdenv.hostPlatform.isAarch32 [
|
|
"-DJPEGXL_FORCE_NEON=ON"
|
|
];
|
|
|
|
LDFLAGS = lib.optionalString stdenv.hostPlatform.isRiscV "-latomic";
|
|
CXXFLAGS = lib.optionalString stdenv.hostPlatform.isAarch32 "-mfp16-format=ieee";
|
|
|
|
# FIXME x86_64-darwin:
|
|
# https://github.com/NixOS/nixpkgs/pull/204030#issuecomment-1352768690
|
|
doCheck = with stdenv; !(hostPlatform.isi686 || isDarwin && isx86_64);
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/libjxl/libjxl";
|
|
description = "JPEG XL image format reference implementation.";
|
|
license = licenses.bsd3;
|
|
maintainers = with maintainers; [ nh2 ];
|
|
platforms = platforms.all;
|
|
};
|
|
}
|