From 7c9a97cbfff0a1d2f179c8bd3dddc0eba4edd27d Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Wed, 26 Oct 2022 01:11:37 +0800 Subject: [PATCH 1/9] libiio: 0.23 -> 0.24 --- pkgs/development/libraries/libiio/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/libiio/default.nix b/pkgs/development/libraries/libiio/default.nix index 400da08cab32..7ed5a3a2faa7 100644 --- a/pkgs/development/libraries/libiio/default.nix +++ b/pkgs/development/libraries/libiio/default.nix @@ -10,11 +10,12 @@ , libaio , runtimeShell , lib +, pkg-config }: stdenv.mkDerivation rec { pname = "libiio"; - version = "0.23"; + version = "0.24"; outputs = [ "out" "lib" "dev" "python" ]; @@ -22,7 +23,7 @@ stdenv.mkDerivation rec { owner = "analogdevicesinc"; repo = "libiio"; rev = "v${version}"; - sha256 = "0awny9zb43dcnxa5jpxay2zxswydblnbn4x6vi5mlw1r48pzhjf8"; + sha256 = "sha256-c5HsxCdp1cv5BGTQ/8dc8J893zk9ntbfAudLpqoQ1ow="; }; # Revert after https://github.com/NixOS/nixpkgs/issues/125008 is @@ -33,6 +34,7 @@ stdenv.mkDerivation rec { cmake flex bison + pkg-config ]; buildInputs = [ From a4fc59a4771d14088e531143086d1b26047574c1 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Wed, 26 Oct 2022 01:12:34 +0800 Subject: [PATCH 2/9] libiio: unbreak on darwin --- pkgs/development/libraries/libiio/default.nix | 13 ++++++++++--- pkgs/top-level/all-packages.nix | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/libiio/default.nix b/pkgs/development/libraries/libiio/default.nix index 7ed5a3a2faa7..c495935e1402 100644 --- a/pkgs/development/libraries/libiio/default.nix +++ b/pkgs/development/libraries/libiio/default.nix @@ -11,6 +11,8 @@ , runtimeShell , lib , pkg-config +, CFNetwork +, CoreServices }: stdenv.mkDerivation rec { @@ -42,12 +44,17 @@ stdenv.mkDerivation rec { libxml2 libusb1 avahi - libaio - ] ++ lib.optional python.isPy3k python.pkgs.setuptools; + ] ++ lib.optional python.isPy3k python.pkgs.setuptools + ++ lib.optional stdenv.isLinux libaio + ++ lib.optionals stdenv.isDarwin [ CFNetwork CoreServices ]; cmakeFlags = [ "-DUDEV_RULES_INSTALL_DIR=${placeholder "out"}/lib/udev/rules.d" "-DPYTHON_BINDINGS=on" + # osx framework is disabled, + # the linux-like directory structure is used for proper output splitting + "-DOSX_PACKAGE=off" + "-DOSX_FRAMEWORK=off" ]; postPatch = '' @@ -67,7 +74,7 @@ stdenv.mkDerivation rec { description = "API for interfacing with the Linux Industrial I/O Subsystem"; homepage = "https://github.com/analogdevicesinc/libiio"; license = licenses.lgpl21Plus; - platforms = platforms.linux; + platforms = platforms.linux ++ platforms.darwin; maintainers = with maintainers; [ thoughtpolice ]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c5d3578381b3..16bde9eaba44 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -20030,6 +20030,7 @@ with pkgs; libgxps = callPackage ../development/libraries/libgxps { }; libiio = callPackage ../development/libraries/libiio { + inherit (darwin.apple_sdk.frameworks) CFNetwork CoreServices; python = python3; }; From d33f9be4c70810ccb621fd073f513862e1f0a2f0 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Wed, 26 Oct 2022 01:12:46 +0800 Subject: [PATCH 3/9] libad9361: unbreak on darwin --- pkgs/development/libraries/libad9361/default.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/libad9361/default.nix b/pkgs/development/libraries/libad9361/default.nix index 74707897bd0c..115f37161553 100644 --- a/pkgs/development/libraries/libad9361/default.nix +++ b/pkgs/development/libraries/libad9361/default.nix @@ -15,11 +15,19 @@ stdenv.mkDerivation rec { buildInputs = [ libiio ]; + postPatch = lib.optionalString stdenv.isDarwin '' + # Fix iio include path on darwin to match linux + for i in test/*.c; do + substituteInPlace $i \ + --replace 'iio/iio.h' 'iio.h' + done + ''; + meta = with lib; { description = "IIO AD9361 library for filter design and handling, multi-chip sync, etc"; homepage = "http://analogdevicesinc.github.io/libad9361-iio/"; license = licenses.lgpl21Plus; maintainers = with maintainers; [ sikmir ]; - platforms = platforms.linux; + platforms = platforms.linux ++ platforms.darwin; }; } From 70254067071d04da6cd56203dbf56fc646b17c5f Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Tue, 25 Oct 2022 08:30:38 +0800 Subject: [PATCH 4/9] qwt: fix dylib names on darwin Change dylib name to absoulate path on darwin. --- pkgs/development/libraries/qwt/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/qwt/default.nix b/pkgs/development/libraries/qwt/default.nix index e74f8300bf72..9a2a53587e48 100644 --- a/pkgs/development/libraries/qwt/default.nix +++ b/pkgs/development/libraries/qwt/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, qtbase, qtsvg, qttools, qmake }: +{ lib, stdenv, fetchurl, qtbase, qtsvg, qttools, qmake, fixDarwinDylibNames }: stdenv.mkDerivation rec { pname = "qwt"; @@ -12,7 +12,7 @@ stdenv.mkDerivation rec { }; propagatedBuildInputs = [ qtbase qtsvg qttools ]; - nativeBuildInputs = [ qmake ]; + nativeBuildInputs = [ qmake ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; postPatch = '' sed -e "s|QWT_INSTALL_PREFIX.*=.*|QWT_INSTALL_PREFIX = $out|g" -i qwtconfig.pri From 4e4170851849a09016c9b9d79885b5a299cc19be Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Tue, 25 Oct 2022 08:31:44 +0800 Subject: [PATCH 5/9] 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 From fffa532feb6c72af742872f805fe7b8cb7400c65 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Tue, 25 Oct 2022 11:56:39 +0800 Subject: [PATCH 6/9] gnuradio3_8Packages.osmosdr: add missing framework on darwin --- pkgs/development/gnuradio-modules/osmosdr/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/development/gnuradio-modules/osmosdr/default.nix b/pkgs/development/gnuradio-modules/osmosdr/default.nix index b0c7a43c8e4c..20fe12826671 100644 --- a/pkgs/development/gnuradio-modules/osmosdr/default.nix +++ b/pkgs/development/gnuradio-modules/osmosdr/default.nix @@ -1,4 +1,6 @@ { lib +, stdenv +, darwin , mkDerivation , fetchgit , gnuradio @@ -58,6 +60,9 @@ in mkDerivation { ] ++ lib.optionals (gnuradio.hasFeature "gr-ctrlport") [ thrift python.pkgs.thrift + ] ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.IOKit + darwin.apple_sdk.frameworks.Security ]; cmakeFlags = [ (if (gnuradio.hasFeature "python-support") then From 40ebb33f6b757f0a1c26afbbc5b9d94624b28d80 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Tue, 25 Oct 2022 23:17:41 +0800 Subject: [PATCH 7/9] gnuradio3_8Packages.grnet: fix compilation on darwin --- pkgs/development/gnuradio-modules/grnet/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/development/gnuradio-modules/grnet/default.nix b/pkgs/development/gnuradio-modules/grnet/default.nix index 6e8b72a6565b..fc12abd8cfa5 100644 --- a/pkgs/development/gnuradio-modules/grnet/default.nix +++ b/pkgs/development/gnuradio-modules/grnet/default.nix @@ -1,6 +1,7 @@ { lib , mkDerivation , fetchFromGitHub +, fetchpatch , gnuradio , cmake , pkg-config @@ -54,6 +55,16 @@ mkDerivation { inherit src; disabledForGRafter = "3.10"; + patches = [ + # Use cross platform struct ip instead of iphdr + # https://github.com/ghostop14/gr-grnet/pull/19 + (fetchpatch { + name = "fix-compilation-on-darwin.patch"; + url = "https://github.com/ghostop14/gr-grnet/commit/52c07daa9ba595b76ffa5dd90c0c96694d95d140.patch"; + sha256 = "sha256-1gJaYLIn09blOhALMfBPROt5YBXaosG41Vsd3+5h518="; + }) + ]; + buildInputs = [ boost log4cpp From 996098b653286575e960459bd38b2f0a1f777e7e Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Tue, 25 Oct 2022 13:53:03 +0800 Subject: [PATCH 8/9] gnuradio3_9Packages: fix alias --- pkgs/top-level/all-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 16bde9eaba44..3e7cb005cc78 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -28266,7 +28266,7 @@ with pkgs; python = python3; }; }; - gnuradio3_9Packages = lib.recurseIntoAttrs gnuradio.pkgs; + gnuradio3_9Packages = lib.recurseIntoAttrs gnuradio3_9.pkgs; # A build without gui components and other utilites not needed for end user # libraries gnuradio3_9Minimal = gnuradio.override { From d4c4f87e04952db681ef3277674237688213b1f3 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Tue, 25 Oct 2022 23:18:23 +0800 Subject: [PATCH 9/9] gnuradio: add jiegec as maintainer --- pkgs/applications/radio/gnuradio/shared.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/radio/gnuradio/shared.nix b/pkgs/applications/radio/gnuradio/shared.nix index 9fd1c8b378dc..a5ae83eb3513 100644 --- a/pkgs/applications/radio/gnuradio/shared.nix +++ b/pkgs/applications/radio/gnuradio/shared.nix @@ -129,6 +129,6 @@ rec { homepage = "https://www.gnuradio.org"; license = licenses.gpl3; platforms = platforms.unix; - maintainers = with maintainers; [ doronbehar bjornfor fpletz ]; + maintainers = with maintainers; [ doronbehar bjornfor fpletz jiegec ]; }; }