Merge pull request #226676 from doronbehar/pkg/uhd-cross

uhd: Better cross compilation support

authored by

Doron Behar and committed by
GitHub
0038a3c5 d6fea845

+10 -34
+10 -15
pkgs/applications/radio/uhd/default.nix
··· 11 11 # requires numpy 12 12 , enablePythonApi ? false 13 13 , python3 14 + , buildPackages 14 15 , enableExamples ? false 15 16 , enableUtils ? false 16 - , enableSim ? false 17 17 , libusb1 18 18 , enableDpdk ? false 19 19 , dpdk ··· 34 34 let 35 35 onOffBool = b: if b then "ON" else "OFF"; 36 36 inherit (lib) optionals; 37 + # Later used in pythonEnv generation. Python + mako are always required for the build itself but not necessary for runtime. 38 + pythonEnvArg = (ps: with ps; [ mako ] 39 + ++ optionals (enablePythonApi) [ numpy setuptools ] 40 + ++ optionals (enableUtils) [ requests six ] 41 + ); 37 42 in 38 43 39 44 stdenv.mkDerivation rec { ··· 84 89 ++ [ (lib.optionalString stdenv.isAarch32 "-DCMAKE_CXX_FLAGS=-Wno-psabi") ] 85 90 ; 86 91 87 - # Python + mako are always required for the build itself but not necessary for runtime. 88 - pythonEnv = python3.withPackages (ps: with ps; [ mako ] 89 - ++ optionals (enablePythonApi) [ numpy setuptools ] 90 - ++ optionals (enableUtils) [ requests six ] 91 - ); 92 + pythonEnv = python3.withPackages pythonEnvArg; 92 93 93 94 nativeBuildInputs = [ 94 95 cmake 95 96 pkg-config 96 - python3 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 (!enablePythonApi && !enableUtils) [ pythonEnv ] 102 - ; 97 + # Present both here and in buildInputs for cross compilation. 98 + (buildPackages.python3.withPackages pythonEnvArg) 99 + ]; 103 100 buildInputs = [ 104 101 boost 105 102 libusb1 ··· 122 119 patches = [ 123 120 # Disable tests that fail in the sandbox 124 121 ./no-adapter-tests.patch 125 - ] ++ lib.optionals stdenv.isAarch32 [ 126 - ./neon.patch 127 122 ]; 128 123 129 124 postPhases = [ "installFirmware" "removeInstalledTests" ]
-19
pkgs/applications/radio/uhd/neon.patch
··· 1 - Description: When building for armhf, enable NEON 2 - NEON is part of the armhf baseline, so this will always be enabled on 3 - armhf. 4 - Author: Paul Tagliamonte <paultag@debian.org> 5 - Bug-Debian: https://bugs.debian.org/873608 6 - Origin: vendor 7 - Last-Update: 2017-08-29 8 - 9 - --- uhd-3.10.2.0.orig/host/lib/convert/CMakeLists.txt 10 - +++ uhd-3.10.2.0/host/lib/convert/CMakeLists.txt 11 - @@ -67,6 +67,8 @@ IF(HAVE_ARM_NEON_H AND (${CMAKE_SIZEOF_V 12 - ${CMAKE_CURRENT_SOURCE_DIR}/convert_with_neon.cpp 13 - ${CMAKE_CURRENT_SOURCE_DIR}/convert_neon.S 14 - ) 15 - + 16 - + SET ( CMAKE_CXX_FLAGS "-mfpu=neon" ) 17 - ENDIF() 18 - 19 - ########################################################################