summary refs log tree commit diff
path: root/gnu/packages/gtk.scm
diff options
context:
space:
mode:
authorRaghav Gururajan <rg@raghavgururajan.name>2021-05-21 00:08:24 -0400
committerMathieu Othacehe <othacehe@gnu.org>2021-10-02 10:54:13 +0000
commitef5b32310b392f6eabe768a6181402bd30413d7f (patch)
tree13c8f4a951d966b37caa3869da2f43f6b03296cc /gnu/packages/gtk.scm
parent26117f0d57ff840e9bc69b06c7cd6e107aebba54 (diff)
downloadguix-ef5b32310b392f6eabe768a6181402bd30413d7f.tar.gz
gnu: Add gtk.
* gnu/packages/gtk.scm (gtk): New variable.
* gnu/packages/patches/gtk4-respect-GUIX_GTK4_PATH.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
Diffstat (limited to 'gnu/packages/gtk.scm')
-rw-r--r--gnu/packages/gtk.scm176
1 files changed, 176 insertions, 0 deletions
diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index 9868b11e48..f161c556e7 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -93,11 +93,15 @@
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages pretty-print)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-build)
   #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages guile-xyz)
   #:use-module (gnu packages cups)
   #:use-module (gnu packages version-control)
+  #:use-module (gnu packages video)
+  #:use-module (gnu packages vulkan)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
@@ -1119,6 +1123,178 @@ application suites.")
             (variable "GUIX_GTK3_PATH")
             (files '("lib/gtk-3.0")))))))
 
+(define-public gtk
+  (package
+    (name "gtk")
+    (version "4.2.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://gnome/sources/" name "/"
+                           (version-major+minor version)  "/"
+                           name "-" version ".tar.xz"))
+       (sha256
+        (base32 "1rh9fd5axf79pmd93hb2fmmflic5swcvqvq6vqghlgz4bmvnjc82"))
+       (patches
+        (search-patches "gtk4-respect-GUIX_GTK4_PATH.patch"))))
+    (build-system meson-build-system)
+    (outputs '("out" "bin" "doc"))
+    (arguments
+     `(#:configure-flags
+       (list
+        "-Dbroadway-backend=true"      ;for broadway display-backend
+        "-Dcloudproviders=enabled"     ;for cloud-providers support
+        "-Dtracker=enabled"            ;for filechooser search support
+        "-Dcolord=enabled"             ;for color printing support
+        ,@(if (%current-target-system)
+              ;; If true, gtkdoc-scangobj will try to execute a
+              ;; cross-compiled binary.
+              '("-Dgtk_doc=false")
+              '("-Dgtk_doc=true"))
+        "-Dman-pages=true")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch
+           (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
+             ;; Correct DTD resources of docbook.
+             (substitute* (find-files "docs" "\\.xml$")
+               (("http://www.oasis-open.org/docbook/xml/4.3/")
+                (string-append
+                 (assoc-ref (or native-inputs inputs) "docbook-xml-4.3")
+                 "/xml/dtd/docbook/")))
+             ;; Disable building of icon cache.
+             (substitute* "meson.build"
+               (("gtk_update_icon_cache: true")
+                "gtk_update_icon_cache: false"))
+             ;; Disable failing tests.
+             (substitute* (find-files "testsuite" "meson.build")
+               (("[ \t]*'empty-text.node',") "")
+               (("[ \t]*'testswitch.node',") "")
+               (("[ \t]*'widgetfactory.node',") ""))
+             (substitute* "testsuite/reftests/meson.build"
+               (("[ \t]*'label-wrap-justify.ui',") "")) ))
+         (add-before 'build 'set-cache
+           (lambda _
+             (setenv "XDG_CACHE_HOME" (getcwd))))
+         (add-before 'check 'pre-check
+           (lambda _
+             ;; Tests require a running X server.
+             (system "Xvfb :1 +extension GLX &")
+             (setenv "DISPLAY" ":1")
+             ;; Tests write to $HOME.
+             (setenv "HOME" (getcwd))
+             ;; Tests look for those variables.
+             (setenv "XDG_RUNTIME_DIR" (getcwd))
+             ;; For missing '/etc/machine-id'.
+             (setenv "DBUS_FATAL_WARNINGS" "0")))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               (setenv "MESON_TESTTHREADS" "1")
+               ;; Run tests using the x11 setup,
+               ;; instead of the default wayland.
+               (invoke "meson" "test" "--setup=x11"))))
+         (add-after 'install 'move-files
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (assoc-ref outputs "bin"))
+                    (doc (assoc-ref outputs "doc")))
+               (for-each mkdir-p
+                         (list
+                          (string-append bin "/bin")
+                          (string-append bin "/share/applications")
+                          (string-append bin "/share/icons")
+                          (string-append bin "/share/man")
+                          (string-append bin "/share/metainfo")
+                          (string-append doc "/share/doc")))
+               ;; Move programs and related files to output 'bin'.
+               (for-each (lambda (dir)
+                           (rename-file
+                            (string-append out dir)
+                            (string-append bin dir)))
+                         (list
+                          "/bin"
+                          "/share/applications"
+                          "/share/icons"
+                          "/share/man"
+                          "/share/metainfo"))
+               ;; Move HTML documentation to output 'doc'.
+               (rename-file
+                (string-append out "/share/doc")
+                (string-append doc "/share/doc"))))))))
+    (native-inputs
+     `(("docbook-xml-4.3" ,docbook-xml-4.3)
+       ("docbook-xsl" ,docbook-xsl)
+       ("gettext-minimal" ,gettext-minimal)
+       ("glib:bin" ,glib "bin")
+       ("gobject-introspection" ,gobject-introspection) ;for building introspection data
+       ("gtk-doc" ,gtk-doc)             ;for building documentation
+       ("intltool" ,intltool)
+       ("libxslt" ,libxslt)             ;for building man-pages
+       ("pkg-config" ,pkg-config)
+       ;; These python modules are required for building documentation.
+       ("python-jinja2" ,python-jinja2)
+       ("python-markdown" ,python-markdown)
+       ("python-markupsafe" ,python-markupsafe)
+       ("python-pygments" ,python-pygments)
+       ("python-toml" ,python-toml)
+       ("python-typogrify" ,python-typogrify)
+       ("sassc" ,sassc)                 ;for building themes
+       ("vala" ,vala)
+       ("xorg-server-for-tests" ,xorg-server-for-tests)))
+    (inputs
+     `(("colord" ,colord)               ;for color printing support
+       ("cups" ,cups)                   ;for CUPS print-backend
+       ("ffmpeg" ,ffmpeg)               ;for ffmpeg media-backend
+       ("fribidi" ,fribidi)
+       ("gstreamer" ,gstreamer)         ;for gstreamer media-backend
+       ("gst-plugins-bad" ,gst-plugins-bad) ;provides gstreamer-player
+       ("gst-plugins-base" ,gst-plugins-base) ;provides gstreamer-gl
+       ("harfbuzz" ,harfbuzz)
+       ("iso-codes" ,iso-codes)
+       ("json-glib" ,json-glib)
+       ("libcloudproviders" ,libcloudproviders) ;for cloud-providers support
+       ("librsvg" ,librsvg)
+       ("python" ,python)
+       ("rest" ,rest)
+       ("tracker" ,tracker)))          ;for filechooser search support
+    (propagated-inputs
+     ;; Following dependencies are referenced in .pc files.
+     `(("cairo" ,cairo)
+       ("fontconfig" ,fontconfig)
+       ("gdk-pixbuf+svg" ,gdk-pixbuf+svg)
+       ("glib" ,glib)
+       ("graphene" ,graphene)
+       ("libepoxy" ,libepoxy)
+       ("libx11" ,libx11)               ;for x11 display-backend
+       ("libxcomposite" ,libxcomposite)
+       ("libxcursor" ,libxcursor)
+       ("libxdamage" ,libxdamage)
+       ("libxext" ,libxext)
+       ("libxfixes" ,libxfixes)
+       ("libxi" ,libxi)
+       ("libxinerama" ,libxinerama)     ;for xinerama support
+       ("libxkbcommon" ,libxkbcommon)
+       ("libxrandr" ,libxrandr)
+       ("libxrender" ,libxrender)
+       ("pango" ,pango)
+       ("vulkan-headers" ,vulkan-headers)
+       ("vulkan-loader" ,vulkan-loader) ;for vulkan graphics API support
+       ("wayland" ,wayland)             ;for wayland display-backend
+       ("wayland-protocols" ,wayland-protocols)))
+    (native-search-paths
+     (list
+      (search-path-specification
+       (variable "GUIX_GTK4_PATH")
+       (files '("lib/gtk-4.0")))))
+    (search-paths native-search-paths)
+    (home-page "https://www.gtk.org/")
+    (synopsis "Cross-platform widget toolkit")
+    (description "GTK is a multi-platform toolkit for creating graphical user
+interfaces.  Offering a complete set of widgets, GTK is suitable for projects
+ranging from small one-off tools to complete application suites.")
+    (license license:lgpl2.1+)))
+
 ;;;
 ;;; Guile bindings.
 ;;;