2021-02-15 20:14:54 +00:00
|
|
|
{ lib, stdenv
|
|
|
|
, fetchFromGitHub
|
2021-10-21 13:45:38 +01:00
|
|
|
, fetchpatch
|
2021-02-15 20:14:54 +00:00
|
|
|
, cmake
|
|
|
|
# Remove gcc and python references
|
|
|
|
, removeReferencesTo
|
|
|
|
, pkg-config
|
|
|
|
, volk
|
|
|
|
, cppunit
|
|
|
|
, swig
|
|
|
|
, orc
|
|
|
|
, boost
|
|
|
|
, log4cpp
|
|
|
|
, mpir
|
|
|
|
, doxygen
|
|
|
|
, python
|
|
|
|
, codec2
|
|
|
|
, gsm
|
2021-10-21 13:45:55 +01:00
|
|
|
, thrift
|
2021-02-15 20:14:54 +00:00
|
|
|
, fftwFloat
|
2021-06-10 03:57:09 +01:00
|
|
|
, alsa-lib
|
2021-02-15 20:14:54 +00:00
|
|
|
, libjack2
|
|
|
|
, CoreAudio
|
|
|
|
, uhd
|
|
|
|
, SDL
|
|
|
|
, gsl
|
|
|
|
, cppzmq
|
|
|
|
, zeromq
|
|
|
|
# Needed only if qt-gui is disabled, from some reason
|
|
|
|
, icu
|
|
|
|
# GUI related
|
|
|
|
, gtk3
|
|
|
|
, pango
|
|
|
|
, gobject-introspection
|
|
|
|
, cairo
|
|
|
|
, qt5
|
|
|
|
, libsForQt5
|
|
|
|
# Features available to override, the list of them is in featuresInfo. They
|
|
|
|
# are all turned on by default.
|
|
|
|
, features ? {}
|
|
|
|
# If one wishes to use a different src or name for a very custom build
|
|
|
|
, overrideSrc ? {}
|
|
|
|
, pname ? "gnuradio"
|
|
|
|
, versionAttr ? {
|
|
|
|
major = "3.8";
|
2021-10-21 09:22:37 +01:00
|
|
|
minor = "4";
|
|
|
|
patch = "0";
|
2021-02-15 20:14:54 +00:00
|
|
|
}
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-10-21 09:22:37 +01:00
|
|
|
sourceSha256 = "sha256-C8S3iF7vj9A8SpxriW9y7idrhXzonvenoQtVAMex+Iw=";
|
2021-02-15 20:14:54 +00:00
|
|
|
featuresInfo = {
|
|
|
|
# Needed always
|
|
|
|
basic = {
|
|
|
|
native = [
|
|
|
|
cmake
|
|
|
|
pkg-config
|
|
|
|
orc
|
|
|
|
];
|
|
|
|
runtime = [
|
|
|
|
boost
|
|
|
|
log4cpp
|
|
|
|
mpir
|
|
|
|
]
|
|
|
|
# when gr-qtgui is disabled, icu needs to be included, otherwise
|
|
|
|
# building with boost 1.7x fails
|
2021-10-21 21:59:37 +01:00
|
|
|
++ lib.optionals (!(hasFeature "gr-qtgui")) [ icu ];
|
2021-02-15 20:14:54 +00:00
|
|
|
pythonNative = with python.pkgs; [
|
|
|
|
Mako
|
|
|
|
six
|
|
|
|
];
|
|
|
|
};
|
|
|
|
volk = {
|
|
|
|
cmakeEnableFlag = "VOLK";
|
|
|
|
runtime = [
|
|
|
|
volk
|
|
|
|
];
|
|
|
|
};
|
|
|
|
doxygen = {
|
|
|
|
native = [ doxygen ];
|
|
|
|
cmakeEnableFlag = "DOXYGEN";
|
|
|
|
};
|
|
|
|
sphinx = {
|
|
|
|
pythonNative = with python.pkgs; [ sphinx ];
|
|
|
|
cmakeEnableFlag = "SPHINX";
|
|
|
|
};
|
|
|
|
python-support = {
|
|
|
|
pythonRuntime = [ python.pkgs.six ];
|
|
|
|
native = [
|
|
|
|
swig
|
|
|
|
python
|
|
|
|
];
|
|
|
|
cmakeEnableFlag = "PYTHON";
|
|
|
|
};
|
|
|
|
testing-support = {
|
|
|
|
native = [ cppunit ];
|
|
|
|
cmakeEnableFlag = "TESTING";
|
|
|
|
};
|
|
|
|
gnuradio-runtime = {
|
|
|
|
cmakeEnableFlag = "GNURADIO_RUNTIME";
|
|
|
|
};
|
|
|
|
gr-ctrlport = {
|
|
|
|
cmakeEnableFlag = "GR_CTRLPORT";
|
|
|
|
native = [
|
|
|
|
swig
|
|
|
|
];
|
2021-10-21 13:45:55 +01:00
|
|
|
runtime = [
|
|
|
|
thrift
|
|
|
|
];
|
2021-10-21 09:31:30 +01:00
|
|
|
pythonRuntime = with python.pkgs; [
|
2021-10-21 13:45:55 +01:00
|
|
|
python.pkgs.thrift
|
2021-10-21 09:31:30 +01:00
|
|
|
# For gr-perf-monitorx
|
|
|
|
matplotlib
|
|
|
|
networkx
|
|
|
|
];
|
2021-02-15 20:14:54 +00:00
|
|
|
};
|
|
|
|
gnuradio-companion = {
|
|
|
|
pythonRuntime = with python.pkgs; [
|
|
|
|
pyyaml
|
|
|
|
Mako
|
|
|
|
numpy
|
|
|
|
pygobject3
|
|
|
|
];
|
|
|
|
runtime = [
|
|
|
|
gtk3
|
|
|
|
pango
|
|
|
|
gobject-introspection
|
|
|
|
cairo
|
|
|
|
];
|
|
|
|
cmakeEnableFlag = "GRC";
|
|
|
|
};
|
|
|
|
gr-blocks = {
|
|
|
|
cmakeEnableFlag = "GR_BLOCKS";
|
|
|
|
};
|
|
|
|
gr-fec = {
|
|
|
|
cmakeEnableFlag = "GR_FEC";
|
|
|
|
};
|
|
|
|
gr-fft = {
|
|
|
|
runtime = [ fftwFloat ];
|
|
|
|
cmakeEnableFlag = "GR_FFT";
|
|
|
|
};
|
|
|
|
gr-filter = {
|
|
|
|
runtime = [ fftwFloat ];
|
|
|
|
cmakeEnableFlag = "GR_FILTER";
|
|
|
|
};
|
|
|
|
gr-analog = {
|
|
|
|
cmakeEnableFlag = "GR_ANALOG";
|
|
|
|
};
|
|
|
|
gr-digital = {
|
|
|
|
cmakeEnableFlag = "GR_DIGITAL";
|
|
|
|
};
|
|
|
|
gr-dtv = {
|
|
|
|
cmakeEnableFlag = "GR_DTV";
|
|
|
|
};
|
|
|
|
gr-audio = {
|
|
|
|
runtime = []
|
2021-06-10 03:57:09 +01:00
|
|
|
++ lib.optionals stdenv.isLinux [ alsa-lib libjack2 ]
|
2021-02-15 20:14:54 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ CoreAudio ]
|
|
|
|
;
|
|
|
|
cmakeEnableFlag = "GR_AUDIO";
|
|
|
|
};
|
|
|
|
gr-channels = {
|
|
|
|
cmakeEnableFlag = "GR_CHANNELS";
|
|
|
|
};
|
|
|
|
gr-qtgui = {
|
|
|
|
runtime = [ qt5.qtbase libsForQt5.qwt ];
|
|
|
|
pythonRuntime = [ python.pkgs.pyqt5 ];
|
|
|
|
cmakeEnableFlag = "GR_QTGUI";
|
|
|
|
};
|
|
|
|
gr-trellis = {
|
|
|
|
cmakeEnableFlag = "GR_TRELLIS";
|
|
|
|
};
|
|
|
|
gr-uhd = {
|
|
|
|
runtime = [ uhd ];
|
|
|
|
cmakeEnableFlag = "GR_UHD";
|
|
|
|
};
|
|
|
|
gr-utils = {
|
|
|
|
cmakeEnableFlag = "GR_UTILS";
|
2021-10-21 09:31:30 +01:00
|
|
|
pythonRuntime = with python.pkgs; [
|
|
|
|
# For gr_plot
|
|
|
|
matplotlib
|
|
|
|
];
|
2021-02-15 20:14:54 +00:00
|
|
|
};
|
|
|
|
gr-modtool = {
|
|
|
|
pythonRuntime = with python.pkgs; [
|
2021-10-21 09:31:30 +01:00
|
|
|
setuptools
|
2021-02-15 20:14:54 +00:00
|
|
|
click
|
|
|
|
click-plugins
|
|
|
|
];
|
|
|
|
cmakeEnableFlag = "GR_MODTOOL";
|
|
|
|
};
|
|
|
|
gr-video-sdl = {
|
|
|
|
runtime = [ SDL ];
|
|
|
|
cmakeEnableFlag = "GR_VIDEO_SDL";
|
|
|
|
};
|
|
|
|
gr-vocoder = {
|
|
|
|
runtime = [ codec2 gsm ];
|
|
|
|
cmakeEnableFlag = "GR_VOCODER";
|
|
|
|
};
|
|
|
|
gr-wavelet = {
|
|
|
|
cmakeEnableFlag = "GR_WAVELET";
|
|
|
|
runtime = [ gsl ];
|
|
|
|
};
|
|
|
|
gr-zeromq = {
|
|
|
|
runtime = [ cppzmq zeromq ];
|
|
|
|
cmakeEnableFlag = "GR_ZEROMQ";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
shared = (import ./shared.nix {
|
|
|
|
inherit
|
|
|
|
stdenv
|
|
|
|
lib
|
|
|
|
python
|
|
|
|
removeReferencesTo
|
|
|
|
featuresInfo
|
|
|
|
features
|
|
|
|
versionAttr
|
|
|
|
sourceSha256
|
|
|
|
overrideSrc
|
|
|
|
fetchFromGitHub
|
|
|
|
;
|
|
|
|
qt = qt5;
|
|
|
|
gtk = gtk3;
|
|
|
|
});
|
|
|
|
inherit (shared) hasFeature; # function
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
inherit pname;
|
|
|
|
inherit (shared)
|
|
|
|
version
|
|
|
|
src
|
|
|
|
nativeBuildInputs
|
|
|
|
buildInputs
|
|
|
|
disallowedReferences
|
|
|
|
stripDebugList
|
|
|
|
doCheck
|
|
|
|
dontWrapPythonPrograms
|
|
|
|
dontWrapQtApps
|
|
|
|
meta
|
|
|
|
;
|
2021-10-21 13:45:38 +01:00
|
|
|
patches = [
|
|
|
|
# Not accepted upstream, see https://github.com/gnuradio/gnuradio/pull/5227
|
|
|
|
./modtool-newmod-permissions.3_8.patch
|
|
|
|
(fetchpatch {
|
|
|
|
# https://github.com/gnuradio/gnuradio/pull/5226
|
|
|
|
url = "https://github.com/gnuradio/gnuradio/commit/9d7343526dd793120b6425cd9a6969416ed32503.patch";
|
|
|
|
sha256 = "sha256-usSoRDDuClUfdX4yFbQNu8wDzve6UEhZYTFj1oZbFic=";
|
|
|
|
})
|
|
|
|
];
|
2021-02-15 20:14:54 +00:00
|
|
|
passthru = shared.passthru // {
|
|
|
|
# Deps that are potentially overriden and are used inside GR plugins - the same version must
|
|
|
|
inherit boost volk;
|
2021-10-21 21:59:37 +01:00
|
|
|
} // lib.optionalAttrs (hasFeature "gr-uhd") {
|
2021-02-15 20:14:54 +00:00
|
|
|
inherit uhd;
|
2021-10-21 21:59:37 +01:00
|
|
|
} // lib.optionalAttrs (hasFeature "gr-qtgui") {
|
2021-02-15 20:14:54 +00:00
|
|
|
inherit (libsForQt5) qwt;
|
|
|
|
};
|
|
|
|
cmakeFlags = shared.cmakeFlags
|
|
|
|
# From some reason, if these are not set, libcodec2 and gsm are not
|
2021-04-02 19:36:31 +01:00
|
|
|
# detected properly. The issue is reported upstream:
|
|
|
|
# https://github.com/gnuradio/gnuradio/issues/4278
|
2021-06-28 11:16:39 +01:00
|
|
|
# The above issue was fixed for GR3.9 without a backporting patch.
|
2021-04-02 19:36:31 +01:00
|
|
|
#
|
|
|
|
# NOTE: qradiolink needs libcodec2 to be detected in
|
2021-02-15 20:14:54 +00:00
|
|
|
# order to build, see https://github.com/qradiolink/qradiolink/issues/67
|
2021-10-21 21:59:37 +01:00
|
|
|
++ lib.optionals (hasFeature "gr-vocoder") [
|
2021-04-02 19:36:31 +01:00
|
|
|
"-DLIBCODEC2_FOUND=TRUE"
|
2021-02-15 20:14:54 +00:00
|
|
|
"-DLIBCODEC2_LIBRARIES=${codec2}/lib/libcodec2.so"
|
|
|
|
"-DLIBCODEC2_INCLUDE_DIRS=${codec2}/include"
|
|
|
|
"-DLIBCODEC2_HAS_FREEDV_API=ON"
|
2021-04-02 19:36:31 +01:00
|
|
|
"-DLIBGSM_FOUND=TRUE"
|
2021-02-15 20:14:54 +00:00
|
|
|
"-DLIBGSM_LIBRARIES=${gsm}/lib/libgsm.so"
|
|
|
|
"-DLIBGSM_INCLUDE_DIRS=${gsm}/include/gsm"
|
|
|
|
]
|
2021-10-21 21:59:37 +01:00
|
|
|
++ lib.optionals (hasFeature "volk" && volk != null) [
|
2021-02-15 20:14:54 +00:00
|
|
|
"-DENABLE_INTERNAL_VOLK=OFF"
|
|
|
|
]
|
|
|
|
;
|
|
|
|
|
|
|
|
postInstall = shared.postInstall
|
|
|
|
# This is the only python reference worth removing, if needed (3.7 doesn't
|
|
|
|
# set that reference).
|
2021-10-21 21:59:37 +01:00
|
|
|
+ lib.optionalString (!hasFeature "python-support") ''
|
2021-02-15 20:14:54 +00:00
|
|
|
${removeReferencesTo}/bin/remove-references-to -t ${python} $out/lib/cmake/gnuradio/GnuradioConfig.cmake
|
|
|
|
''
|
|
|
|
;
|
|
|
|
}
|