2016-03-22 00:15:40 +00:00
{ stdenv , fetchurl , fetchFromGitHub , cmake , pkgconfig
, python , pythonPackages , orc , libusb1 , boost } :
2013-05-02 13:27:11 +00:00
# You need these udev rules to not have to run as root (copied from
# ${uhd}/share/uhd/utils/uhd-usrp.rules):
#
# SUBSYSTEMS=="usb", ATTRS{idVendor}=="fffe", ATTRS{idProduct}=="0002", MODE:="0666"
# SUBSYSTEMS=="usb", ATTRS{idVendor}=="2500", ATTRS{idProduct}=="0002", MODE:="0666"
2018-02-01 19:43:40 +00:00
let
2018-03-29 01:14:08 +00:00
uhdVer = " v " + version ;
2013-05-02 13:27:11 +00:00
# UHD seems to use three different version number styles: x.y.z, xxx_yyy_zzz
2018-03-29 01:14:08 +00:00
# and xxx.yyy.zzz. Hrmpf... style keeps changing
2018-06-26 21:47:22 +00:00
version = " 3 . 1 2 . 0 . 0 " ;
2018-02-01 19:43:40 +00:00
2018-06-26 21:47:22 +00:00
# Firmware images are downloaded (pre-built) from the respective release on Github
2018-02-01 19:43:40 +00:00
uhdImagesSrc = fetchurl {
2018-06-26 21:47:22 +00:00
url = " h t t p s : / / g i t h u b . c o m / E t t u s R e s e a r c h / u h d / r e l e a s e s / d o w n l o a d / ${ uhdVer } / u h d - i m a g e s _ ${ version } . t a r . x z " ;
sha256 = " 1 g l f 2 q a y 4 a s a j b l 9 2 f y 4 3 2 i d q k 0 s j 5 h 6 0 3 n a j r 8 s g k b d y y y r 9 3 3 p " ;
2018-02-01 19:43:40 +00:00
} ;
in stdenv . mkDerivation {
name = " u h d - ${ version } " ;
2013-05-02 13:27:11 +00:00
2016-03-22 00:15:40 +00:00
src = fetchFromGitHub {
owner = " E t t u s R e s e a r c h " ;
repo = " u h d " ;
2018-03-29 01:14:08 +00:00
rev = " ${ uhdVer } " ;
2018-06-26 21:47:22 +00:00
sha256 = " 0 m 7 v w 7 d m v n 7 d 0 1 k k z p h a y z i 0 b k 5 0 m 5 v 9 a 1 7 r p n x h n 0 b q h w 2 8 2 k s v " ;
2013-05-02 13:27:11 +00:00
} ;
2016-03-22 00:15:40 +00:00
enableParallelBuilding = true ;
2018-03-29 01:14:08 +00:00
# ABI differences GCC 7.1
# /nix/store/wd6r25miqbk9ia53pp669gn4wrg9n9cj-gcc-7.3.0/include/c++/7.3.0/bits/vector.tcc:394:7: note: parameter passing for argument of type 'std::vector<uhd::range_t>::iterator {aka __gnu_cxx::__normal_iterator<uhd::range_t*, std::vector<uhd::range_t> >}' changed in GCC 7.1
cmakeFlags = [ " - D L I B U S B _ I N C L U D E _ D I R S = ${ libusb1 . dev } / i n c l u d e / l i b u s b - 1 . 0 " ] ++
treewide: isArm -> isAarch32
Following legacy packing conventions, `isArm` was defined just for
32-bit ARM instruction set. This is confusing to non packagers though,
because Aarch64 is an ARM instruction set.
The official ARM overview for ARMv8[1] is surprisingly not confusing,
given the overall state of affairs for ARM naming conventions, and
offers us a solution. It divides the nomenclature into three levels:
```
ISA: ARMv8 {-A, -R, -M}
/ \
Mode: Aarch32 Aarch64
| / \
Encoding: A64 A32 T32
```
At the top is the overall v8 instruction set archicture. Second are the
two modes, defined by bitwidth but differing in other semantics too, and
buttom are the encodings, (hopefully?) isomorphic if they encode the
same mode.
The 32 bit encodings are mostly backwards compatible with previous
non-Thumb and Thumb encodings, and if so we can pun the mode names to
instead mean "sets of compatable or isomorphic encodings", and then
voilà we have nice names for 32-bit and 64-bit arm instruction sets
which do not use the word ARM so as to not confused either laymen or
experienced ARM packages.
[1]: https://developer.arm.com/products/architecture/a-profile
2018-03-20 02:41:06 +00:00
[ ( stdenv . lib . optionalString stdenv . isAarch32 " - D C M A K E _ C X X _ F L A G S = - W n o - p s a b i " ) ] ;
2013-05-02 13:27:11 +00:00
2016-03-22 00:15:40 +00:00
nativeBuildInputs = [ cmake pkgconfig ] ;
buildInputs = [ python pythonPackages . pyramid_mako orc libusb1 boost ] ;
2013-05-02 13:27:11 +00:00
# Build only the host software
preConfigure = " c d h o s t " ;
treewide: isArm -> isAarch32
Following legacy packing conventions, `isArm` was defined just for
32-bit ARM instruction set. This is confusing to non packagers though,
because Aarch64 is an ARM instruction set.
The official ARM overview for ARMv8[1] is surprisingly not confusing,
given the overall state of affairs for ARM naming conventions, and
offers us a solution. It divides the nomenclature into three levels:
```
ISA: ARMv8 {-A, -R, -M}
/ \
Mode: Aarch32 Aarch64
| / \
Encoding: A64 A32 T32
```
At the top is the overall v8 instruction set archicture. Second are the
two modes, defined by bitwidth but differing in other semantics too, and
buttom are the encodings, (hopefully?) isomorphic if they encode the
same mode.
The 32 bit encodings are mostly backwards compatible with previous
non-Thumb and Thumb encodings, and if so we can pun the mode names to
instead mean "sets of compatable or isomorphic encodings", and then
voilà we have nice names for 32-bit and 64-bit arm instruction sets
which do not use the word ARM so as to not confused either laymen or
experienced ARM packages.
[1]: https://developer.arm.com/products/architecture/a-profile
2018-03-20 02:41:06 +00:00
patches = if stdenv . isAarch32 then ./neon.patch else null ;
2013-05-02 13:27:11 +00:00
postPhases = [ " i n s t a l l F i r m w a r e " ] ;
2018-06-26 21:47:22 +00:00
# UHD expects images in `$CMAKE_INSTALL_PREFIX/share/uhd/images`
2013-05-02 13:27:11 +00:00
installFirmware = ''
2018-06-26 21:47:22 +00:00
mkdir - p " $ o u t / s h a r e / u h d / i m a g e s "
tar - - strip-components = 1 - xvf " ${ uhdImagesSrc } " - C " $ o u t / s h a r e / u h d / i m a g e s "
2013-05-02 13:27:11 +00:00
'' ;
meta = with stdenv . lib ; {
description = " U S R P H a r d w a r e D r i v e r ( f o r S o f t w a r e D e f i n e d R a d i o ) " ;
longDescription = ''
The USRP Hardware Driver ( UHD ) software is the hardware driver for all
USRP ( Universal Software Radio Peripheral ) devices .
USRP devices are designed and sold by Ettus Research , LLC and its parent
company , National Instruments .
'' ;
2017-06-20 01:26:14 +00:00
homepage = https://uhd.ettus.com/ ;
2013-05-02 13:27:11 +00:00
license = licenses . gpl3Plus ;
2017-05-26 03:15:15 +00:00
platforms = platforms . linux ++ platforms . darwin ;
2018-03-29 01:14:08 +00:00
maintainers = with maintainers ; [ bjornfor fpletz tomberek ] ;
2013-05-02 13:27:11 +00:00
} ;
}