Unverified Commit 694814ad authored by Doron Behar's avatar Doron Behar Committed by GitHub
Browse files

LPCNet: 0.5 -> 0.5-unstable-2025-01-19 (#404338)

parents d91608b0 01fb9591
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
  fetchFromGitHub,
  cmake,
  freedvSupport ? false,
  lpcnetfreedv,
  lpcnet,
}:

stdenv.mkDerivation (finalAttrs: {
@@ -37,7 +37,7 @@ stdenv.mkDerivation (finalAttrs: {
  ];

  buildInputs = lib.optionals freedvSupport [
    lpcnetfreedv
    lpcnet
  ];

  # we need to unset these variables from stdenv here and then set their equivalents in the cmake flags
+2 −2
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@
  libpulseaudio,
  libsamplerate,
  libsndfile,
  lpcnetfreedv,
  lpcnet,
  portaudio,
  speexdsp,
  hamlib_4,
@@ -54,7 +54,7 @@ stdenv.mkDerivation (finalAttrs: {
    codec2
    libsamplerate
    libsndfile
    lpcnetfreedv
    lpcnet
    speexdsp
    hamlib_4
    wxGTK32
+17 −32
Original line number Diff line number Diff line
@@ -5,22 +5,25 @@
  fetchurl,
  cmake,
  codec2,
  # for tests
  octave,
  sox,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "LPCNet";
  version = "0.5";
  version = "0.5-unstable-2025-01-19";

  src = fetchFromGitHub {
    owner = "drowe67";
    repo = "LPCNet";
    tag = "v${finalAttrs.version}";
    hash = "sha256-tHZLKXmuM86A6OpfS3CRRjhFbqj1Q/w1w56msdgLHb0=";
    rev = "c8e51ac5e2fe674849cb53e7da44689b572cc246";
    sha256 = "sha256-0Knoym+deTuFAyJrrD55MijVh6DlhJp3lss66BJUHiA=";
  };

  patches = [
    # extracted from https://github.com/drowe67/LPCNet/pull/59
    ./darwin.patch
  ];

  passthru = {
    # Prebuilt neural network model that is needed during the build - can be overwritten
    nnmodel = fetchurl {
@@ -36,10 +39,6 @@ stdenv.mkDerivation (finalAttrs: {
      build/${finalAttrs.finalPackage.passthru.nnmodel.name}
  '';

  prePatch = ''
    patchShebangs *.sh unittest/*.sh
  '';

  nativeBuildInputs = [
    cmake
  ];
@@ -48,37 +47,23 @@ stdenv.mkDerivation (finalAttrs: {
    codec2
  ];

  cmakeFlags = lib.optionals (stdenv.cc.isClang && stdenv.hostPlatform.isAarch64) [
    # unsupported option '-mfpu=' for target 'x86_64-apple-darwin'
    "-DNEON=OFF"
  ];

  doCheck = true;
  nativeCheckInputs = [
    octave
    # NOTE: From some reason, the tests pass without this on x86_64-linux, but
    # not on aarch64-linux, although the relevant test is not enabled
    # conditionally, see:
    # https://github.com/drowe67/LPCNet/blob/c8e51ac5e2fe674849cb53e7da44689b572cc246/CMakeLists.txt#L220-L225
    sox
  ];

  disabledTests = lib.optionals (stdenv.cc.isClang && stdenv.hostPlatform.isAarch64) [
    # disable tests that require NEON
    "SIMD_functions"
  ];

  doCheck = true;
  checkPhase = ''
    runHook preCheck

    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}/build/source/build/src"

    ctest -j 1 --output-on-failure -E '^${lib.concatStringsSep "|" finalAttrs.disabledTests}$'

    runHook postCheck
  '';

  meta = {
    description = "Experimental Neural Net speech coding for FreeDV";
    homepage = "https://github.com/drowe67/LPCNet";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ doronbehar ];
    maintainers = with lib.maintainers; [
      doronbehar
      mvs
    ];
    platforms = lib.platforms.all;
  };
})
+0 −51
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  fetchurl,
  cmake,
  nix-update-script,
}:

let
  dataVersion = "191005_v1.0";
  data = fetchurl {
    url = "http://rowetel.com/downloads/deep/lpcnet_${dataVersion}.tgz";
    sha256 = "sha256-UJRAkkdR/dh/+qVoPuPd3ZN69cgzuRBMzOZdUWFJJsg=";
  };
in
stdenv.mkDerivation {
  pname = "lpcnetfreedv";
  version = "0.5-unstable-2025-01-19";

  src = fetchFromGitHub {
    owner = "drowe67";
    repo = "LPCNet";
    rev = "c8e51ac5e2fe674849cb53e7da44689b572cc246";
    sha256 = "sha256-0Knoym+deTuFAyJrrD55MijVh6DlhJp3lss66BJUHiA=";
  };

  nativeBuildInputs = [ cmake ];

  patches = [
    # extracted from https://github.com/drowe67/LPCNet/pull/59
    ./darwin.patch
  ];

  postPatch = ''
    mkdir build
    ln -s ${data} build/lpcnet_${dataVersion}.tgz
  '';

  passthru.updateScript = nix-update-script {
    extraArgs = [ "--version=branch" ];
  };

  meta = {
    homepage = "https://freedv.org/";
    description = "Experimental Neural Net speech coding for FreeDV";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ mvs ];
    platforms = lib.platforms.all;
  };
}
Loading