2022-11-01 00:53:25 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, freedvSupport ? false
|
|
|
|
, lpcnetfreedv
|
|
|
|
, codec2
|
|
|
|
}:
|
2018-08-12 21:30:53 +00:00
|
|
|
|
2021-01-03 10:07:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-13 21:52:01 +00:00
|
|
|
pname = "codec2";
|
2022-07-29 08:51:13 +00:00
|
|
|
version = "1.0.5";
|
2018-08-12 21:30:53 +00:00
|
|
|
|
2019-11-17 12:27:48 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "drowe67";
|
|
|
|
repo = "codec2";
|
|
|
|
rev = "v${version}";
|
2022-07-29 08:51:13 +00:00
|
|
|
hash = "sha256-Q5p6NicwmHBR7drX8Tdgf6Mruqssg9qzMC9sG9DlMbQ=";
|
2018-08-12 21:30:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
2022-11-01 00:53:25 +00:00
|
|
|
buildInputs = lib.optionals freedvSupport [
|
|
|
|
lpcnetfreedv
|
|
|
|
];
|
|
|
|
|
2022-07-03 17:53:06 +00:00
|
|
|
# Install a binary that is used by openwebrx
|
|
|
|
postInstall = ''
|
2022-07-06 23:03:12 +00:00
|
|
|
install -Dm0755 src/freedv_rx -t $out/bin/
|
2022-07-03 17:53:06 +00:00
|
|
|
'';
|
|
|
|
|
2021-10-20 14:59:22 +00:00
|
|
|
# Swap keyword order to satisfy SWIG parser
|
|
|
|
postFixup = ''
|
|
|
|
sed -r -i 's/(\<_Complex)(\s+)(float|double)/\3\2\1/' $out/include/$pname/freedv_api.h
|
|
|
|
'';
|
|
|
|
|
2022-07-12 15:20:45 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
# RPATH of binary /nix/store/.../bin/freedv_rx contains a forbidden reference to /build/
|
|
|
|
"-DCMAKE_SKIP_BUILD_RPATH=ON"
|
2022-11-01 00:53:25 +00:00
|
|
|
] ++ lib.optionals freedvSupport [
|
|
|
|
"-DLPCNET=ON"
|
2022-07-12 15:20:45 +00:00
|
|
|
];
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2018-08-12 21:30:53 +00:00
|
|
|
description = "Speech codec designed for communications quality speech at low data rates";
|
2022-01-03 15:53:12 +00:00
|
|
|
homepage = "https://www.rowetel.com/codec2.html";
|
2021-02-01 12:35:18 +00:00
|
|
|
license = licenses.lgpl21Only;
|
2021-01-03 10:07:52 +00:00
|
|
|
platforms = platforms.unix;
|
2018-08-12 21:30:53 +00:00
|
|
|
maintainers = with maintainers; [ markuskowa ];
|
|
|
|
};
|
|
|
|
}
|