1{ lib, stdenv
2, fetchFromGitHub
3, cmake
4, pkg-config
5, freeglut
6, lapack
7, libusb1
8, blas
9, zlib
10, eigen
11}:
12
13stdenv.mkDerivation rec {
14 pname = "libsurvive";
15 version = "1.01";
16
17 src = fetchFromGitHub {
18 owner = "cntools";
19 repo = pname;
20 rev = "v${version}";
21 # Fixes 'Unknown CMake command "cnkalman_generate_code"'
22 fetchSubmodules = true;
23 sha256 = "sha256-NcxdTKra+YkLt/iu9+1QCeQZLV3/qlhma2Ns/+ZYVsk=";
24 };
25
26 nativeBuildInputs = [ cmake pkg-config ];
27
28 buildInputs = [
29 freeglut
30 lapack
31 libusb1
32 blas
33 zlib
34 eigen
35 ];
36
37 # https://github.com/cntools/libsurvive/issues/272
38 postPatch = ''
39 substituteInPlace survive.pc.in \
40 libs/cnkalman/cnkalman.pc.in libs/cnkalman/libs/cnmatrix/cnmatrix.pc.in \
41 --replace '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@
42 '';
43
44 meta = with lib; {
45 description = "Open Source Lighthouse Tracking System";
46 homepage = "https://github.com/cntools/libsurvive";
47 license = licenses.mit;
48 maintainers = with maintainers; [ expipiplus1 prusnak ];
49 platforms = platforms.linux;
50 };
51}