@@ -1,10 +1,18 @@
1−{ lib, stdenv, fetchFromGitHub, cmake, nasm
1+{ lib
2+, stdenv
3+, fetchFromGitHub
4+, cmake
5+, nasm
26, openjdk
37, enableJava ? false # whether to build the java wrapper
8+, enableJpeg7 ? false # whether to build libjpeg with v7 compatibility
9+, enableJpeg8 ? false # whether to build libjpeg with v8 compatibility
410, enableStatic ? stdenv.hostPlatform.isStatic
511, enableShared ? !stdenv.hostPlatform.isStatic
612}:
713
14+assert !(enableJpeg7 && enableJpeg8); # pick only one or none, not both
15+
816stdenv.mkDerivation rec {
917
1018 pname = "libjpeg-turbo";
@@ -20,7 +28,7 @@ stdenv.mkDerivation rec {
2028 # This is needed by freeimage
2129 patches = [ ./0001-Compile-transupp.c-as-part-of-the-library.patch ]
2230 ++ lib.optional (stdenv.hostPlatform.libc or null == "msvcrt")
23− ./mingw-boolean.patch;
31+ ./mingw-boolean.patch;
2432
2533 outputs = [ "bin" "dev" "dev_private" "out" "man" "doc" ];
2634
@@ -40,6 +48,10 @@ stdenv.mkDerivation rec {
4048 "-DENABLE_SHARED=${if enableShared then "1" else "0"}"
4149 ] ++ lib.optionals enableJava [
4250 "-DWITH_JAVA=1"
51+ ] ++ lib.optionals enableJpeg7 [
52+ "-DWITH_JPEG7=1"
53+ ] ++ lib.optionals enableJpeg8 [
54+ "-DWITH_JPEG8=1"
4355 ] ++ lib.optionals stdenv.hostPlatform.isRiscV [
4456 # https://github.com/libjpeg-turbo/libjpeg-turbo/issues/428
4557 # https://github.com/libjpeg-turbo/libjpeg-turbo/commit/88bf1d16786c74f76f2e4f6ec2873d092f577c75
@@ -53,7 +65,7 @@ stdenv.mkDerivation rec {
5365 homepage = "https://libjpeg-turbo.org/";
5466 description = "A faster (using SIMD) libjpeg implementation";
5567 license = licenses.ijg; # and some parts under other BSD-style licenses
56− maintainers = with maintainers; [ vcunat colemickens ];
68+ maintainers = with maintainers; [ vcunat colemickens kamadorueda ];
5769 platforms = platforms.all;
5870 };
5971}