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: Enable Darwin Support #27344

Merged
merged 24 commits into from
Nov 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8ec6bcf
UHD: enable Darwin build
May 26, 2017
c3cfa10
qwt6_qt4: 6.1.2 -> 6.1.3
Jul 14, 2017
f90ddc9
qwt6_qt4: Fix darwin build by adding AGL input
Jul 14, 2017
97c5cf0
qwt6_qt4: preFixup: Repair relative reference in darwin framework output
Jul 14, 2017
de51e4a
qwt6_qt4: enableParallelBuilding
Jul 14, 2017
b32e8ce
libosmocore: 0.9.0 -> 0.9.6
Jul 12, 2017
9be55b0
libosmocore: enable Darwin building
Jul 15, 2017
4bc189d
urh: platforms to linux only due to qt5 issue on Darwin
Jul 18, 2017
60d95cc
rtl-sdr: enable Darwin building; postInstall: only run on Linux
Jul 15, 2017
ba49dfb
gnuradio: document purpose of package inputs
Jul 14, 2017
b9c426c
gnuradio: use qwt6_qt4 instead of qwt5
Jul 14, 2017
861773b
gnuradio: reorder build inputs
Jul 14, 2017
e81d84f
gnuradio: add CoreAudio input for Darwin
Jul 14, 2017
3cdf430
gnuradio: wrapProgram: set DYLD_FRAMEWORK_PATH
Jul 14, 2017
482d8de
gnuradio: postInstall: PYTHONPATH / DYLD_FRAMEWORK_PATH notes
Jul 14, 2017
17908a7
gnuradio: setupHook: enable composition with nix-shell
Jul 14, 2017
6e9140d
gnuradio: force wxgui and pygtk check to true
Jul 25, 2017
5d75dbe
gnuradio: Resolve darwin c++11 issues
Nov 11, 2017
1b1c82f
gnuradio: 3.7.11.0 -> 3.7.11.1
Nov 11, 2017
86d953e
gnuradio: enable Darwin building
Jul 14, 2017
d8d9697
gnuradio-ais: Fix Volk library search issue. Fix incorrect version date.
Jul 15, 2017
b1c666e
gnuradio-{ais,gsm,nacl,osmosdr,rds}: enable Darwin building
Jul 15, 2017
03193f5
gnuradio-{ais,gsm,nacl,osmosdr,rds}: enableParallelBuilding
Jul 15, 2017
367e5f7
gnuradio-osmosdr: update homepage
Jul 15, 2017
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
11 changes: 7 additions & 4 deletions pkgs/applications/misc/gnuradio-ais/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ assert pythonSupport -> python != null && swig != null;

stdenv.mkDerivation rec {
name = "gnuradio-ais-${version}";
version = "2016-08-26";
version = "2015-12-20";

src = fetchFromGitHub {
owner = "bistromath";
repo = "gr-ais";
rev = "1863d1bf8a7709a8dfedb3ddb8e2b99112e7c872";
sha256 = "1vl3kk8xr2mh5lf31zdld7yzmwywqffffah8iblxdzblgsdwxfl6";
# Upstream PR: https://github.com/bistromath/gr-ais/commit/8502d0252a2a1a9b8d1a71795eaeb5d820684054
"rev" = "8502d0252a2a1a9b8d1a71795eaeb5d820684054";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to update "version" above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1863d1b (Dec 20, 2015) is the newest commit on the repo, which is "unversioned"
8502d02 is just my pr that fixes a linking issue on top of the above.
Although the version didn't change, should I change the version to the correct date? ("2015-12-20", the last commit to master)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, version should be the commit date (for unversioned repositories).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems weird that version goes back one year. Can you clarify a bit in the commit message what's going on here? Also, perhaps make a point of switching from building upstream branch to a PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure where the 2016-08-26 date even originated from as the commit referenced (bistromath/gr-ais@1863d1b) is on the date I changed it to.
But yeah I'll add both for clarification

"sha256" = "1b9j0kc74cw12a7jv4lii77dgzqzg2s8ndzp4xmisxksgva1qfvh";
};

nativeBuildInputs = [ pkgconfig ];
Expand All @@ -27,11 +28,13 @@ stdenv.mkDerivation rec {
done
'';

enableParallelBuilding = true;

meta = with stdenv.lib; {
description = "Gnuradio block for ais";
homepage = https://github.com/bistromath/gr-ais;
license = licenses.gpl3Plus;
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ mog ];
};
}
4 changes: 3 additions & 1 deletion pkgs/applications/misc/gnuradio-gsm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ stdenv.mkDerivation rec {
done
'';

enableParallelBuilding = true;

meta = with stdenv.lib; {
description = "Gnuradio block for gsm";
homepage = https://github.com/ptrkrysik/gr-gsm;
license = licenses.gpl3Plus;
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ mog ];
};
}
4 changes: 3 additions & 1 deletion pkgs/applications/misc/gnuradio-nacl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ stdenv.mkDerivation rec {
done
'';

enableParallelBuilding = true;

meta = with stdenv.lib; {
description = "Gnuradio block for encryption";
homepage = https://github.com/stwunsch/gr-nacl;
license = licenses.gpl3Plus;
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ mog ];
};
}
6 changes: 4 additions & 2 deletions pkgs/applications/misc/gnuradio-osmosdr/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ stdenv.mkDerivation rec {
done
'';

enableParallelBuilding = true;

meta = with stdenv.lib; {
description = "Gnuradio block for OsmoSDR and rtl-sdr";
homepage = http://sdr.osmocom.org/trac/wiki/GrOsmoSDR;
homepage = https://sdr.osmocom.org/trac/wiki/GrOsmoSDR;
license = licenses.gpl3Plus;
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ bjornfor the-kenny ];
};
}
4 changes: 3 additions & 1 deletion pkgs/applications/misc/gnuradio-rds/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ stdenv.mkDerivation rec {
done
'';

enableParallelBuilding = true;

meta = with stdenv.lib; {
description = "Gnuradio block for radio data system";
homepage = https://github.com/bastibl/gr-rds;
license = licenses.gpl2Plus;
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ mog ];
};
}
82 changes: 58 additions & 24 deletions pkgs/applications/misc/gnuradio/default.nix
Original file line number Diff line number Diff line change
@@ -1,41 +1,51 @@
{ stdenv, fetchurl
# core dependencies
{ stdenv, fetchFromGitHub, writeText, makeWrapper
# Dependencies documented @ https://gnuradio.org/doc/doxygen/build_guide.html
# => core dependencies
, cmake, pkgconfig, git, boost, cppunit, fftw
# python wrappers
# => python wrappers
# May be able to upgrade to swig3
, python, swig2, numpy, scipy, matplotlib
# grc - the gnu radio companion
# => grc - the gnu radio companion
, cheetah, pygtk
# gr-wavelet: collection of wavelet blocks
# => gr-wavelet: collection of wavelet blocks
, gsl
# gr-qtgui: the Qt-based GUI
, qt4, qwt, pyqt4 #, pyqwt
# gr-wxgui: the Wx-based GUI
# => 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
# uhd: the Ettus USRP Hardware Driver Interface
# => 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
# => gr-video-sdl: PAL and NTSC display
, SDL
# Other
, libusb1, orc, pyopengl
, makeWrapper
}:

stdenv.mkDerivation rec {
name = "gnuradio-${version}";
version = "3.7.11";
version = "3.7.11.1";

src = fetchurl {
url = "https://gnuradio.org/releases/gnuradio/${name}.tar.gz";
sha256 = "1m2jf8lafr6pr2dlm40nbvr6az8gwjfkzpbs4fxzv3l5hcqvmnc7";
src = fetchFromGitHub {
owner = "gnuradio";
repo = "gnuradio";
rev = "6d2221196082a4954c249dc6955e33d5832a56f2";
sha256 = "1fkrb8cnjbriy2x94lz73q6aqxar1rkvfbafp266ykdpm29b4xgm";
fetchSubmodules = true;
};

nativeBuildInputs = [ pkgconfig ];
buildInputs = [
cmake git boost cppunit fftw python swig2 orc lxml qt4
qwt alsaLib SDL libusb1 uhd gsl makeWrapper
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 = [
cheetah numpy scipy matplotlib pyqt4 pygtk wxPython pyopengl
];
Expand All @@ -48,22 +58,46 @@ stdenv.mkDerivation rec {
--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
}
envHooks+=(addGRCBlocksPath)
'';

setupHook = [ grcSetupHook ];

# patch wxgui and pygtk check due to python importerror in a headless environment
preConfigure = ''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -Wno-unused-variable -std=c++11"
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>)' "{}" ";"
'';

# 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"
--set MATPLOTLIBRC "$out/share/gnuradio" \
${stdenv.lib.optionalString stdenv.isDarwin "--set DYLD_FRAMEWORK_PATH /System/Library/Frameworks"}
done
'';

Expand All @@ -80,7 +114,7 @@ stdenv.mkDerivation rec {
'';
homepage = https://www.gnuradio.org;
license = licenses.gpl3;
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ bjornfor fpletz ];
};
}
26 changes: 16 additions & 10 deletions pkgs/applications/misc/libosmocore/default.nix
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
{ stdenv, fetchFromGitHub, autoreconfHook, pcsclite, pkgconfig
{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig
, pcsclite, talloc, python2
}:

stdenv.mkDerivation rec {
name = "libosmocore-${version}";
version = "0.9.0";
version = "0.9.6";

src = fetchFromGitHub {
owner = "osmocom";
repo = "libosmocore";
rev = "8649d57f507d359c99a89654aac7e19ce22db282";
sha256 = "08mcpy9ljwb1i3l4cmlwn024q2psk5gg9f0ylgh99hy1ffx0n7am";
rev = "3cc757df1822114bf446dc2d5f6a95da92321a25";
sha256 = "0dk7065qcy2kjra0p8q2124p73jcyvvzz3cmhid1kx5scyxmr017";
};

nativeBuildInputs = [ autoreconfHook pkgconfig ];
propagatedBuildInputs = [
talloc
];

nativeBuildInputs = [
autoreconfHook pkgconfig
];

buildInputs = [
pcsclite
pcsclite python2
];

preConfigure = ''
autoreconf -i -f
'';
enableParallelBuilding = true;

meta = with stdenv.lib; {
description = "libosmocore";
homepage = https://github.com/osmocom/libosmocore;
license = licenses.gpl2Plus;
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ mog ];
};
}
4 changes: 2 additions & 2 deletions pkgs/applications/misc/rtl-sdr/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
# /etc/udev/rules.d/, and there is no option to install elsewhere. So install
# rules manually.
# * Propagate libusb-1.0 dependency in pkg-config file.
postInstall = ''
postInstall = stdenv.lib.optionalString stdenv.isLinux ''
mkdir -p "$out/etc/udev/rules.d/"
cp ../rtl-sdr.rules "$out/etc/udev/rules.d/99-rtl-sdr.rules"

Expand All @@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
description = "Turns your Realtek RTL2832 based DVB dongle into a SDR receiver";
homepage = http://sdr.osmocom.org/trac/wiki/rtl-sdr;
license = licenses.gpl2Plus;
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
maintainers = [ maintainers.bjornfor ];
};
}
2 changes: 1 addition & 1 deletion pkgs/applications/misc/urh/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ python3Packages.buildPythonApplication rec {
inherit (src.meta) homepage;
description = "Universal Radio Hacker: investigate wireless protocols like a boss";
license = licenses.asl20;
platforms = platforms.all;
platforms = platforms.linux;
maintainers = with maintainers; [ fpletz ];
};
}
20 changes: 16 additions & 4 deletions pkgs/development/libraries/qwt/6_qt4.nix
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
{ stdenv, fetchurl, qt4, qmake4Hook }:
{ stdenv, fetchurl, qt4, qmake4Hook, AGL }:

stdenv.mkDerivation rec {
name = "qwt-6.1.2";
name = "qwt-6.1.3";

src = fetchurl {
url = "mirror://sourceforge/qwt/${name}.tar.bz2";
sha256 = "031x4hz1jpbirv9k35rqb52bb9mf2w7qav89qv1yfw1r3n6z221b";
sha256 = "0cwp63s03dw351xavb3pzbjlqvx7kj88wv7v4a2b18m9f97d7v7k";
};

buildInputs = [ qt4 ];
buildInputs = [
qt4
] ++ stdenv.lib.optionals stdenv.isDarwin [ AGL ];

nativeBuildInputs = [ qmake4Hook ];

enableParallelBuilding = true;

postPatch = ''
sed -e "s|QWT_INSTALL_PREFIX.*=.*|QWT_INSTALL_PREFIX = $out|g" -i qwtconfig.pri
'';

# qwt.framework output includes a relative reference to itself, which breaks dependents
preFixup =
stdenv.lib.optionalString stdenv.isDarwin ''
echo "Attempting to repair qwt"
install_name_tool -id "$out/lib/qwt.framework/Versions/6/qwt" "$out/lib/qwt.framework/Versions/6/qwt"
'';

qmakeFlags = [ "-after doc.path=$out/share/doc/${name}" ];

meta = with stdenv.lib; {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/tools/misc/uhd/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
'';
homepage = https://uhd.ettus.com/;
license = licenses.gpl3Plus;
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ bjornfor fpletz ];
};
}
6 changes: 5 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10507,7 +10507,9 @@ with pkgs;

qwt = callPackage ../development/libraries/qwt {};

qwt6_qt4 = callPackage ../development/libraries/qwt/6_qt4.nix { };
qwt6_qt4 = callPackage ../development/libraries/qwt/6_qt4.nix {
inherit (darwin.apple_sdk.frameworks) AGL;
};

qxt = callPackage ../development/libraries/qxt {};

Expand Down Expand Up @@ -14646,7 +14648,9 @@ with pkgs;

gnuradio = callPackage ../applications/misc/gnuradio {
inherit (python2Packages) cheetah lxml matplotlib numpy python pyopengl pyqt4 scipy wxPython pygtk;
inherit (darwin.apple_sdk.frameworks) CoreAudio;
fftw = fftwFloat;
qwt = qwt6_qt4;
};

gnuradio-with-packages = callPackage ../applications/misc/gnuradio/wrapper.nix {
Expand Down