summary refs log tree commit diff
path: root/pkgs/development/libraries/opencv/3.x.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/opencv/3.x.nix')
-rw-r--r--pkgs/development/libraries/opencv/3.x.nix19
1 files changed, 17 insertions, 2 deletions
diff --git a/pkgs/development/libraries/opencv/3.x.nix b/pkgs/development/libraries/opencv/3.x.nix
index 49574a4b421b..1d3a9629fd0c 100644
--- a/pkgs/development/libraries/opencv/3.x.nix
+++ b/pkgs/development/libraries/opencv/3.x.nix
@@ -167,7 +167,7 @@ stdenv.mkDerivation rec {
   '';
 
   preConfigure =
-    installExtraFiles ippicv + (
+    lib.optionalString enableIpp (installExtraFiles ippicv) + (
     lib.optionalString buildContrib ''
       cmakeFlagsArray+=("-DOPENCV_EXTRA_MODULES_PATH=$NIX_BUILD_TOP/opencv_contrib")
 
@@ -254,13 +254,28 @@ stdenv.mkDerivation rec {
     make doxygen
   '';
 
+  # By default $out/lib/pkgconfig/opencv.pc looks something like this:
+  #
+  #   prefix=/nix/store/10pzq1a8fkh8q4sysj8n6mv0w0nl0miq-opencv-3.4.1
+  #   exec_prefix=${prefix}
+  #   libdir=${exec_prefix}//nix/store/10pzq1a8fkh8q4sysj8n6mv0w0nl0miq-opencv-3.4.1/lib
+  #   ...
+  #   Libs: -L${exec_prefix}//nix/store/10pzq1a8fkh8q4sysj8n6mv0w0nl0miq-opencv-3.4.1/lib ...
+  #
+  # Note that ${exec_prefix} is set to $out but that $out is also appended to
+  # ${exec_prefix}. This causes linker errors in downstream packages so we strip
+  # of $out after the ${exec_prefix} prefix:
+  postInstall = ''
+    sed -i "s|\''${exec_prefix}/$out|\''${exec_prefix}|" "$out/lib/pkgconfig/opencv.pc"
+  '';
+
   hardeningDisable = [ "bindnow" "relro" ];
 
   passthru = lib.optionalAttrs enablePython { pythonPath = []; };
 
   meta = {
     description = "Open Computer Vision Library with more than 500 algorithms";
-    homepage = http://opencv.org/;
+    homepage = https://opencv.org/;
     license = with stdenv.lib.licenses; if enableUnfree then unfree else bsd3;
     maintainers = with stdenv.lib.maintainers; [viric mdaiter basvandijk];
     platforms = with stdenv.lib.platforms; linux ++ darwin;