Merge pull request #99685 from doronbehar/pkg/gnuradio

gnuradio: rewrite
This commit is contained in:
Doron Behar 2020-12-05 17:14:37 +02:00 committed by GitHub
commit a5e44038df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 944 additions and 201 deletions

View file

@ -26,6 +26,19 @@
<listitem>
<para>GNOME desktop environment was upgraded to 3.38, see its <link xlink:href="https://help.gnome.org/misc/release-notes/3.38/">release notes</link>.</para>
</listitem>
<listitem>
<para>
<link xlink:href="https://www.gnuradio.org/">GNURadio</link> 3.8 was
<link xlink:href="https://github.com/NixOS/nixpkgs/issues/82263">finnally</link>
packaged, along with a rewrite to the Nix expressions, allowing users to
override the features upstream supports selecting to compile or not to.
Additionally, the attribute <code>gnuradio<code> and <code>gnuradio3_7<code>
now point to an externally wrapped by default derivations, that allow you to
also add `extraPythonPackages` to the Python interpreter used by GNURadio.
Missing environmental variables needed for operational GUI were also added
(<link xlink:href="https://github.com/NixOS/nixpkgs/issues/75478">#7547</link>).
</para>
</listitem>
</itemizedlist>
</section>

View file

@ -41,6 +41,7 @@ stdenv.mkDerivation rec {
orc
pkgconfig
pythonPackages.Mako
pythonPackages.six
# UHD support is optional, but gnuradio is built with it, so there's
# nothing to be gained by leaving it out.

View file

@ -0,0 +1,295 @@
{ stdenv
, fetchFromGitHub
, fetchpatch
, cmake
# Remove gcc and python references
, removeReferencesTo
, pkgconfig
, cppunit
, swig
, orc
, boost
, log4cpp
, mpir
, doxygen
, python
, codec2
, gsm
, fftwFloat
, alsaLib
, libjack2
, CoreAudio
, uhd
, comedilib
, libusb1
, SDL
, gsl
, cppzmq
, zeromq
# GUI related
, gtk2
, pango
, cairo
, qt4
, qwt6_qt4
# 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.7";
minor = "14";
patch = "0";
}
, fetchSubmodules ? true
}:
let
sourceSha256 = "1nh4f9dmygprlbqybd3j1byg9fsr6065n140mvc4b0v8qqygmhrc";
featuresInfo = {
# Needed always
basic = {
native = [
cmake
pkgconfig
orc
];
runtime = [ boost log4cpp mpir ];
pythonNative = with python.pkgs; [ Mako six ];
};
volk = {
cmakeEnableFlag = "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
];
};
gnuradio-companion = {
pythonRuntime = with python.pkgs; [
pyyaml
cheetah
lxml
pygtk
numpy
# propagated by pygtk, but since wrapping is done externally, it help
# the wrapper if it's here
pycairo
pygobject2
];
runtime = [
gtk2
pango
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-atsc = {
cmakeEnableFlag = "GR_ATSC";
};
gr-audio = {
runtime = []
++ stdenv.lib.optionals stdenv.isLinux [ alsaLib libjack2 ]
++ stdenv.lib.optionals stdenv.isDarwin [ CoreAudio ]
;
cmakeEnableFlag = "GR_AUDIO";
};
gr-comedi = {
runtime = [ comedilib ];
cmakeEnableFlag = "GR_COMEDI";
};
gr-channels = {
cmakeEnableFlag = "GR_CHANNELS";
};
gr-noaa = {
cmakeEnableFlag = "GR_NOAA";
};
gr-pager = {
cmakeEnableFlag = "GR_PAGER";
};
gr-qtgui = {
runtime = [ qt4 qwt6_qt4 ];
pythonRuntime = [ python.pkgs.pyqt4 ];
cmakeEnableFlag = "GR_QTGUI";
};
gr-trellis = {
cmakeEnableFlag = "GR_TRELLIS";
};
gr-uhd = {
runtime = [ uhd ];
cmakeEnableFlag = "GR_UHD";
};
gr-utils = {
cmakeEnableFlag = "GR_UTILS";
};
gr-video-sdl = {
runtime = [ SDL ];
cmakeEnableFlag = "GR_VIDEO_SDL";
};
gr-vocoder = {
runtime = [ codec2 gsm ];
cmakeEnableFlag = "GR_VOCODER";
};
gr-fcd = {
runtime = [ libusb1 ];
cmakeEnableFlag = "GR_FCD";
};
gr-wavelet = {
cmakeEnableFlag = "GR_WAVELET";
runtime = [ gsl ];
};
gr-zeromq = {
runtime = [ cppzmq zeromq ];
cmakeEnableFlag = "GR_ZEROMQ";
};
gr-wxgui = {
pythonRuntime = with python.pkgs; [ numpy wxPython ];
cmakeEnableFlag = "GR_WXGUI";
};
};
shared = (import ./shared.nix {
inherit
stdenv
python
removeReferencesTo
featuresInfo
features
versionAttr
sourceSha256
overrideSrc
fetchFromGitHub
fetchSubmodules
;
qt = qt4;
gtk = gtk2;
});
inherit (shared)
version
src
hasFeature # function
nativeBuildInputs
buildInputs
disallowedReferences
postInstall
passthru
doCheck
dontWrapPythonPrograms
meta
;
cmakeFlags = shared.cmakeFlags
# From some reason, if these are not set, libcodec2 and gsm are
# not detected properly (slightly different then what's in
# ./default.nix).
++ stdenv.lib.optionals (hasFeature "gr-vocoder" features) [
"-DLIBCODEC2_LIBRARIES=${codec2}/lib/libcodec2.so"
"-DLIBCODEC2_INCLUDE_DIR=${codec2}/include"
"-DLIBGSM_LIBRARIES=${gsm}/lib/libgsm.so"
"-DLIBGSM_INCLUDE_DIR=${gsm}/include/gsm"
]
;
stripDebugList = shared.stripDebugList
# gr-fcd feature was dropped in 3.8
++ stdenv.lib.optionals (hasFeature "gr-fcd" features) [ "share/gnuradio/examples/fcd" ]
;
preConfigure = ''
''
# wxgui and pygtk are not looked up properly, so we force them to be
# detected as found, if they are requested by the `features` attrset.
+ stdenv.lib.optionalString (hasFeature "gr-wxgui" features) ''
sed -i 's/.*wx\.version.*/set(WX_FOUND TRUE)/g' gr-wxgui/CMakeLists.txt
''
+ stdenv.lib.optionalString (hasFeature "gnuradio-companion" features) ''
sed -i 's/.*pygtk_version.*/set(PYGTK_FOUND TRUE)/g' grc/CMakeLists.txt
''
# If python-support is disabled, don't install volk's (git submodule)
# volk_modtool - it references python.
#
# NOTE: The same is done for 3.8, but we don't put this string in
# ./shared.nix since on the next release of 3.8 it won't be needed there,
# but it will be needed for 3.7, probably for ever.
+ stdenv.lib.optionalString (!hasFeature "python-support" features) ''
sed -i -e "/python\/volk_modtool/d" volk/CMakeLists.txt
''
;
patches = [
# Don't install python referencing files if python support is disabled.
# See: https://github.com/gnuradio/gnuradio/pull/3856
(fetchpatch {
url = "https://github.com/gnuradio/gnuradio/commit/acef55433d15c231661fa44751f9a2d90a4baa4b.diff";
sha256 = "2CEX44Ll8frfLXTIWjdDhKl7aXcjiAWsezVdwrynelE=";
})
(fetchpatch {
url = "https://github.com/gnuradio/gnuradio/commit/a2681edcfaabcb1ecf878ae861161b6a6bf8459d.diff";
sha256 = "2Pitgu8accs16B5X5+/q51hr+IY9DMsA15f56gAtBs8=";
})
];
in
stdenv.mkDerivation rec {
inherit
pname
version
src
nativeBuildInputs
buildInputs
cmakeFlags
preConfigure
# disallowedReferences
stripDebugList
patches
postInstall
passthru
doCheck
dontWrapPythonPrograms
meta
;
}

View file

@ -1,5 +1,5 @@
{ stdenv, fetchFromGitHub, cmake, pkgconfig, boost, gnuradio
, makeWrapper, cppunit, gr-osmosdr
, makeWrapper, cppunit, gr-osmosdr, log4cpp
, pythonSupport ? true, python, swig
}:
@ -19,7 +19,7 @@ stdenv.mkDerivation {
nativeBuildInputs = [ pkgconfig ];
buildInputs = [
cmake boost gnuradio makeWrapper cppunit gr-osmosdr
cmake boost gnuradio makeWrapper cppunit gr-osmosdr log4cpp
] ++ stdenv.lib.optionals pythonSupport [ python swig ];
postInstall = ''

View file

@ -1,165 +1,288 @@
{ stdenv
, fetchFromGitHub
, makeWrapper
, writeText
# Dependencies documented @ https://gnuradio.org/doc/doxygen/build_guide.html
# => core dependencies
, fetchpatch
, cmake
# Remove gcc and python references
, removeReferencesTo
, pkgconfig
, git
, boost
, cppunit
, fftw
# => python wrappers
# May be able to upgrade to swig3
, python
, swig2
, numpy
, scipy
, matplotlib
# => grc - the gnu radio companion
, Mako
, cheetah
, pygtk # Note: GR is migrating to Mako. Cheetah should be removed for GR3.8
# => gr-wavelet: collection of wavelet blocks
, gsl
# => gr-qtgui: the Qt-based GUI
, qt4
, qwt
, pyqt4
# => gr-wxgui: the Wx-based GUI
, wxPython
, lxml
# => gr-audio: audio subsystems (system/OS dependent)
, alsaLib # linux 'audio-alsa'
, CoreAudio # darwin 'audio-osx'
# => uhd: the Ettus USRP Hardware Driver Interface
, uhd
# => gr-video-sdl: PAL and NTSC display
, SDL
# Other
, libusb1
, swig
, orc
, pyopengl
, boost
, log4cpp
, mpir
, doxygen
, python
, codec2
, gsm
, fftwFloat
, alsaLib
, libjack2
, CoreAudio
, uhd
, SDL
, gsl
, cppzmq
, zeromq
# 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";
minor = "2";
patch = "0";
}
# Should be false on the release after 3.8.2.0
, fetchSubmodules ? true
}:
stdenv.mkDerivation rec {
pname = "gnuradio";
version = "3.7.14.0";
src = fetchFromGitHub {
owner = "gnuradio";
repo = "gnuradio";
rev = "v${version}";
sha256 = "1nh4f9dmygprlbqybd3j1byg9fsr6065n140mvc4b0v8qqygmhrc";
fetchSubmodules = true;
let
sourceSha256 = "1mnfwdy7w3160vi6110x2qkyq8l78qi8771zwak9n72bl7lhhpnf";
featuresInfo = {
# Needed always
basic = {
native = [
cmake
pkgconfig
orc
];
runtime = [
boost
log4cpp
mpir
];
pythonNative = with python.pkgs; [
Mako
six
];
};
# NOTE: Should be removed on the release after 3.8.2.0, see:
# https://github.com/gnuradio/gnuradio/commit/80c04479d
volk = {
cmakeEnableFlag = "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 = {
# Thrift support is not really working well, and even the patch they
# recommend applying on 0.9.2 won't apply. See:
# https://github.com/gnuradio/gnuradio/blob/v3.8.2.0/gnuradio-runtime/lib/controlport/thrift/README
cmakeEnableFlag = "GR_CTRLPORT";
native = [
swig
];
};
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 = []
++ stdenv.lib.optionals stdenv.isLinux [ alsaLib libjack2 ]
++ stdenv.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";
};
gr-modtool = {
pythonRuntime = with python.pkgs; [
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
python
removeReferencesTo
featuresInfo
features
versionAttr
sourceSha256
overrideSrc
fetchFromGitHub
fetchSubmodules
;
qt = qt5;
gtk = gtk3;
});
inherit (shared)
version
src
hasFeature # function
nativeBuildInputs
buildInputs
disallowedReferences
stripDebugList
passthru
doCheck
dontWrapPythonPrograms
meta
;
cmakeFlags = shared.cmakeFlags
# From some reason, if these are not set, libcodec2 and gsm are not
# detected properly. NOTE: qradiolink needs libcodec2 to be detected in
# order to build, see https://github.com/qradiolink/qradiolink/issues/67
++ stdenv.lib.optionals (hasFeature "gr-vocoder" features) [
"-DLIBCODEC2_LIBRARIES=${codec2}/lib/libcodec2.so"
"-DLIBCODEC2_INCLUDE_DIRS=${codec2}/include"
"-DLIBCODEC2_HAS_FREEDV_API=ON"
"-DLIBGSM_LIBRARIES=${gsm}/lib/libgsm.so"
"-DLIBGSM_INCLUDE_DIRS=${gsm}/include/gsm"
]
;
nativeBuildInputs = [
cmake
pkgconfig
git
makeWrapper
cppunit
orc
];
buildInputs = [
boost
fftw
python
swig2
lxml
qt4
qwt
SDL
libusb1
uhd
gsl
] ++ stdenv.lib.optionals stdenv.isLinux [ alsaLib ]
++ stdenv.lib.optionals stdenv.isDarwin [ CoreAudio ];
propagatedBuildInputs = [
Mako
cheetah
numpy
scipy
matplotlib
pyqt4
pygtk
wxPython
pyopengl
];
NIX_LDFLAGS = "-lpthread";
enableParallelBuilding = true;
postPatch = ''
substituteInPlace \
gr-fec/include/gnuradio/fec/polar_decoder_common.h \
--replace BOOST_CONSTEXPR_OR_CONST const
'';
# Enables composition with nix-shell
grcSetupHook = writeText "grcSetupHook.sh" ''
addGRCBlocksPath() {
addToSearchPath GRC_BLOCKS_PATH $1/share/gnuradio/grc/blocks
}
addEnvHooks "$targetOffset" addGRCBlocksPath
'';
setupHook = [ grcSetupHook ];
# patch wxgui and pygtk check due to python importerror in a headless environment
# wxgtk gui will be removed in GR3.8
# c++11 hack may not be necessary anymore
postInstall = shared.postInstall
# This is the only python reference worth removing, if needed (3.7 doesn't
# set that reference).
+ stdenv.lib.optionalString (!hasFeature "python-support" features) ''
${removeReferencesTo}/bin/remove-references-to -t ${python} $out/lib/cmake/gnuradio/GnuradioConfig.cmake
''
;
preConfigure = ''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -Wno-unused-variable ${stdenv.lib.optionalString (!stdenv.isDarwin) "-std=c++11"}"
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
find . -name "CMakeLists.txt" -exec sed -i '1iadd_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=c++11>)' "{}" ";"
'';
''
# If python-support is disabled, don't install volk's (git submodule)
# volk_modtool - it references python.
#
# NOTE: on the next release, volk will always be required to be installed
# externally (submodule removed upstream). Hence this hook will fail and
# we'll need to package volk while able to tell it to install or not
# install python referencing files. When we'll be there, this will help:
# https://github.com/gnuradio/volk/pull/404
+ stdenv.lib.optionalString (!hasFeature "python-support" features) ''
sed -i -e "/python\/volk_modtool/d" volk/CMakeLists.txt
''
;
patches = [
# Don't install python referencing files if python support is disabled.
# See: https://github.com/gnuradio/gnuradio/pull/3839
(fetchpatch {
url = "https://github.com/gnuradio/gnuradio/commit/4a4fd570b398b0b50fe875fcf0eb9c9db2ea5c6e.diff";
sha256 = "xz2E0ji6zfdOAhjfPecAcaVOIls1XP8JngLkBbBBW5Q=";
})
(fetchpatch {
url = "https://github.com/gnuradio/gnuradio/commit/dbc8ad7e7361fddc7b1dbc267c07a776a3f9664b.diff";
sha256 = "tQcCpcUbJv3yqAX8rSHN/pAuBq4ueEvoVo7sNzZGvf4=";
})
];
in
# Framework path needed for qwt6_qt4 but not qwt5
cmakeFlags =
stdenv.lib.optionals stdenv.isDarwin [ "-DCMAKE_FRAMEWORK_PATH=${qwt}/lib" ];
# - 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/.
# 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
postInstall = ''
printf "backend : Qt4Agg\n" > "$out/share/gnuradio/matplotlibrc"
for file in $(find $out/bin $out/share/gnuradio/examples -type f -executable); do
wrapProgram "$file" \
--prefix PYTHONPATH : $PYTHONPATH:$(toPythonPath "$out") \
--set MATPLOTLIBRC "$out/share/gnuradio" \
${stdenv.lib.optionalString stdenv.isDarwin "--set DYLD_FRAMEWORK_PATH /System/Library/Frameworks"}
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.
'';
homepage = "https://www.gnuradio.org";
license = licenses.gpl3;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ bjornfor fpletz ];
};
stdenv.mkDerivation rec {
inherit
pname
version
src
nativeBuildInputs
buildInputs
cmakeFlags
preConfigure
# disallowedReferences
stripDebugList
patches
postInstall
passthru
doCheck
dontWrapPythonPrograms
meta
;
}

View file

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, cmake, pkgconfig, boost, gnuradio
{ stdenv, fetchFromGitHub, cmake, pkgconfig, boost, gnuradio, log4cpp
, makeWrapper, cppunit, libosmocore, gr-osmosdr
, pythonSupport ? true, python, swig
}:
@ -18,7 +18,7 @@ stdenv.mkDerivation {
nativeBuildInputs = [ pkgconfig ];
buildInputs = [
cmake boost gnuradio makeWrapper cppunit libosmocore gr-osmosdr
cmake boost gnuradio makeWrapper cppunit libosmocore gr-osmosdr log4cpp
] ++ stdenv.lib.optionals pythonSupport [ python swig ];
postInstall = ''

View file

@ -1,5 +1,5 @@
{ stdenv, fetchFromGitHub, cmake, pkgconfig, boost, gnuradio
, pythonSupport ? true, python, swig, limesuite
, pythonSupport ? true, python, swig, limesuite, log4cpp
} :
assert pythonSupport -> python != null && swig != null;
@ -24,7 +24,7 @@ in stdenv.mkDerivation {
] ++ stdenv.lib.optionals pythonSupport [ swig ];
buildInputs = [
boost gnuradio limesuite
boost gnuradio limesuite log4cpp
] ++ stdenv.lib.optionals pythonSupport [ python ];

View file

@ -1,5 +1,5 @@
{ stdenv, fetchFromGitHub, cmake, pkgconfig, boost, gnuradio, uhd
, makeWrapper, libsodium, cppunit
, makeWrapper, libsodium, cppunit, log4cpp
, pythonSupport ? true, python, swig
}:
@ -18,7 +18,7 @@ stdenv.mkDerivation {
nativeBuildInputs = [ pkgconfig ];
buildInputs = [
cmake boost gnuradio uhd makeWrapper libsodium cppunit
cmake boost gnuradio uhd makeWrapper libsodium cppunit log4cpp
] ++ stdenv.lib.optionals pythonSupport [ python swig ];
postInstall = ''

View file

@ -8,6 +8,7 @@
, rtl-sdr
, soapysdr-with-plugins
, uhd
, log4cpp
}:
assert pythonSupport -> python != null && swig != null;
@ -24,10 +25,10 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkgconfig ];
buildInputs = [
cmake makeWrapper boost
cmake makeWrapper boost log4cpp
airspy gnuradio hackrf libbladeRF rtl-sdr uhd
] ++ stdenv.lib.optionals stdenv.isLinux [ soapysdr-with-plugins ]
++ stdenv.lib.optionals pythonSupport [ python swig ];
++ stdenv.lib.optionals pythonSupport [ python swig python.pkgs.cheetah ];
postInstall = ''
for prog in "$out"/bin/*; do

View file

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, cmake, pkgconfig, boost, gnuradio
{ stdenv, fetchFromGitHub, cmake, pkgconfig, boost, gnuradio, log4cpp
, makeWrapper, pythonSupport ? true, python, swig
}:
@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkgconfig ];
buildInputs = [
cmake boost gnuradio makeWrapper
cmake boost gnuradio makeWrapper log4cpp
] ++ stdenv.lib.optionals pythonSupport [ python swig ];
postInstall = ''

View file

@ -0,0 +1,135 @@
{ stdenv
, python
, qt
, gtk
, removeReferencesTo
, featuresInfo
, features
, versionAttr
, sourceSha256
# If overriden. No need to set default values, as they are given defaults in
# the main expressions
, overrideSrc
, fetchFromGitHub
, fetchSubmodules
}:
let
lib = stdenv.lib;
in rec {
version = builtins.concatStringsSep "." (
lib.attrVals [ "major" "minor" "patch" ] versionAttr
);
src = if overrideSrc != {} then
overrideSrc
else
fetchFromGitHub {
repo = "gnuradio";
owner = "gnuradio";
rev = "v${version}";
sha256 = sourceSha256;
inherit fetchSubmodules;
}
;
# Check if a feature is enabled, while defaulting to true if feat is not
# specified.
hasFeature = feat: features: (
if builtins.hasAttr feat features then
features.${feat}
else
true
);
nativeBuildInputs = lib.flatten (lib.mapAttrsToList (
feat: info: (
if hasFeature feat features then
(if builtins.hasAttr "native" info then info.native else []) ++
(if builtins.hasAttr "pythonNative" info then info.pythonNative else [])
else
[]
)
) featuresInfo);
buildInputs = lib.flatten (lib.mapAttrsToList (
feat: info: (
if hasFeature feat features then
(if builtins.hasAttr "runtime" info then info.runtime else []) ++
(if builtins.hasAttr "pythonRuntime" info then info.pythonRuntime else [])
else
[]
)
) featuresInfo);
cmakeFlags = lib.mapAttrsToList (
feat: info: (
if feat == "basic" then
# Abuse this unavoidable "iteration" to set this flag which we want as
# well - it means: Don't turn on features just because their deps are
# satisfied, let only our cmakeFlags decide.
"-DENABLE_DEFAULT=OFF"
else
if hasFeature feat features then
"-DENABLE_${info.cmakeEnableFlag}=ON"
else
"-DENABLE_${info.cmakeEnableFlag}=OFF"
)) featuresInfo
;
disallowedReferences = [
# TODO: Should this be conditional?
stdenv.cc
stdenv.cc.cc
]
# If python-support is disabled, we probably don't want it referenced
++ lib.optionals (!hasFeature "python-support" features) [ python ]
;
# Gcc references from examples
stripDebugList = [ "lib" "bin" ]
++ lib.optionals (hasFeature "gr-audio" features) [ "share/gnuradio/examples/audio" ]
++ lib.optionals (hasFeature "gr-uhd" features) [ "share/gnuradio/examples/uhd" ]
++ lib.optionals (hasFeature "gr-qtgui" features) [ "share/gnuradio/examples/qt-gui" ]
;
postInstall = ''
''
# Gcc references
+ lib.optionalString (hasFeature "volk" features) ''
${removeReferencesTo}/bin/remove-references-to -t ${stdenv.cc} $(readlink -f $out/lib/libvolk.so)
''
+ lib.optionalString (hasFeature "gnuradio-runtime" features) ''
${removeReferencesTo}/bin/remove-references-to -t ${stdenv.cc} $(readlink -f $out/lib/libgnuradio-runtime.so)
''
;
# NOTE: Outputs are disabled due to upstream not using GNU InstallDIrs cmake
# module. It's not that bad since it's a development package for most
# purposes. If closure size needs to be reduced, features should be disabled
# via an override.
passthru = {
inherit
hasFeature
versionAttr
features
featuresInfo
python
qt
gtk
;
};
# Wrapping is done with an external wrapper
dontWrapPythonPrograms = true;
# Tests should succeed, but it's hard to get LD_LIBRARY_PATH right in order
# for it to happen.
doCheck = false;
meta = with 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.
'';
homepage = "https://www.gnuradio.org";
license = licenses.gpl3;
platforms = platforms.unix;
maintainers = with maintainers; [ doronbehar bjornfor fpletz ];
};
}

View file

@ -1,24 +1,134 @@
{ stdenv, gnuradio, makeWrapper, python, extraPackages ? [] }:
{ stdenv
, unwrapped
, makeWrapper
# For lndir
, xorg
# For Emulating wrapGAppsHook
, gsettings-desktop-schemas
, glib
, hicolor-icon-theme
, pango
, json-glib
, dconf
, gobject-introspection
, librsvg
, gdk-pixbuf
, harfbuzz
, at-spi2-core
, atk
# For Adding additional GRC blocks
, extraPackages ? []
# For Adding additional python packaages
, extraPythonPackages ? []
# Allow to add whatever you want to the wrapper
, extraMakeWrapperArgs ? []
}:
with { inherit (stdenv.lib) appendToName makeSearchPath; };
let
pythonPkgs = extraPythonPackages
# Add the extraPackages as python modules as well
++ (builtins.map unwrapped.python.pkgs.toPythonModule extraPackages)
++ stdenv.lib.flatten (stdenv.lib.mapAttrsToList (
feat: info: (
if unwrapped.hasFeature feat unwrapped.features then
(if builtins.hasAttr "pythonRuntime" info then info.pythonRuntime else [])
else
[]
)
) unwrapped.featuresInfo)
++ stdenv.lib.optionals (unwrapped.hasFeature "python-support" unwrapped.features) [
# Add unwrapped itself as a python module
(unwrapped.python.pkgs.toPythonModule unwrapped)
]
;
python3Env = unwrapped.python.withPackages(ps: pythonPkgs);
name = (stdenv.lib.appendToName "wrapped" unwrapped).name;
makeWrapperArgs = builtins.concatStringsSep " " ([
]
# Emulating wrapGAppsHook & wrapQtAppsHook working together
++ stdenv.lib.optionals (
(unwrapped.hasFeature "gnuradio-companion" unwrapped.features)
|| (unwrapped.hasFeature "gr-qtgui" unwrapped.features)
) [
"--prefix" "XDG_DATA_DIRS" ":" "$out/share"
"--prefix" "XDG_DATA_DIRS" ":" "$out/share/gsettings-schemas/${name}"
"--prefix" "XDG_DATA_DIRS" ":" "${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}"
"--prefix" "XDG_DATA_DIRS" ":" "${hicolor-icon-theme}/share"
# Needs to run `gsettings` on startup, see:
# https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1764890.html
"--prefix" "PATH" ":" "${stdenv.lib.getBin glib}/bin"
]
++ stdenv.lib.optionals (unwrapped.hasFeature "gnuradio-companion" unwrapped.features) [
"--set" "GDK_PIXBUF_MODULE_FILE" "${librsvg}/${gdk-pixbuf.moduleDir}.cache"
"--prefix" "GIO_EXTRA_MODULES" ":" "${stdenv.lib.getLib dconf}/lib/gio/modules"
"--prefix" "XDG_DATA_DIRS" ":" "${unwrapped.gtk}/share"
"--prefix" "XDG_DATA_DIRS" ":" "${unwrapped.gtk}/share/gsettings-schemas/${unwrapped.gtk.name}"
"--prefix" "GI_TYPELIB_PATH" ":" "${stdenv.lib.makeSearchPath "lib/girepository-1.0" [
unwrapped.gtk
gsettings-desktop-schemas
atk
# From some reason, if .out is not used, .bin is used, and we want
# what's in `.out`.
pango.out
gdk-pixbuf
json-glib
harfbuzz
librsvg
gobject-introspection
at-spi2-core
]}"
]
++ stdenv.lib.optionals (extraPackages != []) [
"--prefix" "GRC_BLOCKS_PATH" ":" "${stdenv.lib.makeSearchPath "share/gnuradio/grc/blocks" extraPackages}"
]
++ stdenv.lib.optionals (unwrapped.hasFeature "gr-qtgui" unwrapped.features)
# 3.7 builds with qt4
(if unwrapped.versionAttr.major == "3.8" then
[
"--prefix" "QT_PLUGIN_PATH" ":"
"${stdenv.lib.getBin unwrapped.qt.qtbase}/${unwrapped.qt.qtbase.qtPluginPrefix}"
"--prefix" "QML2_IMPORT_PATH" ":"
"${stdenv.lib.getBin unwrapped.qt.qtbase}/${unwrapped.qt.qtbase.qtQmlPrefix}"
]
else
# TODO: Add here qt4 related environment for 3.7?
[
]
)
++ extraMakeWrapperArgs
);
in
stdenv.mkDerivation {
name = (appendToName "with-packages" gnuradio).name;
buildInputs = [ makeWrapper python ];
inherit name;
buildInputs = [
makeWrapper
xorg.lndir
];
passthru = {
inherit python3Env pythonPkgs unwrapped;
};
buildCommand = ''
mkdir -p $out/bin
ln -s "${gnuradio}"/bin/* $out/bin/
for file in $(find -L $out/bin -type f); do
if test -x "$(readlink -f "$file")"; then
wrapProgram "$file" \
--prefix PYTHONPATH : ${stdenv.lib.concatStringsSep ":"
(map (path: "$(toPythonPath ${path})") extraPackages)} \
--prefix GRC_BLOCKS_PATH : ${makeSearchPath "share/gnuradio/grc/blocks" extraPackages}
fi
mkdir $out
cd $out
lndir -silent ${unwrapped}
for i in $out/bin/*; do
if [[ ! -x "$i" ]]; then
continue
fi
cp -L "$i" "$i".tmp
mv -f "$i".tmp "$i"
if head -1 "$i" | grep -q ${unwrapped.python}; then
substituteInPlace "$i" \
--replace ${unwrapped.python} ${python3Env}
fi
wrapProgram "$i" ${makeWrapperArgs}
done
'';
inherit (gnuradio) meta;
inherit (unwrapped) meta;
}

View file

@ -13,13 +13,13 @@
stdenv.mkDerivation rec {
pname = "comedilib";
version = "0.11.0";
version = "0.12.0";
src = fetchFromGitHub {
owner = "Linux-Comedi";
repo = "comedilib";
rev = "r${stdenv.lib.replaceStrings [ "." ] [ "_" ] version}";
sha256 = "159sv4jdgmcaqz76vazkyxxb85ni7pg14p1qv7y94hib3kspc195";
sha256 = "0kfs2dw62vjz8j7fgsxq6ky8r8kca726gyklbm6kljvgfh47lyfw";
};
nativeBuildInputs = [

View file

@ -189,6 +189,10 @@ mapAliases ({
gnuradio-limesdr = gr-limesdr; # added 2019-05-27
gnuradio-rds = gr-rds; # added 2019-05-27
gnuradio-osmosdr = gr-osmosdr; # added 2019-05-27
# added 20-10-2020
gnuradio-with-packages = gnuradio3_7.override {
extraPackages = [ gr-nacl gr-gsm gr-ais gr-limesdr gr-rds gr-osmosdr ];
};
gnustep-make = gnustep.make; # added 2016-7-6
gnupg20 = throw "gnupg20 has been removed from nixpkgs as upstream dropped support on 2017-12-31";# added 2020-07-12
go_1_12 = throw "go_1_12 has been removed"; # added 2020-04-26

View file

@ -15741,7 +15741,13 @@ in
qm-dsp = callPackage ../development/libraries/audio/qm-dsp { };
qradiolink = callPackage ../applications/radio/qradiolink { };
qradiolink = callPackage ../applications/radio/qradiolink {
# 3.8 support is not ready yet:
# https://github.com/qradiolink/qradiolink/issues/67#issuecomment-703222573
# The non minimal build is used because the 'qtgui' component is needed.
# gr-osmosdr is using the same gnuradio as of now.
gnuradio = gnuradio3_7-unwrapped;
};
qrupdate = callPackage ../development/libraries/qrupdate { };
@ -21152,34 +21158,80 @@ in
gksu = callPackage ../applications/misc/gksu { };
gnss-sdr = callPackage ../applications/radio/gnss-sdr { boost=boost166; };
gnuradio = callPackage ../applications/radio/gnuradio {
inherit (python2Packages) cheetah lxml Mako matplotlib numpy python pyopengl pyqt4 scipy wxPython pygtk;
inherit (darwin.apple_sdk.frameworks) CoreAudio;
fftw = fftwFloat;
qwt = qwt6_qt4;
gnss-sdr = callPackage ../applications/radio/gnss-sdr {
boost = boost166;
gnuradio = gnuradio3_7-unwrapped;
};
gnuradio-with-packages = callPackage ../applications/radio/gnuradio/wrapper.nix {
inherit (python2Packages) python;
extraPackages = [ gr-nacl gr-osmosdr gr-ais gr-rds ]
++ lib.optionals stdenv.isLinux [ gr-gsm gr-limesdr ];
gnuradio-unwrapped = callPackage ../applications/radio/gnuradio {
inherit (darwin.apple_sdk.frameworks) CoreAudio;
python = python3;
};
# A build without gui components and other utilites not needed for end user
# libraries
gnuradioMinimal = gnuradio-unwrapped.override {
features = {
gnuradio-companion = false;
python-support = false;
gr-ctrlport = false;
examples = false;
gr-qtgui = false;
gr-utils = false;
gr-modtool = false;
sphinx = false;
doxygen = false;
};
};
gnuradio = callPackage ../applications/radio/gnuradio/wrapper.nix {
unwrapped = gnuradio-unwrapped;
};
gnuradio3_7-unwrapped = callPackage ../applications/radio/gnuradio/3.7.nix {
inherit (darwin.apple_sdk.frameworks) CoreAudio;
python = python2;
};
# A build without gui components and other utilites not needed if gnuradio is
# used as a c++ library.
gnuradio3_7Minimal = gnuradio3_7-unwrapped.override {
features = {
gnuradio-companion = false;
python-support = false;
gr-ctrlport = false;
gr-qtgui = false;
gr-utils = false;
sphinx = false;
doxygen = false;
gr-wxgui = false;
};
};
gnuradio3_7 = callPackage ../applications/radio/gnuradio/wrapper.nix {
unwrapped = gnuradio3_7-unwrapped;
};
grandorgue = callPackage ../applications/audio/grandorgue { };
gr-nacl = callPackage ../applications/radio/gnuradio/nacl.nix { };
gr-nacl = callPackage ../applications/radio/gnuradio/nacl.nix {
gnuradio = gnuradio3_7-unwrapped;
};
gr-gsm = callPackage ../applications/radio/gnuradio/gsm.nix { };
gr-gsm = callPackage ../applications/radio/gnuradio/gsm.nix {
gnuradio = gnuradio3_7-unwrapped;
};
gr-ais = callPackage ../applications/radio/gnuradio/ais.nix { };
gr-ais = callPackage ../applications/radio/gnuradio/ais.nix {
gnuradio = gnuradio3_7-unwrapped;
};
gr-limesdr = callPackage ../applications/radio/gnuradio/limesdr.nix { };
gr-limesdr = callPackage ../applications/radio/gnuradio/limesdr.nix {
gnuradio = gnuradio3_7-unwrapped;
};
gr-rds = callPackage ../applications/radio/gnuradio/rds.nix { };
gr-rds = callPackage ../applications/radio/gnuradio/rds.nix {
gnuradio = gnuradio3_7-unwrapped;
};
gr-osmosdr = callPackage ../applications/radio/gnuradio/osmosdr.nix { };
gr-osmosdr = callPackage ../applications/radio/gnuradio/osmosdr.nix {
gnuradio = gnuradio3_7-unwrapped;
};
goldendict = libsForQt514.callPackage ../applications/misc/goldendict {
inherit (darwin) libiconv;
@ -21218,7 +21270,14 @@ in
gpx = callPackage ../applications/misc/gpx { };
gqrx = libsForQt514.callPackage ../applications/radio/gqrx { };
gqrx = libsForQt514.callPackage ../applications/radio/gqrx {
gnuradio = gnuradio3_7Minimal;
# Use the same gnuradio for gr-osmosdr as well
gr-osmosdr = gr-osmosdr.override {
gnuradio = gnuradio3_7Minimal;
pythonSupport = false;
};
};
gpx-viewer = callPackage ../applications/misc/gpx-viewer { };
@ -21984,7 +22043,9 @@ in
inkscape-extensions = recurseIntoAttrs (callPackages ../applications/graphics/inkscape/extensions.nix {});
inspectrum = libsForQt514.callPackage ../applications/radio/inspectrum { };
inspectrum = libsForQt514.callPackage ../applications/radio/inspectrum {
gnuradio = gnuradioMinimal;
};
ion3 = callPackage ../applications/window-managers/ion-3 {
lua = lua5_1;