summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-07-29 17:33:18 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-07-29 22:03:34 -0400
commit0413e90ab15cd1a40f6edba390967bb76a5f8181 (patch)
tree880d1bac3884e24c8f457bf27ba71b9fff29a79d
parent4613a9948a7814e877bc6421d7cec3cc267ec928 (diff)
downloadguix-0413e90ab15cd1a40f6edba390967bb76a5f8181.tar.gz
gnu: Add libmodulemd.
* gnu/packages/rpm.scm (libmodulemd): New variable.
-rw-r--r--gnu/packages/rpm.scm81
1 files changed, 81 insertions, 0 deletions
diff --git a/gnu/packages/rpm.scm b/gnu/packages/rpm.scm
index 176d0fe286..7132aa145c 100644
--- a/gnu/packages/rpm.scm
+++ b/gnu/packages/rpm.scm
@@ -22,11 +22,18 @@
   #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system meson)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages curl)
+  #:use-module (gnu packages docbook)
+  #:use-module (gnu packages glib)
+  #:use-module (gnu packages gtk)
+  #:use-module (gnu packages man)
   #:use-module (gnu packages package-management)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages popt)
+  #:use-module (gnu packages serialization)
   #:use-module (gnu packages tls))
 
 (define-public drpm
@@ -60,3 +67,77 @@
     (description "This package provides a library for making, reading and
 applying deltarpms, compatible with the original deltarpm packages.")
     (license license:lgpl2.1+)))
+
+(define-public libmodulemd
+  (package
+    (name "libmodulemd")
+    (version "2.13.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/fedora-modularity/"
+                                  "libmodulemd/releases/download/" version
+                                  "/modulemd-" version ".tar.xz"))
+              (sha256
+               (base32
+                "1g4wizr2wwl5x77ni5j46nfcax8fbb7nqq5nr7va9sccyigwwwnc"))))
+    (build-system meson-build-system)
+    (outputs '("out" "doc"))            ;2.6 MiB of HTML documentation
+    (arguments
+     `(#:configure-flags
+       (list (string-append "-Dgobject_overrides_dir_py3="
+                            (python:site-packages %build-inputs %outputs)))
+       #:imported-modules (,@%meson-build-system-modules
+                           (guix build python-build-system))
+       #:modules ((guix build meson-build-system)
+                  ((guix build python-build-system) #:prefix python:)
+                  (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-glib-doc-prefix
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((glib:doc (assoc-ref inputs "glib:doc")))
+               (substitute* "meson.build"
+                 (("glib_docpath = .*")
+                  (format #f "glib_docpath = '~a'~%"
+                          (string-append glib:doc
+                                         "/share/gtk-doc/html")))))))
+         (add-after 'unpack 'fix-docbook-references
+           ;; gtk-doc doesn't seem to honor DocBook 4.1.2's docbook.cat's
+           ;; catalog file, even when adding it to XML_CATALOG_FILES.  Work
+           ;; around it by adjusting the DocBook references directly.
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "modulemd/modulemd-docs.xml"
+               (("http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd")
+                (string-append (assoc-ref inputs "docbook-xml")
+                               "/xml/dtd/docbook/docbookx.dtd")))))
+         (add-after 'install 'move-documentation
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (doc (assoc-ref outputs "doc"))
+                    (src (string-append out "/share/gtk-doc"))
+                    (dst (string-append doc "/share/gtk-doc")))
+               (mkdir-p (dirname dst))
+               (rename-file src dst)))))))
+    (native-inputs
+     `(("docbook-xml" ,docbook-xml-4.1.2)
+       ("glib:bin" ,glib "bin")
+       ("glib:doc" ,glib-with-documentation "doc")
+       ("gobject-introspection" ,gobject-introspection) ;for g-ir-scanner
+       ("gtk-doc" ,gtk-doc)
+       ("help2man" ,help2man)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("gtk" ,gtk+)
+       ("python-pygobject" ,python-pygobject)))
+    (propagated-inputs
+     ;; glib and gobject are listed as 'Requires' in modulemd-2.0.pc.
+     `(("glib" ,glib)
+       ;; yaml and rpm are listed as 'Requires.private' in modulemd-2.0.pc.
+       ("libyaml" ,libyaml)
+       ("rpm" ,rpm)))
+    (home-page "https://github.com/fedora-modularity/libmodulemd")
+    (synopsis "C library for manipulating module metadata files")
+    (description "The libmodulemd API provides a number of convenience tools
+for interacting with repodata (that is, streams of YAML that contains
+information on multiple streams, default data and translations).")
+    (license license:expat)))