Unverified Commit 43cc8036 authored by Doron Behar's avatar Doron Behar Committed by GitHub
Browse files

sdr-j-fm: 3.16-unstable-2023-12-07 → 3.20-2025-10-07 (#448315)

parents 1506cdec 3a633edf
Loading
Loading
Loading
Loading
+40 −18
Original line number Diff line number Diff line
@@ -3,76 +3,98 @@
  stdenv,
  fetchFromGitHub,
  cmake,
  wrapQtAppsHook,
  pkg-config,
  qtbase,
  qwt6_1,
  qt5,
  libsForQt5,
  fftwFloat,
  libsamplerate,
  portaudio,
  libusb1,
  libsndfile,
  featuresOverride ? { },
  airspy,
  hackrf,
  libiio,
  limesuite,
  rtl-sdr,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "sdr-j-fm";
  # The stable release doen't include the commit the came after 3.16 which
  # added support for cmake options instead of using cmake set() commands. See
  # also: https://github.com/JvanKatwijk/sdr-j-fm/pull/25
  version = "3.16-unstable-2023-12-07";
  version = "3.20-2025-10-07";

  src = fetchFromGitHub {
    owner = "JvanKatwijk";
    repo = "sdr-j-fm";
    rev = "8e3a67f8fbf72dd6968cbeb2e3d7d513fd107c71";
    hash = "sha256-l9WqfhDp2V01lhleYZqRpmyL1Ww+tJj10bjkMMlvyA0=";
    rev = "e348cc0a4b4b16f716f36115400dfd861b9a0bd5";
    hash = "sha256-Do2W+B4U8xxCwGRjrJNWkSpgcXG+2PXoemju5oef+jU=";
  };

  nativeBuildInputs = [
    cmake
    wrapQtAppsHook
    qt5.wrapQtAppsHook
    pkg-config
  ];

  buildInputs = [
    qtbase
    qwt6_1
    qt5.qtbase
    qt5.qtmultimedia
    libsForQt5.qwt6_1
    fftwFloat
    libsamplerate
    portaudio
    libusb1
    libsndfile
  ];
  cmakeFlags = lib.mapAttrsToList lib.cmakeBool finalAttrs.passthru.features;
  cmakeFlags = lib.mapAttrsToList lib.cmakeBool finalAttrs.passthru.features ++ [
    # https://github.com/JvanKatwijk/sdr-j-fm/issues/27#issuecomment-3371932903
    # https://github.com/NixOS/nixpkgs/issues/445447
    (lib.cmakeFeature "CMAKE_POLICY_VERSION_MINIMUM" "3.5")
  ];

  passthru = {
    features = {
      # All of these features don't require an external dependencies, although it
      # may be implied - upstraem bundles everything they need in their repo.
      AIRSPY = true;
      SDRPLAY = true;
      SDRPLAY_V3 = true;
      HACKRF = true;
      LIME = true;
      PLUTO = true;
      RTLSDR = true;
      # Some more cmake flags are mentioned in upstream's CMakeLists.txt file
      # but they don't actually make a difference.
    }
    // featuresOverride;
    runtimeDependencies = [
      airspy
      hackrf
      libiio
      limesuite
      rtl-sdr
    ];
  };

  postInstall = ''
    # Weird default of upstream
    mv $out/linux-bin $out/bin
    mv $out/bin/fmreceiver{-3.15,}

    # Ideally, upstream's cmake files should link these libraries to the
    # executable, but it'd require a bit of work. See:
    # https://github.com/JvanKatwijk/sdr-j-fm/issues/27
    wrapProgram $out/bin/fmreceiver \
      --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath finalAttrs.finalPackage.passthru.runtimeDependencies}
  '';

  meta = with lib; {
  meta = {
    description = "SDR based FM radio receiver software";
    homepage = "https://github.com/JvanKatwijk/sdr-j-fm";
    license = licenses.gpl2Only;
    maintainers = with maintainers; [ doronbehar ];
    license = lib.licenses.gpl2Only;
    maintainers = with lib.maintainers; [ doronbehar ];
    # Upstream doesn't find libusb1 on Darwin. Upstream probably doesn't
    # support it officially.
    platforms = platforms.linux;
    platforms = lib.platforms.linux;
    mainProgram = "fmreceiver";
  };
})
+0 −2
Original line number Diff line number Diff line
@@ -8601,8 +8601,6 @@ with pkgs;
  SDL = SDL_compat;
  SDL2 = sdl2-compat;

  sdr-j-fm = libsForQt5.callPackage ../applications/radio/sdr-j-fm { };

  sigdigger = libsForQt5.callPackage ../applications/radio/sigdigger { };

  sev-snp-measure = with python3Packages; toPythonApplication sev-snp-measure;