Subject: [PATCH 1/6] gnu: audacity: Move into new module to break cycles.

From: Maxime Devos <[email-masked]>
Date: Wed, 23 Mar 2022 18:48:50 +0000

Currently, there's a cycle between ncurses, linux, audio and music.
By moving audacity to its own module, 'audio' does not have to import
'music' and 'linux' anymore.  Looking at the output of
"guix graph --type=module", there still appears to be cycles, so
this commit will not sufficient by itself.

* gnu/packages/audio.scm (audacity): Move to ...
* gnu/packages/audacity.scm: This new module.  Remove unneeded imports
  from the old module.  Add a few comments to the old module to discourage
  re-importing the 'linux' and 'music' module in the future.
* gnu/local.mk (GNU_SYSTEM_MODULES): Register new module.
---
 gnu/local.mk           |   1 +
 gnu/packages/audio.scm | 140 ++---------------------------------------
 2 files changed, 5 insertions(+), 136 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index ad39e648f7..aab22d32d4 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -112,6 +112,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/assembly.scm			\
   %D%/packages/astronomy.scm			\
   %D%/packages/attr.scm				\
+  %D%/packages/audacity.scm			\
   %D%/packages/audio.scm			\
   %D%/packages/augeas.scm			\
   %D%/packages/authentication.scm		\
diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 13e0f02837..d74f8de1ab 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -90,14 +90,16 @@
   #:use-module (gnu packages libbsd)
   #:use-module (gnu packages libffi)
   #:use-module (gnu packages libusb)
-  #:use-module (gnu packages linux)
   #:use-module (gnu packages llvm)
+  ;; Don't import that module here, otherwise a cycle would result.
+  ;; #:use-module (gnu packages linux)
   #:use-module (gnu packages machine-learning)
   #:use-module (gnu packages man)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mp3) ;taglib
   #:use-module (gnu packages multiprecision)
-  #:use-module (gnu packages music)
+  ;; Don't import that module here, otherwise a cycle would result.
+  ;; #:use-module (gnu packages music)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages onc-rpc)
@@ -122,7 +124,6 @@
   #:use-module (gnu packages vim) ;xxd
   #:use-module (gnu packages web)
   #:use-module (gnu packages webkit)
-  #:use-module (gnu packages wxwidgets)
   #:use-module (gnu packages xiph)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
@@ -761,139 +762,6 @@ record, edit, mix and master audio and MIDI projects.  It is targeted at audio
 engineers, musicians, soundtrack editors and composers.")
     (license license:gpl2+)))
 
-(define-public audacity
-  (package
-    (name "audacity")
-    (version "3.1.3")
-    (source
-     (origin
-       ;; If built from the release tag, Audacity will describe itself
-       ;; as an "Alpha test version" and suggest to users that they use
-       ;; the "latest stable released version".
-       (method url-fetch)
-       (uri (string-append "https://github.com/audacity/audacity/releases/download/"
-                           "Audacity-" version "/audacity-" version
-                           "-source.tar.gz"))
-       (sha256
-        (base32
-         "189agx11361k9j958s6q5bngnnfx0rwaf0dwbjxy6fwvsb1wv3px"))
-       (patches (search-patches "audacity-ffmpeg-fallback.patch"))
-       (modules '((guix build utils)))
-       (snippet
-        ;; Remove bundled libraries.
-        '(begin
-           (for-each
-            (lambda (dir)
-              (delete-file-recursively (string-append "lib-src/" dir)))
-            '("libsoxr" "libvamp" "lv2" "soundtouch" "sqlite" "twolame"
-              ;; FIXME: these libraries have not been packaged yet:
-              ;; "libnyquist"
-              ;; "libscorealign"
-              ;; "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 cmake-build-system)
-    (inputs
-     (list wxwidgets-3.1
-           gtk+
-           alsa-lib
-           jack-1
-           expat
-           lame
-           linux-libre-headers
-           flac
-           ffmpeg
-           libid3tag
-           libjpeg-turbo
-           libmad
-           ;;("libsbsms" ,libsbsms)         ;bundled version is modified
-           libsndfile
-           soundtouch
-           soxr ;replaces libsamplerate
-           sqlite
-           twolame
-           vamp
-           libvorbis
-           lv2
-           lilv ;for lv2
-           suil ;for lv2
-           portaudio
-           portmidi))
-    (native-inputs
-     `(("autoconf" ,autoconf)
-       ("automake" ,automake)
-       ("gettext" ,gettext-minimal)     ;for msgfmt
-       ("libtool" ,libtool)
-       ("pkg-config" ,pkg-config)
-       ("python" ,python)
-       ("which" ,which)))
-    (arguments
-     `(#:configure-flags
-       (list
-        "-Daudacity_conan_enabled=off"
-        "-Daudacity_lib_preference=system"
-        ;; TODO: enable this flag once we've packaged all dependencies
-        ;; "-Daudacity_obey_system_dependencies=on"
-        ;; disable crash reports, updates, ..., anything that phones home
-        "-Daudacity_has_networking=off")
-       #:imported-modules ((guix build glib-or-gtk-build-system)
-                           ,@%cmake-build-system-modules)
-       #:modules
-       ((guix build utils)
-        (guix build cmake-build-system)
-        ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:))
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'fix-cmake-rpath
-           (lambda* (#:key outputs #:allow-other-keys)
-             (substitute* "CMakeLists.txt"
-               (("\\$ORIGIN/\\.\\./\\$\\{_PKGLIB\\}")
-                (string-append (assoc-ref outputs "out") "/lib/audacity"))
-               (("CMAKE_BUILD_WITH_INSTALL_RPATH [A-Z]*")
-                "CMAKE_BUILD_WITH_INSTALL_RPATH TRUE")
-               (("CMAKE_INSTALL_RPATH_USE_LINK_PATH [A-Z]*")
-                "CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE"))
-             (substitute* "src/CMakeLists.txt"
-               (("-Wl,--disable-new-dtags") "-Wl,--enable-new-dtags"))))
-         (add-after 'unpack 'comment-out-revision-ident
-           (lambda _
-             (substitute* "src/CMakeLists.txt"
-               (("file\\( TOUCH \".*RevisionIdent\\.h\" \\)" directive)
-                (string-append "# " directive)))
-             (substitute* "src/AboutDialog.cpp"
-               (("(.*RevisionIdent\\.h.*)" include-line)
-                (string-append "// " include-line)))))
-         (add-after 'unpack 'use-upstream-headers
-           (lambda* (#:key inputs #:allow-other-keys)
-             (substitute* '("libraries/lib-files/FileNames.cpp")
-               (("\"/usr/include/linux/magic.h\"") "<linux/magic.h>"))))
-         (add-after 'wrap-program 'glib-or-gtk-wrap
-           (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))
-       ;; The test suite is not "well exercised" according to the developers,
-       ;; and fails with various errors.  See
-       ;; <http://sourceforge.net/p/audacity/mailman/message/33524292/>.
-       #:tests? #f))
-    (native-search-paths
-     (list (search-path-specification
-            (variable "AUDACITY_MODULES_PATH")
-            (files '("lib/audacity/modules")))
-           (search-path-specification
-            (variable "AUDACITY_PATH")
-            (files '("share/audacity")))))
-    (home-page "https://www.audacityteam.org/")
-    (synopsis "Software for recording and editing sounds")
-    (description
-     "Audacity is a multi-track audio editor designed for recording, playing
-and editing digital audio.  It features digital effects and spectrum analysis
-tools.")
-    (license license:gpl2+)))
-
 (define-public audiofile
   (package
     (name "audiofile")

base-commit: 9a31942cabb5c73174aee96ecd873fcf89955a9d
prerequisite-patch-id: f64e340873270246660f566eabe4af5e20ede85f
-- 
2.30.2