1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 autoreconfHook,
6 lcms2,
7 pkg-config,
8
9 # for passthru.tests
10 freeimage,
11 hdrmerge,
12 imagemagick,
13 python3,
14}:
15
16stdenv.mkDerivation rec {
17 pname = "libraw";
18 version = "0.21.4";
19
20 src = fetchFromGitHub {
21 owner = "LibRaw";
22 repo = "LibRaw";
23 rev = version;
24 hash = "sha256-JAGIM7A9RbK22F8KczRcb+29t4fDDXzoCA3a4s/z6Q8=";
25 };
26
27 outputs = [
28 "out"
29 "lib"
30 "dev"
31 "doc"
32 ];
33
34 propagatedBuildInputs = [ lcms2 ];
35
36 nativeBuildInputs = [
37 autoreconfHook
38 pkg-config
39 ];
40
41 enableParallelBuilding = true;
42
43 postPatch = lib.optionalString stdenv.hostPlatform.isFreeBSD ''
44 substituteInPlace libraw*.pc.in --replace-fail -lstdc++ ""
45 '';
46
47 passthru.tests = {
48 inherit imagemagick hdrmerge; # freeimage
49 inherit (python3.pkgs) rawkit;
50 };
51
52 meta = with lib; {
53 description = "Library for reading RAW files obtained from digital photo cameras (CRW/CR2, NEF, RAF, DNG, and others)";
54 homepage = "https://www.libraw.org/";
55 license = with licenses; [
56 cddl
57 lgpl2Plus
58 ];
59 platforms = platforms.unix;
60 };
61}