1 { stdenv, lib, fetchFromGitHub
22 stdenv.mkDerivation rec {
26 outputs = [ "out" "dev" ];
28 src = fetchFromGitHub {
32 sha256 = "sha256-fTK5hyU9PZ6nigMsfzVugwviihgAXfEcLF+l+n5h+54=";
33 # There are various submodules in `third_party/`.
34 fetchSubmodules = true;
38 # present in master, see https://github.com/libjxl/libjxl/pull/1403
40 name = "prefixless-pkg-config.patch";
41 url = "https://github.com/libjxl/libjxl/commit/0b906564bfbfd8507d61c5d6a447f545f893227c.patch";
42 sha256 = "1g5c6lrsmgxb9j64pjy8lbdgbvw834m5jyfivy9ppmd8iiv0kkq4";
45 # present in master, remove after 0.7?
47 name = "fix-link-lld-macho.patch";
48 url = "https://github.com/libjxl/libjxl/commit/88fe3fff3dc70c72405f57c69feffd9823930034.patch";
49 sha256 = "1419fyiq4srpj72cynwyvqy8ldi7vn9asvkp5fsbmiqkyhb15jpk";
52 # "robust statistics" have been removed in upstream mainline as they are
53 # conidered to cause "interoperability problems". sure enough the tests
54 # fail with precision issues on aarch64.
56 name = "remove-robust-and-descriptive-statistics.patch";
57 url = "https://github.com/libjxl/libjxl/commit/204f87a5e4d684544b13900109abf040dc0b402b.patch";
58 sha256 = "sha256-DoAaYWLmQ+R9GZbHMTYGe0gBL9ZesgtB+2WhmbARna8=";
61 # fix build with asciidoc wrapped in shell script
63 url = "https://github.com/libjxl/libjxl/commit/b8ec58c58c6281987f42ebec892f513824c0cc0e.patch";
64 hash = "sha256-g8U+YVhLfgSHJ+PWJgvVOI66+FElJSC8IgSRodNnsMw=";
67 url = "https://github.com/libjxl/libjxl/commit/ca8e276aacf63a752346a6a44ba673b0af993237.patch";
68 excludes = [ "AUTHORS" ];
69 hash = "sha256-9VXy1LdJ0JhYbCGPNMySpnGLBxUrr8BYzE+oU3LnUGw=";
77 ] ++ lib.optionals buildDocs [
83 depsBuildBuild = lib.optionals buildDocs [
87 # Functionality not currently provided by this package
88 # that the cmake build can apparently use:
89 # OpenGL/GLUT (for Examples -> comparison with sjpeg)
90 # viewer (see `cmakeFlags`)
91 # plugins like for GDK and GIMP (see `cmakeFlags`)
94 # `libjxl` currently vendors many libraries as git submodules that they
95 # might patch often (e.g. test/gmock, see
96 # https://github.com/NixOS/nixpkgs/pull/103160#discussion_r519487734).
97 # When it has stabilised in the future, we may want to tell the build
98 # to use use nixpkgs system libraries.
100 # As of writing, libjxl does not point out all its dependencies
101 # conclusively in its README or otherwise; they can best be determined
102 # by checking the CMake output for "Could NOT find".
105 gperftools # provides `libtcmalloc`
113 propagatedBuildInputs = [
119 # For C dependencies like brotli, which are dynamically linked,
120 # we want to use the system libraries, so that we don't have to care about
121 # installing their .so files generated by this build.
122 # The other C++ dependencies are statically linked in, so there
123 # using the vendorered ones is easier.
124 "-DJPEGXL_FORCE_SYSTEM_BROTLI=ON"
126 # Use our version of highway, though it is still statically linked in
127 "-DJPEGXL_FORCE_SYSTEM_HWY=ON"
129 # TODO: Update this package to enable this (overridably via an option):
130 # Viewer tools for evaluation.
131 # "-DJPEGXL_ENABLE_VIEWERS=ON"
133 # TODO: Update this package to enable this (overridably via an option):
134 # Enable plugins, such as:
135 # * the `gdk-pixbuf` one, which allows applications like `eog` to load jpeg-xl files
136 # * the `gimp` one, which allows GIMP to load jpeg-xl files
137 # "-DJPEGXL_ENABLE_PLUGINS=ON"
138 ] ++ lib.optionals stdenv.hostPlatform.isStatic [
142 LDFLAGS = lib.optionalString stdenv.hostPlatform.isRiscV "-latomic";
144 doCheck = !stdenv.hostPlatform.isi686;
147 homepage = "https://github.com/libjxl/libjxl";
148 description = "JPEG XL image format reference implementation.";
149 license = licenses.bsd3;
150 maintainers = with maintainers; [ nh2 ];
151 platforms = platforms.all;