opencv2: don't build unfree libraries by default

In opencv 2.x, unfree libraries are built by default.  The package
should therefore have been marked as unfree, but wasn't.

I've disabled the non-free libraries by default, and added an option
to enable them.  There are three programs in Nixpkgs that depend on
opencv2: mathematica, pfstools, and p2pvc.  pfstools requires the
non-free libraries if it's built with opencv support, so I've disabled
opencv by default there and added an option to enable it.  p2pvc links
fine, so presumably doesn't need the non-free libraries.  I can't test
mathematica, so I'm just going to leave it alone.
This commit is contained in:
Alyssa Ross 2021-09-27 13:57:14 +00:00
parent 0d19d263fe
commit d69583c6c2
4 changed files with 19 additions and 5 deletions

View File

@ -1059,6 +1059,16 @@ Superuser created successfully.
changelog</link>.
</para>
</listitem>
<listitem>
<para>
<literal>opencv2</literal> no longer includes the non-free
libraries by default, and consequently
<literal>pfstools</literal> no longer includes OpenCV support
by default. Both packages now support an
<literal>enableUnfree</literal> option to re-enable this
functionality.
</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="sec-release-21.11-notable-changes">

View File

@ -331,6 +331,8 @@ In addition to numerous new and upgraded packages, this release has the followin
respectively. As a result `services.datadog-agent` has had breaking changes to the
configuration file. For details, see the [upstream changelog](https://github.com/DataDog/datadog-agent/blob/main/CHANGELOG.rst).
- `opencv2` no longer includes the non-free libraries by default, and consequently `pfstools` no longer includes OpenCV support by default. Both packages now support an `enableUnfree` option to re-enable this functionality.
## Other Notable Changes {#sec-release-21.11-notable-changes}

View File

@ -9,6 +9,7 @@
, enableFfmpeg ? false, ffmpeg
, enableGStreamer ? false, gst_all_1
, enableEigen ? true, eigen
, enableUnfree ? false
, Cocoa, QTKit
}:
@ -67,7 +68,7 @@ stdenv.mkDerivation rec {
(opencvFlag "PNG" enablePNG)
(opencvFlag "OPENEXR" enableEXR)
(opencvFlag "GSTREAMER" enableGStreamer)
];
] ++ lib.optional (!enableUnfree) "-DBUILD_opencv_nonfree=OFF";
hardeningDisable = [ "bindnow" "relro" ];
@ -82,7 +83,7 @@ stdenv.mkDerivation rec {
meta = with lib; {
description = "Open Computer Vision Library with more than 500 algorithms";
homepage = "https://opencv.org/";
license = licenses.bsd3;
license = if enableUnfree then licenses.unfree else licenses.bsd3;
maintainers = with maintainers; [ ];
platforms = platforms.linux;
};

View File

@ -1,6 +1,7 @@
{ lib, stdenv, mkDerivation, fetchurl, cmake, pkg-config, darwin
, openexr, zlib, imagemagick6, libGLU, libGL, freeglut, fftwFloat
, fftw, gsl, libexif, perl, opencv2, qtbase, netpbm
, fftw, gsl, libexif, perl, qtbase, netpbm
, enableUnfree ? false, opencv2
}:
mkDerivation rec {
@ -28,12 +29,12 @@ mkDerivation rec {
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [
openexr zlib imagemagick6 fftwFloat
fftw gsl libexif perl opencv2 qtbase netpbm
fftw gsl libexif perl qtbase netpbm
] ++ (if stdenv.isDarwin then (with darwin.apple_sdk.frameworks; [
OpenGL GLUT
]) else [
libGLU libGL freeglut
]);
]) ++ lib.optional enableUnfree (opencv2.override { enableUnfree = true; });
patches = [ ./threads.patch ./pfstools.patch ./pfsalign.patch ];