Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gnuradio: rewrite #99685

Merged
merged 7 commits into from
Dec 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions nixos/doc/manual/release-notes/rl-2103.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
1 change: 1 addition & 0 deletions pkgs/applications/radio/gnss-sdr/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
295 changes: 295 additions & 0 deletions pkgs/applications/radio/gnuradio/3.7.nix
Original file line number Diff line number Diff line change
@@ -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
;
}
4 changes: 2 additions & 2 deletions pkgs/applications/radio/gnuradio/ais.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ stdenv, fetchFromGitHub, cmake, pkgconfig, boost, gnuradio
, makeWrapper, cppunit, gr-osmosdr
, makeWrapper, cppunit, gr-osmosdr, log4cpp
, pythonSupport ? true, python, swig
}:

Expand All @@ -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 = ''
Expand Down
Loading