From 650ee258fde069a1ac3544cdce89029e9f91d5c5 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sat, 13 Mar 2021 13:50:15 +0200 Subject: [PATCH] gnuradio3_{7,8}: Use external volk Now that volk is packaged, we can use our build and save some closure space for those that have more then 1 version of gnuradio installed. Also, simplify a bit how attributes are inherited in the expression. --- pkgs/applications/radio/gnuradio/3.7.nix | 49 ++++++------------- pkgs/applications/radio/gnuradio/default.nix | 44 ++++------------- pkgs/applications/radio/gnuradio/shared.nix | 3 -- .../gnuradio-modules/mkDerivation.nix | 6 ++- pkgs/top-level/all-packages.nix | 7 +++ pkgs/top-level/gnuradio-packages.nix | 3 +- 6 files changed, 38 insertions(+), 74 deletions(-) diff --git a/pkgs/applications/radio/gnuradio/3.7.nix b/pkgs/applications/radio/gnuradio/3.7.nix index 7ad2d2979824..50993dd6f8ef 100644 --- a/pkgs/applications/radio/gnuradio/3.7.nix +++ b/pkgs/applications/radio/gnuradio/3.7.nix @@ -5,6 +5,7 @@ # Remove gcc and python references , removeReferencesTo , pkg-config +, volk , cppunit , swig , orc @@ -43,11 +44,12 @@ minor = "14"; patch = "0"; } -, fetchSubmodules ? true +# We use our build of volk and not the one bundled with the release +, fetchSubmodules ? false }: let - sourceSha256 = "1nh4f9dmygprlbqybd3j1byg9fsr6065n140mvc4b0v8qqygmhrc"; + sourceSha256 = "BiUDibXV/5cEYmAAaIxT4WTxF/ni4MJumF5oJ/vuOyc="; featuresInfo = { # Needed always basic = { @@ -61,6 +63,9 @@ let }; volk = { cmakeEnableFlag = "VOLK"; + runtime = [ + volk + ]; }; doxygen = { native = [ doxygen ]; @@ -213,10 +218,14 @@ let qt = qt4; gtk = gtk2; }); + inherit (shared) hasFeature; # function +in + +stdenv.mkDerivation rec { + inherit pname; inherit (shared) version src - hasFeature # function nativeBuildInputs buildInputs disallowedReferences @@ -228,7 +237,7 @@ let passthru = shared.passthru // { # Deps that are potentially overriden and are used inside GR plugins - the same version must - inherit boost; + inherit boost volk; } // lib.optionalAttrs (hasFeature "gr-uhd" features) { inherit uhd; }; @@ -242,6 +251,9 @@ let "-DLIBGSM_LIBRARIES=${gsm}/lib/libgsm.so" "-DLIBGSM_INCLUDE_DIR=${gsm}/include/gsm" ] + ++ lib.optionals (hasFeature "volk" features && volk != null) [ + "-DENABLE_INTERNAL_VOLK=OFF" + ] ; stripDebugList = shared.stripDebugList # gr-fcd feature was dropped in 3.8 @@ -256,15 +268,6 @@ let + lib.optionalString (hasFeature "gnuradio-companion" features) '' sed -i 's/.*pygtk_version.*/set(PYGTK_FOUND TRUE)/g' grc/CMakeLists.txt '' - # If python-support is disabled, don't install volk's (git submodule) - # volk_modtool - it references python. - # - # NOTE: The same is done for 3.8, but we don't put this string in - # ./shared.nix since on the next release of 3.8 it won't be needed there, - # but it will be needed for 3.7, probably for ever. - + lib.optionalString (!hasFeature "python-support" features) '' - sed -i -e "/python\/volk_modtool/d" volk/CMakeLists.txt - '' ; patches = [ # Don't install python referencing files if python support is disabled. @@ -278,24 +281,4 @@ let sha256 = "2Pitgu8accs16B5X5+/q51hr+IY9DMsA15f56gAtBs8="; }) ]; -in - -stdenv.mkDerivation rec { - inherit - pname - version - src - nativeBuildInputs - buildInputs - cmakeFlags - preConfigure - # disallowedReferences - stripDebugList - patches - postInstall - passthru - doCheck - dontWrapPythonPrograms - meta - ; } diff --git a/pkgs/applications/radio/gnuradio/default.nix b/pkgs/applications/radio/gnuradio/default.nix index 4ba1782bfabb..304fccf91d0e 100644 --- a/pkgs/applications/radio/gnuradio/default.nix +++ b/pkgs/applications/radio/gnuradio/default.nix @@ -214,6 +214,11 @@ let qt = qt5; gtk = gtk3; }); + inherit (shared) hasFeature; # function +in + +stdenv.mkDerivation rec { + inherit pname; inherit (shared) version src @@ -229,7 +234,7 @@ let ; passthru = shared.passthru // { # Deps that are potentially overriden and are used inside GR plugins - the same version must - inherit boost; + inherit boost volk; } // lib.optionalAttrs (hasFeature "gr-uhd" features) { inherit uhd; } // lib.optionalAttrs (hasFeature "gr-qtgui" features) { @@ -246,6 +251,9 @@ let "-DLIBGSM_LIBRARIES=${gsm}/lib/libgsm.so" "-DLIBGSM_INCLUDE_DIRS=${gsm}/include/gsm" ] + ++ lib.optionals (hasFeature "volk" features && volk != null) [ + "-DENABLE_INTERNAL_VOLK=OFF" + ] ; postInstall = shared.postInstall @@ -255,19 +263,6 @@ let ${removeReferencesTo}/bin/remove-references-to -t ${python} $out/lib/cmake/gnuradio/GnuradioConfig.cmake '' ; - preConfigure = "" - # If python-support is disabled, don't install volk's (git submodule) - # volk_modtool - it references python. - # - # NOTE: on the next release, volk will always be required to be installed - # externally (submodule removed upstream). Hence this hook will fail and - # we'll need to package volk while able to tell it to install or not - # install python referencing files. When we'll be there, this will help: - # https://github.com/gnuradio/volk/pull/404 - + lib.optionalString (!hasFeature "python-support" features) '' - sed -i -e "/python\/volk_modtool/d" volk/CMakeLists.txt - '' - ; patches = [ # Don't install python referencing files if python support is disabled. # See: https://github.com/gnuradio/gnuradio/pull/3839 @@ -287,25 +282,4 @@ let sha256 = "1ajf4797f869lqv436xw61s29qdbn7f01i0970kfxv3yahd34p9v"; }) ]; -in - -stdenv.mkDerivation rec { - inherit - pname - version - src - nativeBuildInputs - buildInputs - cmakeFlags - preConfigure - # disallowedReferences - stripDebugList - patches - postInstall - passthru - doCheck - dontWrapPythonPrograms - dontWrapQtApps - meta - ; } diff --git a/pkgs/applications/radio/gnuradio/shared.nix b/pkgs/applications/radio/gnuradio/shared.nix index 271819e60724..f8ea2f0b1601 100644 --- a/pkgs/applications/radio/gnuradio/shared.nix +++ b/pkgs/applications/radio/gnuradio/shared.nix @@ -85,9 +85,6 @@ rec { ; postInstall = "" # Gcc references - + lib.optionalString (hasFeature "volk" features) '' - ${removeReferencesTo}/bin/remove-references-to -t ${stdenv.cc} $(readlink -f $out/lib/libvolk.so) - '' + lib.optionalString (hasFeature "gnuradio-runtime" features) '' ${removeReferencesTo}/bin/remove-references-to -t ${stdenv.cc} $(readlink -f $out/lib/libgnuradio-runtime.so) '' diff --git a/pkgs/development/gnuradio-modules/mkDerivation.nix b/pkgs/development/gnuradio-modules/mkDerivation.nix index 235eff25cdbd..014968f82cc6 100644 --- a/pkgs/development/gnuradio-modules/mkDerivation.nix +++ b/pkgs/development/gnuradio-modules/mkDerivation.nix @@ -17,7 +17,9 @@ let args_ = { enableParallelBuilding = args.enableParallelBuilding or true; nativeBuildInputs = (args.nativeBuildInputs or []); - # We add gnuradio itself by default - buildInputs = (args.buildInputs or []) ++ [ unwrapped ]; + # We add gnuradio and volk itself by default - most gnuradio based packages + # will not consider it a depenency worth mentioning and it will almost + # always be needed + buildInputs = (args.buildInputs or []) ++ [ unwrapped unwrapped.volk ]; }; in mkDerivation (args // args_) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 23bbaccd54d3..fd680c47af1b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22342,6 +22342,10 @@ in gnuradioMinimal = gnuradio.override { wrap = false; unwrapped = gnuradio.unwrapped.override { + volk = volk.override { + # So it will not reference python + enableModTool = false; + }; features = { gnuradio-companion = false; python-support = false; @@ -22368,6 +22372,9 @@ in gnuradio3_7Minimal = gnuradio3_7.override { wrap = false; unwrapped = gnuradio3_7.unwrapped.override { + volk = volk.override { + enableModTool = false; + }; features = { gnuradio-companion = false; python-support = false; diff --git a/pkgs/top-level/gnuradio-packages.nix b/pkgs/top-level/gnuradio-packages.nix index 6c8db76cb3e0..e5c2c8be3131 100644 --- a/pkgs/top-level/gnuradio-packages.nix +++ b/pkgs/top-level/gnuradio-packages.nix @@ -16,9 +16,10 @@ let callPackage = self.newScope { inherit (gnuradio) - # Packages that are potentially overriden and commonly + # Packages that are potentially overriden and used as deps here. boost uhd + volk ; inherit mkDerivationWith mkDerivation; };