From patchwork Wed Oct 31 06:09:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alex Vong X-Patchwork-Id: 63 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id AA4F41676A; Wed, 31 Oct 2018 06:11:12 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) by mira.cbaines.net (Postfix) with ESMTPS id 1CDB51675C for ; Wed, 31 Oct 2018 06:11:12 +0000 (GMT) Received: from localhost ([::1]:57500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHjih-00040s-Cm for patchwork@mira.cbaines.net; Wed, 31 Oct 2018 02:11:11 -0400 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 X-Loop: help-debbugs@gnu.org Subject: [bug#33215] [PATCH 05/11] guix: Add clojure-utils. References: <87muquhcw3.fsf@gmail.com> In-Reply-To: <87muquhcw3.fsf@gmail.com> Resent-From: Alex Vong Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 31 Oct 2018 06:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33215 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 33215@debbugs.gnu.org Received: via spool by 33215-submit@debbugs.gnu.org id=B33215.154096620325756 (code B ref 33215); Wed, 31 Oct 2018 06:11:01 +0000 Received: (at 33215) by debbugs.gnu.org; 31 Oct 2018 06:10:03 +0000 Received: from localhost ([127.0.0.1]:56180 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHjhZ-0006hA-Ty for submit@debbugs.gnu.org; Wed, 31 Oct 2018 02:10:02 -0400 Received: from mail-pf1-f181.google.com ([209.85.210.181]:34415) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHjhX-0006gm-QY for 33215@debbugs.gnu.org; Wed, 31 Oct 2018 02:10:00 -0400 Received: by mail-pf1-f181.google.com with SMTP id f78-v6so7089375pfe.1 for <33215@debbugs.gnu.org>; Tue, 30 Oct 2018 23:09:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:user-agent:mime-version; bh=Kd6947j+CsYUmJV1durd0JVj37sg7sOyURDayNTTcV4=; b=gMeeFYRmIysDFwJJJ/H/XTw53gmVyNg7dM6eVz3Lm+zusWyDhsCzzmGnqevsI+wkgz LR/WUC6Aq9ZDPXT/NNyLASrnsOqr1yH6tPm9C1xQs/yv05tjE1OLK5uld2umsPwV7qWx bSYC5UA+D+uGfmYMG0ZLdKEOC4YADvICWF1wacCZ7xrMRfMGd4n8fIWWZFpeR0TqGZlx IBz7NuOit4FUH/Y+7n0MAhPVmfQmCeyqa12dTwiLvzs8l0newdVsTcr3QMf8R6moVmOk 0emGrNYx3WgDbHRv/pga5TIzNedbMRgTvrishTGXnHRXk7T8a7/Jwr6WoTo5PxTX+oMs WUvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :mime-version; bh=Kd6947j+CsYUmJV1durd0JVj37sg7sOyURDayNTTcV4=; b=h/ljzVxUDtgyW+WJZyPsfkuMXEbzBI9F2QZeSXFGWpLKN6MXxvVb9ko4exjpLsGS8u TKlkRStay8YdWM+vHD/iWhBueOM277Q+eizQbblG6yGTXfCfguQlAwVUxW+/WtTKTl4S IkY+sSF4fyeE3xpW5GoQeZZ/eVK1C2kmSzmZkVZKWU6jHUvrFP1dqAtKUlbu9m+/Wk56 fEnMvDowHFZkkvSQ7M1K4POcBsq71W7jWXmd8e0pHUc1yej/WIotIVuCsHxXtS447o3A 7jVB+CpVHiZIyWEHy1pkud7n1Pl/nBfAgNgW1L0BflDdPFH82Nkt48yNLKKwEsyOHxVv tLuQ== X-Gm-Message-State: AGRZ1gL5pJc9nHCUFRxkwsloulKnAugaHRvW1uq8tq9TkePVpi7oVSiv 7IF28x14qq7+ARpV2TZRgyY= X-Google-Smtp-Source: AJdET5eGlp3odc5evSkAr2baefB0cle4+L5iOWLZs4WJzzBSbhJDwYS2c3qyLALeKZOcqO95GzuCqg== X-Received: by 2002:a62:cd47:: with SMTP id o68-v6mr1989224pfg.12.1540966194312; Tue, 30 Oct 2018 23:09:54 -0700 (PDT) Received: from debian (42-3-197-089.static.netvigator.com. [42.3.197.89]) by smtp.gmail.com with ESMTPSA id j5-v6sm29148882pgm.79.2018.10.30.23.09.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Oct 2018 23:09:53 -0700 (PDT) From: Alex Vong Date: Wed, 31 Oct 2018 14:09:50 +0800 Message-ID: <871s86hck1.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexvong1995@gmail.com Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches From 857cce37325f01c26f79a6e15e33d7988ea4a0a2 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. --- 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 --- a/Makefile.am +++ b/Makefile.am @@ -12,6 +12,7 @@ # Copyright © 2018 Nils Gillmann # Copyright © 2018 Julien Lepiller # Copyright © 2018 Oleg Pykhalov +# Copyright © 2018 Alex Vong # # This file is part of GNU Guix. # @@ -172,6 +173,7 @@ MODULES = \ 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 --- 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 - `(#: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) - (ice-9 ftw) - (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 "./")) - (add-after 'install 'install-doc - (lambda* (#:key outputs #:allow-other-keys) - (let ((doc-dir (string-append (assoc-ref outputs "out") - "/share/doc/clojure-" - ,version "/"))) - (copy-recursively "doc/clojure" doc-dir) - (for-each (cut install-file <> doc-dir) - (filter (cut string-match - ".*\\.(html|markdown|md|txt)" - <>) - (scandir "./"))) - #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 --- /dev/null +++ b/guix/build/clojure-utils.scm @@ -0,0 +1,65 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 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 files." + (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)) -- 2.19.1