nixpkgs/pkgs/development/libraries/exiv2/default.nix

120 lines
2.7 KiB
Nix
Raw Normal View History

{ stdenv
, fetchFromGitHub
2020-03-20 12:00:00 +00:00
, fetchpatch
, zlib
, expat
, cmake
, which
, libxml2
, python3
, gettext
, doxygen
, graphviz
, libxslt
}:
stdenv.mkDerivation rec {
pname = "exiv2";
2019-08-25 16:49:35 +00:00
version = "0.27.2";
2019-08-13 21:52:01 +00:00
src = fetchFromGitHub {
owner = "exiv2";
repo = "exiv2";
2019-08-25 16:49:35 +00:00
rev = "v${version}";
sha256 = "0n8il52yzbmvbkryrl8waz7hd9a2fdkw8zsrmhyh63jlvmmc31gf";
};
2020-03-20 12:00:00 +00:00
patches = [
# included in next release
(fetchpatch {
name = "cve-2019-20421.patch";
2020-03-20 12:00:00 +00:00
url = "https://github.com/Exiv2/exiv2/commit/a82098f4f90cd86297131b5663c3dec6a34470e8.patch";
sha256 = "16r19qb9l5j43ixm5jqid9sdv5brlkk1wq0w79rm5agxq4kblfyc";
excludes = [ "tests/bugfixes/github/test_issue_1011.py" "test/data/Jp2Image_readMetadata_loop.poc" ];
})
];
cmakeFlags = [
"-DEXIV2_BUILD_PO=ON"
"-DEXIV2_BUILD_DOC=ON"
# the cmake package does not handle absolute CMAKE_INSTALL_INCLUDEDIR correctly
# (setting it to an absolute path causes include files to go to $out/$out/include,
# because the absolute path is interpreted with root at $out).
"-DCMAKE_INSTALL_INCLUDEDIR=include"
"-DCMAKE_INSTALL_LIBDIR=lib"
];
outputs = [ "out" "dev" "doc" "man" ];
2016-04-25 11:51:53 +00:00
nativeBuildInputs = [
cmake
doxygen
gettext
graphviz
libxslt
];
propagatedBuildInputs = [
expat
zlib
];
checkInputs = [
libxml2.bin
python3
which
];
buildFlags = [
"doc"
];
doCheck = true;
# Test setup found by inspecting ${src}/.travis/run.sh; problems without cmake.
checkTarget = "tests";
preCheck = ''
patchShebangs ../test/
mkdir ../test/tmp
export LD_LIBRARY_PATH="$(realpath ../build/lib)"
2020-05-02 04:33:29 +00:00
${stdenv.lib.optionalString (stdenv.isAarch64 || stdenv.isAarch32) ''
# Fix tests on arm
# https://github.com/Exiv2/exiv2/issues/933
rm -f ../tests/bugfixes/github/test_CVE_2018_12265.py
''}
${stdenv.lib.optionalString stdenv.isDarwin ''
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH''${DYLD_LIBRARY_PATH:+:}`pwd`/lib
# Removing tests depending on charset conversion
substituteInPlace ../test/Makefile --replace "conversions.sh" ""
rm -f ../tests/bugfixes/redmine/test_issue_460.py
rm -f ../tests/bugfixes/redmine/test_issue_662.py
''}
'';
postCheck = ''
(cd ../tests/ && python3 runner.py)
'';
# With cmake we have to enable samples or there won't be
# a tests target. This removes them.
postInstall = ''
( cd "$out/bin"
mv exiv2 .exiv2
rm *
mv .exiv2 exiv2
)
'';
enableParallelBuilding = true;
2018-08-05 18:14:27 +00:00
meta = with stdenv.lib; {
homepage = "https://www.exiv2.org/";
description = "A library and command-line utility to manage image metadata";
2018-08-05 18:14:27 +00:00
platforms = platforms.all;
license = licenses.gpl2Plus;
};
}