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.
This commit is contained in:
Doron Behar 2021-03-13 13:50:15 +02:00
parent 7df0fa108a
commit 650ee258fd
6 changed files with 38 additions and 74 deletions

View file

@ -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
;
}

View file

@ -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
;
}

View file

@ -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)
''

View file

@ -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_)

View file

@ -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;

View file

@ -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;
};