Subject: [bug#58208] [PATCH v2 1/9] gnu: Add oggz.

From: Lilah Tascheter <[email-masked]>
Date: Fri, 2 Jun 2023 00:56:38 -0500

* gnu/packages/xiph.scm (oggz): New variable.
---
 gnu/packages/xiph.scm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/gnu/packages/xiph.scm b/gnu/packages/xiph.scm
index b47c718fb6..2f69d3aa6b 100644
--- a/gnu/packages/xiph.scm
+++ b/gnu/packages/xiph.scm
@@ -32,6 +32,7 @@
 (define-module (gnu packages xiph)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages curl)
@@ -46,6 +47,7 @@ (define-module (gnu packages xiph)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu))
 
@@ -259,6 +261,40 @@ (define-public flac
                                "See COPYING in the distribution.")) ; and LGPL and GPL
    (home-page "https://xiph.org/flac/")))
 
+(define-public oggz
+  (package
+    (name "oggz")
+    (version "1.1.1")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append "https://downloads.xiph.org/releases/liboggz/"
+                                 "liboggz-" version ".tar.gz"))
+             (file-name (string-append name "-" version ".tar.gz"))
+             (sha256
+              (base32
+               "0nj17lhnsw4qbbk8jy4j6a78w6v2llhqdwq46g44mbm9w2qsvbvb"))))
+    (build-system gnu-build-system)
+    (arguments
+      (list #:phases
+            #~(modify-phases %standard-phases
+                (add-before 'build 'patch-oggz-diff-script
+                  (lambda* (#:key inputs #:allow-other-keys)
+                    (let* ((input (lambda (i) (search-input-file inputs i)))
+                           (getopt (input "/bin/getopt"))
+                           (basename (input "/bin/basename"))
+                           (diff (input "/bin/diff")))
+                      (substitute* "src/tools/oggz-diff.in"
+                        (("`getopt") (string-append "`" getopt))
+                        (("`basename") (string-append "`" basename))
+                        (("^diff") diff))))))))
+    (inputs (list coreutils-minimal diffutils libogg util-linux))
+    (home-page "https://xiph.org/oggz/")
+    (synopsis "Library and command-line tool for working with Ogg files")
+    (description "Oggz is a C library for reading and writing Ogg files and
+streams in multiple formats.  It comes bundled with cli tools to inspect,
+validate, crop, and edit Ogg files.")
+    (license license:bsd-3)))
+
 (define-public libkate
   (package
    (name "libkate")
-- 
2.40.1