1{ lib
2, stdenv
3, fetchFromGitHub
4, fetchpatch
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.1";
24
25 outputs = [ "out" "lib" "dev" "doc" "man" ];
26
27 src = fetchFromGitHub {
28 owner = "exiv2";
29 repo = "exiv2";
30 rev = "v${version}";
31 hash = "sha256-Jim8vYWyCa16LAJ1GuP8cCzhXIc2ouo6hVsHg3UQbdg=";
32 };
33
34 patches = [
35 (fetchpatch {
36 url = "https://github.com/Exiv2/exiv2/commit/c351c7cce317571934abf693055779a59df30d6e.patch";
37 hash = "sha256-fWJT4IUBrAELl6ku0M1iTzGFX74le8Z0UzTJLU/gYls=";
38 })
39 ];
40
41 nativeBuildInputs = [
42 cmake
43 doxygen
44 gettext
45 graphviz
46 libxslt
47 removeReferencesTo
48 ];
49
50 buildInputs = lib.optionals stdenv.isDarwin [
51 libiconv
52 ];
53
54 propagatedBuildInputs = [
55 brotli
56 expat
57 inih
58 zlib
59 ];
60
61 nativeCheckInputs = [
62 libxml2.bin
63 python3
64 which
65 ];
66
67 cmakeFlags = [
68 "-DEXIV2_ENABLE_NLS=ON"
69 "-DEXIV2_BUILD_DOC=ON"
70 "-DEXIV2_ENABLE_BMFF=ON"
71 ];
72
73 buildFlags = [
74 "all"
75 "doc"
76 ];
77
78 doCheck = true;
79
80 preCheck = ''
81 patchShebangs ../test/
82 mkdir ../test/tmp
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 '' + lib.optionalString stdenv.isDarwin ''
88 export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH''${DYLD_LIBRARY_PATH:+:}$PWD/lib
89 export LC_ALL=C
90
91 # disable tests that requires loopback networking
92 substituteInPlace ../tests/bash_tests/testcases.py \
93 --replace "def io_test(self):" "def io_disabled(self):"
94 '';
95
96 preFixup = ''
97 remove-references-to -t ${stdenv.cc.cc} $lib/lib/*.so.*.*.* $out/bin/exiv2 $static/lib/*.a
98 '';
99
100 disallowedReferences = [ stdenv.cc.cc ];
101
102 # causes redefinition of _FORTIFY_SOURCE
103 hardeningDisable = [ "fortify3" ];
104
105 meta = with lib; {
106 homepage = "https://exiv2.org";
107 description = "A library and command-line utility to manage image metadata";
108 platforms = platforms.all;
109 license = licenses.gpl2Plus;
110 maintainers = with maintainers; [ wegank ];
111 };
112}