git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #150910 from veprbl/pr/audacity_darwin_fix

audacity: fix for darwin

commit03ec468b14067729a285c2c7cfa7b9434a04816c authorDmitry Kalinkin <dmitry.kalinkin@gmail.com> dateThu 16 Dec 2021, 19:08 (5 years ago) parentde2715648fe2ff
3 files changed+52−31
pkgs/applications/audio/audacity/default.nix+43−29 pkgs/development/libraries/audio/suil/default.nix+1−1 pkgs/top-level/all-packages.nix+8−1
pkgs/applications/audio/audacity/default.nix+43−29
@@ -3,7 +3,6 @@
33, fetchFromGitHub
44, fetchpatch
55, cmake
6−, wxGTK
76, pkg-config
87, python3
98, gettext
@@ -18,7 +17,6 @@
1817, sqlite
1918, sratom
2019, suil
21−, alsa-lib
2220, libsndfile
2321, soxr
2422, flac
@@ -28,8 +26,10 @@
2826, libopus
2927, ffmpeg
3028, soundtouch
31−, pcre /*, portaudio - given up fighting their portaudio.patch */
29+, pcre
30+/*, portaudio - given up fighting their portaudio.patch */
3231, linuxHeaders
32+, alsa-lib
3333, at-spi2-core
3434, dbus
3535, libepoxy
@@ -40,6 +40,16 @@
4040, libsepol
4141, libxkbcommon
4242, util-linux
43+, wxGTK
44+, AppKit ? null
45+, AudioToolbox ? null
46+, AudioUnit ? null
47+, Carbon ? null
48+, Cocoa ? null
49+, CoreAudio ? null
50+, CoreAudioKit ? null
51+, CoreServices ? null
52+, wxmac
4353}:
4454
4555# TODO
@@ -49,14 +59,20 @@
4959let
5060 inherit (lib) optionals;
5161
62+ wxWidgets_src = fetchFromGitHub {
63+ owner = "audacity";
64+ repo = "wxWidgets";
65+ rev = "07e7d832c7a337aedba3537b90b2c98c4d8e2985";
66+ sha256 = "1mawnkcrmqj98jp0jxlnh9xkc950ca033ccb51c7035pzmi9if9a";
67+ fetchSubmodules = true;
68+ };
69+
5270 wxGTK' = wxGTK.overrideAttrs (oldAttrs: rec {
53− src = fetchFromGitHub {
54− owner = "audacity";
55− repo = "wxWidgets";
56− rev = "07e7d832c7a337aedba3537b90b2c98c4d8e2985";
57− sha256 = "1mawnkcrmqj98jp0jxlnh9xkc950ca033ccb51c7035pzmi9if9a";
58− fetchSubmodules = true;
59− };
71+ src = wxWidgets_src;
72+ });
73+
74+ wxmac' = wxmac.overrideAttrs (oldAttrs: rec {
75+ src = wxWidgets_src;
6076 });
6177
6278in
@@ -88,24 +104,11 @@ stdenv.mkDerivation rec {
88104
89105 postPatch = ''
90106 touch src/RevisionIdent.h
91−
107+ '' + lib.optionalString stdenv.isLinux ''
92108 substituteInPlace src/FileNames.cpp \
93109 --replace /usr/include/linux/magic.h ${linuxHeaders}/include/linux/magic.h
94110 '';
95111
96− # audacity only looks for ffmpeg at runtime, so we need to link it in manually
97− NIX_LDFLAGS = toString [
98− "-lavcodec"
99− "-lavdevice"
100− "-lavfilter"
101− "-lavformat"
102− "-lavresample"
103− "-lavutil"
104− "-lpostproc"
105− "-lswresample"
106− "-lswscale"
107− ];
108−
109112 nativeBuildInputs = [
110113 cmake
111114 gettext
@@ -116,7 +119,6 @@ stdenv.mkDerivation rec {
116119 ];
117120
118121 buildInputs = [
119− alsa-lib
120122 expat
121123 ffmpeg
122124 file
@@ -138,9 +140,8 @@ stdenv.mkDerivation rec {
138140 sratom
139141 suil
140142 twolame
141− wxGTK'
142− wxGTK'.gtk
143143 ] ++ optionals stdenv.isLinux [
144+ alsa-lib # for portaudio
144145 at-spi2-core
145146 dbus
146147 libepoxy
@@ -151,6 +152,19 @@ stdenv.mkDerivation rec {
151152 libselinux
152153 libsepol
153154 util-linux
155+ wxGTK'
156+ wxGTK'.gtk
157+ ] ++ optionals stdenv.isDarwin [
158+ wxmac'
159+ AppKit
160+ Cocoa
161+ CoreAudioKit
162+ AudioUnit AudioToolbox CoreAudio CoreServices Carbon # for portaudio
163+ ];
164+
165+ cmakeFlags = [
166+ "-Daudacity_use_ffmpeg=linked"
167+ "-DDISABLE_DYNAMIC_LOADING_FFMPEG=ON"
154168 ];
155169
156170 doCheck = false; # Test fails
@@ -159,7 +173,7 @@ stdenv.mkDerivation rec {
159173 description = "Sound editor with graphical UI";
160174 homepage = "https://www.audacityteam.org/";
161175 license = licenses.gpl2Plus;
162− maintainers = with maintainers; [ lheckemann ];
163− platforms = platforms.linux;
176+ maintainers = with maintainers; [ lheckemann veprbl ];
177+ platforms = platforms.unix;
164178 };
165179}
pkgs/development/libraries/audio/suil/default.nix+1−1
@@ -31,6 +31,6 @@ stdenv.mkDerivation rec {
3131 description = "A lightweight C library for loading and wrapping LV2 plugin UIs";
3232 license = licenses.mit;
3333 maintainers = with maintainers; [ goibhniu ];
34− platforms = platforms.linux;
34+ platforms = platforms.unix;
3535 };
3636}
pkgs/top-level/all-packages.nix+8−1
@@ -24192,7 +24192,14 @@ with pkgs;
2419224192
2419324193 audacity-gtk2 = callPackage ../applications/audio/audacity { wxGTK = wxGTK31-gtk2; };
2419424194 audacity-gtk3 = callPackage ../applications/audio/audacity { wxGTK = wxGTK31-gtk3; };
24195− audacity = audacity-gtk2;
24195+ audacity =
24196+ if stdenv.isDarwin then
24197+ callPackage ../applications/audio/audacity {
24198+ inherit (darwin.apple_sdk.frameworks) AppKit AudioToolbox AudioUnit Carbon Cocoa CoreAudio CoreAudioKit CoreServices;
24199+ suil = suil-qt5;
24200+ }
24201+ else
24202+ audacity-gtk2;
2419624203
2419724204 audio-recorder = callPackage ../applications/audio/audio-recorder { };
2419824205