Merge pull request #258968 from hexagonal-sun/add-uhd-with-utils

uhd: build with utils by default

authored by Doron Behar and committed by GitHub b8446541 2646b294

+20 -163
-160
pkgs/applications/radio/uhd/3.5.nix
··· 1 - { lib 2 - , stdenv 3 - , fetchurl 4 - , fetchFromGitHub 5 - , cmake 6 - , pkg-config 7 - # See https://files.ettus.com/manual_archive/v3.15.0.0/html/page_build_guide.html for dependencies explanations 8 - , boost 9 - , enableLibuhd_C_api ? true 10 - # requires numpy 11 - , enableLibuhd_Python_api ? false 12 - , python3 13 - , enableExamples ? false 14 - , enableUtils ? false 15 - , enableLiberio ? false 16 - , liberio 17 - , libusb1 18 - , enableDpdk ? false 19 - , dpdk 20 - # Devices 21 - , enableOctoClock ? true 22 - , enableMpmd ? true 23 - , enableB100 ? true 24 - , enableB200 ? true 25 - , enableUsrp1 ? true 26 - , enableUsrp2 ? true 27 - , enableX300 ? true 28 - , enableN230 ? true 29 - , enableN300 ? true 30 - , enableN320 ? true 31 - , enableE300 ? true 32 - , enableE320 ? true 33 - }: 34 - 35 - let 36 - onOffBool = b: if b then "ON" else "OFF"; 37 - inherit (lib) optionals; 38 - in 39 - 40 - stdenv.mkDerivation rec { 41 - pname = "uhd"; 42 - # UHD seems to use three different version number styles: x.y.z, xxx_yyy_zzz 43 - # and xxx.yyy.zzz. Hrmpf... style keeps changing 44 - version = "3.15.0.0"; 45 - 46 - src = fetchFromGitHub { 47 - owner = "EttusResearch"; 48 - repo = "uhd"; 49 - rev = "v${version}"; 50 - sha256 = "0jknln88a69fh244670nb7qrflbyv0vvdxfddb5g8ncpb6hcg8qf"; 51 - }; 52 - # Firmware images are downloaded (pre-built) from the respective release on Github 53 - uhdImagesSrc = fetchurl { 54 - url = "https://github.com/EttusResearch/uhd/releases/download/v${version}/uhd-images_${version}.tar.xz"; 55 - sha256 = "1fir1a13ac07mqhm4sr34cixiqj2difxq0870qv1wr7a7cbfw6vp"; 56 - }; 57 - 58 - cmakeFlags = [ 59 - "-DENABLE_LIBUHD=ON" 60 - "-DENABLE_USB=ON" 61 - "-DENABLE_TESTS=ON" # This installs tests as well so we delete them via postPhases 62 - "-DENABLE_EXAMPLES=${onOffBool enableExamples}" 63 - "-DENABLE_UTILS=${onOffBool enableUtils}" 64 - "-DENABLE_LIBUHD_C_API=${onOffBool enableLibuhd_C_api}" 65 - "-DENABLE_LIBUHD_PYTHON_API=${onOffBool enableLibuhd_Python_api}" 66 - "-DENABLE_LIBERIO=${onOffBool enableLiberio}" 67 - "-DENABLE_DPDK=${onOffBool enableDpdk}" 68 - # Devices 69 - "-DENABLE_OCTOCLOCK=${onOffBool enableOctoClock}" 70 - "-DENABLE_MPMD=${onOffBool enableMpmd}" 71 - "-DENABLE_B100=${onOffBool enableB100}" 72 - "-DENABLE_B200=${onOffBool enableB200}" 73 - "-DENABLE_USRP1=${onOffBool enableUsrp1}" 74 - "-DENABLE_USRP2=${onOffBool enableUsrp2}" 75 - "-DENABLE_X300=${onOffBool enableX300}" 76 - "-DENABLE_N230=${onOffBool enableN230}" 77 - "-DENABLE_N300=${onOffBool enableN300}" 78 - "-DENABLE_N320=${onOffBool enableN320}" 79 - "-DENABLE_E300=${onOffBool enableE300}" 80 - "-DENABLE_E320=${onOffBool enableE320}" 81 - ] 82 - # TODO: Check if this still needed 83 - # ABI differences GCC 7.1 84 - # /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 85 - ++ [ (lib.optionalString stdenv.isAarch32 "-DCMAKE_CXX_FLAGS=-Wno-psabi") ] 86 - ; 87 - 88 - # Python + mako are always required for the build itself but not necessary for runtime. 89 - pythonEnv = python3.withPackages (ps: with ps; [ mako ] 90 - ++ optionals (enableLibuhd_Python_api) [ numpy setuptools ] 91 - ++ optionals (enableUtils) [ requests six ] 92 - ); 93 - 94 - nativeBuildInputs = [ 95 - cmake 96 - pkg-config 97 - ] 98 - # If both enableLibuhd_Python_api and enableUtils are off, we don't need 99 - # pythonEnv in buildInputs as it's a 'build' dependency and not a runtime 100 - # dependency 101 - ++ optionals (!enableLibuhd_Python_api && !enableUtils) [ pythonEnv ] 102 - ; 103 - buildInputs = [ 104 - boost 105 - libusb1 106 - ] 107 - # However, if enableLibuhd_Python_api *or* enableUtils is on, we need 108 - # pythonEnv for runtime as well. The utilities' runtime dependencies are 109 - # handled at the environment 110 - ++ optionals (enableLibuhd_Python_api || enableUtils) [ pythonEnv ] 111 - ++ optionals (enableLiberio) [ liberio ] 112 - ++ optionals (enableDpdk) [ dpdk ] 113 - ; 114 - 115 - doCheck = true; 116 - 117 - # Build only the host software 118 - preConfigure = "cd host"; 119 - # TODO: Check if this still needed, perhaps relevant: 120 - # https://files.ettus.com/manual_archive/v3.15.0.0/html/page_build_guide.html#build_instructions_unix_arm 121 - patches = if stdenv.isAarch32 then ./neon.patch else null; 122 - 123 - postPhases = [ "installFirmware" "removeInstalledTests" ] 124 - ++ optionals (enableUtils) [ "moveUdevRules" ] 125 - ; 126 - 127 - # UHD expects images in `$CMAKE_INSTALL_PREFIX/share/uhd/images` 128 - installFirmware = '' 129 - mkdir -p "$out/share/uhd/images" 130 - tar --strip-components=1 -xvf "${uhdImagesSrc}" -C "$out/share/uhd/images" 131 - ''; 132 - 133 - # -DENABLE_TESTS=ON installs the tests, we don't need them in the output 134 - removeInstalledTests = '' 135 - rm -r $out/lib/uhd/tests 136 - ''; 137 - 138 - # Moves the udev rules to the standard location, needed only if utils are 139 - # enabled 140 - moveUdevRules = '' 141 - mkdir -p $out/lib/udev/rules.d 142 - mv $out/lib/uhd/utils/uhd-usrp.rules $out/lib/udev/rules.d/ 143 - ''; 144 - 145 - meta = with lib; { 146 - broken = (stdenv.isLinux && stdenv.isAarch64) || stdenv.isDarwin; 147 - description = "USRP Hardware Driver (for Software Defined Radio)"; 148 - longDescription = '' 149 - The USRP Hardware Driver (UHD) software is the hardware driver for all 150 - USRP (Universal Software Radio Peripheral) devices. 151 - 152 - USRP devices are designed and sold by Ettus Research, LLC and its parent 153 - company, National Instruments. 154 - ''; 155 - homepage = "https://uhd.ettus.com/"; 156 - license = licenses.gpl3Plus; 157 - platforms = platforms.linux ++ platforms.darwin; 158 - maintainers = with maintainers; [ bjornfor fpletz tomberek ]; 159 - }; 160 - }
···
+12 -2
pkgs/applications/radio/uhd/default.nix
··· 8 , boost 9 , ncurses 10 , enableCApi ? true 11 - # requires numpy 12 , enablePythonApi ? false 13 , python3 14 , buildPackages 15 , enableExamples ? false 16 - , enableUtils ? false 17 , libusb1 18 , enableDpdk ? false 19 , dpdk 20 # Devices ··· 143 mkdir -p $out/lib/udev/rules.d 144 mv $out/lib/uhd/utils/uhd-usrp.rules $out/lib/udev/rules.d/ 145 ''; 146 147 meta = with lib; { 148 description = "USRP Hardware Driver (for Software Defined Radio)";
··· 8 , boost 9 , ncurses 10 , enableCApi ? true 11 + # Although we handle the Python API's dependencies in pythonEnvArg, this 12 + # feature is currently disabled as upstream attempts to run `python setup.py 13 + # install` by itself, and it fails because the Python's environment's prefix is 14 + # not a writable directly. Adding support for this feature would require using 15 + # python's pypa/build nad pypa/install hooks directly, and currently it is hard 16 + # to do that because it all happens after a long buildPhase of the C API. 17 , enablePythonApi ? false 18 , python3 19 , buildPackages 20 , enableExamples ? false 21 + , enableUtils ? true 22 , libusb1 23 + # Disable dpdk for now due to compilation issues. 24 , enableDpdk ? false 25 , dpdk 26 # Devices ··· 149 mkdir -p $out/lib/udev/rules.d 150 mv $out/lib/uhd/utils/uhd-usrp.rules $out/lib/udev/rules.d/ 151 ''; 152 + 153 + disallowedReferences = optionals (!enablePythonApi && !enableUtils) [ 154 + python3 155 + ]; 156 157 meta = with lib; { 158 description = "USRP Hardware Driver (for Software Defined Radio)";
+1
pkgs/top-level/aliases.nix
··· 816 uade123 = uade; # Added 2022-07-30 817 uberwriter = apostrophe; # Added 2020-04-23 818 ubootBeagleboneBlack = ubootAmx335xEVM; # Added 2020-01-21 819 uhhyou.lv2 = throw "'uhhyou.lv2' has been removed, upstream gone"; # Added 2023-06-21 820 unicorn-emu = unicorn; # Added 2020-10-29 821 uniffi-bindgen = throw "uniffi-bindgen has been removed since upstream no longer provides a standalone package for the CLI";
··· 816 uade123 = uade; # Added 2022-07-30 817 uberwriter = apostrophe; # Added 2020-04-23 818 ubootBeagleboneBlack = ubootAmx335xEVM; # Added 2020-01-21 819 + uhd3_5 = throw "uhd3_5 has been removed, because it was no longer needed"; # Added 2023-10-07 820 uhhyou.lv2 = throw "'uhhyou.lv2' has been removed, upstream gone"; # Added 2023-06-21 821 unicorn-emu = unicorn; # Added 2020-10-29 822 uniffi-bindgen = throw "uniffi-bindgen has been removed since upstream no longer provides a standalone package for the CLI";
+7 -1
pkgs/top-level/all-packages.nix
··· 20508 20509 uefi-firmware-parser = callPackage ../development/tools/analysis/uefi-firmware-parser { }; 20510 20511 - uhd3_5 = callPackage ../applications/radio/uhd/3.5.nix { }; 20512 uhd = callPackage ../applications/radio/uhd { }; 20513 20514 uisp = callPackage ../development/embedded/uisp { }; 20515 ··· 31847 # So it will not reference python 31848 enableModTool = false; 31849 }; 31850 features = { 31851 gnuradio-companion = false; 31852 python-support = false; ··· 31879 # So it will not reference python 31880 enableModTool = false; 31881 }; 31882 features = { 31883 gnuradio-companion = false; 31884 python-support = false; ··· 31910 volk = volk.override { 31911 enableModTool = false; 31912 }; 31913 features = { 31914 gnuradio-companion = false; 31915 python-support = false;
··· 20508 20509 uefi-firmware-parser = callPackage ../development/tools/analysis/uefi-firmware-parser { }; 20510 20511 uhd = callPackage ../applications/radio/uhd { }; 20512 + uhdMinimal = uhd.override { 20513 + enableUtils = false; 20514 + enablePythonApi = false; 20515 + }; 20516 20517 uisp = callPackage ../development/embedded/uisp { }; 20518 ··· 31850 # So it will not reference python 31851 enableModTool = false; 31852 }; 31853 + uhd = uhdMinimal; 31854 features = { 31855 gnuradio-companion = false; 31856 python-support = false; ··· 31883 # So it will not reference python 31884 enableModTool = false; 31885 }; 31886 + uhd = uhdMinimal; 31887 features = { 31888 gnuradio-companion = false; 31889 python-support = false; ··· 31915 volk = volk.override { 31916 enableModTool = false; 31917 }; 31918 + uhd = uhdMinimal; 31919 features = { 31920 gnuradio-companion = false; 31921 python-support = false;