Unverified Commit 04654c49 authored by Doron Behar's avatar Doron Behar Committed by GitHub
Browse files

gnuradio3_8: remove (#356976)

parents c6bc2635 d50107f0
Loading
Loading
Loading
Loading
+0 −289
Original line number Diff line number Diff line
{ lib, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
# Remove gcc and python references
, removeReferencesTo
, pkg-config
, volk
, cppunit
, swig3
, orc
, boost
, log4cpp
, mpir
, doxygen
, python
, codec2
, gsm
, thrift
, fftwFloat
, alsa-lib
, libjack2
, CoreAudio
, uhd
, SDL
, gsl
, cppzmq
# Needed only if qt-gui is disabled, from some reason
, icu
# GUI related
, gtk3
, pango
, gobject-introspection
, cairo
, qt5
, libsForQt5
# Features available to override, the list of them is in featuresInfo. They
# are all turned on by default.
, features ? {}
# If one wishes to use a different src or name for a very custom build
, overrideSrc ? {}
, pname ? "gnuradio"
, version ? "3.8.5.0"
}:

let
  sourceSha256 = "sha256-p4VFjTE0GXmdA7QGhWSUzO/WxJ+8Dq3JEnOABtQtJUU=";
  featuresInfo = {
    # Needed always
    basic = {
      native = [
        cmake
        pkg-config
        orc
      ];
      runtime = [
        boost
        log4cpp
        mpir
      ]
        # 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; [
        mako
        six
      ];
    };
    volk = {
      cmakeEnableFlag = "VOLK";
      runtime = [
        volk
      ];
    };
    doxygen = {
      native = [ doxygen ];
      cmakeEnableFlag = "DOXYGEN";
    };
    sphinx = {
      pythonNative = with python.pkgs; [ sphinx ];
      cmakeEnableFlag = "SPHINX";
    };
    python-support = {
      pythonRuntime = [ python.pkgs.six ];
      native = [
        swig3
        python
      ];
      cmakeEnableFlag = "PYTHON";
    };
    testing-support = {
      native = [ cppunit ];
      cmakeEnableFlag = "TESTING";
    };
    gnuradio-runtime = {
      cmakeEnableFlag = "GNURADIO_RUNTIME";
    };
    gr-ctrlport = {
      cmakeEnableFlag = "GR_CTRLPORT";
      native = [
        swig3
      ];
      runtime = [
        thrift
      ];
      pythonRuntime = [
        python.pkgs.thrift
        # For gr-perf-monitorx
        python.pkgs.matplotlib
        python.pkgs.networkx
      ];
    };
    gnuradio-companion = {
      pythonRuntime = with python.pkgs; [
        pyyaml
        mako
        numpy
        pygobject3
      ];
      runtime = [
        gtk3
        pango
        gobject-introspection
        cairo
      ];
      cmakeEnableFlag = "GRC";
    };
    gr-blocks = {
      cmakeEnableFlag = "GR_BLOCKS";
    };
    gr-fec = {
      cmakeEnableFlag = "GR_FEC";
    };
    gr-fft = {
      runtime = [ fftwFloat ];
      cmakeEnableFlag = "GR_FFT";
    };
    gr-filter = {
      runtime = [ fftwFloat ];
      cmakeEnableFlag = "GR_FILTER";
    };
    gr-analog = {
      cmakeEnableFlag = "GR_ANALOG";
    };
    gr-digital = {
      cmakeEnableFlag = "GR_DIGITAL";
    };
    gr-dtv = {
      cmakeEnableFlag = "GR_DTV";
    };
    gr-audio = {
      runtime = []
        ++ lib.optionals stdenv.hostPlatform.isLinux [ alsa-lib libjack2 ]
        ++ lib.optionals stdenv.hostPlatform.isDarwin [ CoreAudio ]
      ;
      cmakeEnableFlag = "GR_AUDIO";
    };
    gr-channels = {
      cmakeEnableFlag = "GR_CHANNELS";
    };
    gr-qtgui = {
      runtime = [ qt5.qtbase libsForQt5.qwt6_1 ];
      pythonRuntime = [ python.pkgs.pyqt5 ];
      cmakeEnableFlag = "GR_QTGUI";
    };
    gr-trellis = {
      cmakeEnableFlag = "GR_TRELLIS";
    };
    gr-uhd = {
      runtime = [ uhd ];
      cmakeEnableFlag = "GR_UHD";
    };
    gr-utils = {
      cmakeEnableFlag = "GR_UTILS";
      pythonRuntime = with python.pkgs; [
        # For gr_plot
        matplotlib
      ];
    };
    gr-modtool = {
      pythonRuntime = with python.pkgs; [
        setuptools
        click
        click-plugins
      ];
      cmakeEnableFlag = "GR_MODTOOL";
    };
    gr-video-sdl = {
      runtime = [ SDL ];
      cmakeEnableFlag = "GR_VIDEO_SDL";
    };
    gr-vocoder = {
      runtime = [ codec2 gsm ];
      cmakeEnableFlag = "GR_VOCODER";
    };
    gr-wavelet = {
      cmakeEnableFlag = "GR_WAVELET";
      runtime = [ gsl ];
    };
    gr-zeromq = {
      runtime = [ cppzmq ];
      cmakeEnableFlag = "GR_ZEROMQ";
      pythonRuntime = [
        # Will compile without this, but it is required by tests, and by some
        # gr blocks.
        python.pkgs.pyzmq
      ];
    };
  };
  shared = (import ./shared.nix {
    inherit
      stdenv
      lib
      python
      removeReferencesTo
      featuresInfo
      features
      version
      sourceSha256
      overrideSrc
      fetchFromGitHub
    ;
    qt = qt5;
    gtk = gtk3;
  });
  inherit (shared.passthru) hasFeature; # function
in

stdenv.mkDerivation (finalAttrs: (shared // {
  inherit pname version;
  # Will still evaluate correctly if not used here. It only helps nix-update
  # find the right file in which version is defined.
  inherit (shared) src;
  # Some of the tests we know why they fail, but others simply hang-out and
  # timeout...
  doCheck = false;
  patches = [
    # Not accepted upstream, see https://github.com/gnuradio/gnuradio/pull/5227
    ./modtool-newmod-permissions.3_8.patch
    # Fix compilation with boost 177
    (fetchpatch {
      url = "https://github.com/gnuradio/gnuradio/commit/2c767bb260a25b415e8c9c4b3ea37280b2127cec.patch";
      sha256 = "sha256-l4dSzkXb5s3vcCeuKMMwiKfv83hFI9Yg+EMEX+sl+Uo=";
    })
  ];
  passthru = shared.passthru // {
    # Deps that are potentially overridden and are used inside GR plugins - the same version must
    inherit
      boost
      volk
    ;
    # Used by many gnuradio modules, the same attribute is present in
    # gnuradio3.10 where there it's spdlog.
    logLib = log4cpp;
  } // lib.optionalAttrs (hasFeature "gr-uhd") {
    inherit uhd;
  } // lib.optionalAttrs (hasFeature "gr-qtgui") {
    qwt = libsForQt5.qwt6_1;
  };
  cmakeFlags = shared.cmakeFlags
    # From some reason, if these are not set, libcodec2 and gsm are not
    # detected properly. The issue is reported upstream:
    # https://github.com/gnuradio/gnuradio/issues/4278
    # The above issue was fixed for GR3.9 without a backporting patch.
    #
    # NOTE: qradiolink needs libcodec2 to be detected in
    # order to build, see https://github.com/qradiolink/qradiolink/issues/67
    ++ lib.optionals (hasFeature "gr-vocoder") [
      "-DLIBCODEC2_FOUND=TRUE"
      "-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${stdenv.hostPlatform.extensions.sharedLibrary}"
      "-DLIBGSM_INCLUDE_DIRS=${gsm}/include/gsm"
    ]
    ++ lib.optionals (hasFeature "volk" && volk != null) [
      "-DENABLE_INTERNAL_VOLK=OFF"
    ]
  ;

  postInstall = shared.postInstall
    # This is the only python reference worth removing, if needed (3.7 doesn't
    # set that reference).
    + lib.optionalString (!hasFeature "python-support") ''
      remove-references-to -t ${python} $out/lib/cmake/gnuradio/GnuradioConfig.cmake
    ''
  ;
}))
+0 −3
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@
, orc
, boost
, spdlog
, swig
, mpir
, doxygen
, python
@@ -21,7 +20,6 @@
, libjack2
, libiio
, libad9361
, CoreAudio
, uhd
, SDL
, gsl
@@ -173,7 +171,6 @@ let
    gr-audio = {
      runtime = []
        ++ lib.optionals stdenv.hostPlatform.isLinux [ alsa-lib libjack2 ]
        ++ lib.optionals stdenv.hostPlatform.isDarwin [ CoreAudio ]
      ;
      cmakeEnableFlag = "GR_AUDIO";
    };
+22 −15
Original line number Diff line number Diff line
@@ -3,7 +3,8 @@
, libpulseaudio
, libconfig
# Needs a gnuradio built with qt gui support
, gnuradio3_8
, gnuradio
, log4cpp
, thrift
# Not gnuradioPackages'
, codec2
@@ -22,15 +23,16 @@
, uhd
}:

gnuradio3_8.pkgs.mkDerivation rec {
gnuradio.pkgs.mkDerivation rec {
  pname = "qradiolink";
  version = "0.9.0-1";
  # https://github.com/qradiolink/qradiolink/tree/gr_3.10
  version = "0.9.0-1-unstable-2024-08-29";

  src = fetchFromGitHub {
    owner = "qradiolink";
    repo = "qradiolink";
    rev = version;
    sha256 = "sha256-Js6DzmUG8O9c9VvjE6hc7JGuFmgc1Wq41zVJb8Us/yI=";
    rev = "f1006a20e0a642d0ac20aab18b19fa97567f2621";
    sha256 = "sha256-9AYFO+mmwLAH8gEpZn6qcENabc/KBMcg/0wCTKsInNY=";
  };

  preBuild = ''
@@ -48,35 +50,40 @@ gnuradio3_8.pkgs.mkDerivation rec {
  '';

  buildInputs = [
    gnuradio3_8.unwrapped.boost
    gnuradio.unwrapped.boost
    codec2
    gnuradio3_8.unwrapped.logLib
    gnuradio.unwrapped.logLib
    # gnuradio uses it's own log library (spdlog), and qradiolink is still
    # using the old gnuradio log library log4cpp. Perhaps this won't be needed
    # once the gr_3.10 branch will mature enough to be merged into qradiolink's
    # master branch.
    log4cpp
    gmp
    libpulseaudio
    libconfig
    gsm
    gnuradio3_8.pkgs.osmosdr
    gnuradio.pkgs.osmosdr
    libopus
    libjpeg
    limesuite
    soapysdr-with-plugins
    speex
    speexdsp
    gnuradio3_8.qt.qtbase
    gnuradio3_8.qt.qtmultimedia
    gnuradio.qt.qtbase
    gnuradio.qt.qtmultimedia
    libftdi
    libsndfile
    cppzmq
    gnuradio3_8.qwt
    gnuradio.qwt
    uhd
  ] ++ lib.optionals (gnuradio3_8.hasFeature "gr-ctrlport") [
  ] ++ lib.optionals (gnuradio.hasFeature "gr-ctrlport") [
    thrift
    gnuradio3_8.unwrapped.python.pkgs.thrift
    gnuradio.unwrapped.python.pkgs.thrift
  ];
  nativeBuildInputs = [
    protobuf
    gnuradio3_8.qt.qmake
    gnuradio3_8.qt.wrapQtAppsHook
    gnuradio.qt.qmake
    gnuradio.qt.wrapQtAppsHook
  ];

  meta = with lib; {
+6 −2
Original line number Diff line number Diff line
{ stdenv, lib, fetchFromGitHub, fetchzip
{ stdenv, lib, fetchFromGitHub, fetchpatch, fetchzip
, autoconf, automake, libtool, makeWrapper
, pkg-config, cmake, yasm, python3Packages
, libxcrypt, libgcrypt, libgpg-error, libunistring
@@ -99,6 +99,10 @@ in stdenv.mkDerivation (finalAttrs: {

    patches = [
      ./no-python-lib.patch
      (fetchpatch {
        url = "https://github.com/xbmc/xbmc/commit/32b04718c65a90f87e409674c4ef984b087b8657.patch";
        hash = "sha256-I79thepzDOfw55r9gfaOp/Ri2FA0gouc+RgTc2Zh1Sw=";
      })
    ];

    # make  derivations declared in the let binding available here, so
@@ -190,7 +194,7 @@ in stdenv.mkDerivation (finalAttrs: {
      "-DENABLE_OPTICAL=${if opticalSupport then "ON" else "OFF"}"
      "-DENABLE_VDPAU=${if vdpauSupport then "ON" else "OFF"}"
      "-DLIRC_DEVICE=/run/lirc/lircd"
      "-DSWIG_EXECUTABLE=${buildPackages.swig3}/bin/swig"
      "-DSWIG_EXECUTABLE=${buildPackages.swig}/bin/swig"
      "-DFLATBUFFERS_FLATC_EXECUTABLE=${buildPackages.flatbuffers}/bin/flatc"
      "-DPYTHON_EXECUTABLE=${buildPackages.python3Packages.python}/bin/python"
      "-DPYTHON_LIB_PATH=${python3Packages.python.sitePackages}"
+31 −0
Original line number Diff line number Diff line
{
  gnuradio,
  volk,
  uhdMinimal,
}:
# A build without gui components and other utilites not needed for end user
# libraries
gnuradio.override {
  doWrap = false;
  unwrapped = gnuradio.unwrapped.override {
    volk = volk.override {
      # So it will not reference python
      enableModTool = false;
    };
    uhd = uhdMinimal;
    features = {
      gnuradio-companion = false;
      python-support = false;
      examples = false;
      gr-qtgui = false;
      gr-utils = false;
      gr-modtool = false;
      gr-blocktool = false;
      sphinx = false;
      doxygen = false;
      # Doesn't make it reference python eventually, but makes reverse
      # depdendencies require python to use cmake files of GR.
      gr-ctrlport = false;
    };
  };
}
Loading