2016-03-22 00:15:40 +00:00
{ stdenv , fetchurl , fetchFromGitHub , cmake , pkgconfig
, python , pythonPackages , orc , libusb1 , boost } :
2013-05-02 14:27:11 +01: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 02:14:08 +01:00
uhdVer = " v " + version ;
2013-05-02 14:27:11 +01:00
# UHD seems to use three different version number styles: x.y.z, xxx_yyy_zzz
2018-03-29 02:14:08 +01:00
# and xxx.yyy.zzz. Hrmpf... style keeps changing
2019-05-31 13:35:48 +01:00
version = " 3 . 1 4 . 0 . 0 " ;
2018-02-01 19:43:40 +00:00
2018-06-26 22:47:22 +01: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 22:47:22 +01: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 " ;
2019-05-31 13:35:48 +01:00
sha256 = " 1 f p 3 7 w g q k b r 1 4 c x g 9 l 7 g h f d 4 r 9 2 y 2 b x w g b 7 c f j z s 9 6 h b p d 9 s 6 a l 0 " ;
2018-02-01 19:43:40 +00:00
} ;
in stdenv . mkDerivation {
2019-08-13 22:52:01 +01:00
pname = " u h d " ;
inherit version ;
2013-05-02 14:27:11 +01: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 " ;
2019-09-09 00:38:31 +01:00
rev = uhdVer ;
2019-05-31 13:35:48 +01:00
sha256 = " 0 y 1 h f f 4 v s l f v 3 6 v x g v j q a j g 4 8 6 2 a 1 1 d 4 w g r 0 v c b 0 v i s g h 1 b i 8 q g y " ;
2013-05-02 14:27:11 +01:00
} ;
2016-03-22 00:15:40 +00:00
enableParallelBuilding = true ;
2018-03-29 02:14:08 +01: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 14:27:11 +01:00
2016-03-22 00:15:40 +00:00
nativeBuildInputs = [ cmake pkgconfig ] ;
buildInputs = [ python pythonPackages . pyramid_mako orc libusb1 boost ] ;
2013-05-02 14:27:11 +01: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 14:27:11 +01:00
postPhases = [ " i n s t a l l F i r m w a r e " ] ;
2018-06-26 22:47:22 +01:00
# UHD expects images in `$CMAKE_INSTALL_PREFIX/share/uhd/images`
2013-05-02 14:27:11 +01:00
installFirmware = ''
2018-06-26 22:47:22 +01: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 14:27:11 +01: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 02:26:14 +01:00
homepage = https://uhd.ettus.com/ ;
2013-05-02 14:27:11 +01:00
license = licenses . gpl3Plus ;
2017-05-26 04:15:15 +01:00
platforms = platforms . linux ++ platforms . darwin ;
2018-03-29 02:14:08 +01:00
maintainers = with maintainers ; [ bjornfor fpletz tomberek ] ;
2013-05-02 14:27:11 +01:00
} ;
}