depot/third_party/nixpkgs/pkgs/applications/radio/freedv/default.nix
Default email 2c76a4cb41 Project import generated by Copybara.
GitOrigin-RevId: c757e9bd77b16ca2e03c89bf8bc9ecb28e0c06ad
2023-11-16 04:20:00 +00:00

96 lines
2 KiB
Nix

{ config
, lib
, stdenv
, fetchFromGitHub
, cmake
, macdylibbundler
, makeWrapper
, darwin
, codec2
, libpulseaudio
, libsamplerate
, libsndfile
, lpcnetfreedv
, portaudio
, speexdsp
, hamlib_4
, wxGTK32
, sioclient
, pulseSupport ? config.pulseaudio or stdenv.isLinux
, AppKit
, AVFoundation
, Cocoa
, CoreMedia
}:
stdenv.mkDerivation rec {
pname = "freedv";
version = "1.9.4";
src = fetchFromGitHub {
owner = "drowe67";
repo = "freedv-gui";
rev = "v${version}";
hash = "sha256-3SQ3a1gg4/cXy8BJXazTgh6nkS/KQpM0fCA6JcbHOPc=";
};
postPatch = lib.optionalString stdenv.isDarwin ''
substituteInPlace CMakeLists.txt \
--replace "-Wl,-ld_classic" ""
substituteInPlace src/CMakeLists.txt \
--replace "\''${CMAKE_SOURCE_DIR}/macdylibbundler/dylibbundler" "dylibbundler"
sed -i "/hdiutil/d" src/CMakeLists.txt
'';
nativeBuildInputs = [
cmake
] ++ lib.optionals stdenv.isDarwin [
macdylibbundler
makeWrapper
darwin.autoSignDarwinBinariesHook
];
buildInputs = [
codec2
libsamplerate
libsndfile
lpcnetfreedv
speexdsp
hamlib_4
wxGTK32
sioclient
] ++ (if pulseSupport then [ libpulseaudio ] else [ portaudio ])
++ lib.optionals stdenv.isDarwin [
AppKit
AVFoundation
Cocoa
CoreMedia
];
cmakeFlags = [
"-DUSE_INTERNAL_CODEC2:BOOL=FALSE"
"-DUSE_STATIC_DEPS:BOOL=FALSE"
"-DUNITTEST=ON"
"-DUSE_PULSEAUDIO:BOOL=${if pulseSupport then "TRUE" else "FALSE"}"
];
env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
"-DAPPLE_OLD_XCODE"
]);
doCheck = true;
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
'';
meta = with lib; {
homepage = "https://freedv.org/";
description = "Digital voice for HF radio";
license = licenses.lgpl21;
maintainers = with maintainers; [ mvs wegank ];
platforms = platforms.unix;
};
}