From 126b5f5990ae4b4e47aa88c72cb7ecee126da3e8 Mon Sep 17 00:00:00 2001 From: Daniel Ethridge Date: Mon, 3 May 2021 14:40:20 -0400 Subject: [PATCH 1/3] Start drafting an update for audacity: 2.4.2 -> 3.0.2 The XGD-config patch is removed since it conflicts with the new version of audacity, as it was not merged upstream. Audacity now requires their own fork of wxWidgets, according to https://wiki.audacityteam.org/wiki/Building_On_Linux - this is the cause of current trouble since I am new to nix and unsure how to integrate it. I copied the current 3.1.4 nixpkgs version of wxWidgets found at pkgs/development/libraries/wxwidgets/3.1/default.nix and modified it to retrieve the forked version, but that's it so far. --- pkgs/applications/audio/audacity/default.nix | 24 +-- .../audio/audacity/wxWidgets-audacity.nix | 137 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 +- 3 files changed, 142 insertions(+), 23 deletions(-) create mode 100644 pkgs/applications/audio/audacity/wxWidgets-audacity.nix diff --git a/pkgs/applications/audio/audacity/default.nix b/pkgs/applications/audio/audacity/default.nix index 36320a01061..1ce0a44445b 100644 --- a/pkgs/applications/audio/audacity/default.nix +++ b/pkgs/applications/audio/audacity/default.nix @@ -1,9 +1,7 @@ { stdenv , lib , fetchFromGitHub -, fetchpatch , cmake -, wxGTK , pkg-config , python3 , gettext @@ -41,33 +39,20 @@ }: # TODO -# - as of 2.4.2, GTK2 is still the recommended version ref https://www.audacityteam.org/download/source/ check if that changes in future versions +# - 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 # - detach sbsms stdenv.mkDerivation rec { pname = "audacity"; - version = "2.4.2"; + version = "3.0.2"; src = fetchFromGitHub { owner = "audacity"; repo = "audacity"; rev = "Audacity-${version}"; - sha256 = "sha256-hpRTo5B0EMyzORopsNPOgv6mohBkwJfWfCLnPvFmdFI="; + sha256 = "035qq2ff16cdl2cb9iply2bfjmhfl1dpscg79x6c9l0i9m8k41zj"; }; - patches = [ - (fetchpatch { - url = "https://github.com/audacity/audacity/commit/a070b5d8a8ba10fb86edba6aeb8fdab0f66ba408.patch"; - sha256 = "sha256-8UZupGcN+/tytAhyy5T1P0nufvsQPeyLgOUMGt7l8Oc="; - name = "audacity_xdg_paths.patch"; - }) - ]; - - # this file *should* be generated by cmake but as of 2.4.2 isn't yet - postPatch = '' - touch src/RevisionIdent.h - ''; - # workaround for a broken cmake. Drop it with a later version to see if it works. # https://github.com/NixOS/nixpkgs/issues/94905 cmakeFlags = lib.optional stdenv.isLinux "-DCMAKE_OSX_ARCHITECTURES="; @@ -110,8 +95,7 @@ stdenv.mkDerivation rec { sratom suil twolame - wxGTK - wxGTK.gtk + import ./wxWidgets-audacity.nix {} ] ++ lib.optionals stdenv.isLinux [ at-spi2-core dbus diff --git a/pkgs/applications/audio/audacity/wxWidgets-audacity.nix b/pkgs/applications/audio/audacity/wxWidgets-audacity.nix new file mode 100644 index 00000000000..e593ba69eca --- /dev/null +++ b/pkgs/applications/audio/audacity/wxWidgets-audacity.nix @@ -0,0 +1,137 @@ +{ lib, stdenv +, fetchFromGitHub +, fetchurl +, pkg-config +, libXinerama +, libSM +, libXxf86vm +, libXtst +, gtk2 +, GConf ? null +, gtk3 +, xorgproto +, gst_all_1 +, setfile +, libGLSupported ? lib.elem stdenv.hostPlatform.system lib.platforms.mesaPlatforms +, withMesa ? libGLSupported +, libGLU ? null +, libGL ? null +, compat28 ? false +, compat30 ? true +, unicode ? true +, withGtk2 ? true +, withWebKit ? false +, webkitgtk ? null +, AGL ? null +, Carbon ? null +, Cocoa ? null +, Kernel ? null +, QTKit ? null +}: + +with lib; + +assert withMesa -> libGLU != null && libGL != null; +assert withWebKit -> webkitgtk != null; + +assert assertMsg (withGtk2 -> withWebKit == false) "wxGTK31: You cannot enable withWebKit when using withGtk2."; + +stdenv.mkDerivation rec { + version = "3.1.3"; + pname = "wxwidgets"; + + src = fetchFromGitHub { + owner = "audacity"; + repo = "wxWidgets"; + rev = "07e7d832c7a337aedba3537b90b2c98c4d8e2985"; + sha256 = "1mawnkcrmqj98jp0jxlnh9xkc950ca033ccb51c7035pzmi9if9a"; + fetchSubmodules = true; + }; + + buildInputs = [ + libXinerama + libSM + libXxf86vm + libXtst + xorgproto + gst_all_1.gstreamer + gst_all_1.gst-plugins-base + ] ++ optionals withGtk2 [ gtk2 GConf ] + ++ optional (!withGtk2) gtk3 + ++ optional withMesa libGLU + ++ optional withWebKit webkitgtk + ++ optionals stdenv.isDarwin [ setfile Carbon Cocoa Kernel QTKit ]; + + nativeBuildInputs = [ pkg-config ]; + + propagatedBuildInputs = optional stdenv.isDarwin AGL; + + patches = [ + (fetchurl { + # https://trac.wxwidgets.org/ticket/17942 + url = "https://trac.wxwidgets.org/raw-attachment/ticket/17942/" + + "fix_assertion_using_hide_in_destroy.diff"; + sha256 = "009y3dav79wiig789vkkc07g1qdqprg1544lih79199kb1h64lvy"; + }) + ]; + + configureFlags = + [ + "--disable-precomp-headers" + "--enable-mediactrl" + (if compat28 then "--enable-compat28" else "--disable-compat28") + (if compat30 then "--enable-compat30" else "--disable-compat30") + ] + ++ optional unicode "--enable-unicode" + ++ optional withMesa "--with-opengl" + ++ optionals stdenv.isDarwin + # allow building on 64-bit + [ "--with-cocoa" "--enable-universal-binaries" "--with-macosx-version-min=10.7" ] + ++ optionals withWebKit + [ "--enable-webview" "--enable-webviewwebkit" ]; + + SEARCH_LIB = "${libGLU.out}/lib ${libGL.out}/lib "; + + preConfigure = " + substituteInPlace configure --replace 'SEARCH_INCLUDE=' 'DUMMY_SEARCH_INCLUDE=' + substituteInPlace configure --replace 'SEARCH_LIB=' 'DUMMY_SEARCH_LIB=' + substituteInPlace configure --replace /usr /no-such-path + " + optionalString stdenv.isDarwin '' + substituteInPlace configure --replace \ + 'ac_cv_prog_SETFILE="/Developer/Tools/SetFile"' \ + 'ac_cv_prog_SETFILE="${setfile}/bin/SetFile"' + substituteInPlace configure --replace \ + "-framework System" \ + -lSystem + ''; + + postInstall = " + (cd $out/include && ln -s wx-*/* .) + "; + + passthru = { + inherit compat28 compat30 unicode; + gtk = if withGtk2 then gtk2 else gtk3; + }; + + enableParallelBuilding = true; + + meta = { + platforms = with platforms; darwin ++ linux; + license = licenses.wxWindows; + homepage = "https://www.wxwidgets.org/"; + description = "A C++ library that lets developers create applications for Windows, macOS, Linux and other platforms with a single code base"; + longDescription = '' + WxWidgets gives you a single, easy-to-use API for + writing GUI applications on multiple platforms that still utilize the + native platform's controls and utilities. Link with the appropriate library + for your platform and compiler, and your application will adopt the look + and feel appropriate to that platform. On top of great GUI functionality, + wxWidgets gives you: online help, network programming, streams, clipboard + and drag and drop, multithreading, image loading and saving in a variety of + popular formats, database support, HTML viewing and printing, and much + more. + ''; + badPlatforms = [ "x86_64-darwin" ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a9f24ab1d51..8b86a1ddf2d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22152,9 +22152,7 @@ in audacious = libsForQt5.callPackage ../applications/audio/audacious { }; audaciousQt5 = audacious; - audacity-gtk2 = callPackage ../applications/audio/audacity { wxGTK = wxGTK31-gtk2; }; - audacity-gtk3 = callPackage ../applications/audio/audacity { wxGTK = wxGTK31-gtk3; }; - audacity = audacity-gtk2; + audacity = callPackage ../applications/audio/audacity { }; audio-recorder = callPackage ../applications/audio/audio-recorder { }; From d1605b45386de4649e959a1322adf3c14971e3b9 Mon Sep 17 00:00:00 2001 From: Daniel Ethridge Date: Mon, 3 May 2021 22:06:51 -0400 Subject: [PATCH 2/3] Add back an updated version of the XDG-config paths patch --- pkgs/applications/audio/audacity/default.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkgs/applications/audio/audacity/default.nix b/pkgs/applications/audio/audacity/default.nix index 1ce0a44445b..d8db58e6d36 100644 --- a/pkgs/applications/audio/audacity/default.nix +++ b/pkgs/applications/audio/audacity/default.nix @@ -1,6 +1,7 @@ { stdenv , lib , fetchFromGitHub +, fetchpatch , cmake , pkg-config , python3 @@ -53,6 +54,19 @@ stdenv.mkDerivation rec { sha256 = "035qq2ff16cdl2cb9iply2bfjmhfl1dpscg79x6c9l0i9m8k41zj"; }; + patches = [ + (fetchpatch { + url = "https://github.com/audacity/audacity/commit/007852e51fcbb5f1f359d112f28b8984a604dac6.patch"; + sha256 = "1ajwp0zq725qp5v98av0g9z05w153vdrk69f61aq2qa73g7p1fnz"; + name = "audacity_xdg_paths.patch"; + }) + ]; + + # this file *should* be generated by cmake but as of 2.4.2 isn't yet + postPatch = '' + touch src/RevisionIdent.h + ''; + # workaround for a broken cmake. Drop it with a later version to see if it works. # https://github.com/NixOS/nixpkgs/issues/94905 cmakeFlags = lib.optional stdenv.isLinux "-DCMAKE_OSX_ARCHITECTURES="; From 49cfef8c69136295542dfa470aa8bdbf2f29ddef Mon Sep 17 00:00:00 2001 From: Daniel Ethridge Date: Mon, 3 May 2021 23:00:47 -0400 Subject: [PATCH 3/3] Switch to the simple patching of wxWidgets approach --- pkgs/applications/audio/audacity/default.nix | 31 +++- .../audio/audacity/wxWidgets-audacity.nix | 137 ------------------ pkgs/top-level/all-packages.nix | 2 +- 3 files changed, 29 insertions(+), 141 deletions(-) delete mode 100644 pkgs/applications/audio/audacity/wxWidgets-audacity.nix diff --git a/pkgs/applications/audio/audacity/default.nix b/pkgs/applications/audio/audacity/default.nix index d8db58e6d36..1bbed0613c8 100644 --- a/pkgs/applications/audio/audacity/default.nix +++ b/pkgs/applications/audio/audacity/default.nix @@ -3,6 +3,7 @@ , fetchFromGitHub , fetchpatch , cmake +, wxGTK , pkg-config , python3 , gettext @@ -27,6 +28,7 @@ , ffmpeg , soundtouch , pcre /*, portaudio - given up fighting their portaudio.patch */ +, linuxHeaders , at-spi2-core ? null , dbus ? null , epoxy ? null @@ -43,6 +45,17 @@ # - 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 # - detach sbsms +let + wxGTK-audacity = wxGTK.overrideAttrs (oldAttrs: rec { + src = fetchFromGitHub { + owner = "audacity"; + repo = "wxWidgets"; + rev = "07e7d832c7a337aedba3537b90b2c98c4d8e2985"; + sha256 = "1mawnkcrmqj98jp0jxlnh9xkc950ca033ccb51c7035pzmi9if9a"; + fetchSubmodules = true; + }; + }); +in stdenv.mkDerivation rec { pname = "audacity"; version = "3.0.2"; @@ -57,7 +70,7 @@ stdenv.mkDerivation rec { patches = [ (fetchpatch { url = "https://github.com/audacity/audacity/commit/007852e51fcbb5f1f359d112f28b8984a604dac6.patch"; - sha256 = "1ajwp0zq725qp5v98av0g9z05w153vdrk69f61aq2qa73g7p1fnz"; + sha256 = "0zp2iydd46analda9cfnbmzdkjphz5m7dynrdj5qdnmq6j3px9fw"; name = "audacity_xdg_paths.patch"; }) ]; @@ -67,6 +80,10 @@ stdenv.mkDerivation rec { touch src/RevisionIdent.h ''; + preConfigure = '' + substituteInPlace src/FileNames.cpp --replace /usr/include/linux/magic.h ${linuxHeaders}/include/linux/magic.h + ''; + # workaround for a broken cmake. Drop it with a later version to see if it works. # https://github.com/NixOS/nixpkgs/issues/94905 cmakeFlags = lib.optional stdenv.isLinux "-DCMAKE_OSX_ARCHITECTURES="; @@ -85,7 +102,14 @@ stdenv.mkDerivation rec { "-lswscale" ]; - nativeBuildInputs = [ cmake gettext pkg-config python3 ]; + nativeBuildInputs = [ + cmake + gettext + pkg-config + python3 + ] ++ lib.optionals stdenv.isLinux [ + linuxHeaders + ]; buildInputs = [ alsaLib @@ -109,7 +133,8 @@ stdenv.mkDerivation rec { sratom suil twolame - import ./wxWidgets-audacity.nix {} + wxGTK-audacity + wxGTK-audacity.gtk ] ++ lib.optionals stdenv.isLinux [ at-spi2-core dbus diff --git a/pkgs/applications/audio/audacity/wxWidgets-audacity.nix b/pkgs/applications/audio/audacity/wxWidgets-audacity.nix deleted file mode 100644 index e593ba69eca..00000000000 --- a/pkgs/applications/audio/audacity/wxWidgets-audacity.nix +++ /dev/null @@ -1,137 +0,0 @@ -{ lib, stdenv -, fetchFromGitHub -, fetchurl -, pkg-config -, libXinerama -, libSM -, libXxf86vm -, libXtst -, gtk2 -, GConf ? null -, gtk3 -, xorgproto -, gst_all_1 -, setfile -, libGLSupported ? lib.elem stdenv.hostPlatform.system lib.platforms.mesaPlatforms -, withMesa ? libGLSupported -, libGLU ? null -, libGL ? null -, compat28 ? false -, compat30 ? true -, unicode ? true -, withGtk2 ? true -, withWebKit ? false -, webkitgtk ? null -, AGL ? null -, Carbon ? null -, Cocoa ? null -, Kernel ? null -, QTKit ? null -}: - -with lib; - -assert withMesa -> libGLU != null && libGL != null; -assert withWebKit -> webkitgtk != null; - -assert assertMsg (withGtk2 -> withWebKit == false) "wxGTK31: You cannot enable withWebKit when using withGtk2."; - -stdenv.mkDerivation rec { - version = "3.1.3"; - pname = "wxwidgets"; - - src = fetchFromGitHub { - owner = "audacity"; - repo = "wxWidgets"; - rev = "07e7d832c7a337aedba3537b90b2c98c4d8e2985"; - sha256 = "1mawnkcrmqj98jp0jxlnh9xkc950ca033ccb51c7035pzmi9if9a"; - fetchSubmodules = true; - }; - - buildInputs = [ - libXinerama - libSM - libXxf86vm - libXtst - xorgproto - gst_all_1.gstreamer - gst_all_1.gst-plugins-base - ] ++ optionals withGtk2 [ gtk2 GConf ] - ++ optional (!withGtk2) gtk3 - ++ optional withMesa libGLU - ++ optional withWebKit webkitgtk - ++ optionals stdenv.isDarwin [ setfile Carbon Cocoa Kernel QTKit ]; - - nativeBuildInputs = [ pkg-config ]; - - propagatedBuildInputs = optional stdenv.isDarwin AGL; - - patches = [ - (fetchurl { - # https://trac.wxwidgets.org/ticket/17942 - url = "https://trac.wxwidgets.org/raw-attachment/ticket/17942/" - + "fix_assertion_using_hide_in_destroy.diff"; - sha256 = "009y3dav79wiig789vkkc07g1qdqprg1544lih79199kb1h64lvy"; - }) - ]; - - configureFlags = - [ - "--disable-precomp-headers" - "--enable-mediactrl" - (if compat28 then "--enable-compat28" else "--disable-compat28") - (if compat30 then "--enable-compat30" else "--disable-compat30") - ] - ++ optional unicode "--enable-unicode" - ++ optional withMesa "--with-opengl" - ++ optionals stdenv.isDarwin - # allow building on 64-bit - [ "--with-cocoa" "--enable-universal-binaries" "--with-macosx-version-min=10.7" ] - ++ optionals withWebKit - [ "--enable-webview" "--enable-webviewwebkit" ]; - - SEARCH_LIB = "${libGLU.out}/lib ${libGL.out}/lib "; - - preConfigure = " - substituteInPlace configure --replace 'SEARCH_INCLUDE=' 'DUMMY_SEARCH_INCLUDE=' - substituteInPlace configure --replace 'SEARCH_LIB=' 'DUMMY_SEARCH_LIB=' - substituteInPlace configure --replace /usr /no-such-path - " + optionalString stdenv.isDarwin '' - substituteInPlace configure --replace \ - 'ac_cv_prog_SETFILE="/Developer/Tools/SetFile"' \ - 'ac_cv_prog_SETFILE="${setfile}/bin/SetFile"' - substituteInPlace configure --replace \ - "-framework System" \ - -lSystem - ''; - - postInstall = " - (cd $out/include && ln -s wx-*/* .) - "; - - passthru = { - inherit compat28 compat30 unicode; - gtk = if withGtk2 then gtk2 else gtk3; - }; - - enableParallelBuilding = true; - - meta = { - platforms = with platforms; darwin ++ linux; - license = licenses.wxWindows; - homepage = "https://www.wxwidgets.org/"; - description = "A C++ library that lets developers create applications for Windows, macOS, Linux and other platforms with a single code base"; - longDescription = '' - WxWidgets gives you a single, easy-to-use API for - writing GUI applications on multiple platforms that still utilize the - native platform's controls and utilities. Link with the appropriate library - for your platform and compiler, and your application will adopt the look - and feel appropriate to that platform. On top of great GUI functionality, - wxWidgets gives you: online help, network programming, streams, clipboard - and drag and drop, multithreading, image loading and saving in a variety of - popular formats, database support, HTML viewing and printing, and much - more. - ''; - badPlatforms = [ "x86_64-darwin" ]; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8b86a1ddf2d..8e436653ba8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22152,7 +22152,7 @@ in audacious = libsForQt5.callPackage ../applications/audio/audacious { }; audaciousQt5 = audacious; - audacity = callPackage ../applications/audio/audacity { }; + audacity = callPackage ../applications/audio/audacity { wxGTK = wxGTK31-gtk2; }; audio-recorder = callPackage ../applications/audio/audio-recorder { };