Switch to the simple patching of wxWidgets approach

This commit is contained in:
Daniel Ethridge 2021-05-03 23:00:47 -04:00
parent d1605b4538
commit 49cfef8c69
3 changed files with 29 additions and 141 deletions

View file

@ -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

View file

@ -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" ];
};
}

View file

@ -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 { };