diff mbox series

[bug#56668] gnu: Add wavbreaker

Message ID 714ebc67b8a09e7f37fdd51c1e83c018@posteo.net
State Accepted
Headers show
Series [bug#56668] gnu: Add wavbreaker | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Joeke de Graaf July 27, 2022, 11:43 p.m. UTC
I've modified my patch to make wavbreaker work in pure environments.

The only thing I haven't been able to fix is the program's own icon in 
Gnome's activity overview (the overview of open programs one gets when 
one presses the super key).
If wavbreaker is run in a pure environment, this icon does not show up. 
Otherwise, the program seems to run fine.


Best regards,

Joeke de Graaf
diff mbox series

Patch

diff --git a/gnu/packages/mp3.scm b/gnu/packages/mp3.scm
index 4a8bdad711..35343a80d4 100644
--- a/gnu/packages/mp3.scm
+++ b/gnu/packages/mp3.scm
@@ -10,6 +10,7 @@ 
 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
 ;;; Copyright © 2021 Simon Streit <simon@netpanic.org>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2022 Joeke de Graaf <joeke@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -50,13 +51,17 @@  (define-module (gnu packages mp3)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages linux)               ;alsa-lib
   #:use-module (gnu packages video)               ;ffmpeg
+  #:use-module (gnu packages cmake)
+  #:use-module (gnu packages bash)
+  #:use-module (gnu packages gnome)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
-  #:use-module (guix build-system cmake))
+  #:use-module (guix build-system cmake)
+  #:use-module (guix build-system-meson))
 
 (define-public libmad
   (package
@@ -710,3 +715,61 @@  (define-public python-pytaglib
 cross-platform, works with all Python versions, and is very
 simple to use yet fully featured.")
     (license license:gpl3)))
+
+(define-public wavbreaker
+  (package
+    (name "wavbreaker")
+    (version "0.15")
+    (source (origin
+	      (method git-fetch)
+	      (uri (git-reference
+		    (url "https://github.com/thp/wavbreaker/")
+		    (commit version)))
+	      (file-name (git-file-name name version))
+	      (sha256
+	       (base32 "16h0sfcb8av6a368giizzwv9m0lq5c3bnf4b9vyyh9nkbbsc7c3j"))))
+    (build-system meson-build-system)
+    (native-inputs
+     (list pkg-config cmake))
+    (arguments
+     '(#:modules
+       ((guix build utils)
+	(guix build meson-build-system))
+
+       #:phases
+       (modify-phases %standard-phases
+	 (add-after 'install 'wrap-program
+	   ;; This wrapping is necessary to make wavbreaker find things it needs in pure environments
+	   (lambda* (#:key inputs outputs #:allow-other-keys)
+	     (let ((out (assoc-ref outputs "out"))
+		   (adwaita-icons (assoc-ref inputs "adwaita-icon-theme"))
+		   (hicolor-icons (assoc-ref inputs "hicolor-icon-theme"))
+		   (shared-mime (assoc-ref inputs "shared-mime-info")))
+	       (wrap-program (string-append out "/bin/wavbreaker")
+		 ;; Needed in order for wavbreakere to find the icons it needs
+		 `("XDG_DATA_DIRS" ":" prefix ,(map (lambda (package)
+                                                      (string-append package
+                                                                     "/share"))
+                                                    `(,out ;; For wavbreaker's icon
+                                                      ,adwaita-icons
+                                                      ,hicolor-icons
+                                                      ,shared-mime)))
+		 ;; This is necessary to load some pixbufs like Adwaita's check-symbolic.svg
+		 ;; and wavbreaker's own logo in the 'about' section
+		 `("GDK_PIXBUF_MODULE_FILE" =
+		   (,(getenv "GDK_PIXBUF_MODULE_FILE")))
+		 ;; Needed for GTK's file chooser to not crash
+		 `("GSETTINGS_SCHEMA_DIR" =
+                 (,(string-append (assoc-ref inputs "gtk+")
+                                  "/share/glib-2.0/schemas"))))))))))
+    (inputs (list glib gtk+ ao bash-minimal adwaita-icon-theme shared-mime-info hicolor-icon-theme gsettings-desktop-schemas))
+    (home-page "https://wavbreaker.sourceforge.io/")
+    (synopsis "WAV and MP3 file splitter with a GUI")
+    (description
+     "Wavbreaker is a WAV and MP3 file splitter.  It can be used to
+  break up a WAV or MP3 audio file into multiple WAV files.
+  Wavbreaker contains a helpful waveform display of the audio file
+  being edited, to help the user in splitting the file at the right
+  point.  Wavbreaker also supports splitting MP3 files without
+  re-encoding them, to preserve their original audio quality.")
+    (license license:gpl2+)))