diff --git a/pkgs/by-name/lp/LPCNet/package.nix b/pkgs/by-name/lp/LPCNet/package.nix index 351e51118cb5..c7bf42a7d7e9 100644 --- a/pkgs/by-name/lp/LPCNet/package.nix +++ b/pkgs/by-name/lp/LPCNet/package.nix @@ -7,6 +7,7 @@ codec2, # for tests octave, + sox, }: stdenv.mkDerivation (finalAttrs: { @@ -16,9 +17,10 @@ stdenv.mkDerivation (finalAttrs: { src = fetchFromGitHub { owner = "drowe67"; repo = "LPCNet"; - rev = "v${finalAttrs.version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-tHZLKXmuM86A6OpfS3CRRjhFbqj1Q/w1w56msdgLHb0="; }; + passthru = { # Prebuilt neural network model that is needed during the build - can be overwritten nnmodel = fetchurl { @@ -26,6 +28,7 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-UJRAkkdR/dh/+qVoPuPd3ZN69cgzuRBMzOZdUWFJJsg="; }; }; + preConfigure = '' mkdir build cp \ @@ -37,20 +40,45 @@ stdenv.mkDerivation (finalAttrs: { patchShebangs *.sh unittest/*.sh ''; - nativeBuildInputs = [ cmake ]; - buildInputs = [ codec2 ]; - nativeCheckInputs = [ octave ]; + nativeBuildInputs = [ + cmake + ]; + + buildInputs = [ + codec2 + ]; + + cmakeFlags = lib.optionals (stdenv.cc.isClang && stdenv.hostPlatform.isAarch64) [ + # unsupported option '-mfpu=' for target 'x86_64-apple-darwin' + "-DNEON=OFF" + ]; + + nativeCheckInputs = [ + octave + sox + ]; + + disabledTests = lib.optionals (stdenv.cc.isClang && stdenv.hostPlatform.isAarch64) [ + # disable tests that require NEON + "SIMD_functions" + ]; doCheck = true; - preCheck = '' + 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 = with lib; { + meta = { description = "Experimental Neural Net speech coding for FreeDV"; homepage = "https://github.com/drowe67/LPCNet"; - license = licenses.bsd3; - maintainers = with maintainers; [ doronbehar ]; - platforms = platforms.all; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ doronbehar ]; + platforms = lib.platforms.all; }; })