diff --git a/gnu/local.mk b/gnu/local.mk index 54d1ac91c9..71ed39f34a 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -542,6 +542,7 @@ dist_patch_DATA = \ %D%/packages/patches/ath9k-htc-firmware-binutils.patch \ %D%/packages/patches/ath9k-htc-firmware-gcc.patch \ %D%/packages/patches/ath9k-htc-firmware-objcopy.patch \ + %D%/packages/patches/audacity-build-with-system-portaudio.patch \ %D%/packages/patches/automake-skip-amhello-tests.patch \ %D%/packages/patches/automake-regexp-syntax.patch \ %D%/packages/patches/automake-test-gzip-warning.patch \ diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm index ea57f96fe9..384010372f 100644 --- a/gnu/packages/audio.scm +++ b/gnu/packages/audio.scm @@ -82,6 +82,7 @@ #:use-module (gnu packages xorg) #:use-module (gnu packages maths) #:use-module (gnu packages multiprecision) + #:use-module (gnu packages music) #:use-module (srfi srfi-1)) (define-public alsa-modular-synth @@ -275,20 +276,42 @@ engineers, musicians, soundtrack editors and composers.") (define-public audacity (package (name "audacity") - (version "2.1.3") + (version "2.2.0") (source (origin (method url-fetch) (uri (string-append "https://github.com/audacity/audacity/archive" "/Audacity-" version ".tar.gz")) (sha256 - (base32 "11mx7gb4dbqrgfp7hm0154x3m76ddnmhf2675q5zkxn7jc5qfc6b")))) + (base32 "09xpr4bjnainz1xmc35v3qg3dadjr9wv8bmn1p4y91aqyihnhjry")) + (patches (search-patches "audacity-build-with-system-portaudio.patch")) + (modules '((guix build utils))) + (snippet + ;; Remove bundled libraries. + '(begin + (for-each + (lambda (dir) + (delete-file-recursively (string-append "lib-src/" dir))) + '("expat" "ffmpeg" "libflac" "libid3tag" "libmad" "libogg" + "libsndfile" "libsoxr" "libvamp" "libvorbis" "lv2" + "portaudio-v19" "portmidi" "soundtouch" "twolame" + ;; FIXME: these libraries have not been packaged yet: + ;; "libnyquist" + ;; "libscorealign" + ;; "libwidgetextra" + ;; "portburn" + ;; "portsmf" + ;; "portmixer" + + ;; FIXME: we have this library, but it differs in that the Slide + ;; class does not have a member "getInverseStretchedTime". + ;; "sbsms" + )) + #t)))) (build-system gnu-build-system) (inputs - ;; TODO: Add portSMF and libwidgetextra once they're packaged. In-tree - ;; versions shipping with Audacity are used for now. - `(("wxwidgets" ,wxwidgets-gtk2) - ("gtk" ,gtk+-2) + `(("wxwidgets" ,wxwidgets) + ("gtk" ,gtk+) ("alsa-lib" ,alsa-lib) ("jack" ,jack-1) ("expat" ,expat) @@ -297,7 +320,7 @@ engineers, musicians, soundtrack editors and composers.") ("flac" ,flac) ("libid3tag" ,libid3tag) ("libmad" ,libmad) - ("libsbsms" ,libsbsms) + ;;("libsbsms" ,libsbsms) ;bundled version is modified ("libsndfile" ,libsndfile) ("soundtouch" ,soundtouch) ("soxr" ,soxr) ;replaces libsamplerate @@ -305,8 +328,10 @@ engineers, musicians, soundtrack editors and composers.") ("vamp" ,vamp) ("libvorbis" ,libvorbis) ("lv2" ,lv2) - ("lilv" ,lilv) - ("portaudio" ,portaudio))) + ("lilv" ,lilv) ;for lv2 + ("suil" ,suil) ;for lv2 + ("portaudio" ,portaudio) + ("portmidi" ,portmidi))) (native-inputs `(("autoconf" ,autoconf) ("automake" ,automake) @@ -318,22 +343,55 @@ engineers, musicians, soundtrack editors and composers.") (arguments '(#:configure-flags (let ((libid3tag (assoc-ref %build-inputs "libid3tag")) - (libmad (assoc-ref %build-inputs "libmad"))) + (libmad (assoc-ref %build-inputs "libmad")) + (portmidi (assoc-ref %build-inputs "portmidi"))) (list ;; Loading FFmpeg dynamically is problematic. "--disable-dynamic-loading" - ;; libid3tag and libmad provide no .pc files, so pkg-config fails to - ;; find them. Force their inclusion. + ;; portmidi, libid3tag and libmad provide no .pc files, so + ;; pkg-config fails to find them. Force their inclusion. (string-append "ID3TAG_CFLAGS=-I" libid3tag "/include") (string-append "ID3TAG_LIBS=-L" libid3tag "/lib -lid3tag -lz") (string-append "LIBMAD_CFLAGS=-I" libmad "/include") - (string-append "LIBMAD_LIBS=-L" libmad "/lib -lmad"))) + (string-append "LIBMAD_LIBS=-L" libmad "/lib -lmad") + (string-append "PORTMIDI_CFLAGS=-I" portmidi "/include") + (string-append "PORTMIDI_LIBS=-L" portmidi "/lib -lportmidi") + "EXPAT_USE_SYSTEM=yes" + "FFMPEG_USE_SYSTEM=yes" + "LAME_USE_SYSTEM=yes" + "LIBFLAC_USE_SYSTEM=yes" + "LIBID3TAG_USE_SYSTEM=yes" + "LIBMAD_USE_SYSTEM=yes" + "USE_LOCAL_LIBNYQUIST=" ;not packaged yet + ;;"LIBSBSMS_USE_SYSTEM=yes" ;bundled version is patched + "LIBSNDFILE_USE_SYSTEM=yes" + "LIBSOUNDTOUCH_USE_SYSTEM=yes" + "LIBSOXR_USE_SYSTEM=yes" + "LIBTWOLAME_USE_SYSTEM=yes" + "LIBVAMP_USE_SYSTEM=yes" + "LIBVORBIS_USE_SYSTEM=yes" + "LV2_USE_SYSTEM=yes" + "PORTAUDIO_USE_SYSTEM=yes")) #:phases (modify-phases %standard-phases - ;; FFmpeg is only detected if autoreconf runs. - (add-after 'unpack 'autoreconf + (add-after 'unpack 'fix-sbsms-check (lambda _ - (zero? (system* "autoreconf" "-vfi"))))) + ;; This check is wrong: there is no 2.2.0 release; not even the + ;; bundled sources match this release string. + (substitute* '("m4/audacity_checklib_libsbsms.m4" + "configure") + (("sbsms >= 2.2.0") "sbsms >= 2.0.0")) + #t)) + (add-after 'unpack 'use-upstream-headers + (lambda* (#:key inputs #:allow-other-keys) + (substitute* '("src/NoteTrack.cpp" + "src/AudioIO.cpp" + "src/AudioIO.h") + (("../lib-src/portmidi/pm_common/portmidi.h") "portmidi.h") + (("../lib-src/portmidi/porttime/porttime.h") "porttime.h")) + (substitute* "src/prefs/MidiIOPrefs.cpp" + (("../../lib-src/portmidi/pm_common/portmidi.h") "portmidi.h")) + #t))) ;; The test suite is not "well exercised" according to the developers, ;; and fails with various errors. See ;; . diff --git a/gnu/packages/patches/audacity-build-with-system-portaudio.patch b/gnu/packages/patches/audacity-build-with-system-portaudio.patch new file mode 100644 index 0000000000..3b73a6c930 --- /dev/null +++ b/gnu/packages/patches/audacity-build-with-system-portaudio.patch @@ -0,0 +1,64 @@ +Downloaded from here: +https://sourceforge.net/p/audacity/mailman/message/36106562/ + +>From 5f9482a191359f2c477763a36d2c865c5f186602 Mon Sep 17 00:00:00 2001 +From: Antonio Ospite +Date: Tue, 7 Nov 2017 13:06:33 +0100 +Subject: [PATCH] Fix building against the system portaudio library + +Building against the system portaudio results in this error: + +./src/AudioIO.cpp:983: undefined reference to `PaUtil_GetTime' +audacity-AudioIO.o: In function `audacityAudioCallback(void const*, void*, +unsigned long, PaStreamCallbackTimeInfo const*, unsigned long, void*)': +./src/AudioIO.cpp:4630: undefined reference to `PaUtil_GetTime' +collect2: error: ld returned 1 exit status +Makefile:2349: recipe for target 'audacity' failed +make[3]: *** [audacity] Error 1 + +This is because PaUtil_GetTime is declared as a C symbol in pa_util.h +but is resolved as a C++ symbol at link time. + +Audacity fixes this in the local tree with this change: +https://github.com/audacity/audacity/commit/38fd97b8e26060332ab3e9e000a8882326a70ba7 + +However this is not general enough for the portaudio debian package. + +Since PaUtil_GetTime() is the only function causing problems, just copy +over the code where it's used. +--- + src/AudioIO.cpp | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +diff --git a/src/AudioIO.cpp b/src/AudioIO.cpp +index a78bd1cab..d5481838d 100644 +--- a/src/AudioIO.cpp ++++ b/src/AudioIO.cpp +@@ -452,8 +452,23 @@ writing audio. + #define ROUND(x) (int) ((x)+0.5) + //#include + #include "../lib-src/portmidi/pm_common/portmidi.h" +- #include "../lib-src/portaudio-v19/src/common/pa_util.h" + #include "NoteTrack.h" ++ ++PaTime PaUtil_GetTime( void ) ++{ ++#ifdef HAVE_MACH_ABSOLUTE_TIME ++ return mach_absolute_time() * machSecondsConversionScaler_; ++#elif defined(HAVE_CLOCK_GETTIME) ++ struct timespec tp; ++ clock_gettime(CLOCK_REALTIME, &tp); ++ return (PaTime)(tp.tv_sec + tp.tv_nsec * 1e-9); ++#else ++ struct timeval tv; ++ gettimeofday( &tv, NULL ); ++ return (PaTime) tv.tv_usec * 1e-6 + tv.tv_sec; ++#endif ++} ++ + #endif + + #ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT +-- +2.15.0 +