From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqxVx-0006fm-PE for guix-patches@gnu.org; Wed, 28 Feb 2018 03:55:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqxVu-0000OQ-IX for guix-patches@gnu.org; Wed, 28 Feb 2018 03:55:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:56768) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqxVu-0000OH-9Q for guix-patches@gnu.org; Wed, 28 Feb 2018 03:55:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eqxVu-00068x-22 for guix-patches@gnu.org; Wed, 28 Feb 2018 03:55:02 -0500 Subject: [bug#30385] Add vim-build-system Resent-Message-ID: Date: Wed, 28 Feb 2018 08:54:17 +0000 From: ng0 Message-ID: <20180228085417.b2o725dxstovrwic@abyayala> References: <87a7wkv3eh.fsf@abyayala.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bby7qmk6raz3dxfv" Content-Disposition: inline In-Reply-To: <87a7wkv3eh.fsf@abyayala.i-did-not-set--mail-host-address--so-tickle-me> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 30385@debbugs.gnu.org --bby7qmk6raz3dxfv Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable ng0@crash.cx transcribed 19K bytes: > This adds a first version of a functional vim-build-system. >=20 > As explained today on IRC, and as you can guess by reading > gnu/packages/vim.scm Vim has a concept of folders and files in > standard places, but Makefiles and similar tools are an > exception. Usually you have to copy them somewhere (or use > external Vim package managers that pull the files for yoz and set > the "run time path" (rtp) for you). >=20 > There's also (to my best knowledge, keep in mind I've last read > into Vim when I did the last commits in the Vim module) no ENV > VAR or anything we could export, you have to manually set >=20 > set rtp+=3D~/.guix-profile/share/vim/vimfiles/ >=20 > in your $home/.vimrc >=20 > The build system comes with a FIXME note, but it works. I'm in > the middle of tests and exams, so this is the best I can correct > from my earlier attempt in '17 on this. What I can apply are > changes and adjustments to what I submit now. >=20 > 4 Patches attached, 3 of them are for proof of work. >=20 Are 4 patches too much? Do we have no vim users here? I've never written a build system for Guix before, so if anyone feels like doing the QA here that would be nice. > From 617fc10671c18c35c0e3fcd6bc0c9d06a96a4ebf Mon Sep 17 00:00:00 2001 > From: ng0 > Date: Sun, 2 Jul 2017 16:07:48 +0000 > Subject: [PATCH 1/4] build-system: Add 'vim-build-system'. >=20 > * 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. > --- > Makefile.am | 4 +- > 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 >=20 > diff --git a/Makefile.am b/Makefile.am > index eb5d38231..72ad184ef 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -9,7 +9,7 @@ > # Copyright =C2=A9 2017 Ricardo Wurmus > # Copyright =C2=A9 2017 Jan Nieuwenhuizen > # Copyright =C2=A9 2017 Arun Isaac > -# Copyright =C2=A9 2018 ng0 > +# Copyright =C2=A9 2018 ng0 > # > # This file is part of GNU Guix. > # > @@ -106,6 +106,7 @@ MODULES =3D \ > 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 =3D \ > 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/git.scm \ > guix/build/hg.scm \ > guix/build/glib-or-gtk-build-system.scm \ > diff --git a/guix/build-system/vim.scm b/guix/build-system/vim.scm > new file mode 100644 > index 000000000..67657c7d8 > --- /dev/null > +++ b/guix/build-system/vim.scm > @@ -0,0 +1,129 @@ > +;;; GNU Guix --- Functional package management for GNU > +;;; Copyright =C2=A9 2018 ng0 > +;;; > +;;; 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 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 > + vim-build > + vim-build-system)) > + > +;; Commentary: > +;; > +;; Standard build procedure for vim packages. This is > +;; implemented as an extension of 'gnu-build-system'. > +;; > +;; Code: > + > +(define %vim-build-system-modules > + ;; Build-side modules imported by default. > + `((guix build vim-build-system) > + ,@%gnu-build-system-modules)) > + > +(define* (lower name > + #:key source inputs native-inputs outputs system target > + #:allow-other-keys > + #:rest arguments) > + "Return a bag for NAME." > + (define private-keywords > + '(#:target #:inputs #:native-inputs)) > + > + (bag > + (name name) > + (system system) > + (host-inputs `(,@(if source > + `(("source" ,source)) > + '()) > + ,@inputs > + ,(list "tar" (module-ref (resolve-interface '(gnu pac= kages base)) 'tar)) > + ,@(let ((compression (resolve-interface '(gnu package= s compression)))) > + (map (match-lambda > + ((name package) > + (list name (module-ref compression packag= e)))) > + `(("gzip" gzip) > + ("bzip2" bzip2) > + ("unzip" unzip) > + ("xz" xz)))))) > + (build-inputs native-inputs) > + (outputs outputs) > + (build vim-build) > + (arguments (strip-keyword-arguments private-keywords arguments)))) > + > +(define* (vim-build store name inputs > + #:key source > + (tests? #t) > + (test-target "test") > + (configure-flags ''()) > + (phases '(@ (guix build vim-build-system) > + %standard-phases)) > + (outputs '("out")) > + (search-paths '()) > + (system (%current-system)) > + (guile #f) > + (imported-modules %vim-build-system-modules) > + (modules '((guix build vim-build-system) > + (guix build utils)))) > + "Build SOURCE with INPUTS." > + (define builder > + `(begin > + (use-modules ,@modules) > + (vim-build #:name ,name > + #:source ,(match (assoc-ref inputs "source") > + (((? derivation? source)) > + (derivation->output-path source)) > + ((source) > + source) > + (source > + source)) > + #:configure-flags ,configure-flags > + #:system ,system > + #:test-target ,test-target > + #:tests? ,tests? > + #:phases ,phases > + #:outputs %outputs > + #:search-paths ',(map search-path-specification->sexp > + search-paths) > + #:inputs %build-inputs))) > + > + (define guile-for-build > + (match guile > + ((? package?) > + (package-derivation store guile system #:graft? #f)) > + (#f ; the default > + (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 > + #:inputs inputs > + #:system system > + #:modules imported-modules > + #:outputs outputs > + #:guile-for-build guile-for-build)) > + > +(define vim-build-system > + (build-system > + (name 'vim) > + (description "The build system for vim packages") > + (lower lower))) > diff --git a/guix/build/vim-build-system.scm b/guix/build/vim-build-syste= m.scm > new file mode 100644 > index 000000000..70e8129df > --- /dev/null > +++ b/guix/build/vim-build-system.scm > @@ -0,0 +1,93 @@ > +;;; GNU Guix --- Functional package management for GNU > +;;; Copyright =C2=A9 2018 ng0 > +;;; > +;;; 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 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 > + %default-exclude > + vim-build)) > + > +;; Commentary: > +;; > +;; Builder-side code of the build procedure for vim packages. > +;; > +;; Code: > + > +;; These are the default inclusion/exclusion regexps for the install pha= se. > +(define %default-exclude '("^\\.github$" "^.*\\.md$" "LICENSE" "COPYING" > + "^.*\\README.*$" "^\\.travis\\.yml$" > + "^.*\\Makefile.*$")) > + > +(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 > + (basename > + (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) > + (begin > + (mkdir "source") > + (chdir "source") > + (copy-file source (store-file->vim-source-file source)) > + #t) > + (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-t= erm > +;; solution to exclusion of files that are not used at runtime. > +(define* (install #:key outputs > + (exclude %default-exclude) > + #:allow-other-keys) > + "Install the package contents." > + (let* ((out (assoc-ref outputs "out")) > + (source (getcwd)) > + (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$")) > + (mkdir out) > + (copy-recursively "." vimfiles) > + #t)) > + > +(define %standard-phases > + (modify-phases gnu:%standard-phases > + (replace 'unpack unpack) > + (delete 'configure) > + (delete 'check) > + (delete 'build) > + (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)) > --=20 > 2.16.1 >=20 > From 1b0a5ec5e59f65cfd6424a53e3bb24ad40586ed5 Mon Sep 17 00:00:00 2001 > From: ng0 > Date: Sun, 2 Jul 2017 16:11:19 +0000 > Subject: [PATCH 2/4] gnu: vim-neocomplete: Use 'vim-build-system'. >=20 > * gnu/packages/vim.scm (vim-neocomplete): Switch to 'vim-build-system'. > --- > gnu/packages/vim.scm | 20 ++------------------ > 1 file changed, 2 insertions(+), 18 deletions(-) >=20 > 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 > @@ -29,6 +29,7 @@ > #: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."))) > (sha256 > (base32 > "1307gbrdwam2akq9w2lpijc41740i4layk2qkd9sjkqxfch5lni2")))) > - (build-system gnu-build-system) > - (arguments > - `(#:tests? #f > - #:phases > - (modify-phases %standard-phases > - (delete 'configure) > - (delete 'build) > - (replace 'install > - (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) > - #t)))))) > + (build-system vim-build-system) > (synopsis "Next generation completion framework for Vim") > (description > "@code{neocomplete}, an abbreviation of 'neo-completion with cache', > --=20 > 2.16.1 >=20 > From cdbd15cf00e0bc1489437845f6c7f60fd517ab9a Mon Sep 17 00:00:00 2001 > From: ng0 > Date: Wed, 7 Feb 2018 22:07:14 +0000 > Subject: [PATCH 3/4] gnu: vim-neosnippet-snippets: Use 'vim-build-system'. >=20 > * gnu/packages/vim.scm (vim-neosnippet-snippets): Switch to 'vim-build-sy= stem'. > --- > gnu/packages/vim.scm | 17 ++--------------- > 1 file changed, 2 insertions(+), 15 deletions(-) >=20 > 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 > @@ -1,7 +1,7 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright =C2=A9 2013 Cyril Roelandt > ;;; Copyright =C2=A9 2016, 2017, 2018 Efraim Flashner > -;;; Copyright =C2=A9 2016, 2017 ng0 > +;;; Copyright =C2=A9 2016, 2017, 2018 ng0 > ;;; Copyright =C2=A9 2017 Ricardo Wurmus > ;;; Copyright =C2=A9 2017 Marius Bakke > ;;; Copyright =C2=A9 2018 Tobias Geerinckx-Rice > @@ -238,20 +238,7 @@ features than Vim's built-in completion.") > (sha256 > (base32 > "151wpvbj6jb9jdkbhj3b77f5sq7y328spvwfbqyj1y32rg4ifmc6")))) > - (build-system gnu-build-system) > - (arguments > - `(#:tests? #f > - #:phases > - (modify-phases %standard-phases > - (delete 'configure) > - (delete 'build) > - (replace 'install > - (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= ")) > - #t)))))) > + (build-system vim-build-system) > (synopsis "Snippets for neosnippet") > (description > "@code{neosnippet-snippets} provides standard snippets for the Vim = plugin > --=20 > 2.16.1 >=20 > From 09cc9c735da27d0adb1ef141bbd2b7d37e1d6754 Mon Sep 17 00:00:00 2001 > From: ng0 > Date: Wed, 7 Feb 2018 22:14:58 +0000 > Subject: [PATCH 4/4] gnu: vim-neosnippet: Use 'vim-build-system'. >=20 > * gnu/packages/vim.scm (vim-neosnippet): Switch to 'vim-build-system'. > --- > gnu/packages/vim.scm | 29 +---------------------------- > 1 file changed, 1 insertion(+), 28 deletions(-) >=20 > 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.") > (sha256 > (base32 > "0k80syscmpnj38ks1fq02ds59g0r4jlg9ll7z4qc048mgi35alw5")))) > - (build-system gnu-build-system) > - (arguments > - `(#:tests? #f > - #:phases > - (modify-phases %standard-phases > - (delete 'configure) > - (delete 'build) > - (replace 'install > - (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) > - #t)))))) > + (build-system vim-build-system) > (synopsis "Snippet support for Vim") > (description > "@code{neosnippet}, is a plugin for Vim which adds snippet support = to Vim. > --=20 > 2.16.1 >=20 > --=20 > ng0 :: https://ea.n0.is > A88C8ADD129828D7EAC02E52E22F9BBFEE348588 :: https://ea.n0.is/keys/ --=20 A88C8ADD129828D7EAC02E52E22F9BBFEE348588 https://n0.is --bby7qmk6raz3dxfv Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEqIyK3RKYKNfqwC5S4i+bv+40hYgFAlqWbjkACgkQ4i+bv+40 hYiHFxAAqi0H/0Nouq+xpaokYIoP6ExTY25ZlcT1SN0MTCuvb5ituav2+suS/Aq8 iYqXgUdKwm/XmZf7xupEjD/3lMR+0Vq+6+ESe0hiQuuswTT1GHs1JFpYUN8h5zkv 7l6Yw0yo6T2BTP83+8ZguzFxIzEG1OwDh04P1cn8kE4jc0J0n3RsxlPP0iDLdWpt jQfd1LSkYMiXl9KHACJyU6p7ftpgSnv98Z1MRq4KcVa1Uco0n9Ebx4DVwH8h5QRU WFg+sChRZ6FJ+jOnrPG6MG+otUxosiyvzX3Fjtu6/vT1Sg24AIuY4igCCNQuNUip zSJ34mf5tXKZXp7DiSVv2cBVHeLf4fv8yUUEzubxxp9BQ8ZfVNBW2x4yAnZRXFu0 lvq3CTiTtK23P8lXZ5jatyhZ3dZT0k+OMbkHR1co/nPz1LctLcVMiECIVvUqvyYu zIPJec13EElgrzrpFiI/WtTLUTOvI8DVD0S+nvNXWEZPTT5sLjhhTcWELSkwW4Vp 97oOc1Q9UwBf0hLRsTgHXc4wppT9cw+SU3Cej5IkelbCPHBAcfaDKuutsHRef6oE Kq8kI11C33uK7xkBesbe97bVBKXMx5VgGzTmtBhmlP7FunulV1dXu1JVET1zg5bq LDSUApLKtc+7MBO3V8FcJVus9crloN2zKQToOc5AiiS/VOtKoDg= =wUbP -----END PGP SIGNATURE----- --bby7qmk6raz3dxfv--