1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 doxygen,
7 gettext,
8 graphviz,
9 libxslt,
10 removeReferencesTo,
11 libiconv,
12 brotli,
13 expat,
14 inih,
15 zlib,
16 libxml2,
17 python3,
18 which,
19}:
20
21stdenv.mkDerivation rec {
22 pname = "exiv2";
23 version = "0.28.5";
24
25 outputs = [
26 "out"
27 "lib"
28 "dev"
29 "doc"
30 "man"
31 ];
32
33 src = fetchFromGitHub {
34 owner = "exiv2";
35 repo = "exiv2";
36 rev = "v${version}";
37 hash = "sha256-+Fe0+wkWWtM3MNgY6qp34/kC8jkOjOLusnd9WquYpA8=";
38 };
39
40 nativeBuildInputs = [
41 cmake
42 doxygen
43 gettext
44 graphviz
45 libxslt
46 removeReferencesTo
47 ];
48
49 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
50 libiconv
51 ];
52
53 propagatedBuildInputs = [
54 brotli
55 expat
56 inih
57 zlib
58 ];
59
60 nativeCheckInputs = [
61 libxml2.bin
62 python3
63 which
64 ];
65
66 cmakeFlags = [
67 "-DEXIV2_ENABLE_NLS=ON"
68 "-DEXIV2_BUILD_DOC=ON"
69 "-DEXIV2_ENABLE_BMFF=ON"
70 ];
71
72 buildFlags = [
73 "all"
74 "doc"
75 ];
76
77 doCheck = true;
78
79 preCheck = ''
80 patchShebangs ../test/
81 mkdir ../test/tmp
82 ''
83 + lib.optionalString stdenv.hostPlatform.isAarch32 ''
84 # Fix tests on arm
85 # https://github.com/Exiv2/exiv2/issues/933
86 rm -f ../tests/bugfixes/github/test_CVE_2018_12265.py
87 ''
88 + lib.optionalString stdenv.hostPlatform.isDarwin ''
89 export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH''${DYLD_LIBRARY_PATH:+:}$PWD/lib
90 export LC_ALL=C
91
92 # disable tests that requires loopback networking
93 substituteInPlace ../tests/bash_tests/testcases.py \
94 --replace "def io_test(self):" "def io_disabled(self):"
95 '';
96
97 preFixup = ''
98 remove-references-to -t ${stdenv.cc.cc} $lib/lib/*.so.*.*.* $out/bin/exiv2
99 '';
100
101 disallowedReferences = [ stdenv.cc.cc ];
102
103 # causes redefinition of _FORTIFY_SOURCE
104 hardeningDisable = [ "fortify3" ];
105
106 meta = with lib; {
107 homepage = "https://exiv2.org";
108 description = "Library and command-line utility to manage image metadata";
109 mainProgram = "exiv2";
110 platforms = platforms.all;
111 license = licenses.gpl2Plus;
112 maintainers = with maintainers; [ wegank ];
113 };
114}