From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id AJURO7IDLWV7IgAAauVa8A:P1 (envelope-from ) for ; Mon, 16 Oct 2023 11:34:43 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id AJURO7IDLWV7IgAAauVa8A (envelope-from ) for ; Mon, 16 Oct 2023 11:34:43 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id DC6DE66908 for ; Mon, 16 Oct 2023 11:34:41 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=d6f66jXn; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1697448882; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=YJLKrD+jeNax+RzDRBq3JMokmONCNX5laTvtRnMEgP0=; b=ck+ShZH6TJnZ/4AhYer/m6o1nzPAc5RsIAeeuWVRFMV5PvQHnuVya7Efpze7doGeUXAo5j LpCVjhXv/crvpPpX1TrE+IDDJnoBVpoSvTOJRIUUdte3OJmIJK4gva6xOTXFZ7x6EL7Gdo pa14ojBmmbEjW7hCP1r+NRScQ4LLDGUbEegWRuAU6ts08FmjmJqQlm6Wuekwi88GeWBHDs 93EtZ+y1XAb4lyQxvneIENbMUuemC5xVzXPru5VS2xzwEljnSSTyNXatzr4PJzgVy2ULxH SDyD0hk/DCsTqd9G4KGoMb8AFXCvAh8TNo5/BWZk0t3UNc7CyN141pUeMjFprg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1697448882; a=rsa-sha256; cv=none; b=SX2x6UiT8y1zEBqRKTN1/hmfNyTjzjnvztBcammmTqTZsP70UkBTGoD5pYa/9zK7XxM27J Ty2f6iz//kv0/5F18ODo3Pf1ZvyuzomVSbkZMSR/SyiXM1OAMoK1xS1whAmXfUG7F9jIeG xw3DxxFebyEhDIpD0wemAEXbCV1qmpyoZPDN0cx75rsARqI4A8HcaKPPvFf+n6OFzyoeJ2 z4Gl3JHjQr/jq+/8u1Mf3BfJhjMyQXIiBrE703Ln3Wp0M+pJdjBUCXBYJGD+JaZM8xt/Lf UIN1hoeWHmvdeAVBky6mHsHA0fZAwdKLT51NjdRJw3xBiSwFTnrE7eblDWtmFQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=d6f66jXn; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qsJkL-0005nC-70; Mon, 16 Oct 2023 05:18:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qsJkG-0005g8-Bz for guix-patches@gnu.org; Mon, 16 Oct 2023 05:18:40 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qsJkE-0006Wh-Ge for guix-patches@gnu.org; Mon, 16 Oct 2023 05:18:39 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qsJkd-0007AE-5O for guix-patches@gnu.org; Mon, 16 Oct 2023 05:19:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#60029] [PATCH v3 2/3] build-system: Add vim-build-system. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 16 Oct 2023 09:19:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60029 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 60029@debbugs.gnu.org Cc: paren@disroot.org, me@jonscoresby.com, Efraim Flashner Received: via spool by 60029-submit@debbugs.gnu.org id=B60029.169744789527451 (code B ref 60029); Mon, 16 Oct 2023 09:19:03 +0000 Received: (at 60029) by debbugs.gnu.org; 16 Oct 2023 09:18:15 +0000 Received: from localhost ([127.0.0.1]:55236 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qsJjq-00078g-Pi for submit@debbugs.gnu.org; Mon, 16 Oct 2023 05:18:15 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:58521) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qsJjm-000780-MB for 60029@debbugs.gnu.org; Mon, 16 Oct 2023 05:18:12 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-307d58b3efbso3516768f8f.0 for <60029@debbugs.gnu.org>; Mon, 16 Oct 2023 02:17:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697447860; x=1698052660; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=YJLKrD+jeNax+RzDRBq3JMokmONCNX5laTvtRnMEgP0=; b=d6f66jXn2GmGZ8tR4msJTiRy9jMZIHihA4wRYZMgBkintGCkmbf/uj3TYE7d/UYMwx 4/ROHbxDJo4qAlDQFy7giWkLV88IzJTqm5xGEWoiNc69fx7ZGD9cy9ox31VM04GAmak2 EOKIHE0R6ENA10wGDAKwuxGnV7QqCcCAy4I6omU38GQSOHAz0uIKlKP1ZgFCHbmc3lng f3LFNnZe312xGMZIeMsaLiqQQ6yYyeuUtiu1/4LOxkOk+QVBGYAV694trJsty+66jByG jgbxYKaidJMil0qZiaZIgS53NpWLGa1DRRqYBOC5eOhi2zr8/WPn8rieZYMDffHEMFyl f9+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697447860; x=1698052660; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=YJLKrD+jeNax+RzDRBq3JMokmONCNX5laTvtRnMEgP0=; b=X2mPUKTvAZq+7kIiinfa7NPdM024rrQIYaP6cNJVkFV6IeQnIHx/tl9GsIHbTtTdhA FTwYd5ykEFQI8DoF3bzEOM5XUm+RLzfef8CNQwjn1Q9oos7YRAX1i4eGA/e9iTVSgZhk lTkeyF9WU4KyJMsfrM/dEi0vY66eC1oI0ZEEDGMQDLGPWbqL7fzcUN8HpCy01zRhtnoK 0NZpXhhp/4hDajLlseqybf3u0Zt83esPuYNYug0rd50g1XZZvUvbvS2RdSBMe05+j+Z3 ismCN+HL9M33a+bwYF64WMSovpds71xlTdRyPJZBQ+mVCVlq2tZ6WvGohH9uRAtvOIJ/ YQoA== X-Gm-Message-State: AOJu0YyBiVOzddkA3y38q1lZRNLVBtEBEfKDpiet2R6kR+J4dC3+OcNv +D7697qjz04LpCF+f64kxO1dn3SiEMO+9w== X-Google-Smtp-Source: AGHT+IG4LL15w6sVWsFlYnd+5O7LtjwL3iWkBjCJ4dU/xEmJmXH9LxeLFxJptCbVOPf9UZ0PIFKUHw== X-Received: by 2002:a5d:58e4:0:b0:32d:8e54:29f7 with SMTP id f4-20020a5d58e4000000b0032d8e5429f7mr8461441wrd.64.1697447859928; Mon, 16 Oct 2023 02:17:39 -0700 (PDT) Received: from localhost ([31.210.180.106]) by smtp.gmail.com with ESMTPSA id d7-20020adfa347000000b0032d72f48555sm11498660wrb.36.2023.10.16.02.17.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 02:17:39 -0700 (PDT) From: Efraim Flashner Date: Mon, 16 Oct 2023 12:15:12 +0300 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Spam-Score: 1.83 X-Migadu-Queue-Id: DC6DE66908 X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: 1.83 X-TUID: vv2SbPXwgQAS From: Jonathan Scoresby * guix/build-system/vim.scm, * guix/build/vim-build-system.scm: New modules. * Makefile.am (MODULES): Register new files. * doc/guix.texi: Document it. Co-authored-by: Efraim Flashner Signed-off-by: Efraim Flashner --- Makefile.am | 4 +- doc/guix.texi | 33 +++++++ guix/build-system/vim.scm | 157 ++++++++++++++++++++++++++++++++ guix/build/vim-build-system.scm | 117 ++++++++++++++++++++++++ 4 files changed, 310 insertions(+), 1 deletion(-) create mode 100644 guix/build-system/vim.scm create mode 100644 guix/build/vim-build-system.scm diff --git a/Makefile.am b/Makefile.am index 310a231259..9fd77c6f43 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,7 +13,7 @@ # Copyright © 2018 Julien Lepiller # Copyright © 2018 Oleg Pykhalov # Copyright © 2018 Alex Vong -# Copyright © 2019 Efraim Flashner +# Copyright © 2019, 2023 Efraim Flashner # Copyright © 2020, 2021, 2023 Maxim Cournoyer # Copyright © 2021 Chris Marusich # Copyright © 2021 Andrew Tropin @@ -184,6 +184,7 @@ MODULES = \ guix/build-system/texlive.scm \ guix/build-system/tree-sitter.scm \ guix/build-system/trivial.scm \ + guix/build-system/vim.scm \ guix/ftp-client.scm \ guix/http-client.scm \ guix/gnupg.scm \ @@ -241,6 +242,7 @@ MODULES = \ guix/build/scons-build-system.scm \ guix/build/texlive-build-system.scm \ guix/build/tree-sitter-build-system.scm \ + guix/build/vim-build-system.scm \ guix/build/waf-build-system.scm \ guix/build/haskell-build-system.scm \ guix/build/julia-build-system.scm \ diff --git a/doc/guix.texi b/doc/guix.texi index 3517c95251..89db688132 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -9482,6 +9482,39 @@ Build Systems @end itemize @end defvar +@defvar vim-build-system +This variable is exported by @code{(guix build-system vim)}. It is an +extension of the @pref{Copy Build System, @code{copy-build-system}}, installing +vim and neovim plugins into locations where these two text editors know to find +their plugins, using their packpaths. + +Packages which are prefixed with @code{vim-} will be installed in vim's +packpath, while those prefixed with @code{neovim-} will be installed in +neovim's packpath. If there is a @code{doc} directory with the plugin then +helptags will be generated automatically. + +There are a couple of keywords added with the @code{vim-build-system}: +@itemize +@item With @code{plugin-name} it is possible to set the name of the plugin. By +default this is set to the name and version of the package, it is often more +helpful to set this to name which the upstream author calls their plugin. +@item With @code{install-plan} it is possible to augment the built-in +install-plan of the @code{vim-build-system}. This is particularly helpful if +you have files which should be installed in other locations. For more +information about using the @code{install-plan}, take a look at the @pref{Copy +Build System, @code{copy-build-system}}. +@item With @code{#:vim} it is possible to add this package to vim's packpath, +in addition to if it is added automatically because of the @code{vim-} prefix. +@item With @code{#:neovim} it is possible to add this package to neovim's +packpath, in addition to if it is added automatically because of the +@code{neovim-} prefix. +@item With @code{#:mode} it is possible to adjust the path which the plugin is +installed into. By default the plugin is installed into @code{start} and other +options are available, including @code{opt}. Adding a plugin into @code{opt} +will mean you will need to run, for example, @command{:packadd foo} to load the +@code{foo} plugin from inside of vim. +@end itemize +@end defvar @cindex Clojure (programming language) @cindex simple Clojure build system diff --git a/guix/build-system/vim.scm b/guix/build-system/vim.scm new file mode 100644 index 0000000000..81f08ff436 --- /dev/null +++ b/guix/build-system/vim.scm @@ -0,0 +1,157 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Jonathan Scoresby +;;; Copyright © 2023 Efraim Flashner +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix build-system vim) + #:use-module (guix store) + #:use-module (guix utils) + #:use-module (guix gexp) + #:use-module (guix monads) + #:use-module (guix packages) + #:use-module (guix search-paths) + #:use-module (guix build-system) + #:use-module (guix build-system copy) + #:use-module (guix build-system gnu) + #:export (%vim-build-system-modules vim-build vim-build-system)) + +;; Commentary: +;; +;; Standard package installer for vim and neovim plugins. +;; This is implemented as an extension of `copy-build-system' +;; and takes advantage of vim and neovim's built-in package manager. +;; It extends the installation procedure from the copy-build-system +;; to put files in the correct place and then generates help tags. +;; +;; Code: + +(define %vim-build-system-modules + ;; Build-side modules imported by default. + `((guix build vim-build-system) + ,@%copy-build-system-modules)) + +(define (default-vim) + "Return the default Vim package." + ;; Lazily resolve the binding to avoid a circular dependency. + (let ((vim (resolve-interface '(gnu packages vim)))) + (module-ref vim 'vim))) + +(define (default-neovim) + "Return the default Neovim package." + (let ((vim (resolve-interface '(gnu packages vim)))) + (module-ref vim 'neovim))) + +(define* (lower name + #:key source + inputs + native-inputs + outputs + system + target + (vim? #f) + (neovim? #f) + (plugin-name name) + (vim (default-vim)) + (neovim (default-neovim)) + #:allow-other-keys #:rest arguments) + "Return a bag for NAME." + (let* ((private-keywords '(#:target #:vim #:neovim #:inputs #:native-inputs)) + (vim? (or (string-prefix? "vim" name) + vim?)) + (neovim? (or (string-prefix? "neovim" name) + neovim?)) + (vim-inputs (append (if vim? + `(("vim" ,vim)) + '()) + (if neovim? + `(("neovim" ,neovim)) + '()))) + (vim-arguments (append arguments + `(#:vim? ,vim? + #:neovim? ,neovim?)))) + (bag (name name) + (system system) + (host-inputs `(,@(if source + `(("source" ,source)) + '()) ,@inputs + + ;; Keep the standard inputs of 'gnu-build-system'. + ,@(standard-packages))) + (build-inputs `(,@vim-inputs ,@native-inputs)) + (outputs outputs) + (build vim-build) + (arguments (strip-keyword-arguments private-keywords vim-arguments))))) + +(define* (vim-build name inputs + #:key guile + source + (vim? #f) + (neovim? #f) + (mode "start") + (plugin-name name) + (install-plan ''()) + (phases '(@ (guix build vim-build-system) %standard-phases)) + (outputs '("out")) + (search-paths '()) + (system (%current-system)) + (substitutable? #t) + (imported-modules %vim-build-system-modules) + (modules '((guix build vim-build-system) + (guix build utils)))) + + (define build + (with-imported-modules imported-modules + #~(begin + (use-modules #$@modules) + #$(with-build-variables inputs outputs + #~(vim-build #:name #$name + #:vim? #$vim? + #:neovim? #$neovim? + #:mode #$mode + #:plugin-name #$plugin-name + #:install-plan #$(if (pair? install-plan) + (sexp->gexp install-plan) + install-plan) + #:source #+source + #:system #$system + #:phases #$(if (pair? phases) + (sexp->gexp phases) + phases) + #:outputs %outputs + #:search-paths '#$(sexp->gexp + (map search-path-specification->sexp + search-paths)) + #:inputs + %build-inputs))))) + + (mlet %store-monad + ((guile (package->derivation (or guile (default-guile)) + system #:graft? #f))) + (gexp->derivation name + build + #:system system + #:target #f + #:graft? #f + #:substitutable? substitutable? + #:guile-for-build guile))) + +(define vim-build-system + (build-system (name 'vim) + (description "The standard Vim build system") + (lower lower))) + +;;; vim.scm ends here diff --git a/guix/build/vim-build-system.scm b/guix/build/vim-build-system.scm new file mode 100644 index 0000000000..28c0f8f83f --- /dev/null +++ b/guix/build/vim-build-system.scm @@ -0,0 +1,117 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Jonathan Scoresby +;;; Copyright © 2023 Efraim Flashner +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix build vim-build-system) + #:use-module ((guix build copy-build-system) + #:prefix copy:) + #:use-module (guix build utils) + #:use-module (ice-9 match) + #:use-module (ice-9 ftw) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + #:export (%standard-phases vim-build)) + +;; Commentary: +;; +;; System for installing vim and neovim plugins. It downloads +;; the source and copies the appropriate files to vim and nvim +;; packpaths. It then generates helptags. +;; +;; Code: + +(define copy:install + (assoc-ref copy:%standard-phases 'install)) + +(define vim-path + "/share/vim/vimfiles/pack/guix/") +(define nvim-path + "/share/nvim/site/pack/guix/") + +(define* (install #:key plugin-name + install-plan + neovim? + vim? + mode + outputs + #:allow-other-keys) + + (let* ((include-regexp '(".*\\/.*\\/.*")) + (exclude-regexp '("^scripts/.*" + "tests?/.*" "^t/.*" + "assets/.*" + ".*\\/\\..*")) + (vim-install (if vim? + `(("." ,(string-append vim-path mode "/" plugin-name "/") + #:include-regexp ,include-regexp + #:exclude-regexp ,exclude-regexp)) + '())) + (neovim-install (if neovim? + `(("." ,(string-append nvim-path mode "/" plugin-name "/") + #:include-regexp ,include-regexp + #:exclude-regexp ,exclude-regexp)) + '()))) + (copy:install #:outputs outputs + #:install-plan (append vim-install + neovim-install + install-plan)))) + +(define* (generate-helptags #:key plugin-name + neovim? + vim? + mode + outputs + #:allow-other-keys) + + (define (vim-generate output) + (invoke "vim" "--clean" "-en" "--cmd" + (string-append "helptags " + output vim-path mode "/" plugin-name "/doc") + "--cmd" "q")) + + (define (neovim-generate output) + (invoke "nvim" "--clean" "--headless" "-en" "--cmd" + (string-append "helptags " + output nvim-path mode "/" plugin-name "/doc") + "--cmd" "q")) + + (when (scandir "./doc") + (let ((out (assoc-ref outputs "out"))) + (when vim? + (vim-generate out)) + (when neovim? + (neovim-generate out))))) + +(define %standard-phases + ;; Everything is as with the Copy Build System except for + ;; the addition of the generate-helptags phase and a few + ;; custom actions are added to the install phase + (modify-phases copy:%standard-phases + (replace 'install install) + (add-after 'install 'generate-helptags generate-helptags))) + +(define* (vim-build #:key inputs + (phases %standard-phases) + #:allow-other-keys #:rest args) + "Build the given package, applying all of PHASES in order." + (apply copy:copy-build + #:inputs inputs + #:phases phases + args)) + +;;; vim-build-system.scm ends here -- Efraim Flashner רנשלפ םירפא GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted