about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorDmitry Kalinkin <dmitry.kalinkin@gmail.com>2021-12-16 19:08:54 -0500
committerGitHub <noreply@github.com>2021-12-16 19:08:54 -0500
commit03ec468b14067729a285c2c7cfa7b9434a04816c (patch)
tree3f0238b67da51fccd0624c7081d1fb1570f675fc /pkgs
parentde27156be068d0f0b54c546e76f19ae714fa13f0 (diff)
parent48fe2ffdec52a0e78701a40faf0e78333b56a8d1 (diff)
Merge pull request #150910 from veprbl/pr/audacity_darwin_fix
audacity: fix for darwin
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/audio/audacity/default.nix72
-rw-r--r--pkgs/development/libraries/audio/suil/default.nix2
-rw-r--r--pkgs/top-level/all-packages.nix9
3 files changed, 52 insertions, 31 deletions
diff --git a/pkgs/applications/audio/audacity/default.nix b/pkgs/applications/audio/audacity/default.nix
index 0832bb1dd9644..55d5383a819bc 100644
--- a/pkgs/applications/audio/audacity/default.nix
+++ b/pkgs/applications/audio/audacity/default.nix
@@ -3,7 +3,6 @@
 , fetchFromGitHub
 , fetchpatch
 , cmake
-, wxGTK
 , pkg-config
 , python3
 , gettext
@@ -18,7 +17,6 @@
 , sqlite
 , sratom
 , suil
-, alsa-lib
 , libsndfile
 , soxr
 , flac
@@ -28,8 +26,10 @@
 , libopus
 , ffmpeg
 , soundtouch
-, pcre /*, portaudio - given up fighting their portaudio.patch */
+, pcre
+/*, portaudio - given up fighting their portaudio.patch */
 , linuxHeaders
+, alsa-lib
 , at-spi2-core
 , dbus
 , libepoxy
@@ -40,6 +40,16 @@
 , libsepol
 , libxkbcommon
 , util-linux
+, wxGTK
+, AppKit ? null
+, AudioToolbox ? null
+, AudioUnit ? null
+, Carbon ? null
+, Cocoa ? null
+, CoreAudio ? null
+, CoreAudioKit ? null
+, CoreServices ? null
+, wxmac
 }:
 
 # TODO
@@ -49,14 +59,20 @@
 let
   inherit (lib) optionals;
 
+  wxWidgets_src = fetchFromGitHub {
+    owner = "audacity";
+    repo = "wxWidgets";
+    rev = "07e7d832c7a337aedba3537b90b2c98c4d8e2985";
+    sha256 = "1mawnkcrmqj98jp0jxlnh9xkc950ca033ccb51c7035pzmi9if9a";
+    fetchSubmodules = true;
+  };
+
   wxGTK' = wxGTK.overrideAttrs (oldAttrs: rec {
-    src = fetchFromGitHub {
-      owner = "audacity";
-      repo = "wxWidgets";
-      rev = "07e7d832c7a337aedba3537b90b2c98c4d8e2985";
-      sha256 = "1mawnkcrmqj98jp0jxlnh9xkc950ca033ccb51c7035pzmi9if9a";
-      fetchSubmodules = true;
-    };
+    src = wxWidgets_src;
+  });
+
+  wxmac' = wxmac.overrideAttrs (oldAttrs: rec {
+    src = wxWidgets_src;
   });
 
 in
@@ -88,24 +104,11 @@ stdenv.mkDerivation rec {
 
   postPatch = ''
     touch src/RevisionIdent.h
-
+  '' + lib.optionalString stdenv.isLinux ''
     substituteInPlace src/FileNames.cpp \
       --replace /usr/include/linux/magic.h ${linuxHeaders}/include/linux/magic.h
   '';
 
-  # audacity only looks for ffmpeg at runtime, so we need to link it in manually
-  NIX_LDFLAGS = toString [
-    "-lavcodec"
-    "-lavdevice"
-    "-lavfilter"
-    "-lavformat"
-    "-lavresample"
-    "-lavutil"
-    "-lpostproc"
-    "-lswresample"
-    "-lswscale"
-  ];
-
   nativeBuildInputs = [
     cmake
     gettext
@@ -116,7 +119,6 @@ stdenv.mkDerivation rec {
   ];
 
   buildInputs = [
-    alsa-lib
     expat
     ffmpeg
     file
@@ -138,9 +140,8 @@ stdenv.mkDerivation rec {
     sratom
     suil
     twolame
-    wxGTK'
-    wxGTK'.gtk
   ] ++ optionals stdenv.isLinux [
+    alsa-lib # for portaudio
     at-spi2-core
     dbus
     libepoxy
@@ -151,6 +152,19 @@ stdenv.mkDerivation rec {
     libselinux
     libsepol
     util-linux
+    wxGTK'
+    wxGTK'.gtk
+  ] ++ optionals stdenv.isDarwin [
+    wxmac'
+    AppKit
+    Cocoa
+    CoreAudioKit
+    AudioUnit AudioToolbox CoreAudio CoreServices Carbon # for portaudio
+  ];
+
+  cmakeFlags = [
+    "-Daudacity_use_ffmpeg=linked"
+    "-DDISABLE_DYNAMIC_LOADING_FFMPEG=ON"
   ];
 
   doCheck = false; # Test fails
@@ -159,7 +173,7 @@ stdenv.mkDerivation rec {
     description = "Sound editor with graphical UI";
     homepage = "https://www.audacityteam.org/";
     license = licenses.gpl2Plus;
-    maintainers = with maintainers; [ lheckemann ];
-    platforms = platforms.linux;
+    maintainers = with maintainers; [ lheckemann veprbl ];
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/audio/suil/default.nix b/pkgs/development/libraries/audio/suil/default.nix
index 1c978a18f8f98..ac10472e014e3 100644
--- a/pkgs/development/libraries/audio/suil/default.nix
+++ b/pkgs/development/libraries/audio/suil/default.nix
@@ -31,6 +31,6 @@ stdenv.mkDerivation rec {
     description = "A lightweight C library for loading and wrapping LV2 plugin UIs";
     license = licenses.mit;
     maintainers = with maintainers; [ goibhniu ];
-    platforms = platforms.linux;
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 54d79de84b313..4d39d6a22ae14 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -24192,7 +24192,14 @@ with pkgs;
 
   audacity-gtk2 = callPackage ../applications/audio/audacity { wxGTK = wxGTK31-gtk2; };
   audacity-gtk3 = callPackage ../applications/audio/audacity { wxGTK = wxGTK31-gtk3; };
-  audacity = audacity-gtk2;
+  audacity =
+    if stdenv.isDarwin then
+      callPackage ../applications/audio/audacity {
+        inherit (darwin.apple_sdk.frameworks) AppKit AudioToolbox AudioUnit Carbon Cocoa CoreAudio CoreAudioKit CoreServices;
+        suil = suil-qt5;
+      }
+    else
+      audacity-gtk2;
 
   audio-recorder = callPackage ../applications/audio/audio-recorder { };