Merge pull request #336141 from emilazy/push-uztymzmukyyk

opencv{2,3}: drop
This commit is contained in:
Sandro 2024-08-22 09:14:40 +02:00 committed by GitHub
commit 11b26f016e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 15 additions and 895 deletions

View file

@ -326,6 +326,10 @@
- The `lsh` package and the `services.lshd` module have been removed as they had no maintainer in Nixpkgs and hadnt seen an upstream release in over a decade. It is recommended to migrate to `openssh` and `services.openssh`.
- `opencv2` and `opencv3` have been removed, as they are obsolete and
were not used by any other package. External users are encouraged to
migrate to OpenCV 4.
## Other Notable Changes {#sec-release-24.11-notable-changes}
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->

View file

@ -2,7 +2,7 @@
lib,
fetchFromGitHub,
bambu-studio,
opencv2,
opencv,
}:
bambu-studio.overrideAttrs (
finalAttrs: previousAttrs: {
@ -28,7 +28,7 @@ bambu-studio.overrideAttrs (
buildInputs =
previousAttrs.buildInputs
++ [
opencv2
opencv
];
preFixup = ''

View file

@ -1,132 +0,0 @@
{ lib
, patchelf
, requireFile
, stdenv
# arguments from default.nix
, lang
, meta
, name
, src
, version
# dependencies
, alsa-lib
, coreutils
, cudaPackages
, fontconfig
, freetype
, gcc
, glib
, libuuid
, libxml2
, ncurses
, opencv2
, openssl
, unixODBC
, xorg
# options
, cudaSupport
}:
let
platform =
if stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux" then
"Linux"
else
throw "Mathematica requires i686-linux or x86_64 linux";
in
stdenv.mkDerivation rec {
inherit meta src version;
pname = "mathematica";
buildInputs = [
coreutils
patchelf
alsa-lib
coreutils
fontconfig
freetype
gcc.cc
gcc.libc
glib
ncurses
opencv2
openssl
unixODBC
libxml2
libuuid
] ++ (with xorg; [
libX11
libXext
libXtst
libXi
libXmu
libXrender
libxcb
libXcursor
libXfixes
libXrandr
libICE
libSM
]);
ldpath = lib.makeLibraryPath buildInputs
+ lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
(":" + lib.makeSearchPathOutput "lib" "lib64" buildInputs);
dontConfigure = true;
dontBuild = true;
unpackPhase = ''
echo "=== Extracting makeself archive ==="
# find offset from file
offset=$(${stdenv.shell} -c "$(grep -axm1 -e 'offset=.*' $src); echo \$offset" $src)
dd if="$src" ibs=$offset skip=1 | tar -xf -
cd Unix
'';
installPhase = ''
cd Installer
# don't restrict PATH, that has already been done
sed -i -e 's/^PATH=/# PATH=/' MathInstaller
echo "=== Running MathInstaller ==="
./MathInstaller -auto -createdir=y -execdir=$out/bin -targetdir=$out/libexec/Mathematica -platforms=${platform} -silent
'';
preFixup = ''
echo "=== PatchElfing away ==="
# This code should be a bit forgiving of errors, unfortunately
set +e
find $out/libexec/Mathematica/SystemFiles -type f -perm -0100 | while read f; do
type=$(readelf -h "$f" 2>/dev/null | grep 'Type:' | sed -e 's/ *Type: *\([A-Z]*\) (.*/\1/')
if [ -z "$type" ]; then
:
elif [ "$type" == "EXEC" ]; then
echo "patching $f executable <<"
patchelf --shrink-rpath "$f"
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \
"$f" \
&& patchelf --shrink-rpath "$f" \
|| echo unable to patch ... ignoring 1>&2
elif [ "$type" == "DYN" ]; then
echo "patching $f library <<"
patchelf \
--set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \
"$f" \
&& patchelf --shrink-rpath "$f" \
|| echo unable to patch ... ignoring 1>&2
else
echo "not patching $f <<: unknown elf type"
fi
done
'';
# all binaries are already stripped
dontStrip = true;
# we did this in prefixup already
dontPatchELF = true;
}

View file

@ -1,146 +0,0 @@
{ lib
, patchelf
, requireFile
, stdenv
# arguments from default.nix
, lang
, meta
, name
, src
, version
# dependencies
, alsa-lib
, coreutils
, cudaPackages
, dbus
, fontconfig
, freetype
, gcc
, glib
, libGL
, libGLU
, libuuid
, libxml2
, ncurses
, opencv2
, openssl
, unixODBC
, xkeyboard_config
, xorg
, zlib
# options
, cudaSupport
}:
stdenv.mkDerivation rec {
inherit meta name src version;
buildInputs = [
coreutils
patchelf
alsa-lib
coreutils
dbus
fontconfig
freetype
gcc.cc
gcc.libc
glib
ncurses
opencv2
openssl
unixODBC
xkeyboard_config
libxml2
libuuid
zlib
libGL
libGLU
] ++ (with xorg; [
libX11
libXext
libXtst
libXi
libXmu
libXrender
libxcb
libXcursor
libXfixes
libXrandr
libICE
libSM
]);
ldpath = lib.makeLibraryPath buildInputs
+ lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
(":" + lib.makeSearchPathOutput "lib" "lib64" buildInputs);
dontConfigure = true;
dontBuild = true;
unpackPhase = ''
echo "=== Extracting makeself archive ==="
# find offset from file
offset=$(${stdenv.shell} -c "$(grep -axm1 -e 'offset=.*' $src); echo \$offset" $src)
dd if="$src" ibs=$offset skip=1 | tar -xf -
cd Unix
'';
installPhase = ''
cd Installer
# don't restrict PATH, that has already been done
sed -i -e 's/^PATH=/# PATH=/' MathInstaller
sed -i -e 's/\/bin\/bash/\/bin\/sh/' MathInstaller
echo "=== Running MathInstaller ==="
./MathInstaller -auto -createdir=y -execdir=$out/bin -targetdir=$out/libexec/Mathematica -silent
# Fix library paths
cd $out/libexec/Mathematica/Executables
for path in mathematica MathKernel Mathematica WolframKernel wolfram math; do
sed -i -e 's#export LD_LIBRARY_PATH$#export LD_LIBRARY_PATH=${zlib}/lib:\''${LD_LIBRARY_PATH}#' $path
done
# Fix xkeyboard config path for Qt
for path in mathematica Mathematica; do
line=$(grep -n QT_PLUGIN_PATH $path | sed 's/:.*//')
sed -i -e "$line iexport QT_XKB_CONFIG_ROOT=\"${xkeyboard_config}/share/X11/xkb\"" $path
done
'';
preFixup = ''
echo "=== PatchElfing away ==="
# This code should be a bit forgiving of errors, unfortunately
set +e
find $out/libexec/Mathematica/SystemFiles -type f -perm -0100 | while read f; do
type=$(readelf -h "$f" 2>/dev/null | grep 'Type:' | sed -e 's/ *Type: *\([A-Z]*\) (.*/\1/')
if [ -z "$type" ]; then
:
elif [ "$type" == "EXEC" ]; then
echo "patching $f executable <<"
patchelf --shrink-rpath "$f"
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \
"$f" \
&& patchelf --shrink-rpath "$f" \
|| echo unable to patch ... ignoring 1>&2
elif [ "$type" == "DYN" ]; then
echo "patching $f library <<"
patchelf \
--set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \
"$f" \
&& patchelf --shrink-rpath "$f" \
|| echo unable to patch ... ignoring 1>&2
else
echo "not patching $f <<: unknown elf type"
fi
done
'';
# all binaries are already stripped
dontStrip = true;
# we did this in prefixup already
dontPatchELF = true;
}

View file

@ -1,118 +0,0 @@
{ lib
, patchelf
, requireFile
, stdenv
# arguments from default.nix
, lang
, meta
, name
, src
, version
# dependencies
, alsa-lib
, coreutils
, cudaPackages
, fontconfig
, freetype
, gcc
, glib
, ncurses
, opencv2
, openssl
, unixODBC
, xorg
# options
, cudaSupport
}:
let
platform =
if stdenv.hostPlatform.system == "i686-linux" || stdenv.hostPlatform.system == "x86_64-linux" then
"Linux"
else
throw "Mathematica requires i686-linux or x86_64 linux";
in
stdenv.mkDerivation rec {
inherit meta src version;
pname = "mathematica";
buildInputs = [
coreutils
patchelf
alsa-lib
coreutils
fontconfig
freetype
gcc.cc
gcc.libc
glib
ncurses
opencv2
openssl
unixODBC
] ++ (with xorg; [
libX11
libXext
libXtst
libXi
libXmu
libXrender
libxcb
]);
ldpath = lib.makeLibraryPath buildInputs
+ lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
(":" + lib.makeSearchPathOutput "lib" "lib64" buildInputs);
dontConfigure = true;
dontBuild = true;
unpackPhase = ''
echo "=== Extracting makeself archive ==="
# find offset from file
offset=$(${stdenv.shell} -c "$(grep -axm1 -e 'offset=.*' $src); echo \$offset" $src)
dd if="$src" ibs=$offset skip=1 | tar -xf -
cd Unix
'';
installPhase = ''
cd Installer
# don't restrict PATH, that has already been done
sed -i -e 's/^PATH=/# PATH=/' MathInstaller
echo "=== Running MathInstaller ==="
./MathInstaller -auto -createdir=y -execdir=$out/bin -targetdir=$out/libexec/Mathematica -platforms=${platform} -silent
'';
preFixup = ''
echo "=== PatchElfing away ==="
find $out/libexec/Mathematica/SystemFiles -type f -perm -0100 | while read f; do
type=$(readelf -h "$f" 2>/dev/null | grep 'Type:' | sed -e 's/ *Type: *\([A-Z]*\) (.*/\1/')
if [ -z "$type" ]; then
:
elif [ "$type" == "EXEC" ]; then
echo "patching $f executable <<"
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${ldpath}" \
"$f"
patchelf --shrink-rpath "$f"
elif [ "$type" == "DYN" ]; then
echo "patching $f library <<"
patchelf \
--set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \
"$f" \
&& patchelf --shrink-rpath "$f" \
|| echo unable to patch ... ignoring 1>&2
else
echo "not patching $f <<: unknown elf type"
fi
done
'';
# all binaries are already stripped
dontStrip = true;
# we did this in prefixup already
dontPatchELF = true;
}

View file

@ -44,12 +44,6 @@ let versions = callPackage ./versions.nix { };
else "and with local documentation"}")
else lib.head matching-versions;
specific-drv = ./. + "/${lib.versions.major found-version.version}.nix";
real-drv = if lib.pathExists specific-drv
then specific-drv
else ./generic.nix;
isMatching = v1: v2:
let as = lib.splitVersion v1;
bs = lib.splitVersion v2;
@ -64,7 +58,7 @@ let versions = callPackage ./versions.nix { };
in
callPackage real-drv {
callPackage ./generic.nix {
inherit cudaSupport cudaPackages;
inherit (found-version) version lang;
src = if source == null then found-version.src else source;

View file

@ -147,34 +147,6 @@ let versions = [
sha256 = "sha256-uftx4a/MHXLCABlv+kNFEtII+ikg4geHhDP1BOWK6dc=";
installer = "Mathematica_12.0.0_LINUX.sh";
}
{
version = "11.3.0";
lang = "en";
language = "English";
sha256 = "sha256-D8/iCMHqyESOe+OvC9uENwsXvZxdBmwBOSjI7pWu0Q4=";
installer = "Mathematica_11.3.0_LINUX.sh";
}
{
version = "11.2.0";
lang = "ja";
language = "Japanese";
sha256 = "sha256-kWOS7dMr7YYiI430Nd2OhkJrsEMDijM28w3xDYGbSbE=";
installer = "Mathematica_11.2.0_ja_LINUX.sh";
}
{
version = "9.0.0";
lang = "en";
language = "English";
sha256 = "sha256-mKgxdd7dLWa5EOuR5C37SeU+UC9Cv5YTbY5xSK9y34A=";
installer = "Mathematica_9.0.0_LINUX.sh";
}
{
version = "10.0.2";
lang = "en";
language = "English";
sha256 = "sha256-NHUg1jzLos1EsIr8TdYdNaA5+3jEcFqVZIr9GVVUXrQ=";
installer = "Mathematica_10.0.2_LINUX.sh";
}
];
in

View file

@ -1,29 +0,0 @@
{ lib, stdenv, pkg-config, fetchFromGitHub, opencv2, ncurses, portaudio }:
stdenv.mkDerivation {
pname = "p2pvc";
version = "unstable-2015-02-12";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ opencv2 ncurses portaudio ];
enableParallelBuilding = true;
installPhase = "mkdir -p $out/bin; cp p2pvc $out/bin/";
src = fetchFromGitHub {
owner = "mofarrell";
repo = "p2pvc";
rev = "d7b1c70288a7750fc8f9a22dbddbe51d34b5b9e5";
sha256 = "0d4vvrsjad5gk4rrjwgydn9ffj12jfb4aksw2px6jw75hp9pzmka";
};
meta = {
description = "Point to point color terminal video chat";
homepage = "https://github.com/mofarrell/p2pvc";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ trino ];
platforms = with lib.platforms; linux;
mainProgram = "p2pvc";
};
}

View file

@ -1,304 +0,0 @@
{ lib, stdenv
, fetchFromGitHub
, callPackage
, cmake, pkg-config, unzip, zlib, pcre, hdf5
, glog, boost, gflags, protobuf_21
, config
, enableJPEG ? true, libjpeg
, enablePNG ? true, libpng
, enableTIFF ? true, libtiff
, enableWebP ? true, libwebp
, enableEXR ? !stdenv.isDarwin, openexr_3
, enableEigen ? true, eigen
, enableOpenblas ? true, openblas, blas, lapack
, enableContrib ? true
, enableCuda ? config.cudaSupport
, cudaPackages
, enableUnfree ? false
, enableIpp ? false
, enablePython ? false, pythonPackages ? null
, enableGtk2 ? false, gtk2
, enableGtk3 ? false, gtk3
, enableFfmpeg ? false, ffmpeg
, enableGStreamer ? false, gst_all_1
, enableTesseract ? false, tesseract, leptonica
, enableTbb ? false, tbb
, enableOvis ? false, ogre
, enableGPhoto2 ? false, libgphoto2
, enableDC1394 ? false, libdc1394
, enableDocs ? false, doxygen, graphviz-nox
, AVFoundation, Cocoa, VideoDecodeAcceleration, bzip2, CoreMedia, MediaToolbox, Accelerate
}:
assert blas.implementation == "openblas" && lapack.implementation == "openblas";
assert enablePython -> pythonPackages != null;
let
inherit (cudaPackages) backendStdenv cudatoolkit;
inherit (cudaPackages.cudaFlags) cudaCapabilities;
version = "3.4.18";
src = fetchFromGitHub {
owner = "opencv";
repo = "opencv";
rev = version;
hash = "sha256-PgwAZNoPknFT0jCLt3TCzend6OYFY3iUIzDf/FptAYA=";
};
contribSrc = fetchFromGitHub {
owner = "opencv";
repo = "opencv_contrib";
rev = version;
hash = "sha256-TEF/GHglOmsshlC6q4iw14ZMpvA0SaKwlidomAN+sRc=";
};
# Contrib must be built in order to enable Tesseract support:
buildContrib = enableContrib || enableTesseract;
useSystemProtobuf = ! stdenv.isDarwin;
# See opencv/3rdparty/ippicv/ippicv.cmake
ippicv = {
src = fetchFromGitHub {
owner = "opencv";
repo = "opencv_3rdparty";
rev = "32e315a5b106a7b89dbed51c28f8120a48b368b4";
sha256 = "19w9f0r16072s59diqxsr5q6nmwyz9gnxjs49nglzhd66p3ddbkp";
} + "/ippicv";
files = let name = platform : "ippicv_2019_${platform}_general_20180723.tgz"; in
if stdenv.hostPlatform.system == "x86_64-linux" then
{ ${name "lnx_intel64"} = "c0bd78adb4156bbf552c1dfe90599607"; }
else if stdenv.hostPlatform.system == "i686-linux" then
{ ${name "lnx_ia32"} = "4f38432c30bfd6423164b7a24bbc98a0"; }
else if stdenv.hostPlatform.system == "x86_64-darwin" then
{ ${name "mac_intel64"} = "fe6b2bb75ae0e3f19ad3ae1a31dfa4a2"; }
else
throw "ICV is not available for this platform (or not yet supported by this package)";
dst = ".cache/ippicv";
};
# See opencv_contrib/modules/xfeatures2d/cmake/download_vgg.cmake
vgg = {
src = fetchFromGitHub {
owner = "opencv";
repo = "opencv_3rdparty";
rev = "fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d";
sha256 = "0r9fam8dplyqqsd3qgpnnfgf9l7lj44di19rxwbm8mxiw0rlcdvy";
};
files = {
"vgg_generated_48.i" = "e8d0dcd54d1bcfdc29203d011a797179";
"vgg_generated_64.i" = "7126a5d9a8884ebca5aea5d63d677225";
"vgg_generated_80.i" = "7cd47228edec52b6d82f46511af325c5";
"vgg_generated_120.i" = "151805e03568c9f490a5e3a872777b75";
};
dst = ".cache/xfeatures2d/vgg";
};
# See opencv_contrib/modules/xfeatures2d/cmake/download_boostdesc.cmake
boostdesc = {
src = fetchFromGitHub {
owner = "opencv";
repo = "opencv_3rdparty";
rev = "34e4206aef44d50e6bbcd0ab06354b52e7466d26";
sha256 = "13yig1xhvgghvxspxmdidss5lqiikpjr0ddm83jsi0k85j92sn62";
};
files = {
"boostdesc_bgm.i" = "0ea90e7a8f3f7876d450e4149c97c74f";
"boostdesc_bgm_bi.i" = "232c966b13651bd0e46a1497b0852191";
"boostdesc_bgm_hd.i" = "324426a24fa56ad9c5b8e3e0b3e5303e";
"boostdesc_binboost_064.i" = "202e1b3e9fec871b04da31f7f016679f";
"boostdesc_binboost_128.i" = "98ea99d399965c03d555cef3ea502a0b";
"boostdesc_binboost_256.i" = "e6dcfa9f647779eb1ce446a8d759b6ea";
"boostdesc_lbgm.i" = "0ae0675534aa318d9668f2a179c2a052";
};
dst = ".cache/xfeatures2d/boostdesc";
};
# See opencv_contrib/modules/face/CMakeLists.txt
face = {
src = fetchFromGitHub {
owner = "opencv";
repo = "opencv_3rdparty";
rev = "8afa57abc8229d611c4937165d20e2a2d9fc5a12";
sha256 = "061lsvqdidq9xa2hwrcvwi9ixflr2c2lfpc8drr159g68zi8bp4v";
};
files = {
"face_landmark_model.dat" = "7505c44ca4eb54b4ab1e4777cb96ac05";
};
dst = ".cache/data";
};
# See opencv/cmake/OpenCVDownload.cmake
installExtraFiles = extra : ''
mkdir -p "${extra.dst}"
'' + lib.concatStrings (lib.mapAttrsToList (name : md5 : ''
ln -s "${extra.src}/${name}" "${extra.dst}/${md5}-${name}"
'') extra.files);
opencvFlag = name: enabled: "-DWITH_${name}=${printEnabled enabled}";
printEnabled = enabled : if enabled then "ON" else "OFF";
in
stdenv.mkDerivation {
pname = "opencv";
inherit version src;
postUnpack = lib.optionalString buildContrib ''
cp --no-preserve=mode -r "${contribSrc}/modules" "$NIX_BUILD_TOP/opencv_contrib"
'';
# Ensures that we use the system OpenEXR rather than the vendored copy of the source included with OpenCV.
patches = [
./cmake-don-t-use-OpenCVFindOpenEXR.patch
];
# This prevents cmake from using libraries in impure paths (which
# causes build failure on non NixOS)
# Also, work around https://github.com/NixOS/nixpkgs/issues/26304 with
# what appears to be some stray headers in dnn/misc/tensorflow
# in contrib when generating the Python bindings:
postPatch = ''
sed -i '/Add these standard paths to the search paths for FIND_LIBRARY/,/^\s*$/{d}' CMakeLists.txt
sed -i -e 's|if len(decls) == 0:|if len(decls) == 0 or "opencv2/" not in hdr:|' ./modules/python/src2/gen2.py
'';
preConfigure =
lib.optionalString enableIpp (installExtraFiles ippicv) + (
lib.optionalString buildContrib ''
cmakeFlagsArray+=("-DOPENCV_EXTRA_MODULES_PATH=$NIX_BUILD_TOP/opencv_contrib")
${installExtraFiles vgg}
${installExtraFiles boostdesc}
${installExtraFiles face}
'');
postConfigure = ''
[ -e modules/core/version_string.inc ]
echo '"(build info elided)"' > modules/core/version_string.inc
'';
buildInputs =
[ zlib pcre hdf5 glog boost gflags ]
++ lib.optional useSystemProtobuf protobuf_21
++ lib.optional enablePython pythonPackages.python
++ lib.optional enableGtk2 gtk2
++ lib.optional enableGtk3 gtk3
++ lib.optional enableJPEG libjpeg
++ lib.optional enablePNG libpng
++ lib.optional enableTIFF libtiff
++ lib.optional enableWebP libwebp
++ lib.optionals enableEXR [ openexr_3 ]
++ lib.optional enableFfmpeg ffmpeg
++ lib.optionals (enableFfmpeg && stdenv.isDarwin)
[ VideoDecodeAcceleration bzip2 ]
++ lib.optionals enableGStreamer [ gst_all_1.gstreamer gst_all_1.gst-plugins-base ]
++ lib.optional enableOvis ogre
++ lib.optional enableGPhoto2 libgphoto2
++ lib.optional enableDC1394 libdc1394
++ lib.optional enableEigen eigen
++ lib.optional enableOpenblas openblas
# There is seemingly no compile-time flag for Tesseract. It's
# simply enabled automatically if contrib is built, and it detects
# tesseract & leptonica.
++ lib.optionals enableTesseract [ tesseract leptonica ]
++ lib.optional enableTbb tbb
++ lib.optionals stdenv.isDarwin [
bzip2 AVFoundation Cocoa VideoDecodeAcceleration CoreMedia MediaToolbox Accelerate
]
++ lib.optionals enableDocs [ doxygen graphviz-nox ];
propagatedBuildInputs = lib.optional enablePython pythonPackages.numpy
++ lib.optional enableCuda cudatoolkit;
nativeBuildInputs = [ cmake pkg-config unzip ];
# Configure can't find the library without this.
OpenBLAS_HOME = lib.optionalString enableOpenblas openblas;
cmakeFlags = [
"-DWITH_OPENMP=ON"
"-DBUILD_PROTOBUF=${printEnabled (!useSystemProtobuf)}"
"-DPROTOBUF_UPDATE_FILES=${printEnabled useSystemProtobuf}"
"-DOPENCV_ENABLE_NONFREE=${printEnabled enableUnfree}"
"-DBUILD_TESTS=OFF"
"-DBUILD_PERF_TESTS=OFF"
"-DBUILD_DOCS=${printEnabled enableDocs}"
(opencvFlag "IPP" enableIpp)
(opencvFlag "TIFF" enableTIFF)
(opencvFlag "WEBP" enableWebP)
(opencvFlag "JPEG" enableJPEG)
(opencvFlag "PNG" enablePNG)
(opencvFlag "OPENEXR" enableEXR)
(opencvFlag "CUDA" enableCuda)
(opencvFlag "CUBLAS" enableCuda)
(opencvFlag "TBB" enableTbb)
] ++ lib.optionals enableCuda [
"-DCUDA_FAST_MATH=ON"
"-DCUDA_HOST_COMPILER=${backendStdenv.cc}/bin/cc"
"-DCUDA_NVCC_FLAGS=--expt-relaxed-constexpr"
"-DCUDA_ARCH_BIN=${lib.concatStringsSep ";" cudaCapabilities}"
"-DCUDA_ARCH_PTX=${lib.last cudaCapabilities}"
] ++ lib.optionals stdenv.isDarwin [
"-DWITH_OPENCL=OFF"
"-DWITH_LAPACK=OFF"
# Disable unnecessary vendoring that's enabled by default only for Darwin.
# Note that the opencvFlag feature flags listed above still take
# precedence, so we can safely list everything here.
"-DBUILD_ZLIB=OFF"
"-DBUILD_TIFF=OFF"
"-DBUILD_JASPER=OFF"
"-DBUILD_JPEG=OFF"
"-DBUILD_PNG=OFF"
"-DBUILD_WEBP=OFF"
] ++ lib.optionals enablePython [
"-DOPENCV_SKIP_PYTHON_LOADER=ON"
] ++ lib.optionals enableEigen [
# Autodetection broken by https://github.com/opencv/opencv/pull/13337
"-DEIGEN_INCLUDE_PATH=${eigen}/include/eigen3"
];
postBuild = lib.optionalString enableDocs ''
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 = []; } // {
tests = lib.optionalAttrs enableCuda {
no-libstdcxx-errors = callPackage ./libstdcxx-test.nix { attrName = "opencv3"; };
};
};
meta = {
description = "Open Computer Vision Library with more than 500 algorithms";
homepage = "https://opencv.org/";
# OpenCV 3 won't build with CUDA 12+
broken = enableCuda && cudaPackages.cudaAtLeast "12";
license = if enableUnfree then lib.licenses.unfree else lib.licenses.bsd3;
maintainers = with lib.maintainers; [mdaiter basvandijk];
platforms = with lib.platforms; linux ++ darwin;
};
}

View file

@ -1,86 +0,0 @@
{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, unzip
, zlib
, enableGtk2 ? false, gtk2
, enableJPEG ? true, libjpeg
, enablePNG ? true, libpng
, enableTIFF ? true, libtiff
, enableEXR ? (!stdenv.isDarwin), openexr, ilmbase
, enableFfmpeg ? false, ffmpeg
, enableGStreamer ? false, gst_all_1
, enableEigen ? true, eigen
, enableUnfree ? false
, AVFoundation, Cocoa, QTKit, Accelerate
}:
let
opencvFlag = name: enabled: "-DWITH_${name}=${if enabled then "ON" else "OFF"}";
in
stdenv.mkDerivation rec {
pname = "opencv";
version = "2.4.13.7";
src = fetchFromGitHub {
owner = "opencv";
repo = "opencv";
rev = version;
sha256 = "062js7zhh4ixi2wk61wyi23qp9zsk5vw24iz2i5fab2hp97y5zq3";
};
patches =
[ # Don't include a copy of the CMake status output in the
# build. This causes a runtime dependency on GCC.
./no-build-info.patch
];
# This prevents cmake from using libraries in impure paths (which causes build failure on non NixOS)
postPatch = ''
sed -i '/Add these standard paths to the search paths for FIND_LIBRARY/,/^\s*$/{d}' CMakeLists.txt
'';
outputs = [ "out" "dev" ];
buildInputs =
[ zlib ]
++ lib.optional enableGtk2 gtk2
++ lib.optional enableJPEG libjpeg
++ lib.optional enablePNG libpng
++ lib.optional enableTIFF libtiff
++ lib.optionals enableEXR [ openexr ilmbase ]
++ lib.optional enableFfmpeg ffmpeg
++ lib.optionals enableGStreamer (with gst_all_1; [ gstreamer gst-plugins-base ])
++ lib.optional enableEigen eigen
++ lib.optionals stdenv.isDarwin [ AVFoundation Cocoa QTKit Accelerate ]
;
nativeBuildInputs = [ cmake pkg-config unzip ];
CXXFLAGS = lib.optionalString stdenv.cc.isClang "-std=c++14";
env.NIX_CFLAGS_COMPILE = lib.optionalString enableEXR "-I${ilmbase.dev}/include/OpenEXR";
cmakeFlags = [
(opencvFlag "TIFF" enableTIFF)
(opencvFlag "JPEG" enableJPEG)
(opencvFlag "PNG" enablePNG)
(opencvFlag "OPENEXR" enableEXR)
(opencvFlag "GSTREAMER" enableGStreamer)
] ++ lib.optional (!enableUnfree) "-DBUILD_opencv_nonfree=OFF";
hardeningDisable = [ "bindnow" "relro" ];
# Fix pkg-config file that gets broken with multiple outputs
postFixup = ''
sed -i $dev/lib/pkgconfig/opencv.pc -e "s|includedir_old=.*|includedir_old=$dev/include/opencv|"
sed -i $dev/lib/pkgconfig/opencv.pc -e "s|includedir_new=.*|includedir_new=$dev/include|"
'';
meta = with lib; {
description = "Open Computer Vision Library with more than 500 algorithms";
homepage = "https://opencv.org/";
license = if enableUnfree then licenses.unfree else licenses.bsd3;
maintainers = [ ];
platforms = platforms.unix;
};
}

View file

@ -1,14 +0,0 @@
diff -ru -x '*~' opencv-2.4.13-orig/modules/core/src/system.cpp opencv-2.4.13/modules/core/src/system.cpp
--- opencv-2.4.13-orig/modules/core/src/system.cpp 1970-01-01 01:00:01.000000000 +0100
+++ opencv-2.4.13/modules/core/src/system.cpp 2016-10-02 18:44:53.674181762 +0200
@@ -442,9 +442,7 @@
const std::string& getBuildInformation()
{
- static std::string build_info =
-#include "version_string.inc"
- ;
+ static std::string build_info = "(build info elided)";
return build_info;
}

View file

@ -1,7 +1,7 @@
{ lib, stdenv, mkDerivation, fetchurl, cmake, pkg-config, darwin
, openexr, zlib, imagemagick6, libGLU, libGL, libglut, fftwFloat
, fftw, gsl, libexif, perl, qtbase, netpbm
, enableUnfree ? false, opencv2
, enableUnfree ? false, opencv
}:
mkDerivation rec {
@ -36,7 +36,7 @@ mkDerivation rec {
OpenGL GLUT
]) else [
libGLU libGL libglut
]) ++ lib.optional enableUnfree (opencv2.override { enableUnfree = true; });
]) ++ lib.optional enableUnfree (opencv.override { enableUnfree = true; });
patches = [ ./glut.patch ./threads.patch ./pfstools.patch ./pfsalign.patch ];

View file

@ -933,6 +933,9 @@ mapAliases ({
marwaita-peppermint = lib.warn "marwaita-peppermint has been renamed to marwaita-red" marwaita-red; # Added 2024-07-01
marwaita-ubuntu = lib.warn "marwaita-ubuntu has been renamed to marwaita-orange" marwaita-orange; # Added 2024-07-08
masari = throw "masari has been removed as it was abandoned upstream"; # Added 2024-07-11
mathematica9 = throw "mathematica9 has been removed as it was obsolete, broken, and depended on OpenCV 2"; # Added 2024-08-20
mathematica10 = throw "mathematica10 has been removed as it was obsolete, broken, and depended on OpenCV 2"; # Added 2024-08-20
mathematica11 = throw "mathematica11 has been removed as it was obsolete, broken, and depended on OpenCV 2"; # Added 2024-08-20
matrique = spectral; # Added 2020-01-27
matrixcli = throw "'matrixcli' has been removed due to being unmaintained and broken functionality. Recommend 'matrix-commander' as an alternative"; # Added 2024-03-09
matrix-recorder = throw "matrix-recorder has been removed due to being unmaintained"; # Added 2023-05-21
@ -1077,6 +1080,8 @@ mapAliases ({
onevpl-intel-gpu = lib.warn "onevpl-intel-gpu has been renamed to vpl-gpu-rt" vpl-gpu-rt; # Added 2024-06-04
opa = throw "opa has been removed from nixpkgs as upstream has abandoned the project"; # Added 2023-03-21
opam_1_2 = throw "'opam_1_2' has been renamed to/replaced by 'opam'"; # Added 2023-03-08
opencv2 = throw "opencv2 has been removed as it is obsolete and was not used by any other package; please migrate to OpenCV 4"; # Added 2024-08-20
opencv3 = throw "opencv3 has been removed as it is obsolete and was not used by any other package; please migrate to OpenCV 4"; # Added 2024-08-20
openafs_1_8 = openafs; # Added 2022-08-22
openapi-generator-cli-unstable = throw "openapi-generator-cli-unstable was removed as it was not being updated; consider openapi-generator-cli instead"; # Added 2024-01-02
openbangla-keyboard = throw "openbangla-keyboard has been replaced by ibus-engines.openbangla-keyboard and fcitx5-openbangla-keyboard"; # added 2023-10-10
@ -1121,6 +1126,7 @@ mapAliases ({
### P ###
PageEdit = pageedit; # Added 2024-01-21
p2pvc = throw "p2pvc has been removed as it is unmaintained upstream and depends on OpenCV 2"; # Added 2024-08-20
packet-cli = metal-cli; # Added 2021-10-25
packet = throw "packet has been removed as it is no longer working and unmaintained"; # Added 2024-03-29
palemoon = throw "palemoon has been dropped due to python2 being EOL and marked insecure. Use 'palemoon-bin' instead"; # Added 2023-05-18

View file

@ -11214,8 +11214,6 @@ with pkgs;
payload-dumper-go = callPackage ../tools/archivers/payload-dumper-go { };
p2pvc = callPackage ../applications/video/p2pvc { };
p3x-onenote = callPackage ../applications/office/p3x-onenote { };
p4c = callPackage ../development/compilers/p4c {
@ -23012,19 +23010,6 @@ with pkgs;
openct = callPackage ../development/libraries/openct { };
opencv2 = callPackage ../development/libraries/opencv {
inherit (darwin.apple_sdk.frameworks) AVFoundation Cocoa QTKit Accelerate;
ffmpeg = ffmpeg_4;
};
opencv3 = callPackage ../development/libraries/opencv/3.x.nix {
inherit (darwin.apple_sdk.frameworks)
AVFoundation Cocoa VideoDecodeAcceleration CoreMedia MediaToolbox Accelerate;
ffmpeg = ffmpeg_4;
# OpenCV3 won't build with anything newer than CUDA 11 due to API changes.
cudaPackages = cudaPackages_11;
};
opencv4 = callPackage ../development/libraries/opencv/4.x.nix {
inherit (darwin.apple_sdk.frameworks)
AVFoundation Cocoa VideoDecodeAcceleration CoreMedia MediaToolbox Accelerate;
@ -37203,18 +37188,6 @@ with pkgs;
cudaSupport = true;
};
mathematica9 = callPackage ../applications/science/math/mathematica {
version = "9";
};
mathematica10 = callPackage ../applications/science/math/mathematica {
version = "10";
};
mathematica11 = callPackage ../applications/science/math/mathematica {
version = "11";
};
mathmod = libsForQt5.callPackage ../applications/science/math/mathmod { };
metis = callPackage ../development/libraries/science/math/metis { };