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

uhd: Better cross compilation support
This commit is contained in:
Doron Behar 2023-04-21 03:16:32 -07:00 committed by GitHub
commit 0038a3c5fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 34 deletions

View file

@ -11,9 +11,9 @@
# requires numpy
, enablePythonApi ? false
, python3
, buildPackages
, enableExamples ? false
, enableUtils ? false
, enableSim ? false
, libusb1
, enableDpdk ? false
, dpdk
@ -34,6 +34,11 @@
let
onOffBool = b: if b then "ON" else "OFF";
inherit (lib) optionals;
# Later used in pythonEnv generation. Python + mako are always required for the build itself but not necessary for runtime.
pythonEnvArg = (ps: with ps; [ mako ]
++ optionals (enablePythonApi) [ numpy setuptools ]
++ optionals (enableUtils) [ requests six ]
);
in
stdenv.mkDerivation rec {
@ -84,22 +89,14 @@ stdenv.mkDerivation rec {
++ [ (lib.optionalString stdenv.isAarch32 "-DCMAKE_CXX_FLAGS=-Wno-psabi") ]
;
# Python + mako are always required for the build itself but not necessary for runtime.
pythonEnv = python3.withPackages (ps: with ps; [ mako ]
++ optionals (enablePythonApi) [ numpy setuptools ]
++ optionals (enableUtils) [ requests six ]
);
pythonEnv = python3.withPackages pythonEnvArg;
nativeBuildInputs = [
cmake
pkg-config
python3
]
# If both enableLibuhd_Python_api and enableUtils are off, we don't need
# pythonEnv in buildInputs as it's a 'build' dependency and not a runtime
# dependency
++ optionals (!enablePythonApi && !enableUtils) [ pythonEnv ]
;
# Present both here and in buildInputs for cross compilation.
(buildPackages.python3.withPackages pythonEnvArg)
];
buildInputs = [
boost
libusb1
@ -122,8 +119,6 @@ stdenv.mkDerivation rec {
patches = [
# Disable tests that fail in the sandbox
./no-adapter-tests.patch
] ++ lib.optionals stdenv.isAarch32 [
./neon.patch
];
postPhases = [ "installFirmware" "removeInstalledTests" ]

View file

@ -1,19 +0,0 @@
Description: When building for armhf, enable NEON
NEON is part of the armhf baseline, so this will always be enabled on
armhf.
Author: Paul Tagliamonte <paultag@debian.org>
Bug-Debian: https://bugs.debian.org/873608
Origin: vendor
Last-Update: 2017-08-29
--- uhd-3.10.2.0.orig/host/lib/convert/CMakeLists.txt
+++ uhd-3.10.2.0/host/lib/convert/CMakeLists.txt
@@ -67,6 +67,8 @@ IF(HAVE_ARM_NEON_H AND (${CMAKE_SIZEOF_V
${CMAKE_CURRENT_SOURCE_DIR}/convert_with_neon.cpp
${CMAKE_CURRENT_SOURCE_DIR}/convert_neon.S
)
+
+ SET ( CMAKE_CXX_FLAGS "-mfpu=neon" )
ENDIF()
########################################################################