diff mbox series

[bug#37094,1-3/3] gnu: Add nomad.

Message ID 85sgpwcoqz.fsf@disroot.org
State Accepted
Headers show
Series None | expand

Commit Message

Amar M. Singh Aug. 20, 2019, 6:52 a.m. UTC
From the package description:

Nomad is an Emacs-like Web Browser built using Webkitgtk and
Emacsy.  It has a small C backend and most browser features are fully
programmable in Guile.  It has hooks, keymaps, and self documentation
features.

Though it requires a few changes to existing packages:

Patches:

1. Shroud related patches
 a. update to 0.1.2: brings Guile-2.2 support

Related issue: https://issues.guix.gnu.org/issue/36576

2. Emacsy related patches
 a. Add guile-emacsy package,
   $ guix size emacsy ... total: 1136.3 MiB
   versus:
   $ guix size guile-emacsy ... total: 132.3 MiB

Related issue: https://issues.guix.gnu.org/issue/36151
(Discussion about "emacsy" vs "guile-emacsy" naming)

3. Nomad related patches
 a. Add 'Nomad' package in guile-xyz.scm

4. [Optional] Emacsy package can also be cleaned up a bit, mostly
 removal of propagated-inputs. Though that's a seperate issue.
 [patch 04 attached]

Cheers,
amar
diff mbox series

Patch

From b8cc0e6db1abcb395df12437e16ba39007dff33d Mon Sep 17 00:00:00 2001
From: Amar Singh <nly@disroot.org>
Date: Wed, 10 Jul 2019 16:45:50 +0530
Subject: [PATCH 4/4] gnu: emacsy: cleanup build

fix conflicts; emacsy requires guile-2.2.4 but found guile-2.2.6 in profile etc.

build: add phase 'wrap-binaries
bulid: glib-or-gtk-build-system wraps binaries to work with glib or gtk
propagated-inputs: remove all but glib-network and gsettings
---
 gnu/packages/guile-xyz.scm | 40 ++++++++++++++++++++++++++++++++------
 1 file changed, 34 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index 0fed3c6da5..d515e1ed5e 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -21,6 +21,7 @@ 
 ;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby@inria.fr>
 ;;; Copyright © 2018 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2019 swedebugia <swedebugia@riseup.net>
+;;; Copyright (C) 2019 by Amar Singh<nly@disroot.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2393,7 +2394,7 @@  more expressive and flexible than the traditional @code{format} procedure.")
               (sha256
                (base32
                 "1cpb85dl1nibd34c2x2h7vfmjpkgh353p5b1w20v6cs6gmvgg4np"))))
-    (build-system gnu-build-system)
+    (build-system glib-or-gtk-build-system)
     (native-inputs
      `(("autoconf" ,autoconf)
        ("automake" ,automake)
@@ -2405,22 +2406,49 @@  more expressive and flexible than the traditional @code{format} procedure.")
        ("pkg-config" ,pkg-config)
        ("texinfo" ,texinfo)
        ("texlive" ,(texlive-union (list texlive-generic-epsf)))))
-    (propagated-inputs
+    (inputs
      `(("dbus-glib" ,dbus-glib)
        ("guile" ,guile-2.2)
        ("guile-lib" ,guile-lib)
        ("guile-readline" ,guile-readline)
-       ("glib-networking" ,glib-networking)
        ("freeglut" ,freeglut)
-       ("gssettings-desktop-schemas" ,gsettings-desktop-schemas)
        ("webkitgtk" ,webkitgtk)))
+    (propagated-inputs
+     `(("glib-networking" ,glib-networking)
+       ("gssettings-desktop-schemas" ,gsettings-desktop-schemas)))
     (arguments
-     `(#:phases
+     `(#:modules ((guix build gnu-build-system)
+                  (guix build glib-or-gtk-build-system)
+                  (guix build utils)
+                  (ice-9 popen)
+                  (ice-9 rdelim)
+                  (ice-9 regex)
+                  (ice-9 ftw)
+                  (srfi srfi-26))
+       #:phases
        (modify-phases %standard-phases
          (add-before 'configure 'setenv
            (lambda _
              (setenv "GUILE_AUTO_COMPILE" "0")
-             #t)))))
+             #t))
+         (add-after 'install 'wrap-binaries
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (effective (read-line
+                                (open-pipe* OPEN_READ
+                                            "guile" "-c"
+                                            "(display (effective-version))")))
+                    (deps (map (cut assoc-ref inputs <>) '("guile-lib" "guile-readline")))
+                    (scm-path (map (cut string-append <> "/share/guile/site/" effective) `(,out ,@deps)))
+                    (go-path (map (cut string-append <> "/lib/guile/" effective "/site-ccache/") `(,out ,@deps)))
+                    (examples (filter (cut string-match "emacsy" <>)
+                                      (scandir (string-append out "/bin/"))))
+                    (progs (map (cut string-append out "/bin/" <>)
+                                examples)))
+               (map (cut wrap-program <>
+                         `("GUILE_LOAD_PATH" ":" prefix ,scm-path)
+                         `("GUILE_LOAD_COMPILED_PATH" ":" prefix ,go-path)) progs)
+               #t))))))
     (home-page "https://savannah.nongnu.org/projects/emacsy")
     (synopsis "Embeddable GNU Emacs-like library using Guile")
     (description
-- 
2.22.1