Subject: [bug#29624] EasyTAG

From: Pierre Langlois <[email-masked]>
Date: Sat, 09 Dec 2017 13:43:44 +0000

Hello Guix!

Here are a couple of patches adding the EasyTAG gnome package
https://wiki.gnome.org/Apps/EasyTAG.

EasyTAG depends on the libid3tag library and tries to find it using
pkg-config. I thought it'd be a good idea for the library to provide a
.pc file instead of manually telling EasyTAG where it is. It allows
cleaning up dependent packages a little, namely audacity and gmtp, what
do you think?

Thanks!
Pierre

>From 8cd2b22517e04030970bb33abd980577c15c3f01 Mon Sep 17 00:00:00 2001
From: Pierre Langlois <[email-masked]>
Date: Sat, 9 Dec 2017 13:05:21 +0000
Subject: [PATCH 1/2] gnu: libid3tag: Create a pkg-config file.

Cleanup packages depending on libid3tag by allowing pkg-config to find it
automatically.

* gnu/package/mp3.scm (libid3tag)[arguments]: Add a create-pkg-config-file
phase.
* gnu/package/audio.scm (audacity)[arguments]: Do not ID3TAG_CFLAGS and
ID3TAG_LIBS environment variables.
* gnu/package/libusb.scm (gmtp)[arguments]: Remove.
---
 gnu/packages/audio.scm  | 10 ++++------
 gnu/packages/libusb.scm |  8 +-------
 gnu/packages/mp3.scm    | 22 ++++++++++++++++++++++
 3 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 4f6e4a409..2273f4606 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2016 ng0 <[email-masked]>
 ;;; Copyright © 2016 Lukas Gradl <[email-masked]>
 ;;; Copyright © 2016 Tobias Geerinckx-Rice <[email-masked]>
+;;; Copyright © 2017 Pierre Langlois <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -345,8 +346,7 @@ engineers, musicians, soundtrack editors and composers.")
        ("which" ,which)))
     (arguments
      `(#:configure-flags
-       (let ((libid3tag (assoc-ref %build-inputs "libid3tag"))
-             (libmad (assoc-ref %build-inputs "libmad"))
+       (let ((libmad (assoc-ref %build-inputs "libmad"))
              (portmidi (assoc-ref %build-inputs "portmidi")))
          (list
           ;; Loading FFmpeg dynamically is problematic.
@@ -357,10 +357,8 @@ engineers, musicians, soundtrack editors and composers.")
                     '("x64_64" "i686"))
               '()
               '("--enable-sse=no"))
-          ;; 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")
+          ;; portmidi and libmad provide no .pc files, so pkg-config fails to
+          ;; find them.  Force their inclusion.
           (string-append "LIBMAD_CFLAGS=-I" libmad "/include")
           (string-append "LIBMAD_LIBS=-L" libmad "/lib -lmad")
           (string-append "PORTMIDI_CFLAGS=-I" portmidi "/include")
diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index 31c7dfa44..94c611b2f 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2016 Efraim Flashner <[email-masked]>
 ;;; Copyright © 2016 Theodoros Foradis <[email-masked]>
 ;;; Copyright © 2017 Jonathan Brielmaier <[email-masked]>
+;;; Copyright © 2017 Pierre Langlois <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -295,13 +296,6 @@ proposed for standardization.")
                (base32
                 "0fyi3pdl2g57vr0p46ip2wwzyap3l0by7iqaqygv0yxfcs79l6xj"))))
     (build-system glib-or-gtk-build-system)
-    (arguments
-     '(#:configure-flags
-       (let ((libid3tag (assoc-ref %build-inputs "libid3tag")))
-         (list
-          ;; libid3tag provides no .pc file, so pkg-config fails to find them.
-          (string-append "ID3TAG_CFLAGS=-I" libid3tag "/include")
-          (string-append "ID3TAG_LIBS=-L" libid3tag "/lib -lid3tag -lz")))))
     (inputs
      `(("gtk+" ,gtk+)
        ("flac" ,flac)
diff --git a/gnu/packages/mp3.scm b/gnu/packages/mp3.scm
index fbb924ba5..dd40fc59f 100644
--- a/gnu/packages/mp3.scm
+++ b/gnu/packages/mp3.scm
@@ -99,6 +99,28 @@ This package contains the library.")
               "0lb1w883dc46dajbdvnia5870brl5lvnlk7g7y58y9wpg5p4znk3"))))
    (build-system gnu-build-system)
    (inputs `(("zlib" ,zlib)))
+   (arguments
+     `(#:phases
+        (modify-phases %standard-phases
+          (add-after 'install 'create-pkg-config-file
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let* ((out (assoc-ref outputs "out"))
+                     (pkgconfig-path (string-append out "/lib/pkgconfig")))
+                (mkdir-p pkgconfig-path)
+                (with-output-to-file
+                  (string-append pkgconfig-path "/id3tag.pc")
+                  (lambda _
+                    (format #t
+                      "prefix=~@*~a~@
+                       exec_prefix=${prefix}/bin~@
+                       libdir=${prefix}/lib~@
+                       includedir=${prefix}/include~@
+                       Name: ID3TAG~@
+                       Description: libid3tag - ID3 tag manipulation library~@
+                       Version: ~1@*~a~@
+                       Libs: -L${libdir} -lid3tag -lz~@
+                       Cflags: -I${includedir}~%"
+                      out ,version)))))))))
    (synopsis "Library for reading ID3 tags")
    (description
     "Libid3tag is a library for reading ID3 tags, both ID3v1 and the various
-- 
2.15.1

>From bcabaa9b2c8d30d2fe1d8148068452667cd9e4c0 Mon Sep 17 00:00:00 2001
From: Pierre Langlois <[email-masked]>
Date: Sat, 9 Dec 2017 13:05:28 +0000
Subject: [PATCH 2/2] gnu: Add Easytag.

* gnu/packages/music.scm (easytag): New variable.
---
 gnu/packages/music.scm | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index 1aabe814b..d30c9b5de 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -40,6 +40,7 @@
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system python)
   #:use-module (guix build-system scons)
+  #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system waf)
   #:use-module (gnu packages)
   #:use-module (gnu packages algebra)
@@ -469,6 +470,55 @@ background while you work.")
 enable professional yet simple and intuitive pattern-based drum programming.")
     (license license:gpl2+)))
 
+(define-public easytag
+  (package
+    (name "easytag")
+    (version "2.4.3")
+    (source (origin
+             (method url-fetch)
+              (uri (string-append "mirror://gnome/sources/easytag/2.4/easytag-"
+                     version ".tar.xz"))
+             (sha256
+              (base32
+               "1mbxnqrw1fwcgraa1bgik25vdzvf97vma5pzknbwbqq5ly9fwlgw"))))
+    (build-system glib-or-gtk-build-system)
+    (native-inputs
+     `(("desktop-file-utils" ,desktop-file-utils)
+       ("glib" ,glib "bin")
+       ("intltool" ,intltool)
+       ("itstool" ,itstool)
+       ("pkg-config" ,pkg-config)
+       ("xmllint" ,libxml2)))
+    (inputs
+     `(("flac" ,flac)
+       ("gtk+" ,gtk+)
+       ("id3lib" ,id3lib)
+       ("libid3tag" ,libid3tag)
+       ("libvorbis" ,libvorbis)
+       ("opusfile" ,opusfile)
+       ("speex" ,speex)
+       ("taglib" ,taglib)
+       ("wavpack" ,wavpack)
+       ("yelp" ,yelp)))
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-makefile
+           (lambda _
+             (substitute* "Makefile.in"
+               ;; The Makefile generates a test-desktop-file-validate.sh
+               ;; script with /bin/sh hard-coded.
+               (("/bin/sh") (which "sh"))
+               ;; Don't create 'icon-theme.cache'.
+               (("gtk-update-icon-cache") "true")))))))
+    (home-page "https://wiki.gnome.org/Apps/EasyTAG")
+    (synopsis "Simple application for viewing and editing tags in audio files")
+    (description
+      "EasyTAG is an application for viewing and editing tags in audio files.
+It supports MP3, MP2, MP4/AAC, FLAC, Ogg Opus, Ogg Speex, Ogg Vorbis,
+MusePack, Monkey's Audio, and WavPack files.")
+    (license license:gpl2+)))
+
 (define-public extempore
   (package
     (name "extempore")
-- 
2.15.1