summary refs log tree commit diff
path: root/pkgs/development/libraries/exiv2
diff options
context:
space:
mode:
authorworldofpeace <worldofpeace@protonmail.ch>2019-06-27 03:16:46 -0400
committerworldofpeace <worldofpeace@protonmail.ch>2019-06-27 03:16:46 -0400
commitcb77f7e227dd0953beceeebbc8f4842c51e389be (patch)
treeec370088f4208b8ee667397318a24ac4b75784c0 /pkgs/development/libraries/exiv2
parentbff22431b5b0848acd4b16cda44dbfa1137ac32e (diff)
downloadnixpkgs-cb77f7e227dd0953beceeebbc8f4842c51e389be.tar
nixpkgs-cb77f7e227dd0953beceeebbc8f4842c51e389be.tar.gz
nixpkgs-cb77f7e227dd0953beceeebbc8f4842c51e389be.tar.bz2
nixpkgs-cb77f7e227dd0953beceeebbc8f4842c51e389be.tar.lz
nixpkgs-cb77f7e227dd0953beceeebbc8f4842c51e389be.tar.xz
nixpkgs-cb77f7e227dd0953beceeebbc8f4842c51e389be.tar.zst
nixpkgs-cb77f7e227dd0953beceeebbc8f4842c51e389be.zip
exiv2: 0.26.2018.12.30 -> 0.27.1
Also run tests and remove additionally installed stuff.

Co-authored-by: periklis <periklis.tsirakidis@holidaycheck.com>
Co-authored-by: vcunat <vcunat@gmail.com>
Diffstat (limited to 'pkgs/development/libraries/exiv2')
-rw-r--r--pkgs/development/libraries/exiv2/default.nix73
-rw-r--r--pkgs/development/libraries/exiv2/fix-cmake.patch16
2 files changed, 78 insertions, 11 deletions
diff --git a/pkgs/development/libraries/exiv2/default.nix b/pkgs/development/libraries/exiv2/default.nix
index d3095099d3c..c37bacefcab 100644
--- a/pkgs/development/libraries/exiv2/default.nix
+++ b/pkgs/development/libraries/exiv2/default.nix
@@ -1,28 +1,79 @@
-{ stdenv, fetchFromGitHub, zlib, expat, gettext
-, autoconf }:
+{ stdenv
+, fetchFromGitHub
+, zlib
+, expat
+, cmake
+, which
+, libxml2
+, python3
+, gettext
+}:
 
 stdenv.mkDerivation rec {
-  name = "exiv2-0.26.2018.12.30";
+  pname = "exiv2";
+  version = "0.27.1";
 
-    #url = "https://www.exiv2.org/builds/${name}-trunk.tar.gz";
   src = fetchFromGitHub rec {
     owner = "exiv2";
     repo  = "exiv2";
-    rev = "f5d0b25"; # https://github.com/Exiv2/exiv2/commits/0.26
-    sha256 = "1blaz3g8dlij881g14nv2nsgr984wy6ypbwgi2pixk978p0gm70i";
+    rev = version;
+    sha256 = "0b5m921070fkyif0zlyb49gly3p6xd0hv1jyym4j25hx12gzbx0c";
   };
 
-  postPatch = "patchShebangs ./src/svn_version.sh";
-
-  preConfigure = "make config"; # needed because not using tarball
+  patches = [
+    # https://github.com/Exiv2/exiv2/commit/aae88060ca85a483cd7fe791ba116c04d96c0bf9#comments
+    ./fix-cmake.patch
+  ];
 
   outputs = [ "out" "dev" ];
 
   nativeBuildInputs = [
+    cmake
     gettext
-    autoconf # needed because not using tarball
   ];
-  propagatedBuildInputs = [ zlib expat ];
+
+  propagatedBuildInputs = [
+    expat
+    zlib
+  ];
+
+  checkInputs = [
+    libxml2.bin
+    python3
+    which
+  ];
+
+  doCheck = stdenv.isLinux;
+
+  # 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)"
+
+    # Fix tests on Aarch64
+    ${stdenv.lib.optionalString stdenv.isAarch64 ''
+      rm -f ../tests/bugfixes/github/test_CVE_2018_12265.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;
 
   meta = with stdenv.lib; {
     homepage = https://www.exiv2.org/;
diff --git a/pkgs/development/libraries/exiv2/fix-cmake.patch b/pkgs/development/libraries/exiv2/fix-cmake.patch
new file mode 100644
index 00000000000..1e19aed8b90
--- /dev/null
+++ b/pkgs/development/libraries/exiv2/fix-cmake.patch
@@ -0,0 +1,16 @@
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 34087004..41b3a068 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -239,9 +239,9 @@ install(FILES
+     ${CMAKE_BINARY_DIR}/exiv2lib_export.h
+     DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/exiv2)
+ 
+-install(EXPORT exiv2Config DESTINATION "${CMAKE_INSTALL_LIBDIR}/exiv2/cmake")
++install(EXPORT exiv2Config DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/exiv2")
+ 
+-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/exiv2ConfigVersion.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/exiv2/cmake")
++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/exiv2ConfigVersion.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/exiv2")
+ 
+ # ******************************************************************************
+ # exiv2 application