diff --git a/pkgs/applications/radio/gnuradio/default.nix b/pkgs/applications/radio/gnuradio/default.nix index f376fe9e5061..96962f914f7a 100644 --- a/pkgs/applications/radio/gnuradio/default.nix +++ b/pkgs/applications/radio/gnuradio/default.nix @@ -67,7 +67,7 @@ let # when gr-qtgui is disabled, icu needs to be included, otherwise # building with boost 1.7x fails ++ lib.optionals (!(hasFeature "gr-qtgui")) [ icu ]; - pythonNative = with python.pkgs; [ + pythonNative = with python.pythonOnBuildForHost.pkgs; [ mako six ]; @@ -337,6 +337,8 @@ stdenv.mkDerivation ( # This is the only python reference worth removing, if needed. + lib.optionalString (!hasFeature "python-support") '' remove-references-to -t ${python} $out/lib/cmake/gnuradio/GnuradioConfig.cmake + '' + + lib.optionalString (!hasFeature "python-support" && hasFeature "gnuradio-runtime") '' remove-references-to -t ${python} $(readlink -f $out/lib/libgnuradio-runtime${stdenv.hostPlatform.extensions.sharedLibrary}) remove-references-to -t ${python.pkgs.pybind11} $out/lib/cmake/gnuradio/gnuradio-runtimeTargets.cmake ''; diff --git a/pkgs/applications/radio/gnuradio/shared.nix b/pkgs/applications/radio/gnuradio/shared.nix index 0488393bc989..3eac7df05476 100644 --- a/pkgs/applications/radio/gnuradio/shared.nix +++ b/pkgs/applications/radio/gnuradio/shared.nix @@ -24,6 +24,7 @@ let minor = builtins.elemAt (lib.splitVersion version) 2; patch = builtins.elemAt (lib.splitVersion version) 3; }; + cross = stdenv.hostPlatform != stdenv.buildPlatform; in { src = @@ -53,26 +54,30 @@ in feat: info: (lib.optionals (hasFeature feat) ( (lib.optionals (builtins.hasAttr "runtime" info) info.runtime) - ++ (lib.optionals (builtins.hasAttr "pythonRuntime" info) info.pythonRuntime) + ++ (lib.optionals ( + builtins.hasAttr "pythonRuntime" info && hasFeature "python-support" + ) info.pythonRuntime) )) ) featuresInfo ); - cmakeFlags = lib.mapAttrsToList ( + cmakeFlags = [ + # https://pybind11.readthedocs.io/en/stable/changelog.html#version-2-13-0-june-25-2024 + (lib.cmakeBool "CMAKE_CROSSCOMPILING" cross) + (lib.cmakeBool "PYBIND11_USE_CROSSCOMPILING" (cross && hasFeature "gnuradio-runtime")) + ] + ++ lib.mapAttrsToList ( feat: info: ( if feat == "basic" then # Abuse this unavoidable "iteration" to set this flag which we want as # well - it means: Don't turn on features just because their deps are # satisfied, let only our cmakeFlags decide. - "-DENABLE_DEFAULT=OFF" - else if hasFeature feat then - "-DENABLE_${info.cmakeEnableFlag}=ON" + (lib.cmakeBool "ENABLE_DEFAULT" false) else - "-DENABLE_${info.cmakeEnableFlag}=OFF" + (lib.cmakeBool "ENABLE_${info.cmakeEnableFlag}" (hasFeature feat)) ) ) featuresInfo; disallowedReferences = [ - # TODO: Should this be conditional? stdenv.cc stdenv.cc.cc ]