about summary refs log tree commit diff
path: root/pkgs/applications/radio
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2022-08-30 05:15:42 +0200
committerWeijia Wang <9713184+wegank@users.noreply.github.com>2022-08-30 05:15:42 +0200
commite61ffae1360ee4e05daf7665e831514d07d20318 (patch)
tree69da24bcca95b0031ae805a5eab23fe691d6c75c /pkgs/applications/radio
parent36f77596b1fc34b3b556cf2f17ee1fe05b20ff51 (diff)
downloadnixlib-e61ffae1360ee4e05daf7665e831514d07d20318.tar
nixlib-e61ffae1360ee4e05daf7665e831514d07d20318.tar.gz
nixlib-e61ffae1360ee4e05daf7665e831514d07d20318.tar.bz2
nixlib-e61ffae1360ee4e05daf7665e831514d07d20318.tar.lz
nixlib-e61ffae1360ee4e05daf7665e831514d07d20318.tar.xz
nixlib-e61ffae1360ee4e05daf7665e831514d07d20318.tar.zst
nixlib-e61ffae1360ee4e05daf7665e831514d07d20318.zip
freedv: fix build on darwin
Diffstat (limited to 'pkgs/applications/radio')
-rw-r--r--pkgs/applications/radio/freedv/default.nix23
1 files changed, 20 insertions, 3 deletions
diff --git a/pkgs/applications/radio/freedv/default.nix b/pkgs/applications/radio/freedv/default.nix
index df2379b6c704..9e400a11bee5 100644
--- a/pkgs/applications/radio/freedv/default.nix
+++ b/pkgs/applications/radio/freedv/default.nix
@@ -13,6 +13,10 @@
 , hamlib
 , wxGTK31-gtk3
 , pulseSupport ? config.pulseaudio or stdenv.isLinux
+, AppKit
+, AVFoundation
+, Cocoa
+, CoreMedia
 }:
 
 stdenv.mkDerivation rec {
@@ -26,7 +30,15 @@ stdenv.mkDerivation rec {
     hash = "sha256-LPCY5gPinxJkfPfumKggI/JQorcW+Qw/ZAP6XQmPkeA=";
   };
 
+  postPatch = lib.optionalString stdenv.isDarwin ''
+    substituteInPlace src/CMakeLists.txt \
+      --replace "if(APPLE)" "if(0)" \
+      --replace "\''${FREEDV_LINK_LIBS})" "\''${FREEDV_LINK_LIBS} \''${FREEDV_LINK_LIBS_OSX})" \
+      --replace "\''${RES_FILES})" "\''${RES_FILES} \''${FREEDV_SOURCES_OSX})"
+  '';
+
   nativeBuildInputs = [ cmake ];
+
   buildInputs = [
     codec2
     libsamplerate
@@ -35,7 +47,13 @@ stdenv.mkDerivation rec {
     speexdsp
     hamlib
     wxGTK31-gtk3
-  ] ++ (if pulseSupport then [ libpulseaudio ] else [ portaudio ]);
+  ] ++ (if pulseSupport then [ libpulseaudio ] else [ portaudio ])
+  ++ lib.optionals stdenv.isDarwin [
+    AppKit
+    AVFoundation
+    Cocoa
+    CoreMedia
+  ];
 
   cmakeFlags = [
     "-DUSE_INTERNAL_CODEC2:BOOL=FALSE"
@@ -46,8 +64,7 @@ stdenv.mkDerivation rec {
     homepage = "https://freedv.org/";
     description = "Digital voice for HF radio";
     license = licenses.lgpl21;
-    maintainers = with maintainers; [ mvs ];
+    maintainers = with maintainers; [ mvs wegank ];
     platforms = platforms.unix;
-    broken = stdenv.isDarwin;  # see https://github.com/NixOS/nixpkgs/issues/165422
   };
 }