Toggle quote (446 lines)
> From 617fc10671c18c35c0e3fcd6bc0c9d06a96a4ebf Mon Sep 17 00:00:00 2001
> From: ng0 <ng0@infotropique.org>
> Date: Sun, 2 Jul 2017 16:07:48 +0000
> Subject: [PATCH 1/4] build-system: Add 'vim-build-system'.
> * Makefile.am (MODULES): Add 'guix/build-system/vim.scm' and
> 'guix/build/vim-build-system.scm'.
> * guix/build-system/vim.scm: New file.
> * guix/build/vim-build-system.scm: New file.
> guix/build-system/vim.scm | 129 ++++++++++++++++++++++++++++++++++++++++
> guix/build/vim-build-system.scm | 93 +++++++++++++++++++++++++++++
> 3 files changed, 225 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 eb5d38231..72ad184ef 100644
> # Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
> # Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
> # Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
> -# Copyright © 2018 ng0 <ng0@n0.is>
> +# Copyright © 2018 ng0 <ng0@crash.cx>
> # This file is part of GNU Guix.
> @@ -106,6 +106,7 @@ MODULES = \
> guix/build-system/perl.scm \
> guix/build-system/python.scm \
> guix/build-system/ocaml.scm \
> + guix/build-system/vim.scm \
> guix/build-system/waf.scm \
> guix/build-system/r.scm \
> guix/build-system/ruby.scm \
> @@ -134,6 +135,7 @@ MODULES = \
> guix/build/font-build-system.scm \
> guix/build/go-build-system.scm \
> guix/build/asdf-build-system.scm \
> + guix/build/vim-build-system.scm \
> guix/build/glib-or-gtk-build-system.scm \
> diff --git a/guix/build-system/vim.scm b/guix/build-system/vim.scm
> index 000000000..67657c7d8
> +++ b/guix/build-system/vim.scm
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2018 ng0 <ng0@crash.cx>
> +;;; 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 <http://www.gnu.org/licenses/>.
> +(define-module (guix build-system vim)
> + #:use-module (guix utils)
> + #:use-module (guix packages)
> + #:use-module (guix derivations)
> + #:use-module (guix store)
> + #:use-module (guix search-paths)
> + #:use-module (guix build-system)
> + #:use-module (guix build-system gnu)
> + #:use-module (ice-9 match)
> + #:export (%vim-build-system-modules
> +;; Standard build procedure for vim packages. This is
> +;; implemented as an extension of 'gnu-build-system'.
> +(define %vim-build-system-modules
> + ;; Build-side modules imported by default.
> + `((guix build vim-build-system)
> + ,@%gnu-build-system-modules))
> + #:key source inputs native-inputs outputs system target
> + "Return a bag for NAME."
> + (define private-keywords
> + '(#:target #:inputs #:native-inputs))
> + (host-inputs `(,@(if source
> + `(("source" ,source))
> + ,(list "tar" (module-ref (resolve-interface '(gnu packages base)) 'tar))
> + ,@(let ((compression (resolve-interface '(gnu packages compression))))
> + (list name (module-ref compression package))))
> + (build-inputs native-inputs)
> + (arguments (strip-keyword-arguments private-keywords arguments))))
> +(define* (vim-build store name inputs
> + (configure-flags ''())
> + (phases '(@ (guix build vim-build-system)
> + (system (%current-system))
> + (imported-modules %vim-build-system-modules)
> + (modules '((guix build vim-build-system)
> + (guix build utils))))
> + "Build SOURCE with INPUTS."
> + (use-modules ,@modules)
> + (vim-build #:name ,name
> + #:source ,(match (assoc-ref inputs "source")
> + (((? derivation? source))
> + (derivation->output-path source))
> + #:configure-flags ,configure-flags
> + #:test-target ,test-target
> + #:search-paths ',(map search-path-specification->sexp
> + #:inputs %build-inputs)))
> + (define guile-for-build
> + (package-derivation store guile system #:graft? #f))
> + (let* ((distro (resolve-interface '(gnu packages commencement)))
> + (guile (module-ref distro 'guile-final)))
> + (package-derivation store guile system #:graft? #f)))))
> + (build-expression->derivation store name builder
> + #:modules imported-modules
> + #:guile-for-build guile-for-build))
> +(define vim-build-system
> + (description "The build system for vim packages")
> diff --git a/guix/build/vim-build-system.scm b/guix/build/vim-build-system.scm
> index 000000000..70e8129df
> +++ b/guix/build/vim-build-system.scm
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2018 ng0 <ng0@crash.cx>
> +;;; 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 <http://www.gnu.org/licenses/>.
> +(define-module (guix build vim-build-system)
> + #:use-module ((guix build gnu-build-system) #:prefix gnu:)
> + #:use-module (guix build utils)
> + #:use-module (srfi srfi-1)
> + #:use-module (srfi srfi-11)
> + #:use-module (srfi srfi-26)
> + #:export (%standard-phases
> +;; Builder-side code of the build procedure for vim packages.
> +;; These are the default inclusion/exclusion regexps for the install phase.
> +(define %default-exclude '("^\\.github$" "^.*\\.md$" "LICENSE" "COPYING"
> + "^.*\\README.*$" "^\\.travis\\.yml$"
> +(define gnu:unpack (assoc-ref gnu:%standard-phases 'unpack))
> +(define (store-file->vim-source-file file)
> + "Convert FILE, a store file name for an Vim source file, into a file
> +name that has been stripped of the hash and version number."
> + (let ((suffix ".vim"))
> + (let-values (((name version)
> + (package-name->name+version
> + (strip-store-file-name file) suffix))))
> + (string-append name suffix))))
> +(define* (unpack #:key source #:allow-other-keys)
> + "Unpack SOURCE into the build directory. SOURCE may be a compressed
> +archive, a directory or a '.vim' file."
> + (if (string-suffix? ".vim" source)
> + (copy-file source (store-file->vim-source-file source))
> + (gnu:unpack #:source source)))
> +;; FIXME: Files like README.md and other, more unpredictable file names,
> +;; are currently being installed. Because there is no concept of a
> +;; standardized build-system in Vim extensions, we have to find a long-term
> +;; solution to exclusion of files that are not used at runtime.
> +(define* (install #:key outputs
> + (exclude %default-exclude)
> + "Install the package contents."
> + (let* ((out (assoc-ref outputs "out"))
> + (vimfiles (string-append out "/share/vim/vimfiles")))
> + (for-each delete-file-recursively
> + (find-files source "^\\.git$"))
> + (for-each delete-file-recursively
> + (find-files source "^\\.gitignore$"))
> + (copy-recursively "." vimfiles)
> +(define %standard-phases
> + (modify-phases gnu:%standard-phases
> + (replace 'unpack unpack)
> + (replace 'install install)))
> +(define* (vim-build #:key inputs (phases %standard-phases)
> + #:allow-other-keys #:rest args)
> + "Build the given vim package, applying all of PHASES in order."
> + (apply gnu:gnu-build #:inputs inputs #:phases phases args))
> From 1b0a5ec5e59f65cfd6424a53e3bb24ad40586ed5 Mon Sep 17 00:00:00 2001
> From: ng0 <ng0@infotropique.org>
> Date: Sun, 2 Jul 2017 16:11:19 +0000
> Subject: [PATCH 2/4] gnu: vim-neocomplete: Use 'vim-build-system'.
> * gnu/packages/vim.scm (vim-neocomplete): Switch to 'vim-build-system'.
> gnu/packages/vim.scm | 20 ++------------------
> 1 file changed, 2 insertions(+), 18 deletions(-)
> diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
> index abd25bc9d..7a843a0ab 100644
> --- a/gnu/packages/vim.scm
> +++ b/gnu/packages/vim.scm
> #:use-module (guix git-download)
> #:use-module (guix build-system cmake)
> #:use-module (guix build-system gnu)
> + #:use-module (guix build-system vim)
> #:use-module (gnu packages)
> #:use-module (gnu packages acl)
> #:use-module (gnu packages admin) ; For GNU hostname
> @@ -209,24 +210,7 @@ with the editor vim.")))
> "1307gbrdwam2akq9w2lpijc41740i4layk2qkd9sjkqxfch5lni2"))))
> - (build-system gnu-build-system)
> - (modify-phases %standard-phases
> - (lambda* (#:key outputs #:allow-other-keys)
> - (let* ((out (assoc-ref outputs "out"))
> - (vimfiles (string-append out "/share/vim/vimfiles"))
> - (autoload (string-append vimfiles "/autoload"))
> - (doc (string-append vimfiles "/doc"))
> - (plugin (string-append vimfiles "/plugin")))
> - (copy-recursively "autoload" autoload)
> - (copy-recursively "doc" doc)
> - (copy-recursively "plugin" plugin)
> + (build-system vim-build-system)
> (synopsis "Next generation completion framework for Vim")
> "@code{neocomplete}, an abbreviation of 'neo-completion with cache',
> From cdbd15cf00e0bc1489437845f6c7f60fd517ab9a Mon Sep 17 00:00:00 2001
> From: ng0 <ng0@crash.cx>
> Date: Wed, 7 Feb 2018 22:07:14 +0000
> Subject: [PATCH 3/4] gnu: vim-neosnippet-snippets: Use 'vim-build-system'.
> * gnu/packages/vim.scm (vim-neosnippet-snippets): Switch to 'vim-build-system'.
> gnu/packages/vim.scm | 17 ++---------------
> 1 file changed, 2 insertions(+), 15 deletions(-)
> diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
> index 7a843a0ab..13afbaeb4 100644
> --- a/gnu/packages/vim.scm
> +++ b/gnu/packages/vim.scm
> ;;; GNU Guix --- Functional package management for GNU
> ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
> ;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
> -;;; Copyright © 2016, 2017 ng0 <ng0@infotropique.org>
> +;;; Copyright © 2016, 2017, 2018 ng0 <ng0@crash.cx>
> ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
> ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
> ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
> @@ -238,20 +238,7 @@ features than Vim's built-in completion.")
> "151wpvbj6jb9jdkbhj3b77f5sq7y328spvwfbqyj1y32rg4ifmc6"))))
> - (build-system gnu-build-system)
> - (modify-phases %standard-phases
> - (lambda* (#:key outputs #:allow-other-keys)
> - (let* ((out (assoc-ref outputs "out"))
> - (vimfiles (string-append out "/share/vim/vimfiles")))
> - (copy-recursively "neosnippets"
> - (string-append vimfiles "/neosnippets"))
> + (build-system vim-build-system)
> (synopsis "Snippets for neosnippet")
> "@code{neosnippet-snippets} provides standard snippets for the Vim plugin
> From 09cc9c735da27d0adb1ef141bbd2b7d37e1d6754 Mon Sep 17 00:00:00 2001
> From: ng0 <ng0@crash.cx>
> Date: Wed, 7 Feb 2018 22:14:58 +0000
> Subject: [PATCH 4/4] gnu: vim-neosnippet: Use 'vim-build-system'.
> * gnu/packages/vim.scm (vim-neosnippet): Switch to 'vim-build-system'.
> gnu/packages/vim.scm | 29 +----------------------------
> 1 file changed, 1 insertion(+), 28 deletions(-)
> diff --git a/gnu/packages/vim.scm b/gnu/packages/vim.scm
> index 13afbaeb4..99361fa5d 100644
> --- a/gnu/packages/vim.scm
> +++ b/gnu/packages/vim.scm
> @@ -264,34 +264,7 @@ you can fill in on the fly.")
> "0k80syscmpnj38ks1fq02ds59g0r4jlg9ll7z4qc048mgi35alw5"))))
> - (build-system gnu-build-system)
> - (modify-phases %standard-phases
> - (lambda* (#:key outputs #:allow-other-keys)
> - (let* ((out (assoc-ref outputs "out"))
> - (vimfiles (string-append out "/share/vim/vimfiles"))
> - (autoload (string-append vimfiles "/autoload"))
> - (doc (string-append vimfiles "/doc"))
> - (ftdetect (string-append vimfiles "/ftdetect"))
> - (ftplugin (string-append vimfiles "/ftplugin"))
> - (indent (string-append vimfiles "/indent"))
> - (plugin (string-append vimfiles "/plugin"))
> - (rplugin (string-append vimfiles "/rplugin"))
> - (syntax (string-append vimfiles "/syntax")))
> - (copy-recursively "autoload" autoload)
> - (copy-recursively "doc" doc)
> - (copy-recursively "ftdetect" ftdetect)
> - (copy-recursively "ftplugin" ftplugin)
> - (copy-recursively "indent" indent)
> - (copy-recursively "plugin" plugin)
> - (copy-recursively "rplugin" rplugin)
> - (copy-recursively "syntax" syntax)
> + (build-system vim-build-system)
> (synopsis "Snippet support for Vim")
> "@code{neosnippet}, is a plugin for Vim which adds snippet support to Vim.
> ng0 :: https://ea.n0.is
> A88C8ADD129828D7EAC02E52E22F9BBFEE348588 :: https://ea.n0.is/keys/