about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/flann
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-07-23 09:26:00 +0000
committerAlyssa Ross <hi@alyssa.is>2021-07-23 09:26:00 +0000
commitab63e0bb8dcf2b1bf8d4a26ed360af777b8f241d (patch)
tree504b28a058661f6c1cbb7d3f580020e50367ca7f /nixpkgs/pkgs/development/libraries/flann
parent55cc63c079f49e81d695a25bc2f5b3902f2bd290 (diff)
parentb09661d41fb93562fd53f31574dbf781b130ac44 (diff)
downloadnixlib-ab63e0bb8dcf2b1bf8d4a26ed360af777b8f241d.tar
nixlib-ab63e0bb8dcf2b1bf8d4a26ed360af777b8f241d.tar.gz
nixlib-ab63e0bb8dcf2b1bf8d4a26ed360af777b8f241d.tar.bz2
nixlib-ab63e0bb8dcf2b1bf8d4a26ed360af777b8f241d.tar.lz
nixlib-ab63e0bb8dcf2b1bf8d4a26ed360af777b8f241d.tar.xz
nixlib-ab63e0bb8dcf2b1bf8d4a26ed360af777b8f241d.tar.zst
nixlib-ab63e0bb8dcf2b1bf8d4a26ed360af777b8f241d.zip
Merge commit 'b09661d41fb93562fd53f31574dbf781b130ac44'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/flann')
-rw-r--r--nixpkgs/pkgs/development/libraries/flann/default.nix59
1 files changed, 50 insertions, 9 deletions
diff --git a/nixpkgs/pkgs/development/libraries/flann/default.nix b/nixpkgs/pkgs/development/libraries/flann/default.nix
index 913393804249..283c815b199b 100644
--- a/nixpkgs/pkgs/development/libraries/flann/default.nix
+++ b/nixpkgs/pkgs/development/libraries/flann/default.nix
@@ -1,24 +1,65 @@
-{ lib, stdenv, fetchFromGitHub, fetchpatch, unzip, cmake, python }:
+{ lib
+, cmake
+, fetchFromGitHub
+, fetchpatch
+, lz4
+, pkg-config
+, python3
+, stdenv
+, unzip
+, enablePython ? false
+}:
 
-stdenv.mkDerivation {
-  name = "flann-1.9.1";
+stdenv.mkDerivation rec {
+  pname = "flann";
+  version = "1.9.1";
 
   src = fetchFromGitHub {
-    owner = "mariusmuja";
+    owner = "flann-lib";
     repo = "flann";
-    rev = "1.9.1";
+    rev = version;
     sha256 = "13lg9nazj5s9a41j61vbijy04v6839i67lqd925xmxsbybf36gjc";
   };
 
   patches = [
-    # Upstream issue: https://github.com/mariusmuja/flann/issues/369
+    # Patch HDF5_INCLUDE_DIR -> HDF_INCLUDE_DIRS.
     (fetchpatch {
-      url = "https://raw.githubusercontent.com/buildroot/buildroot/45a39b3e2ba42b72d19bfcef30db1b8da9ead51a/package/flann/0001-src-cpp-fix-cmake-3.11-build.patch";
-      sha256 = "1gmj06cmnqvwxx649mxaivd35727wj6w7710zbcmmgmsnyfh2js4";
+      url = "https://salsa.debian.org/science-team/flann/-/raw/debian/1.9.1+dfsg-9/debian/patches/0001-Updated-fix-cmake-hdf5.patch";
+      sha256 = "yM1ONU4mu6lctttM5YcSTg8F344TNUJXwjxXLqzr5Pk=";
+    })
+    # Patch no-source library workaround that breaks on CMake > 3.11.
+    (fetchpatch {
+      url = "https://salsa.debian.org/science-team/flann/-/raw/debian/1.9.1+dfsg-9/debian/patches/0001-src-cpp-fix-cmake-3.11-build.patch";
+      sha256 = "REsBnbe6vlrZ+iCcw43kR5wy2o6q10RM73xjW5kBsr4=";
+    })
+    # Avoid the bundled version of LZ4 and instead use the system one.
+    (fetchpatch {
+      url = "https://salsa.debian.org/science-team/flann/-/raw/debian/1.9.1+dfsg-9/debian/patches/0003-Use-system-version-of-liblz4.patch";
+      sha256 = "xi+GyFn9PEjLgbJeAIEmsbp7ut9G9KIBkVulyT3nfsg=";
+    })
+    # Fix LZ4 string separator issue, see: https://github.com/flann-lib/flann/pull/480
+    (fetchpatch {
+      url = "https://github.com/flann-lib/flann/commit/25eb56ec78472bd419a121c6905095a793cf8992.patch";
+      sha256 = "qt8h576Gn8uR7+T9u9bEBIRz6e6AoTKpa1JfdZVvW9s=";
     })
   ];
 
-  nativeBuildInputs = [ unzip cmake python ];
+  cmakeFlags = [
+    "-DBUILD_EXAMPLES:BOOL=OFF"
+    "-DBUILD_TESTS:BOOL=OFF"
+    "-DBUILD_MATLAB_BINDINGS:BOOL=OFF"
+    "-DBUILD_PYTHON_BINDINGS:BOOL=${if enablePython then "ON" else "OFF"}"
+  ];
+
+  nativeBuildInputs = [
+    cmake
+    pkg-config
+    unzip
+  ];
+
+  propagatedBuildInputs = [ lz4 ];
+
+  buildInputs = lib.optionals enablePython [ python3 ];
 
   meta = {
     homepage = "http://people.cs.ubc.ca/~mariusm/flann/";