Merge pull request #40286 from LumiGuide/opencv.pc

opencv3: fix $out/lib/pkgconfig/opencv.pc
This commit is contained in:
Peter Simons 2018-05-10 15:08:47 +02:00 committed by GitHub
commit 16517b81cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -254,6 +254,21 @@ stdenv.mkDerivation rec {
make doxygen 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" ]; hardeningDisable = [ "bindnow" "relro" ];
passthru = lib.optionalAttrs enablePython { pythonPath = []; }; passthru = lib.optionalAttrs enablePython { pythonPath = []; };