From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57852) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHjic-00040k-6m for guix-patches@gnu.org; Wed, 31 Oct 2018 02:11:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHjiY-0002Zj-3n for guix-patches@gnu.org; Wed, 31 Oct 2018 02:11:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:51925) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHjiX-0002ZO-Tj for guix-patches@gnu.org; Wed, 31 Oct 2018 02:11:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gHjiX-0006ir-O0 for guix-patches@gnu.org; Wed, 31 Oct 2018 02:11:01 -0400 Subject: [bug#33215] [PATCH 05/11] guix: Add clojure-utils. References: <87muquhcw3.fsf@gmail.com> In-Reply-To: <87muquhcw3.fsf@gmail.com> Resent-Message-ID: From: Alex Vong Date: Wed, 31 Oct 2018 14:09:50 +0800 Message-ID: <871s86hck1.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" 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: 33215@debbugs.gnu.org Cc: alexvong1995@gmail.com --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=0005-guix-Add-clojure-utils.patch Content-Transfer-Encoding: quoted-printable From=20857cce37325f01c26f79a6e15e33d7988ea4a0a2 Mon Sep 17 00:00:00 2001 From: Alex Vong Date: Sun, 14 Oct 2018 03:09:48 +0800 Subject: [PATCH 05/11] guix: Add clojure-utils. * guix/build/clojure-utils.scm: New file. * gnu/packages/lisp.scm (clojure)[arguments]: Use it. * Makefile.am (MODULES): Add it. =2D-- Makefile.am | 2 ++ gnu/packages/lisp.scm | 23 +++++-------- guix/build/clojure-utils.scm | 65 ++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 15 deletions(-) create mode 100644 guix/build/clojure-utils.scm diff --git a/Makefile.am b/Makefile.am index 8c3df8f39..e2bc4d369 100644 =2D-- a/Makefile.am +++ b/Makefile.am @@ -12,6 +12,7 @@ # Copyright =C2=A9 2018 Nils Gillmann # Copyright =C2=A9 2018 Julien Lepiller # Copyright =C2=A9 2018 Oleg Pykhalov +# Copyright =C2=A9 2018 Alex Vong # # This file is part of GNU Guix. # @@ -172,6 +173,7 @@ MODULES =3D \ guix/build/syscalls.scm \ guix/build/gremlin.scm \ guix/build/debug-link.scm \ + guix/build/clojure-utils.scm \ guix/build/emacs-utils.scm \ guix/build/java-utils.scm \ guix/build/lisp-utils.scm \ diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm index c451aa4c1..ee43e5abf 100644 =2D-- a/gnu/packages/lisp.scm +++ b/gnu/packages/lisp.scm @@ -596,6 +596,7 @@ interface.") (library-names (match libraries (((library-name _) ...) library-name)))) + (package (name "clojure") (version "1.9.0") @@ -609,11 +610,13 @@ interface.") (base32 "0xjbzcw45z32vsn9pifp7ndysjzqswp5ig0jkjpivigh2ckkdzha"))= )) (build-system ant-build-system) (arguments =2D `(#:modules ((guix build ant-build-system) + `(#:imported-modules ((guix build clojure-utils) + (guix build guile-build-system) + ,@%ant-build-system-modules) + #:modules ((guix build ant-build-system) + (guix build clojure-utils) (guix build java-utils) (guix build utils) =2D (ice-9 ftw) =2D (ice-9 regex) (srfi srfi-26)) #:test-target "test" #:phases @@ -639,18 +642,8 @@ interface.") #t)) (add-after 'build 'build-javadoc ant-build-javadoc) (replace 'install (install-jars "./")) =2D (add-after 'install 'install-doc =2D (lambda* (#:key outputs #:allow-other-keys) =2D (let ((doc-dir (string-append (assoc-ref outputs "out") =2D "/share/doc/clojure-" =2D ,version "/"))) =2D (copy-recursively "doc/clojure" doc-dir) =2D (for-each (cut install-file <> doc-dir) =2D (filter (cut string-match =2D ".*\\.(html|markdown|md|txt)" =2D <>) =2D (scandir "./"))) =2D #t))) + (add-after 'install-license-files 'install-doc + (cut install-doc #:doc-dirs '("doc/clojure/") <...>)) (add-after 'install-doc 'install-javadoc (install-javadoc "target/javadoc/"))))) (native-inputs libraries) diff --git a/guix/build/clojure-utils.scm b/guix/build/clojure-utils.scm new file mode 100644 index 000000000..713dff2d8 =2D-- /dev/null +++ b/guix/build/clojure-utils.scm @@ -0,0 +1,65 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2018 Alex Vong +;;; +;;; 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 clojure-utils) + #:use-module (guix build utils) + #:use-module (ice-9 ftw) + #:use-module (ice-9 regex) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + #:export (%clojure-regex + define-with-docs + install-doc)) + +(define-syntax-rule (define-with-docs name docs val) + "Create top-level variable named NAME with doc string DOCS and value VAL= ." + (begin (define name val) + (set-object-property! name 'documentation docs))) + +(define-with-docs %doc-regex + "Default regex for matching the base name of top-level documentation fil= es." + (format #f + "(~a)|(\\.(html|markdown|md|txt)$)" + (@@ (guix build guile-build-system) + %documentation-file-regexp))) + +(define* (install-doc #:key + doc-dirs + (doc-regex %doc-regex) + outputs + #:allow-other-keys) + "Install the following to the default documentation directory: + +1. Top-level files with base name matching DOC-REGEX. +2. All files (recursively) inside DOC-DIRS. + +DOC-REGEX can be compiled or uncompiled." + (let* ((out (assoc-ref outputs "out")) + (doc (assoc-ref outputs "doc")) + (name-ver (strip-store-file-name out)) + (dest-dir (string-append (or doc out) "/share/doc/" name-ver "/")) + (doc-regex* (if (string? doc-regex) + (make-regexp doc-regex) + doc-regex))) + (for-each (cut install-file <> dest-dir) + (remove (compose file-exists? + (cut string-append dest-dir <>)) + (scandir "./" (cut regexp-exec doc-regex* <>)))) + (for-each (cut copy-recursively <> dest-dir) + doc-dirs) + #t)) =2D-=20 2.19.1 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQSof2ZdXkE0FM5aU4XzrkvbI+zaGwUCW9lHLgAKCRDzrkvbI+za G3+zAQCqyE2HY/IS0uyjVg0kSQRo794Sui3F1rOjM4+0RfTE7gD/SWWaFJBDxpTO QxZnbiUPxYe5KvPIkClkKHl/or0bSwE= =IgVB -----END PGP SIGNATURE----- --==-=-=--