2017-11-11 01:24:05 +01:00
|
|
|
{ stdenv, fetchFromGitHub, writeText, makeWrapper
|
2017-07-15 01:22:07 +02:00
|
|
|
# Dependencies documented @ https://gnuradio.org/doc/doxygen/build_guide.html
|
|
|
|
# => core dependencies
|
2013-05-02 12:44:36 +02:00
|
|
|
, cmake, pkgconfig, git, boost, cppunit, fftw
|
2017-07-15 01:22:07 +02:00
|
|
|
# => python wrappers
|
|
|
|
# May be able to upgrade to swig3
|
2013-05-02 12:44:36 +02:00
|
|
|
, python, swig2, numpy, scipy, matplotlib
|
2017-07-15 01:22:07 +02:00
|
|
|
# => grc - the gnu radio companion
|
2016-10-18 17:53:31 +02:00
|
|
|
, cheetah, pygtk
|
2017-07-15 01:22:07 +02:00
|
|
|
# => gr-wavelet: collection of wavelet blocks
|
2013-05-02 12:44:36 +02:00
|
|
|
, gsl
|
2017-07-15 01:22:07 +02:00
|
|
|
# => gr-qtgui: the Qt-based GUI
|
|
|
|
, qt4, qwt, pyqt4
|
|
|
|
# => gr-wxgui: the Wx-based GUI
|
2013-05-02 12:44:36 +02:00
|
|
|
, wxPython, lxml
|
2017-07-15 01:22:07 +02:00
|
|
|
# => gr-audio: audio subsystems (system/OS dependent)
|
|
|
|
, alsaLib # linux 'audio-alsa'
|
2017-07-15 01:29:38 +02:00
|
|
|
, CoreAudio # darwin 'audio-osx'
|
2017-07-15 01:22:07 +02:00
|
|
|
# => uhd: the Ettus USRP Hardware Driver Interface
|
2013-05-02 12:44:36 +02:00
|
|
|
, uhd
|
2017-07-15 01:22:07 +02:00
|
|
|
# => gr-video-sdl: PAL and NTSC display
|
2013-05-02 12:44:36 +02:00
|
|
|
, SDL
|
2017-07-15 01:22:07 +02:00
|
|
|
# Other
|
2013-05-02 12:44:36 +02:00
|
|
|
, libusb1, orc, pyopengl
|
2014-01-02 17:53:57 +01:00
|
|
|
}:
|
2013-05-02 12:44:36 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "gnuradio-${version}";
|
2017-11-11 01:24:05 +01:00
|
|
|
version = "3.7.11.1";
|
2013-05-02 12:44:36 +02:00
|
|
|
|
2017-11-11 01:24:05 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "gnuradio";
|
|
|
|
repo = "gnuradio";
|
|
|
|
rev = "6d2221196082a4954c249dc6955e33d5832a56f2";
|
|
|
|
sha256 = "1fkrb8cnjbriy2x94lz73q6aqxar1rkvfbafp266ykdpm29b4xgm";
|
|
|
|
fetchSubmodules = true;
|
2013-05-02 12:44:36 +02:00
|
|
|
};
|
|
|
|
|
2017-07-15 01:27:09 +02:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake pkgconfig git makeWrapper cppunit orc
|
2013-05-02 12:44:36 +02:00
|
|
|
];
|
|
|
|
|
2017-07-15 01:27:09 +02:00
|
|
|
buildInputs = [
|
|
|
|
boost fftw python swig2 lxml qt4
|
|
|
|
qwt SDL libusb1 uhd gsl
|
2017-07-15 01:29:38 +02:00
|
|
|
] ++ stdenv.lib.optionals stdenv.isLinux [ alsaLib ]
|
|
|
|
++ stdenv.lib.optionals stdenv.isDarwin [ CoreAudio ];
|
|
|
|
|
2013-05-02 12:44:36 +02:00
|
|
|
propagatedBuildInputs = [
|
2016-10-18 17:53:31 +02:00
|
|
|
cheetah numpy scipy matplotlib pyqt4 pygtk wxPython pyopengl
|
2013-05-02 12:44:36 +02:00
|
|
|
];
|
|
|
|
|
2016-03-22 01:16:53 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2017-09-26 02:20:22 +02:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace \
|
|
|
|
gr-fec/include/gnuradio/fec/polar_decoder_common.h \
|
|
|
|
--replace BOOST_CONSTEXPR_OR_CONST const
|
|
|
|
'';
|
|
|
|
|
2017-07-15 01:34:29 +02:00
|
|
|
# Enables composition with nix-shell
|
|
|
|
grcSetupHook = writeText "grcSetupHook.sh" ''
|
|
|
|
addGRCBlocksPath() {
|
|
|
|
addToSearchPath GRC_BLOCKS_PATH $1/share/gnuradio/grc/blocks
|
|
|
|
}
|
2018-01-07 21:28:50 +01:00
|
|
|
addEnvHooks "$targetOffset" addGRCBlocksPath
|
2017-07-15 01:34:29 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
setupHook = [ grcSetupHook ];
|
|
|
|
|
2017-07-26 01:08:33 +02:00
|
|
|
# patch wxgui and pygtk check due to python importerror in a headless environment
|
2013-05-02 12:44:36 +02:00
|
|
|
preConfigure = ''
|
2017-11-11 01:26:09 +01:00
|
|
|
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -Wno-unused-variable ${stdenv.lib.optionalString (!stdenv.isDarwin) "-std=c++11"}"
|
2017-07-26 01:08:33 +02:00
|
|
|
sed -i 's/.*wx\.version.*/set(WX_FOUND TRUE)/g' gr-wxgui/CMakeLists.txt
|
|
|
|
sed -i 's/.*pygtk_version.*/set(PYGTK_FOUND TRUE)/g' grc/CMakeLists.txt
|
2017-11-11 01:26:09 +01:00
|
|
|
find . -name "CMakeLists.txt" -exec sed -i '1iadd_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=c++11>)' "{}" ";"
|
2013-05-02 12:44:36 +02:00
|
|
|
'';
|
|
|
|
|
2017-07-15 01:24:07 +02:00
|
|
|
# Framework path needed for qwt6_qt4 but not qwt5
|
|
|
|
cmakeFlags =
|
|
|
|
stdenv.lib.optionals stdenv.isDarwin [ "-DCMAKE_FRAMEWORK_PATH=${qwt}/lib" ];
|
|
|
|
|
2013-05-02 12:44:36 +02:00
|
|
|
# - Ensure we get an interactive backend for matplotlib. If not the gr_plot_*
|
|
|
|
# programs will not display anything. Yes, $MATPLOTLIBRC must point to the
|
|
|
|
# *dirname* where matplotlibrc is located, not the file itself.
|
|
|
|
# - GNU Radio core is C++ but the user interface (GUI and API) is Python, so
|
|
|
|
# we must wrap the stuff in bin/.
|
2017-07-15 01:33:28 +02:00
|
|
|
# Notes:
|
|
|
|
# - May want to use makeWrapper instead of wrapProgram
|
|
|
|
# - may want to change interpreter path on Python examples instead of wrapping
|
|
|
|
# - see https://github.com/NixOS/nixpkgs/issues/22688 regarding use of --prefix / python.withPackages
|
|
|
|
# - see https://github.com/NixOS/nixpkgs/issues/24693 regarding use of DYLD_FRAMEWORK_PATH on Darwin
|
2013-05-02 12:44:36 +02:00
|
|
|
postInstall = ''
|
|
|
|
printf "backend : Qt4Agg\n" > "$out/share/gnuradio/matplotlibrc"
|
|
|
|
|
2017-08-10 03:36:10 +02:00
|
|
|
for file in $(find $out/bin $out/share/gnuradio/examples -type f -executable); do
|
2013-05-02 12:44:36 +02:00
|
|
|
wrapProgram "$file" \
|
2014-03-09 22:29:42 +01:00
|
|
|
--prefix PYTHONPATH : $PYTHONPATH:$(toPythonPath "$out") \
|
2017-07-15 01:31:53 +02:00
|
|
|
--set MATPLOTLIBRC "$out/share/gnuradio" \
|
|
|
|
${stdenv.lib.optionalString stdenv.isDarwin "--set DYLD_FRAMEWORK_PATH /System/Library/Frameworks"}
|
2013-05-02 12:44:36 +02:00
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Software Defined Radio (SDR) software";
|
|
|
|
longDescription = ''
|
|
|
|
GNU Radio is a free & open-source software development toolkit that
|
|
|
|
provides signal processing blocks to implement software radios. It can be
|
|
|
|
used with readily-available low-cost external RF hardware to create
|
|
|
|
software-defined radios, or without hardware in a simulation-like
|
|
|
|
environment. It is widely used in hobbyist, academic and commercial
|
|
|
|
environments to support both wireless communications research and
|
|
|
|
real-world radio systems.
|
|
|
|
'';
|
2017-06-20 03:39:54 +02:00
|
|
|
homepage = https://www.gnuradio.org;
|
2013-05-02 12:44:36 +02:00
|
|
|
license = licenses.gpl3;
|
2017-07-15 01:30:20 +02:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2016-03-22 01:16:53 +01:00
|
|
|
maintainers = with maintainers; [ bjornfor fpletz ];
|
2013-05-02 12:44:36 +02:00
|
|
|
};
|
|
|
|
}
|