python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / development / libraries / exiv2 / default.nix
blob1e671c7b2e7d87f5efbbac37b8a0aa31183dc495
1 { lib, stdenv
2 , fetchFromGitHub
3 , zlib
4 , expat
5 , cmake
6 , which
7 , libxml2
8 , python3
9 , gettext
10 , doxygen
11 , graphviz
12 , libxslt
13 , libiconv
14 , removeReferencesTo
17 stdenv.mkDerivation rec {
18   pname = "exiv2";
19   version = "0.27.5";
21   outputs = [ "out" "lib" "dev" "doc" "man" "static" ];
23   src = fetchFromGitHub {
24     owner = "exiv2";
25     repo  = "exiv2";
26     rev = "v${version}";
27     sha256 = "sha256-5kdzw/YzpYldfHjUSPOzu3gW2TPgxt8Oxs0LZDFphgA=";
28   };
30   nativeBuildInputs = [
31     cmake
32     doxygen
33     gettext
34     graphviz
35     libxslt
36     removeReferencesTo
37   ];
39   buildInputs = lib.optional stdenv.isDarwin libiconv;
41   propagatedBuildInputs = [
42     expat
43     zlib
44   ];
46   checkInputs = [
47     libxml2.bin
48     python3
49     which
50   ];
52   cmakeFlags = [
53     "-DEXIV2_ENABLE_NLS=ON"
54     "-DEXIV2_BUILD_DOC=ON"
55     "-DEXIV2_ENABLE_BMFF=ON"
56   ];
58   buildFlags = [
59     "all"
60     "doc"
61   ];
63   doCheck = true;
65   # Test setup found by inspecting ${src}/.travis/run.sh; problems without cmake.
66   checkTarget = "tests";
68   preCheck = ''
69     patchShebangs ../test/
70     mkdir ../test/tmp
72     ${lib.optionalString stdenv.hostPlatform.isAarch ''
73       # Fix tests on arm
74       # https://github.com/Exiv2/exiv2/issues/933
75       rm -f ../tests/bugfixes/github/test_CVE_2018_12265.py
76     ''}
78     ${lib.optionalString stdenv.isDarwin ''
79       export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH''${DYLD_LIBRARY_PATH:+:}$PWD/lib
80       # Removing tests depending on charset conversion
81       substituteInPlace ../test/Makefile --replace "conversions.sh" ""
82       rm -f ../tests/bugfixes/redmine/test_issue_460.py
83       rm -f ../tests/bugfixes/redmine/test_issue_662.py
84       rm -f ../tests/bugfixes/github/test_issue_1046.py
86       rm ../tests/bugfixes/redmine/test_issue_683.py
88       # disable tests that requires loopback networking
89       substituteInPlace  ../tests/bash_tests/testcases.py \
90         --replace "def io_test(self):" "def io_disabled(self):"
91      ''}
92   '' + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
93     export LC_ALL=C
94   '';
96   # With CMake we have to enable samples or there won't be
97   # a tests target. This removes them.
98   postInstall = ''
99     ( cd "$out/bin"
100       mv exiv2 .exiv2
101       rm *
102       mv .exiv2 exiv2
103     )
105     mkdir -p $static/lib
106     mv $lib/lib/*.a $static/lib/
108     remove-references-to -t ${stdenv.cc.cc} $lib/lib/*.so.*.*.* $out/bin/exiv2 $static/lib/*.a
109   '';
111   postFixup = ''
112     substituteInPlace "$dev"/lib/cmake/exiv2/exiv2Config.cmake --replace \
113       "set(_IMPORT_PREFIX \"$out\")" \
114       "set(_IMPORT_PREFIX \"$static\")"
115     substituteInPlace "$dev"/lib/cmake/exiv2/exiv2Config-*.cmake --replace \
116       "$lib/lib/libexiv2-xmp.a" \
117       "$static/lib/libexiv2-xmp.a"
118   '';
120   disallowedReferences = [ stdenv.cc.cc ];
122   meta = with lib; {
123     homepage = "https://exiv2.org";
124     description = "A library and command-line utility to manage image metadata";
125     platforms = platforms.all;
126     license = licenses.gpl2Plus;
127     maintainers = with maintainers; [ wegank ];
128   };