gnss-sdr: 0.0.13 -> 0.0.16

Add support for GR3.10, enable more features for gnss-sdr conditionally,
based on enabled features in GR. Cleanup unused cmake flags. Add a patch
fixing the build, mentioned in:
https://github.com/NixOS/nixpkgs/pull/142557#issuecomment-1041495980
This commit is contained in:
Doron Behar 2022-02-16 16:37:32 +02:00
parent 88519c6309
commit 4b7b5f4fc3
2 changed files with 95 additions and 27 deletions

View file

@ -7,9 +7,9 @@
, gtest
, openssl
, gflags
, gnuradio3_8
, gnuradio
, thrift
, libpcap
, enableRawUdp ? true, libpcap
, orc
, pkg-config
, blas, lapack
@ -18,65 +18,86 @@
, protobuf
}:
gnuradio3_8.pkgs.mkDerivation rec {
gnuradio.pkgs.mkDerivation rec {
pname = "gnss-sdr";
# There's an issue with cpufeatures on 0.0.15, see:
# https://github.com/NixOS/nixpkgs/pull/142557#issuecomment-950217925
version = "0.0.13";
version = "0.0.16";
src = fetchFromGitHub {
owner = "gnss-sdr";
repo = "gnss-sdr";
rev = "v${version}";
sha256 = "0a3k47fl5dizzhbqbrbmckl636lznyjby2d2nz6fz21637hvrnby";
sha256 = "sha256-ODe4k6PDGtDX11FrbggEbN3tc4UtATaItUIpCKl4JjM=";
};
patches = [
# Use the relative install location for volk_gnsssdr_module and
# cpu_features which is bundled in the source. NOTE: Perhaps this patch
# should be sent upstream.
./fix_libcpu_features_install_path.patch
];
nativeBuildInputs = [
cmake
gnuradio3_8.unwrapped.python
gnuradio3_8.unwrapped.python.pkgs.Mako
gnuradio3_8.unwrapped.python.pkgs.six
pkg-config
gnuradio.unwrapped.python
gnuradio.unwrapped.python.pkgs.Mako
gnuradio.unwrapped.python.pkgs.six
];
checkInputs = [
gtest
];
buildInputs = [
gmp
armadillo
gnuradio3_8.unwrapped.boost
glog
gtest
openssl
gflags
openssl
orc
# UHD support is optional, but gnuradio is built with it, so there's
# nothing to be gained by leaving it out.
gnuradio3_8.unwrapped.uhd
gnuradio3_8.unwrapped.log4cpp
blas lapack
matio
pugixml
protobuf
gnuradio3_8.pkgs.osmosdr
gnuradio.unwrapped.boost
] ++ lib.optionals (gnuradio.hasFeature "gr-uhd") [
gnuradio.unwrapped.uhd
] ++ (if (lib.versionAtLeast gnuradio.unwrapped.versionAttr.major "3.10") then [
gnuradio.unwrapped.spdlog
] else [
gnuradio.unwrapped.log4cpp
]) ++ lib.optionals (enableRawUdp) [
libpcap
] ++ lib.optionals (gnuradio3_8.hasFeature "gr-ctrlport") [
] ++ lib.optionals (gnuradio.hasFeature "gr-ctrlport") [
thrift
gnuradio3_8.unwrapped.python.pkgs.thrift
gnuradio.unwrapped.python.pkgs.thrift
] ++ lib.optionals (gnuradio.hasFeature "gr-pdu" || gnuradio.hasFeature "gr-iio") [
gnuradio.unwrapped.libiio
] ++ lib.optionals (gnuradio.hasFeature "gr-pdu") [
gnuradio.unwrapped.libad9361
];
cmakeFlags = [
"-DGFlags_ROOT_DIR=${gflags}/lib"
"-DGFlags_INCLUDE_DIRS=${gflags}/include"
"-DGLOG_INCLUDE_DIR=${glog}/include"
# Should use .dylib if darwin support is requested
"-DGFlags_LIBS=${gflags}/lib/libgflags.so"
"-DGLOG_LIBRARIES=${glog}/lib/libglog.so"
# Use our dependencies glog, gflags and armadillo dependencies
"-DENABLE_OWN_GLOG=OFF"
"-DENABLE_OWN_ARMADILLO=OFF"
"-DENABLE_ORC=ON"
"-DENABLE_LOG=ON"
"-DENABLE_RAW_UDP=${if enableRawUdp then "ON" else "OFF"}"
"-DENABLE_UHD=${if (gnuradio.hasFeature "gr-uhd") then "ON" else "OFF"}"
"-DENABLE_FMCOMMS2=${if (gnuradio.hasFeature "gr-iio" && gnuradio.hasFeature "gr-pdu") then "ON" else "OFF"}"
"-DENABLE_PLUTOSDR=${if (gnuradio.hasFeature "gr-iio") then "ON" else "OFF"}"
"-DENABLE_AD9361=${if (gnuradio.hasFeature "gr-pdu") then "ON" else "OFF"}"
"-DENABLE_UNIT_TESTING=OFF"
# gnss-sdr doesn't truly depend on BLAS or LAPACK, as long as
# armadillo is built using both, so skip checking for them.
"-DBLAS=YES"
"-DLAPACK=YES"
"-DBLAS_LIBRARIES=-lblas"
"-DLAPACK_LIBRARIES=-llapack"
# Similarly, it doesn't actually use gfortran despite checking for
# its presence.
"-DGFORTRAN=YES"
];
meta = with lib; {

View file

@ -0,0 +1,47 @@
--- a/CMakeLists.txt 1970-01-01 08:00:01.000000000 +0800
+++ b/CMakeLists.txt 2022-02-16 20:41:53.725290020 +0800
@@ -1214,7 +1214,7 @@
BINARY_DIR ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/build
CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS}
-DCMAKE_BUILD_TYPE=$<$<CONFIG:None>:None>$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:NoOptWithASM>$<$<CONFIG:Coverage>:Coverage>$<$<CONFIG:O2WithASM>:O2WithASM>$<$<CONFIG:O3WithASM>:O3WithASM>$<$<CONFIG:ASAN>:ASAN>
- -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
+ -DCMAKE_INSTALL_LIBDIR=lib
DOWNLOAD_COMMAND ""
UPDATE_COMMAND ""
PATCH_COMMAND ""
@@ -1247,7 +1247,7 @@
)
set(VOLK_GNSSSDR_BUILD_BYPRODUCTS
${VOLK_GNSSSDR_BUILD_BYPRODUCTS}
- ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}cpu_features${CMAKE_STATIC_LIBRARY_SUFFIX}
+ ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}cpu_features${CMAKE_STATIC_LIBRARY_SUFFIX}
)
endif()
ExternalProject_Add(volk_gnsssdr_module
@@ -1256,7 +1256,7 @@
BINARY_DIR ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/build
CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS}
-DCMAKE_BUILD_TYPE=$<$<CONFIG:None>:None>$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:NoOptWithASM>$<$<CONFIG:Coverage>:Coverage>$<$<CONFIG:O2WithASM>:O2WithASM>$<$<CONFIG:O3WithASM>:O3WithASM>$<$<CONFIG:ASAN>:ASAN>
- -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
+ -DCMAKE_INSTALL_LIBDIR=lib
DOWNLOAD_COMMAND ""
UPDATE_COMMAND ""
PATCH_COMMAND ""
@@ -1271,7 +1271,7 @@
BINARY_DIR ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/build
CMAKE_ARGS ${VOLK_GNSSSDR_CMAKE_ARGS}
-DCMAKE_BUILD_TYPE=$<$<CONFIG:None>:None>$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:NoOptWithASM>:NoOptWithASM>$<$<CONFIG:Coverage>:Coverage>$<$<CONFIG:O2WithASM>:O2WithASM>$<$<CONFIG:O3WithASM>:O3WithASM>$<$<CONFIG:ASAN>:ASAN>
- -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
+ -DCMAKE_INSTALL_LIBDIR=lib
DOWNLOAD_COMMAND ""
UPDATE_COMMAND ""
PATCH_COMMAND ""
@@ -1310,7 +1310,7 @@
if(CMAKE_VERSION VERSION_GREATER 3.0 AND SUPPORTED_CPU_FEATURES_ARCH)
if(NOT CpuFeatures_FOUND)
set_target_properties(Volkgnsssdr::volkgnsssdr PROPERTIES
- INTERFACE_LINK_LIBRARIES ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}cpu_features${CMAKE_STATIC_LIBRARY_SUFFIX}
+ INTERFACE_LINK_LIBRARIES ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/install/lib/${CMAKE_FIND_LIBRARY_PREFIXES}cpu_features${CMAKE_STATIC_LIBRARY_SUFFIX}
)
endif()
endif()