summary refs log tree commit diff
path: root/pkgs/applications/audio/audacity/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/audio/audacity/default.nix')
-rw-r--r--pkgs/applications/audio/audacity/default.nix168
1 files changed, 134 insertions, 34 deletions
diff --git a/pkgs/applications/audio/audacity/default.nix b/pkgs/applications/audio/audacity/default.nix
index 18f2b4f67cd..73a0cebd36b 100644
--- a/pkgs/applications/audio/audacity/default.nix
+++ b/pkgs/applications/audio/audacity/default.nix
@@ -1,37 +1,100 @@
-{ stdenv, fetchzip, wxGTK30, pkgconfig, file, gettext,
-  libvorbis, libmad, libjack2, lv2, lilv, serd, sord, sratom, suil, alsaLib, libsndfile, soxr, flac, lame,
-  expat, libid3tag, ffmpeg_3, soundtouch, /*, portaudio - given up fighting their portaudio.patch */
-  autoconf, automake, libtool
-  }:
+{ stdenv
+, lib
+, fetchFromGitHub
+, fetchpatch
+, cmake
+, wxGTK
+, pkg-config
+, python3
+, gettext
+, file
+, libvorbis
+, libmad
+, libjack2
+, lv2
+, lilv
+, serd
+, sord
+, sqlite
+, sratom
+, suil
+, alsa-lib
+, libsndfile
+, soxr
+, flac
+, twolame
+, expat
+, libid3tag
+, libopus
+, ffmpeg
+, soundtouch
+, pcre /*, portaudio - given up fighting their portaudio.patch */
+, linuxHeaders
+, at-spi2-core
+, dbus
+, epoxy
+, libXdmcp
+, libXtst
+, libpthreadstubs
+, libselinux
+, libsepol
+, libxkbcommon
+, util-linux
+}:
 
-with stdenv.lib;
+# TODO
+# 1. as of 3.0.2, GTK2 is still the recommended version ref https://www.audacityteam.org/download/source/ check if that changes in future versions
+# 2. detach sbsms
 
+let
+  inherit (lib) optionals;
+
+  wxGTK' = wxGTK.overrideAttrs (oldAttrs: rec {
+    src = fetchFromGitHub {
+      owner = "audacity";
+      repo = "wxWidgets";
+      rev = "07e7d832c7a337aedba3537b90b2c98c4d8e2985";
+      sha256 = "1mawnkcrmqj98jp0jxlnh9xkc950ca033ccb51c7035pzmi9if9a";
+      fetchSubmodules = true;
+    };
+  });
+
+in
 stdenv.mkDerivation rec {
-  version = "2.4.1";
   pname = "audacity";
+  # nixpkgs-update: no auto update
+  # Humans too! Let's wait to see how the situation with
+  # https://github.com/audacity/audacity/issues/1213 develops before
+  # pulling any updates that are subject to this privacy policy. We
+  # may wish to switch to a fork, but at the time of writing
+  # (2021-07-05) it's too early to tell how well any of the forks will
+  # be maintained.
+  version = "3.0.2";
 
-  src = fetchzip {
-    url = "https://github.com/audacity/audacity/archive/Audacity-${version}.tar.gz";
-    sha256 = "1xk0piv72d2xd3p7igr916fhcbrm76fhjr418k1rlqdzzg1hfljn";
+  src = fetchFromGitHub {
+    owner = "audacity";
+    repo = "audacity";
+    rev = "Audacity-${version}";
+    sha256 = "035qq2ff16cdl2cb9iply2bfjmhfl1dpscg79x6c9l0i9m8k41zj";
   };
 
-  preConfigure = /* we prefer system-wide libs */ ''
-    autoreconf -vi # use system libraries
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/audacity/audacity/pull/831/commits/007852e51fcbb5f1f359d112f28b8984a604dac6.patch";
+      sha256 = "0zp2iydd46analda9cfnbmzdkjphz5m7dynrdj5qdnmq6j3px9fw";
+      name = "audacity_xdg_paths.patch";
+    })
+  ];
 
-    # we will get a (possibly harmless) warning during configure without this
-    substituteInPlace configure \
-      --replace /usr/bin/file ${file}/bin/file
-  '';
+  postPatch = ''
+    touch src/RevisionIdent.h
 
-  configureFlags = [
-    "--with-libsamplerate"
-  ];
+    substituteInPlace src/FileNames.cpp \
+      --replace /usr/include/linux/magic.h ${linuxHeaders}/include/linux/magic.h
+  '';
 
-  # audacity only looks for lame and ffmpeg at runtime, so we need to link them in manually
+  # audacity only looks for ffmpeg at runtime, so we need to link it in manually
   NIX_LDFLAGS = toString [
-    # LAME
-    "-lmp3lame"
-    # ffmpeg
     "-lavcodec"
     "-lavdevice"
     "-lavfilter"
@@ -43,23 +106,60 @@ stdenv.mkDerivation rec {
     "-lswscale"
   ];
 
-  nativeBuildInputs = [ pkgconfig autoconf automake libtool ];
-  buildInputs = [
-    file gettext wxGTK30 expat alsaLib
-    libsndfile soxr libid3tag libjack2 lv2 lilv serd sord sratom suil wxGTK30.gtk
-    ffmpeg_3 libmad lame libvorbis flac soundtouch
-  ]; #ToDo: detach sbsms
+  nativeBuildInputs = [
+    cmake
+    gettext
+    pkg-config
+    python3
+  ] ++ optionals stdenv.isLinux [
+    linuxHeaders
+  ];
 
-  enableParallelBuilding = true;
+  buildInputs = [
+    alsa-lib
+    expat
+    ffmpeg
+    file
+    flac
+    libid3tag
+    libjack2
+    libmad
+    libopus
+    libsndfile
+    libvorbis
+    lilv
+    lv2
+    pcre
+    serd
+    sord
+    soundtouch
+    soxr
+    sqlite
+    sratom
+    suil
+    twolame
+    wxGTK'
+    wxGTK'.gtk
+  ] ++ optionals stdenv.isLinux [
+    at-spi2-core
+    dbus
+    epoxy
+    libXdmcp
+    libXtst
+    libpthreadstubs
+    libxkbcommon
+    libselinux
+    libsepol
+    util-linux
+  ];
 
-  dontDisableStatic = true;
   doCheck = false; # Test fails
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Sound editor with graphical UI";
-    homepage = "http://audacityteam.org/";
+    homepage = "https://www.audacityteam.org/";
     license = licenses.gpl2Plus;
     maintainers = with maintainers; [ lheckemann ];
-    platforms = intersectLists platforms.linux platforms.x86; # fails on ARM
+    platforms = platforms.linux;
   };
 }