Merge pull request #329823 from ExpidusOS/fix/pkgsllvm/elfutils
[NixPkgs.git] / pkgs / applications / radio / gnss-sdr / default.nix
blob948acd2f19c0e044a4ed1d3eee7f4852594e63a2
1 { lib
2 , fetchFromGitHub
3 , armadillo
4 , cmake
5 , gmp
6 , glog
7 , gtest
8 , openssl
9 , gflags
10 , gnuradio
11 , thrift
12 , enableRawUdp ? true, libpcap
13 , orc
14 , pkg-config
15 , blas, lapack
16 , matio
17 , pugixml
18 , protobuf
21 gnuradio.pkgs.mkDerivation rec {
22   pname = "gnss-sdr";
23   version = "0.0.19.1";
25   src = fetchFromGitHub {
26     owner = "gnss-sdr";
27     repo = "gnss-sdr";
28     rev = "v${version}";
29     sha256 = "sha256-IbkYdw1pwI+FMnZMChsxMz241Kv4EzMcBb0mm6/jq1k=";
30   };
32   patches = [
33     # Use the relative install location for volk_gnsssdr_module and
34     # cpu_features which is bundled in the source. NOTE: Perhaps this patch
35     # should be sent upstream.
36     ./fix_libcpu_features_install_path.patch
37   ];
39   nativeBuildInputs = [
40     cmake
41     pkg-config
42     gnuradio.unwrapped.python
43     gnuradio.unwrapped.python.pkgs.mako
44     gnuradio.unwrapped.python.pkgs.six
45   ];
46   nativeCheckInputs = [
47     gtest
48   ];
50   buildInputs = [
51     gmp
52     armadillo
53     glog
54     gflags
55     openssl
56     orc
57     blas lapack
58     matio
59     pugixml
60     protobuf
61     gnuradio.unwrapped.boost
62     gnuradio.unwrapped.logLib
63   ] ++ lib.optionals (gnuradio.hasFeature "gr-uhd") [
64     gnuradio.unwrapped.uhd
65   ] ++ lib.optionals (enableRawUdp) [
66     libpcap
67   ] ++ lib.optionals (gnuradio.hasFeature "gr-ctrlport") [
68     thrift
69     gnuradio.unwrapped.python.pkgs.thrift
70   ] ++ lib.optionals (gnuradio.hasFeature "gr-pdu" || gnuradio.hasFeature "gr-iio") [
71     gnuradio.unwrapped.libiio
72   ] ++ lib.optionals (gnuradio.hasFeature "gr-pdu") [
73     gnuradio.unwrapped.libad9361
74   ];
76   cmakeFlags = [
77     (lib.cmakeFeature "GFlags_INCLUDE_DIRS" "${gflags}/include")
78     (lib.cmakeFeature "GLOG_INCLUDE_DIR" "${glog}/include")
79     # Should use .dylib if darwin support is requested
80     (lib.cmakeFeature "GFlags_LIBS" "${gflags}/lib/libgflags.so")
81     (lib.cmakeFeature "-DGLOG_LIBRARIES" "${glog}/lib/libglog.so")
82     # Use our dependencies glog, gflags and armadillo dependencies
83     (lib.cmakeBool "ENABLE_OWN_GLOG" false)
84     (lib.cmakeBool "ENABLE_OWN_ARMADILLO" false)
85     (lib.cmakeBool "ENABLE_ORC" true)
86     (lib.cmakeBool "ENABLE_LOG" true)
87     (lib.cmakeBool "ENABLE_RAW_UDP" enableRawUdp)
88     (lib.cmakeBool "ENABLE_UHD" (gnuradio.hasFeature "gr-uhd"))
89     (lib.cmakeBool "ENABLE_FMCOMMS2" (gnuradio.hasFeature "gr-iio" && gnuradio.hasFeature "gr-pdu"))
90     (lib.cmakeBool "ENABLE_PLUTOSDR" (gnuradio.hasFeature "gr-iio"))
91     (lib.cmakeBool "ENABLE_AD9361" (gnuradio.hasFeature "gr-pdu"))
92     (lib.cmakeBool "ENABLE_UNIT_TESTING" false)
94     # gnss-sdr doesn't truly depend on BLAS or LAPACK, as long as
95     # armadillo is built using both, so skip checking for them.
96     (lib.cmakeFeature "BLAS_LIBRARIES" "-lblas")
97     (lib.cmakeFeature "LAPACK_LIBRARIES" "-llapack")
98   ];
100   meta = with lib; {
101     description = "Open source Global Navigation Satellite Systems software-defined receiver";
102     homepage = "https://gnss-sdr.org/";
103     license = licenses.gpl3Plus;
104     platforms = platforms.linux;
105   };