From 4e4170851849a09016c9b9d79885b5a299cc19be Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Tue, 25 Oct 2022 08:31:44 +0800 Subject: [PATCH] gnuradio: fix build on darwin --- pkgs/applications/radio/gnuradio/3.8.nix | 4 ++-- pkgs/applications/radio/gnuradio/3.9.nix | 2 +- pkgs/applications/radio/gnuradio/default.nix | 2 +- pkgs/applications/radio/gnuradio/shared.nix | 7 +++++-- pkgs/applications/radio/gnuradio/wrapper.nix | 10 ++++++---- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/radio/gnuradio/3.8.nix b/pkgs/applications/radio/gnuradio/3.8.nix index f3a56cfdb055..301193a65785 100644 --- a/pkgs/applications/radio/gnuradio/3.8.nix +++ b/pkgs/applications/radio/gnuradio/3.8.nix @@ -271,11 +271,11 @@ stdenv.mkDerivation rec { # order to build, see https://github.com/qradiolink/qradiolink/issues/67 ++ lib.optionals (hasFeature "gr-vocoder") [ "-DLIBCODEC2_FOUND=TRUE" - "-DLIBCODEC2_LIBRARIES=${codec2}/lib/libcodec2.so" + "-DLIBCODEC2_LIBRARIES=${codec2}/lib/libcodec2${stdenv.hostPlatform.extensions.sharedLibrary}" "-DLIBCODEC2_INCLUDE_DIRS=${codec2}/include" "-DLIBCODEC2_HAS_FREEDV_API=ON" "-DLIBGSM_FOUND=TRUE" - "-DLIBGSM_LIBRARIES=${gsm}/lib/libgsm.so" + "-DLIBGSM_LIBRARIES=${gsm}/lib/libgsm${stdenv.hostPlatform.extensions.sharedLibrary}" "-DLIBGSM_INCLUDE_DIRS=${gsm}/include/gsm" ] ++ lib.optionals (hasFeature "volk" && volk != null) [ diff --git a/pkgs/applications/radio/gnuradio/3.9.nix b/pkgs/applications/radio/gnuradio/3.9.nix index 29998fb2097a..e54c502060a2 100644 --- a/pkgs/applications/radio/gnuradio/3.9.nix +++ b/pkgs/applications/radio/gnuradio/3.9.nix @@ -296,7 +296,7 @@ stdenv.mkDerivation rec { # This is the only python reference worth removing, if needed. + lib.optionalString (!hasFeature "python-support") '' ${removeReferencesTo}/bin/remove-references-to -t ${python} $out/lib/cmake/gnuradio/GnuradioConfig.cmake - ${removeReferencesTo}/bin/remove-references-to -t ${python} $(readlink -f $out/lib/libgnuradio-runtime.so) + ${removeReferencesTo}/bin/remove-references-to -t ${python} $(readlink -f $out/lib/libgnuradio-runtime${stdenv.hostPlatform.extensions.sharedLibrary}) ${removeReferencesTo}/bin/remove-references-to -t ${python.pkgs.pybind11} $out/lib/cmake/gnuradio/gnuradio-runtimeTargets.cmake '' ; diff --git a/pkgs/applications/radio/gnuradio/default.nix b/pkgs/applications/radio/gnuradio/default.nix index 01fa40ebcf3c..39aa9336aec9 100644 --- a/pkgs/applications/radio/gnuradio/default.nix +++ b/pkgs/applications/radio/gnuradio/default.nix @@ -317,7 +317,7 @@ stdenv.mkDerivation rec { # This is the only python reference worth removing, if needed. + lib.optionalString (!hasFeature "python-support") '' ${removeReferencesTo}/bin/remove-references-to -t ${python} $out/lib/cmake/gnuradio/GnuradioConfig.cmake - ${removeReferencesTo}/bin/remove-references-to -t ${python} $(readlink -f $out/lib/libgnuradio-runtime.so) + ${removeReferencesTo}/bin/remove-references-to -t ${python} $(readlink -f $out/lib/libgnuradio-runtime${stdenv.hostPlatform.extensions.sharedLibrary}) ${removeReferencesTo}/bin/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 acb13cc1e2a3..9fd1c8b378dc 100644 --- a/pkgs/applications/radio/gnuradio/shared.nix +++ b/pkgs/applications/radio/gnuradio/shared.nix @@ -84,7 +84,11 @@ rec { postInstall = "" # Gcc references + lib.optionalString (hasFeature "gnuradio-runtime") '' - ${removeReferencesTo}/bin/remove-references-to -t ${stdenv.cc} $(readlink -f $out/lib/libgnuradio-runtime.so) + ${removeReferencesTo}/bin/remove-references-to -t ${stdenv.cc} $(readlink -f $out/lib/libgnuradio-runtime${stdenv.hostPlatform.extensions.sharedLibrary}) + '' + # Clang references in InstalledDir + + lib.optionalString (hasFeature "gnuradio-runtime" && stdenv.isDarwin) '' + ${removeReferencesTo}/bin/remove-references-to -t ${stdenv.cc.cc} $(readlink -f $out/lib/libgnuradio-runtime${stdenv.hostPlatform.extensions.sharedLibrary}) '' ; # NOTE: Outputs are disabled due to upstream not using GNU InstallDIrs cmake @@ -112,7 +116,6 @@ rec { doCheck = false; meta = with lib; { - broken = stdenv.isDarwin; description = "Software Defined Radio (SDR) software"; longDescription = '' GNU Radio is a free & open-source software development toolkit that diff --git a/pkgs/applications/radio/gnuradio/wrapper.nix b/pkgs/applications/radio/gnuradio/wrapper.nix index 57d8f75320bb..926022353e41 100644 --- a/pkgs/applications/radio/gnuradio/wrapper.nix +++ b/pkgs/applications/radio/gnuradio/wrapper.nix @@ -98,19 +98,21 @@ let "${ lib.makeSearchPath unwrapped.qt.qtbase.qtPluginPrefix - (builtins.map lib.getBin [ + (builtins.map lib.getBin ([ unwrapped.qt.qtbase + ] ++ lib.optionals stdenv.isLinux [ unwrapped.qt.qtwayland - ]) + ])) }" "--prefix" "QML2_IMPORT_PATH" ":" "${ lib.makeSearchPath unwrapped.qt.qtbase.qtQmlPrefix - (builtins.map lib.getBin [ + (builtins.map lib.getBin ([ unwrapped.qt.qtbase + ] ++ lib.optionals stdenv.isLinux [ unwrapped.qt.qtwayland - ]) + ])) }" ] else