Subject: [PATCH 2/5] gnu: Add gtksourceview-5.
From: Alexandros Theodotou <[email-masked]>
To: [email-masked]
Cc: Alexandros Theodotou <[email-masked]>
Date: Sat, 9 Apr 2022 00:53:43 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/packages/gtk.scm (gtksourceview-5): New variable.
---
 gnu/packages/gtk.scm | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index 96297535ce..e8131bb955 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -30,6 +30,7 @@
 ;;; Copyright © 2021 Maxime Devos <[email-masked]>
 ;;; Copyright © 2021 Wamm K. D. <[email-masked]>
 ;;; Copyright © 2022 Zhu Zihao <[email-masked]>
+;;; Copyright © 2022 Alexandros Theodotou <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -90,6 +91,7 @@ (define-module (gnu packages gtk)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages man)
+  #:use-module (gnu packages pcre)
   #:use-module (gnu packages pdf)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages perl-check)
@@ -618,6 +620,44 @@ (define-public gtksourceview
 highlighting and other features typical of a source code editor.")
    (license license:lgpl2.1+)))
 
+(define-public gtksourceview-5
+ (package (inherit gtksourceview)
+   (name "gtksourceview")
+   (version "5.4.0")
+   (source (origin
+             (method url-fetch)
+             (uri (string-append "mirror://gnome/sources/" name "/"
+                                 (version-major+minor version) "/"
+                                 name "-" version ".tar.xz"))
+             (sha256
+              (base32
+               "0dz6hifma60plbfqm4vlh1mps2z7f15rkkmflf5fra3hwqbw4fq0"))))
+   (build-system meson-build-system)
+   (arguments
+    '(#:phases
+      (modify-phases %standard-phases
+        (add-after 'unpack 'skip-gtk-update-icon-cache
+          (lambda _
+            (substitute* "meson.build"
+              (("gtk_update_icon_cache: true")
+               "gtk_update_icon_cache: false"))))
+        (add-before
+         'check 'pre-check
+         (lambda* (#:key inputs #:allow-other-keys)
+           (let ((xorg-server (assoc-ref inputs "xorg-server")))
+             ;; Tests require a running X server.
+             (system (format #f "~a/bin/Xvfb :1 &" xorg-server))
+             (setenv "DISPLAY" ":1")
+             ;; For the missing /etc/machine-id.
+             (setenv "DBUS_FATAL_WARNINGS" "0")
+             #t))))
+      #:configure-flags
+      ;; Needs newer gobject-introspection
+      '("-Dintrospection=disabled")))
+   (propagated-inputs
+    ;; gtksourceview-3.0.pc refers to all these.
+    (list glib gtk libxml2 pcre2))))
+
 (define-public gtksourceview-3
  (package (inherit gtksourceview)
    (name "gtksourceview")
-- 
2.35.1