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
|
2023-05-24 13:37:59 +00:00
|
|
|
, hamlib_4
|
2022-10-06 18:32:54 +00:00
|
|
|
, wxGTK32
|
2023-07-15 17:15:38 +00:00
|
|
|
, sioclient
|
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-11-16 04:20:00 +00:00
|
|
|
version = "1.9.4";
|
2021-10-28 06:52:43 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "drowe67";
|
|
|
|
repo = "freedv-gui";
|
|
|
|
rev = "v${version}";
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-3SQ3a1gg4/cXy8BJXazTgh6nkS/KQpM0fCA6JcbHOPc=";
|
2021-10-28 06:52:43 +00:00
|
|
|
};
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
postPatch = lib.optionalString stdenv.isDarwin ''
|
2023-11-16 04:20:00 +00:00
|
|
|
substituteInPlace CMakeLists.txt \
|
|
|
|
--replace "-Wl,-ld_classic" ""
|
2022-09-09 14:08:57 +00:00
|
|
|
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
|
2023-05-24 13:37:59 +00:00
|
|
|
hamlib_4
|
2022-10-06 18:32:54 +00:00
|
|
|
wxGTK32
|
2023-07-15 17:15:38 +00:00
|
|
|
sioclient
|
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"
|
2023-10-09 19:29:22 +00:00
|
|
|
"-DUSE_PULSEAUDIO:BOOL=${if pulseSupport then "TRUE" else "FALSE"}"
|
|
|
|
];
|
2021-10-28 06:52:43 +00:00
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
|
2022-10-06 18:32:54 +00:00
|
|
|
"-DAPPLE_OLD_XCODE"
|
2023-03-04 12:14:45 +00:00
|
|
|
]);
|
2022-10-06 18:32:54 +00:00
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|