diff mbox series

[bug#54358] gnu: parinfer-rust: Add phase to install Vim and Kakoune plugins.

Message ID a2e476a7aaf6394bbe5b7c63248f016d97a40183.1707404260.git.herman@rimm.ee
State New
Headers show
Series [bug#54358] gnu: parinfer-rust: Add phase to install Vim and Kakoune plugins. | expand

Commit Message

Herman Rimm Feb. 8, 2024, 3:10 p.m. UTC
From: "(unmatched-parenthesis" <paren@disroot.org>

* gnu/packages/text-editors.scm (rust-parinfer)[arguments]: Install the
bundled Vim and Kakoune plugins.
[outputs]: Add 'plugin' output.
[description]: Specify how to refer to output.

Change-Id: I881315481ec08c59576c4530ae72b877c399fc66
---
Hi,

I think it's fine to have this patch as a separate issue, since it also
adds the Vim editor plugin. The plugins and shared library are installed
to the 'plugin' output. The Vim plugin shared library path is patched.

Cheers,
Herman

 gnu/packages/text-editors.scm | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)


base-commit: 7d3aa578ef0b7fcfcddf0623f806ec625aab6ccd

Comments

Efraim Flashner Feb. 11, 2024, 1:47 p.m. UTC | #1
I wasn't able to cross-compile clang so we were able to leave the
reference to target/release.  I moved the plugins to 'out' since they
don't take up much space and are likely to be helpful.

Patch pushed! Thanks.
diff mbox series

Patch

diff --git a/gnu/packages/text-editors.scm b/gnu/packages/text-editors.scm
index 3fefd59a19..b4d3c23e42 100644
--- a/gnu/packages/text-editors.scm
+++ b/gnu/packages/text-editors.scm
@@ -31,6 +31,8 @@ 
 ;;; Copyright © 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2023 Jaeme Sifat <jaeme@runbox.com>
 ;;; Copyright © 2023 David Pflug <david@pflug.io>
+;;; Copyright © 2024 ( <paren@disroot.org>
+;;; Copyright © 2024 Herman Rimm <herman@rimm.ee>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -308,7 +310,10 @@  (define-public parinfer-rust
        (sha256
         (base32 "0hj5in5h7pj72m4ag80ing513fh65q8xlsf341qzm3vmxm3y3jgd"))
        (file-name (git-file-name name version))))
+    (properties
+      `((output-synopsis "plugin" "Plugins with shared libraries")))
     (build-system cargo-build-system)
+    (outputs (list "out" "plugin"))
     (arguments
      `(#:cargo-inputs
        (("rust-getopts" ,rust-getopts-0.2)
@@ -318,15 +323,36 @@  (define-public parinfer-rust
         ("rust-serde-json" ,rust-serde-json-1)
         ("rust-serde-derive" ,rust-serde-derive-1)
         ("rust-unicode-segmentation" ,rust-unicode-segmentation-1)
-        ("rust-unicode-width" ,rust-unicode-width-0.1))))
+        ("rust-unicode-width" ,rust-unicode-width-0.1))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'install-plugins-and-libs
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "plugin"))
+                    (lib (string-append out "/lib"))
+                    (vimfiles (string-append out "/share/vim/vimfiles/"
+                                             "pack/guix/start/parinfer"))
+                    (doc (string-append vimfiles "/doc"))
+                    (plugin (string-append vimfiles "/plugin"))
+                    (autoload (string-append out "/share/kak/autoload")))
+               (with-directory-excursion "target/release"
+                 (install-file "libparinfer_rust.so" lib))
+               (copy-recursively "doc" doc)
+               (copy-recursively "plugin" plugin)
+               (copy-recursively "rc" autoload)
+               (substitute* (string-append plugin "/parinfer.vim")
+                            (("(let s:libdir = ).*" all libdir)
+                             (format #f "~a'~a'\n" libdir lib)))))))))
     (inputs
      (list clang))
     (home-page "https://github.com/justinbarclay/parinfer-rust")
     (synopsis "Infer parentheses for Clojure, Lisp and Scheme")
     (description
      "Parinfer is a plugin for Kakoune, Vim, Neovim and Emacs that infers
-parentheses and indentation.  This library can be called from other editors that
-can load dynamic libraries.")
+parentheses and indentation.  This library can be called from other
+editors that can load dynamic libraries.  @code{gexp-input} can be used
+to refer to the 'plugin' output of this package, within a
+@code{home-environment} record.")
     (license license:expat)))
 
 (define-public joe