2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv, lib, lndir, makeWrapper
|
|
|
|
, fetchFromGitHub, cmake
|
2021-02-05 17:12:51 +00:00
|
|
|
, libusb-compat-0_1, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, usePython ? false
|
2022-01-19 23:45:15 +00:00
|
|
|
, python ? null
|
|
|
|
, ncurses, swig2
|
2020-04-24 23:36:52 +00:00
|
|
|
, extraPackages ? []
|
2023-02-09 11:40:11 +00:00
|
|
|
, testers
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
version = "0.8.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
modulesVersion = with lib; versions.major version + "." + versions.minor version;
|
|
|
|
modulesPath = "lib/SoapySDR/modules" + modulesVersion;
|
|
|
|
extraPackagesSearchPath = lib.makeSearchPath modulesPath extraPackages;
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
in stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "soapysdr";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pothosware";
|
|
|
|
repo = "SoapySDR";
|
|
|
|
rev = "soapy-sdr-${version}";
|
2021-08-05 21:33:18 +00:00
|
|
|
sha256 = "19f2x0pkxvf9figa0pl6xqlcz8fblvqb19mcnj632p0l8vk6qdv2";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
patches = [
|
|
|
|
# see https://github.com/pothosware/SoapySDR/issues/352 for upstream issue
|
|
|
|
./fix-pkgconfig.patch
|
|
|
|
];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ cmake makeWrapper pkg-config ];
|
2020-05-03 17:38:23 +00:00
|
|
|
buildInputs = [ libusb-compat-0_1 ncurses ]
|
2020-04-24 23:36:52 +00:00
|
|
|
++ lib.optionals usePython [ python swig2 ];
|
|
|
|
|
|
|
|
propagatedBuildInputs = lib.optional usePython python.pkgs.numpy;
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DCMAKE_BUILD_TYPE=Release"
|
|
|
|
] ++ lib.optional usePython "-DUSE_PYTHON_CONFIG=ON";
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
# https://github.com/pothosware/SoapySDR/issues/352
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace lib/SoapySDR.in.pc \
|
|
|
|
--replace '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
|
|
|
|
--replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postFixup = lib.optionalString (lib.length extraPackages != 0) ''
|
|
|
|
# Join all plugins via symlinking
|
|
|
|
for i in ${toString extraPackages}; do
|
|
|
|
${lndir}/bin/lndir -silent $i $out
|
|
|
|
done
|
|
|
|
# Needed for at least the remote plugin server
|
|
|
|
for file in $out/bin/*; do
|
2022-05-18 14:49:53 +00:00
|
|
|
wrapProgram "$file" --prefix SOAPY_SDR_PLUGIN_PATH : ${lib.escapeShellArg extraPackagesSearchPath}
|
2020-04-24 23:36:52 +00:00
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/pothosware/SoapySDR";
|
|
|
|
description = "Vendor and platform neutral SDR support library";
|
|
|
|
license = licenses.boost;
|
|
|
|
maintainers = with maintainers; [ markuskowa ];
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = "SoapySDRUtil";
|
2023-02-09 11:40:11 +00:00
|
|
|
pkgConfigModules = [ "SoapySDR" ];
|
2021-10-01 09:20:50 +00:00
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-02-09 11:40:11 +00:00
|
|
|
})
|