1{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake }:
2
3stdenv.mkDerivation (finalAttrs: {
4 pname = "libspatialindex";
5 version = "1.9.3";
6
7 src = fetchFromGitHub {
8 owner = "libspatialindex";
9 repo = "libspatialindex";
10 rev = finalAttrs.version;
11 hash = "sha256-zsvS0IkCXyuNLCQpccKdAsFKoq0l+y66ifXlTHLNTkc=";
12 };
13
14 patches = [
15 # Allow building static libs
16 (fetchpatch {
17 name = "fix-static-lib-build.patch";
18 url = "https://github.com/libspatialindex/libspatialindex/commit/caee28d84685071da3ff3a4ea57ff0b6ae64fc87.patch";
19 hash = "sha256-nvTW/t9tw1ZLeycJY8nj7rQgZogxQb765Ca2b9NDvRo=";
20 })
21 ];
22
23 nativeBuildInputs = [ cmake ];
24
25 cmakeFlags = [
26 "-DSIDX_BUILD_TESTS=${if finalAttrs.finalPackage.doCheck then "ON" else "OFF"}"
27 ];
28
29 doCheck = true;
30
31 meta = with lib; {
32 description = "Extensible spatial index library in C++";
33 homepage = "https://libspatialindex.org";
34 license = licenses.mit;
35 maintainers = teams.geospatial.members;
36 platforms = platforms.unix;
37 };
38})