2022-03-30 09:31:56 +00:00
|
|
|
{ config
|
|
|
|
, lib
|
2021-10-28 06:52:43 +00:00
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
2023-02-02 18:25:31 +00:00
|
|
|
, macdylibbundler
|
|
|
|
, makeWrapper
|
|
|
|
, darwin
|
2021-10-28 06:52:43 +00:00
|
|
|
, codec2
|
2022-03-30 09:31:56 +00:00
|
|
|
, libpulseaudio
|
2021-10-28 06:52:43 +00:00
|
|
|
, libsamplerate
|
|
|
|
, libsndfile
|
|
|
|
, lpcnetfreedv
|
|
|
|
, portaudio
|
|
|
|
, speexdsp
|
|
|
|
, hamlib
|
2022-10-06 18:32:54 +00:00
|
|
|
, wxGTK32
|
2022-03-30 09:31:56 +00:00
|
|
|
, pulseSupport ? config.pulseaudio or stdenv.isLinux
|
2022-09-09 14:08:57 +00:00
|
|
|
, AppKit
|
|
|
|
, AVFoundation
|
|
|
|
, Cocoa
|
|
|
|
, CoreMedia
|
2021-10-28 06:52:43 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "freedv";
|
2023-02-02 18:25:31 +00:00
|
|
|
version = "1.8.7";
|
2021-10-28 06:52:43 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "drowe67";
|
|
|
|
repo = "freedv-gui";
|
|
|
|
rev = "v${version}";
|
2023-02-02 18:25:31 +00:00
|
|
|
hash = "sha256-N9LZCf2YAhVgxnQWgCB9TqGNpUGP1ZqpLmbYIaQsn08=";
|
2021-10-28 06:52:43 +00:00
|
|
|
};
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
postPatch = lib.optionalString stdenv.isDarwin ''
|
|
|
|
substituteInPlace src/CMakeLists.txt \
|
2023-02-02 18:25:31 +00:00
|
|
|
--replace "\''${CMAKE_SOURCE_DIR}/macdylibbundler/dylibbundler" "dylibbundler"
|
|
|
|
sed -i "/hdiutil/d" src/CMakeLists.txt
|
2022-09-09 14:08:57 +00:00
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
macdylibbundler
|
|
|
|
makeWrapper
|
|
|
|
darwin.autoSignDarwinBinariesHook
|
|
|
|
];
|
2022-09-09 14:08:57 +00:00
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
buildInputs = [
|
|
|
|
codec2
|
|
|
|
libsamplerate
|
|
|
|
libsndfile
|
|
|
|
lpcnetfreedv
|
|
|
|
speexdsp
|
|
|
|
hamlib
|
2022-10-06 18:32:54 +00:00
|
|
|
wxGTK32
|
2022-09-09 14:08:57 +00:00
|
|
|
] ++ (if pulseSupport then [ libpulseaudio ] else [ portaudio ])
|
|
|
|
++ lib.optionals stdenv.isDarwin [
|
|
|
|
AppKit
|
|
|
|
AVFoundation
|
|
|
|
Cocoa
|
|
|
|
CoreMedia
|
|
|
|
];
|
2021-10-28 06:52:43 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DUSE_INTERNAL_CODEC2:BOOL=FALSE"
|
|
|
|
"-DUSE_STATIC_DEPS:BOOL=FALSE"
|
2022-11-02 22:02:43 +00:00
|
|
|
"-DUNITTEST=ON"
|
2022-03-30 09:31:56 +00:00
|
|
|
] ++ lib.optionals pulseSupport [ "-DUSE_PULSEAUDIO:BOOL=TRUE" ];
|
2021-10-28 06:52:43 +00:00
|
|
|
|
2022-10-06 18:32:54 +00:00
|
|
|
NIX_CFLAGS_COMPILE = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
|
|
|
|
"-DAPPLE_OLD_XCODE"
|
|
|
|
];
|
|
|
|
|
2022-11-02 22:02:43 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
postInstall = lib.optionalString stdenv.isDarwin ''
|
|
|
|
mkdir -p $out/Applications
|
|
|
|
mv $out/bin/FreeDV.app $out/Applications
|
|
|
|
makeWrapper $out/Applications/FreeDV.app/Contents/MacOS/FreeDV $out/bin/freedv
|
|
|
|
'';
|
|
|
|
|
2021-10-28 06:52:43 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://freedv.org/";
|
|
|
|
description = "Digital voice for HF radio";
|
|
|
|
license = licenses.lgpl21;
|
2022-09-09 14:08:57 +00:00
|
|
|
maintainers = with maintainers; [ mvs wegank ];
|
2022-03-30 09:31:56 +00:00
|
|
|
platforms = platforms.unix;
|
2021-10-28 06:52:43 +00:00
|
|
|
};
|
|
|
|
}
|