evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / by-name / au / audacity / package.nix
blob050ace8c708abdca5d7dbc9349cd185761feb9f2
2   stdenv,
3   lib,
4   fetchFromGitHub,
5   cmake,
6   makeWrapper,
7   wrapGAppsHook3,
8   pkg-config,
9   python3,
10   gettext,
11   file,
12   libvorbis,
13   libmad,
14   libjack2,
15   lv2,
16   lilv,
17   mpg123,
18   opusfile,
19   rapidjson,
20   serd,
21   sord,
22   sqlite,
23   sratom,
24   suil,
25   libsndfile,
26   soxr,
27   flac,
28   lame,
29   twolame,
30   expat,
31   libid3tag,
32   libopus,
33   libuuid,
34   ffmpeg,
35   soundtouch,
36   pcre,
37   portaudio, # given up fighting their portaudio.patch?
38   portmidi,
39   linuxHeaders,
40   alsa-lib,
41   at-spi2-core,
42   dbus,
43   libepoxy,
44   libXdmcp,
45   libXtst,
46   libpthreadstubs,
47   libsbsms_2_3_0,
48   libselinux,
49   libsepol,
50   libxkbcommon,
51   util-linux,
52   wavpack,
53   wxGTK32,
54   gtk3,
55   apple-sdk_11,
56   libpng,
57   libjpeg,
60 # TODO
61 # 1. detach sbsms
63 stdenv.mkDerivation (finalAttrs: {
64   pname = "audacity";
65   version = "3.7.0";
67   src = fetchFromGitHub {
68     owner = "audacity";
69     repo = "audacity";
70     rev = "Audacity-${finalAttrs.version}";
71     hash = "sha256-jwsn/L9e1ViWLOh8Xc4lTS9FhanD4GK0BllCwtPamZc=";
72   };
74   postPatch =
75     ''
76       mkdir src/private
77       substituteInPlace scripts/build/macOS/fix_bundle.py \
78         --replace-fail "path.startswith('/usr/lib/')" "path.startswith('${builtins.storeDir}')"
79     ''
80     + lib.optionalString stdenv.hostPlatform.isLinux ''
81       substituteInPlace libraries/lib-files/FileNames.cpp \
82         --replace-fail /usr/include/linux/magic.h ${linuxHeaders}/include/linux/magic.h
83     '';
85   nativeBuildInputs =
86     [
87       cmake
88       gettext
89       pkg-config
90       python3
91       makeWrapper
92       wrapGAppsHook3
93     ]
94     ++ lib.optionals stdenv.hostPlatform.isLinux [
95       linuxHeaders
96     ];
98   buildInputs =
99     [
100       expat
101       ffmpeg
102       file
103       flac
104       gtk3
105       lame
106       libid3tag
107       libjack2
108       libmad
109       libopus
110       libsbsms_2_3_0
111       libsndfile
112       libvorbis
113       lilv
114       lv2
115       mpg123
116       opusfile
117       pcre
118       portmidi
119       rapidjson
120       serd
121       sord
122       soundtouch
123       soxr
124       sqlite
125       sratom
126       suil
127       twolame
128       portaudio
129       wavpack
130       wxGTK32
131     ]
132     ++ lib.optionals stdenv.hostPlatform.isLinux [
133       alsa-lib # for portaudio
134       at-spi2-core
135       dbus
136       libepoxy
137       libXdmcp
138       libXtst
139       libpthreadstubs
140       libxkbcommon
141       libselinux
142       libsepol
143       libuuid
144       util-linux
145     ]
146     ++ lib.optionals stdenv.hostPlatform.isDarwin [
147       apple-sdk_11
148       libpng
149       libjpeg
150     ];
152   cmakeFlags = [
153     "-DAUDACITY_BUILD_LEVEL=2"
154     "-DAUDACITY_REV_LONG=nixpkgs"
155     "-DAUDACITY_REV_TIME=nixpkgs"
156     "-DDISABLE_DYNAMIC_LOADING_FFMPEG=ON"
157     "-Daudacity_conan_enabled=Off"
158     "-Daudacity_use_ffmpeg=loaded"
159     "-Daudacity_has_vst3=Off"
160     "-Daudacity_has_crashreports=Off"
162     # RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/
163     "-DCMAKE_SKIP_BUILD_RPATH=ON"
165     # Fix duplicate store paths
166     "-DCMAKE_INSTALL_LIBDIR=lib"
167   ];
169   # [ 57%] Generating LightThemeAsCeeCode.h...
170   # ../../utils/image-compiler: error while loading shared libraries:
171   # lib-theme.so: cannot open shared object file: No such file or directory
172   preBuild = ''
173     export LD_LIBRARY_PATH=$PWD/Release/lib/audacity
174   '';
176   doCheck = false; # Test fails
178   dontWrapGApps = true;
180   # Replace audacity's wrapper, to:
181   # - put it in the right place, it shouldn't be in "$out/audacity"
182   # - Add the ffmpeg dynamic dependency
183   postFixup =
184     lib.optionalString stdenv.hostPlatform.isLinux ''
185       wrapProgram "$out/bin/audacity" \
186         "''${gappsWrapperArgs[@]}" \
187         --prefix LD_LIBRARY_PATH : "$out/lib/audacity":${lib.makeLibraryPath [ ffmpeg ]} \
188         --suffix AUDACITY_MODULES_PATH : "$out/lib/audacity/modules" \
189         --suffix AUDACITY_PATH : "$out/share/audacity"
190     ''
191     + lib.optionalString stdenv.hostPlatform.isDarwin ''
192       mkdir -p $out/{Applications,bin}
193       mv $out/Audacity.app $out/Applications/
194       makeWrapper $out/Applications/Audacity.app/Contents/MacOS/Audacity $out/bin/audacity
195     '';
197   meta = {
198     description = "Sound editor with graphical UI";
199     mainProgram = "audacity";
200     homepage = "https://www.audacityteam.org";
201     changelog = "https://github.com/audacity/audacity/releases";
202     license = with lib.licenses; [
203       gpl2Plus
204       # Must be GPL3 when building with "technologies that require it,
205       # such as the VST3 audio plugin interface".
206       # https://github.com/audacity/audacity/discussions/2142.
207       gpl3
208       # Documentation.
209       cc-by-30
210     ];
211     maintainers = with lib.maintainers; [
212       veprbl
213       wegank
214     ];
215     platforms = lib.platforms.unix;
216   };