From patchwork Thu Apr 28 13:28:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 38980 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 3070527BBEA; Thu, 28 Apr 2022 14:31:22 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E9AA927BBE9 for ; Thu, 28 Apr 2022 14:31:21 +0100 (BST) Received: from localhost ([::1]:34512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nk4Er-0000l8-3j for patchwork@mira.cbaines.net; Thu, 28 Apr 2022 09:31:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nk4Ea-0000hw-BX for guix-patches@gnu.org; Thu, 28 Apr 2022 09:31:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51903) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nk4EX-0000NT-UF for guix-patches@gnu.org; Thu, 28 Apr 2022 09:31:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nk4EX-0004sx-RY for guix-patches@gnu.org; Thu, 28 Apr 2022 09:31:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49607] [PATCH v3 1/3] gnu: idris: Use wrap-program to define IDRIS_CC References: In-Reply-To: Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 28 Apr 2022 13:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49607 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49607@debbugs.gnu.org Cc: Attila Lendvai Received: via spool by 49607-submit@debbugs.gnu.org id=B49607.165115260618597 (code B ref 49607); Thu, 28 Apr 2022 13:31:01 +0000 Received: (at 49607) by debbugs.gnu.org; 28 Apr 2022 13:30:06 +0000 Received: from localhost ([127.0.0.1]:45791 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nk4Dd-0004pt-I9 for submit@debbugs.gnu.org; Thu, 28 Apr 2022 09:30:05 -0400 Received: from mail-ed1-f43.google.com ([209.85.208.43]:40931) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nk4Da-0004p4-UL for 49607@debbugs.gnu.org; Thu, 28 Apr 2022 09:30:03 -0400 Received: by mail-ed1-f43.google.com with SMTP id p18so5533121edr.7 for <49607@debbugs.gnu.org>; Thu, 28 Apr 2022 06:30:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sHv4ZxAZOYzVJZucaEJkhZDG3DhDrFjXJgV7svKxmDA=; b=k7ERS1IkKoU8Uyj12fFWAWqPwYK7CSdpmqL44uQ7zt6E9CLmDDLhbnBeuZjeAl2QsB iarXVyUdmzX20cQt8zx+nO3u0/GB6Vabt2bi8pUeU5vjst8IW0OR2Bf7EVkutei3hSmV OXeclsM5w0BTnKNLnw3pSZAk8UbOfMZjUF8lThJrL8fvlEhUkxgVIaFRM0Y7OfoF8zD5 lK4wbvDAypAS/ZqbBA0qvjyv0l1HlGOmcXJ5WqeVB2A+he17bHjo1AjkRZGnq9dpA0Ii 1v2kyCeGj1Uz03H7Z0I1Ddo/1xOKXsxRjV5J1XQgzkHG3gyNgtWBc/6yC7usCnSzkGGY rqIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=sHv4ZxAZOYzVJZucaEJkhZDG3DhDrFjXJgV7svKxmDA=; b=B0DLgk91wOmEnp27YGaRrYbEDIk5BhzSP9jlI1DuyvRH+Ru4r2VcPKCIsnh3mouyqP fhFdxqHMV0x/c0QSn5y5xqZuIafW0bT60E2BF2h36S7MV8scImUrYbobviasOUxAyM3q bW08pEY8zjGcLxV4HXAQAMXfeMQPnrsBJp0furUTLoPBRZzPFjV2opamIqH1mYqVZUpr q7lSo+N2rqQs6JNXL+q2ZlKXhdTxwH6CbDbvs2xv/kABJiw4A1HhT5yoRw8xG3YM2TvE FeeLEZiYRQEABqTHctK0on2TGZgcYkmtACpBWRtyM4QPISIs6fUjAwNr4I26BgDAa//4 06vQ== X-Gm-Message-State: AOAM531cE/IivdMS9QR+U2g2ih2GUNyAaDC1fOpmqdtP8mpNTypn50uh q1h2ThfsNN2zQq+dYTL5vz+7ZS1MTcA= X-Google-Smtp-Source: ABdhPJzkYuWoHXyWCY3vh7rkb5ExsQwDhzYDyVnWKfRYTBu3zN77yuStXMWK5sx4C6TgKwsfoc7kSA== X-Received: by 2002:a05:6402:4404:b0:426:16f:c0f9 with SMTP id y4-20020a056402440400b00426016fc0f9mr11740426eda.31.1651152597016; Thu, 28 Apr 2022 06:29:57 -0700 (PDT) Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu. [89.132.245.188]) by smtp.gmail.com with ESMTPSA id d19-20020a170906c21300b006e7f0730353sm8365993ejz.101.2022.04.28.06.29.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Apr 2022 06:29:56 -0700 (PDT) From: Attila Lendvai Date: Thu, 28 Apr 2022 15:28:00 +0200 Message-Id: <20220428132801.8629-1-attila@lendvai.name> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Idris requires a C compiler at runtime to generate executables. * gnu/packages/idris.scm (idris) [inputs]: Add bash-minimal (for wrap-program). [phases]: Add wrap-program phase to define IDRIS_CC, use (cc-for-target). --- v3: i have rebased them to master, i.e. on top of the idris-1.3.4 update. it also cleans it up a bit more (e.g. got rid of the clang-toolchain dependency). gnu/packages/idris.scm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/gnu/packages/idris.scm b/gnu/packages/idris.scm index 8f08ed3a3e..61de4883b1 100644 --- a/gnu/packages/idris.scm +++ b/gnu/packages/idris.scm @@ -22,6 +22,7 @@ (define-module (gnu packages idris) #:use-module (gnu packages) + #:use-module (gnu packages bash) #:use-module (gnu packages haskell-check) #:use-module (gnu packages haskell-web) #:use-module (gnu packages haskell-xyz) @@ -35,7 +36,8 @@ (define-module (gnu packages idris) #:use-module (guix git-download) #:use-module (guix utils) #:use-module ((guix licenses) #:prefix license:) - #:use-module (guix packages)) + #:use-module (guix packages) + #:use-module (guix utils)) (define-public idris (package @@ -56,7 +58,8 @@ (define-public idris (list perl ghc-cheapskate ghc-tasty ghc-tasty-golden ghc-tasty-rerun)) (inputs - (list gmp + (list bash-minimal + gmp ncurses ghc-aeson ghc-annotated-wl-pprint @@ -132,7 +135,13 @@ (define-public idris (static (assoc-ref outputs "static")) (filename "/lib/idris/rts/libidris_rts.a")) (rename-file (string-append static filename) - (string-append out filename)))))))) + (string-append out filename))))) + (add-before 'check 'wrap-program + (lambda* (#:key outputs inputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (exe (string-append out "/bin/idris"))) + (wrap-program exe + `("IDRIS_CC" = (,',(cc-for-target)))))))))) (native-search-paths (list (search-path-specification (variable "IDRIS_LIBRARY_PATH") From patchwork Thu Apr 28 13:28:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 38981 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 6956F27BBEB; Thu, 28 Apr 2022 14:31:37 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 49EDC27BBEA for ; Thu, 28 Apr 2022 14:31:36 +0100 (BST) Received: from localhost ([::1]:35010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nk4F5-00017W-B6 for patchwork@mira.cbaines.net; Thu, 28 Apr 2022 09:31:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nk4Ea-0000hu-Ai for guix-patches@gnu.org; Thu, 28 Apr 2022 09:31:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51904) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nk4EY-0000NV-BL for guix-patches@gnu.org; Thu, 28 Apr 2022 09:31:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nk4EY-0004t4-8j for guix-patches@gnu.org; Thu, 28 Apr 2022 09:31:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49607] [PATCH v3 2/3] gnu: idris: Add idris2 0.5.1. Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 28 Apr 2022 13:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49607 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49607@debbugs.gnu.org Cc: Attila Lendvai Received: via spool by 49607-submit@debbugs.gnu.org id=B49607.165115262218698 (code B ref 49607); Thu, 28 Apr 2022 13:31:02 +0000 Received: (at 49607) by debbugs.gnu.org; 28 Apr 2022 13:30:22 +0000 Received: from localhost ([127.0.0.1]:45794 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nk4Ds-0004rU-U8 for submit@debbugs.gnu.org; Thu, 28 Apr 2022 09:30:22 -0400 Received: from mail-ej1-f41.google.com ([209.85.218.41]:37524) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nk4Dq-0004r1-9a for 49607@debbugs.gnu.org; Thu, 28 Apr 2022 09:30:19 -0400 Received: by mail-ej1-f41.google.com with SMTP id kq17so9592120ejb.4 for <49607@debbugs.gnu.org>; Thu, 28 Apr 2022 06:30:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FMgvU55wxnrvfMNaXliq4Og8yAflgxcn2VfpzKaTvgE=; b=e6CimR7tAMcBqMZiXyrKGFii6wwr7lka58ymEIVQFdncnpDqLLLd9rKA5dglRHUZKa LY0dScQLl1Qpf8hxLRdu8LmTzNsEi6fUi6HBvJAlAKOQEsqPq0rVPO/AUG22YYgbnzZv 0rmrayJ0mBEhGii8ZKp+Uvmtunr+o224ZWotnamGfNkM63+2n6zFtF1FEBsvRyQeDrDN qnbANPbUDp9PYHWu+UyFaewXFujdZ3YvZElmLapcZVzHdYNbOXEIQuxuCOmX1L0L/WhP /41HNLd7EJ/AxqGWjrZqvLl0Dk2cMHx+KFz9wo2l2nKk1sKE3f8rf9kiQpJ7e/5Kfv+W vXag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=FMgvU55wxnrvfMNaXliq4Og8yAflgxcn2VfpzKaTvgE=; b=brnoas016Xas8wbv+2hKhjCCtgsQuvOuy8hgL5Z2Zx4wpNT+jcNxPXqh7Py76v3ArH mNvpWGPedzlTf4pZkUQXMr5FI2LPGCNKSGwY2UlsMEOnj+Yp1ZTd7C7cjqH+T39yl+sU LPrzNBYbJY5+JmrraiKTi0L+g3RzBwGRvKpiamb/3H8bb913fbzjoxfB4Vl9vOX6/7P0 DI7UlsO6HYZ8ccGV4GvgMIVIBcwbY55M+XokyK1Cc27my6eQWshh1wNjzwkiCbR8A08B xAhfL6wPF+HtbQ314M9BQN8ziLFFRXwreqlN1M1c0VviJomT9nq5Ye2m+Y5PrxqJTNQ0 QxYA== X-Gm-Message-State: AOAM530X250DN++rEwuEmvGbcVP+/r9ni8bnLDADAu8ahg4rPtlCWJWC 6QsnP2XH46di85R3KSHIaTE8MicxzQU= X-Google-Smtp-Source: ABdhPJz3hOwdypw6VGgqKZQI3GEi/Q1ry7UWgUUmlnqgHN4+v64IVZG0ko6yGI/P4qI0anVIbJ4s7Q== X-Received: by 2002:a17:907:6d96:b0:6f3:8445:5f13 with SMTP id sb22-20020a1709076d9600b006f384455f13mr23293299ejc.529.1651152612387; Thu, 28 Apr 2022 06:30:12 -0700 (PDT) Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu. [89.132.245.188]) by smtp.gmail.com with ESMTPSA id d19-20020a170906c21300b006e7f0730353sm8365993ejz.101.2022.04.28.06.30.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Apr 2022 06:30:11 -0700 (PDT) From: Attila Lendvai Date: Thu, 28 Apr 2022 15:28:02 +0200 Message-Id: <20220428132801.8629-2-attila@lendvai.name> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220428132801.8629-1-attila@lendvai.name> References: <20220428132801.8629-1-attila@lendvai.name> MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches The extra generality (e.g. the make-idris-package function) is added so that it becomes possible to bootstrap Idris HEAD all the way down from GHC. Some of the past releases require patching, which in turn requires importing them into separate git branches. This work has not been merged into upstream yet, therefore some of the historical versions in this commit temprorarily point to my own fork, as noted in the comments. The historical versions are marked #:substitutable #false (but they are not hidden), so that they don't load the substitute servers unnecessarily, but at the same time are installable. Idris can bootstrap itself from the checked in Scheme files of the ChezScheme or Racket backends (it can take a so called 'bootstrap shortcut'), therefore the historical versions are not needed for compiling the latest version. They are only needed when one wants to run the bootstrap of Idris all the way down from Haskell (Idris 1 is written in Haskell). Create binaries with the version in their name, and add a symlink to them; e.g. rename the upstream's binary to `bin/idris-1.3.4` and symlink it to `bin/idris`. This helps when multiple versions are installed. * gnu/packages/idris.scm (idris): Rename the scheme variable to idris-1.3. (make-idris-package): New function to instantiate a package of Idris2. (idris2, idris2-0.1.1, idris2-0.2.1, idris2-0.2.2, idris2-0.3.0, idris2-0.4.0, idris2-dev): New variables. --- gnu/packages/idris.scm | 288 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 285 insertions(+), 3 deletions(-) diff --git a/gnu/packages/idris.scm b/gnu/packages/idris.scm index 61de4883b1..1488996b6a 100644 --- a/gnu/packages/idris.scm +++ b/gnu/packages/idris.scm @@ -20,26 +20,56 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . +;;; TODO: +;;; +;;; - Idris has multiple backends, but we only register Chez as an +;;; input. Decide how to make backends optional, and/or which ones to package +;;; by default. +;;; +;;; - Set RUNPATH instead of using LD_LIBRARY_PATH. See +;;; http://blog.tremily.us/posts/rpath/ This probably needs patching Idris +;;; because it uses its FFI infrastrucutre to open libidris_support.so, which +;;; is based on dlopen. +;;; +;;; - The reason some of the historical packages point to +;;; github.com/attila-lendvai-patches is that these versions need some +;;; patches to make them buildable today, and these branches haven't been +;;; incorporated into the official repo yet. Once/if that happens, these +;;; URL's can be changed to point to the official repo. + (define-module (gnu packages idris) #:use-module (gnu packages) + #:use-module (gnu packages base) #:use-module (gnu packages bash) + #:use-module (gnu packages chez) #:use-module (gnu packages haskell-check) #:use-module (gnu packages haskell-web) #:use-module (gnu packages haskell-xyz) #:use-module (gnu packages libffi) #:use-module (gnu packages multiprecision) #:use-module (gnu packages ncurses) + #:use-module (gnu packages node) #:use-module (gnu packages perl) + #:use-module (gnu packages racket) + #:use-module (gnu packages version-control) #:use-module (guix build-system gnu) #:use-module (guix build-system haskell) #:use-module (guix download) + #:use-module (guix git) #:use-module (guix git-download) #:use-module (guix utils) #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix gexp) #:use-module (guix packages) - #:use-module (guix utils)) + #:use-module (guix utils) + #:use-module (ice-9 match) + #:use-module (ice-9 regex) + #:export (make-idris-package)) -(define-public idris +;;; +;;; Idris 1 +;;; +(define-public idris-1.3 (package (name "idris") (version "1.3.4") @@ -141,7 +171,11 @@ (define-public idris (let* ((out (assoc-ref outputs "out")) (exe (string-append out "/bin/idris"))) (wrap-program exe - `("IDRIS_CC" = (,',(cc-for-target)))))))))) + `("IDRIS_CC" = (,',(cc-for-target)))) + (with-directory-excursion (string-append out "/bin/") + (let ((versioned-name ,(string-append name "-" version))) + (rename-file ,name versioned-name) + (symlink versioned-name ,name))))))))) (native-search-paths (list (search-path-specification (variable "IDRIS_LIBRARY_PATH") @@ -155,6 +189,254 @@ (define-public idris Epigram and Agda.") (license license:bsd-3))) +(define-public idris idris-1.3) + +;;; +;;; Idris 2 +;;; +(define* (make-idris-package source idris-version + #:key bootstrap-idris + (idris-version-tag #false) + (guix-version (string-append + idris-version + (if idris-version-tag + (string-append + "-" idris-version-tag) + ""))) + (ignore-test-failures? #false) + (unwrap? #true) + (tests? #true) + (historical? #false) + (hidden? #false) ; or (hidden? historical?) + (substitutable? (not historical?)) + (files-to-patch-for-shell + '("src/Compiler/Scheme/Chez.idr" + "src/Compiler/Scheme/Racket.idr" + "src/Compiler/Scheme/Gambit.idr" + "src/Compiler/ES/Node.idr" + "bootstrap/idris2_app/idris2.rkt" + "bootstrap/idris2_app/idris2.ss" + "build/stage1/idris2_app/idris2.ss" + "build/stage1/idris2_app/idris2.rkt" + )) + (with-bootstrap-shortcut? (not historical?))) + "HISTORICAL? means that it's only interesting for historical reasons, e.g. to be +used as a bootsrapping stage. + +WITH-BOOTSTRAP-SHORTCUT? controls whether to use a previous version of Idris to +build us (which is potentially recursive), or use the captured compiler output +(Scheme code)." + (package + (name "idris2") + (version guix-version) + (source (match source + ((commit hash . url) + (origin + (method git-fetch) + (uri (git-reference + (url (if (null? url) + "https://github.com/idris-lang/Idris2.git" + (car url))) + (commit commit))) + (sha256 (base32 hash)) + (file-name (git-file-name name version)))) + ((or (? git-checkout?) + (? local-file?)) + source))) + (build-system gnu-build-system) + (native-inputs + (list (if with-bootstrap-shortcut? + chez-scheme + bootstrap-idris) + coreutils which git + node ; only for the tests + racket ; only for the tests + sed)) + (inputs + (list bash-minimal chez-scheme gmp)) + (arguments + (list + #:tests? tests? + #:substitutable? substitutable? + #:make-flags + #~(list (string-append "CC=" #$(cc-for-target)) + #$(string-append "IDRIS_VERSION=" idris-version) + #$(string-append "IDRIS_VERSION_TAG=" (or idris-version-tag "")) + #$(if with-bootstrap-shortcut? + #~(string-append "SCHEME=" + #$(this-package-input "chez-scheme") + "/bin/scheme") + #~(string-append "BOOTSTRAP_IDRIS=" + #$bootstrap-idris + "/bin/" #$(package-name bootstrap-idris))) + (string-append "PREFIX=" (assoc-ref %outputs "out")) + "-j1") + #:phases + `(modify-phases %standard-phases + (delete 'bootstrap) + (delete 'configure) + (delete 'check) ; check must happen after install and wrap-program + (add-after 'unpack 'patch-paths + (lambda* (#:key inputs #:allow-other-keys) + (let ((files-to-patch (filter file-exists? + ',files-to-patch-for-shell))) + (substitute* files-to-patch + ((,(regexp-quote "#!/bin/sh")) + (string-append "#!" (assoc-ref inputs "bash") "/bin/sh")) + (("/usr/bin/env") + (string-append (assoc-ref inputs "coreutils") "/bin/env")))))) + ,@(if unwrap? + `((add-after 'install 'unwrap + (lambda* (#:key outputs #:allow-other-keys) + ;; The bin/idris2 calls bin/idris2_app/idris2.so which is + ;; the real executable, but it sets LD_LIBRARY_PATH + ;; incorrectly. Remove bin/idris2 and replace it with + ;; bin/idris2_app/idris2.so instead. + (let* ((out (assoc-ref outputs "out")) + (image-base (string-append + out "/bin/idris2_app/idris2")) + (image (if (file-exists? image-base) + image-base + ;; For v0.5.1 and older. + (string-append image-base ".so")))) + (delete-file (string-append out "/bin/idris2")) + (rename-file image (string-append out "/bin/idris2")) + (delete-file-recursively (string-append out "/bin/idris2_app")) + (delete-file-recursively (string-append out "/lib")))))) + '()) + ,@(if with-bootstrap-shortcut? + `((replace 'build + (lambda* (#:key make-flags #:allow-other-keys) + ;; i.e. do not build it using the previous version of + ;; Idris, but rather compile the comitted compiler + ;; output. + (apply invoke "make" "bootstrap" make-flags)))) + '()) + (add-after 'unwrap 'wrap-program + (lambda* (#:key outputs inputs #:allow-other-keys) + (let* ((chez (string-append (assoc-ref inputs "chez-scheme") + "/bin/scheme")) + (out (assoc-ref outputs "out")) + (exe (string-append out "/bin/" ,name)) + (version ,idris-version)) + (wrap-program exe + `("IDRIS2_PREFIX" = (,out)) + `("LD_LIBRARY_PATH" prefix (,(string-append + out "/idris2-" version "/lib"))) + `("CC" = (,',(cc-for-target))) + `("CHEZ" = (,chez))) + (with-directory-excursion (string-append out "/bin/") + (let ((versioned-name ,(string-append name "-" version))) + (rename-file ,name versioned-name) + (symlink versioned-name ,name)))))) + (add-after 'wrap-program 'check + (lambda* (#:key outputs make-flags #:allow-other-keys) + (let ((invoke-make + (lambda (target) + (apply invoke "make" + "INTERACTIVE=" + ;; "THREADS=1" ; for reproducible test output + (string-append "IDRIS2=" + (assoc-ref outputs "out") + "/bin/" ,name) + target make-flags)))) + ;; TODO This is something like how it should be handled, but + ;; the Makefile unconditionally invokes the `testenv` target, + ;; and thus overwrites the `runtest` script when `make test` is + ;; invoked. For now this situation is resolved in the Idris + ;; Makefile, by explicitly invoking the Idris `runtest` wrapper + ;; script with an sh prefix. + ;; + ;;(invoke-make "testenv") + ;;(patch-shebang "build/stage2/runtests") + (,(if ignore-test-failures? + 'false-if-exception + 'begin) + (invoke-make "test")))))))) + (properties `((hidden? . ,hidden?))) + (home-page "https://www.idris-lang.org") + (synopsis "General purpose language with full dependent types") + (description "Idris is a general purpose language with full dependent +types. It is compiled, with eager evaluation. Dependent types allow types to +be predicated on values, meaning that some aspects of a program's behaviour +can be specified precisely in the type. The language is closely related to +Epigram and Agda.") + (license license:bsd-3))) + +(define-public idris2-0.1.1 + ;; branch idris.2 + ;; This is the first (untagged) Idris2 version that bootstraps off of the + ;; Idris1 line. Originally it was in the repo called Idris2-boot. + (make-idris-package '("3c2335ee6bc00b7f417ac672a4ab7b73599abeb3" + "10w10ggyvlw7m1pazbfxr4sj3wpb6z1ap6rg3lxc0z6f2s3x53cb") + "0.1.1" + #:bootstrap-idris idris-1.3 + #:historical? #true + #:unwrap? #false + ;; TODO `make bootstrap` needs to be backported into the + ;; Makefile in this branch. Force the bootstrap + ;; shortcut to be turned off. + #:with-bootstrap-shortcut? #false)) + +(define-public idris2-0.2.1 + ;; branch idris.3 + (make-idris-package '("257bbc27498808e8cd4155cc06ea3f6a07541537" + "0idxplcmd6p13i2n0g49bc2snddny4kdr4wvd8854snzsiwqn7p1" + "https://github.com/attila-lendvai-patches/Idris2") + "0.2.1" + #:bootstrap-idris idris2-0.1.1 + #:historical? #true)) + +(define-public idris2-0.2.2 + ;; branch idris.4 + (make-idris-package '("9bc8e6e9834cbc7b52dc6ca2d80d7e96afeb47d1" + "0xzl1mb5yxgp6v36rngy00i59cfy67niyiblcpaksllrgmg639p4" + "https://github.com/attila-lendvai-patches/Idris2") + "0.2.2" + #:bootstrap-idris idris2-0.2.1 + #:historical? #true)) + +(define-public idris2-0.3.0 + ;; branch idris.5 + (make-idris-package '("025b5cd25b76eae28283a10bd155c384e46fbd82" + "00a83paib571ahknipmgw7g9pbym105isk3bz0c1ng41s4kjpsxh" + "https://github.com/attila-lendvai-patches/Idris2") + "0.3.0" + #:bootstrap-idris idris2-0.2.2 + #:historical? #true)) + +(define-public idris2-0.4.0 + ;; branch idris.6 + (make-idris-package '("v0.4.0" + "105jybjf5s0k6003qzfxchzsfcpsxip180bh3mdmi74d464d0h8g") + "0.4.0" + #:bootstrap-idris idris2-0.3.0 + #:ignore-test-failures? #true ; TODO investigate + #:historical? #true)) + +(define-public idris2-0.5.1 + (make-idris-package '("v0.5.1" + "09k5fxnplp6fv3877ynz1lwq9zapxcxbvfvkn6g68yb0ivrff978") + "0.5.1")) + +;; TODO re build failure: in the build sandbox some parts of the test output +;; is missing. I cannot reproduce it in a guix shell. My assumption is that +;; it's an Idris bug that only manifests in certain circumstances. There are +;; some other issues left with the use of #!/bin/sh, too. +(define-public idris2-dev + (make-idris-package '("4bb12225424d76c7874b176e2bfb8b5550c112eb" + "0kb800cgfm0afa83pbyi3x9bpswcl8jz4pr68zy092fs50km3bj7" + "https://github.com/attila-lendvai-patches/Idris2") + "0.5.1" + #:ignore-test-failures? #true + #:idris-version-tag "dev")) + +(define-public idris2 idris2-0.5.1) + +;;; +;;; Idris apps +;;; + ;; Idris modules use the gnu-build-system so that the IDRIS_LIBRARY_PATH is set. (define (idris-default-arguments name) `(#:modules ((guix build gnu-build-system) From patchwork Thu Apr 28 13:28:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 38982 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 B911F27BBEA; Thu, 28 Apr 2022 14:31:44 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 83B1F27BBE9 for ; Thu, 28 Apr 2022 14:31:44 +0100 (BST) Received: from localhost ([::1]:35488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nk4FD-0001Rk-NC for patchwork@mira.cbaines.net; Thu, 28 Apr 2022 09:31:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nk4Ea-0000hv-BX for guix-patches@gnu.org; Thu, 28 Apr 2022 09:31:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51905) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nk4EY-0000NW-S7 for guix-patches@gnu.org; Thu, 28 Apr 2022 09:31:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nk4EY-0004tB-Og for guix-patches@gnu.org; Thu, 28 Apr 2022 09:31:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49607] [PATCH v3 3/3] gnu: idris: Add doc output and build the html documentation. Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 28 Apr 2022 13:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49607 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49607@debbugs.gnu.org Cc: Attila Lendvai Received: via spool by 49607-submit@debbugs.gnu.org id=B49607.165115264118736 (code B ref 49607); Thu, 28 Apr 2022 13:31:02 +0000 Received: (at 49607) by debbugs.gnu.org; 28 Apr 2022 13:30:41 +0000 Received: from localhost ([127.0.0.1]:45798 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nk4EC-0004s5-7R for submit@debbugs.gnu.org; Thu, 28 Apr 2022 09:30:40 -0400 Received: from mail-ej1-f54.google.com ([209.85.218.54]:38458) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nk4E9-0004rs-ON for 49607@debbugs.gnu.org; Thu, 28 Apr 2022 09:30:38 -0400 Received: by mail-ej1-f54.google.com with SMTP id r13so9603447ejd.5 for <49607@debbugs.gnu.org>; Thu, 28 Apr 2022 06:30:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aT4qLJdXyHrZftwvCl4zePNz3uvB7nJJ4yk2MCA7LlQ=; b=ZCzia3LrcbIFG8DM8AUVFov3SuGxBphA0BFbIluaB7GmmcO6pAIAhpJioeA202zwoE LxbYgN8j7OuwXyW2GTVdLUAtYq3puaUg08/j7e0Ha6MqMvuHscXQW+qndANSNswyqaAJ ISPrc31hWCMU+zThxzkgRp1s8f8rn0nrmd2CagN8cqT5xE4IDJus7w0zDuo8NbCcbN1E 0lF9bqA45ZDwLcgPc1vdfwe29NCXpM+rCuAcRezcKZ4TdfMjCv9671OO31YExN8LxfNE EU0+OieYh+6RcO1GHNEuHSKHs4zq+kxW3v3bN7J0DgPKSlCsicQAw5wW6cSz548WqoMG J9fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=aT4qLJdXyHrZftwvCl4zePNz3uvB7nJJ4yk2MCA7LlQ=; b=1++Y2hTGckGY4AEUXeoPzk3QskjonOKryx9+OG57bq1CgUvyU01WDG9ZbfagUozLs5 sF8vRKtMig6A/dJab5FTlaT0uHZRbIRfVilIVUF3i9vjfUnoRh/1mDw7PKBzUQXCd3d7 7y3qx+h51LXb2vVjEX7yDYdRY1IZL07BFj31NFw5CF22eAN6zxN8OGz3EzNWJEBmSEDV F/O762V5tjIt3TIP/bov06TGw+w5HxN56k3dhgGEiA4wUsLAB3PORkBGwCdKnmTjDl5q CoZFnbnLEZS/O1lRrLbzrStmzlIINH5dhuzoHhT+0KTRBojJ8W/NuP/ZAyNnqKY9XEnB DM5g== X-Gm-Message-State: AOAM53111pZQU793AInonJB17yea1Ctsu3BhZKdYaWcjgnLEGkTJotZC M50B0sU72VhS2zdD1gr03GNjGVlzFWw= X-Google-Smtp-Source: ABdhPJz3DludAPm9TPoRSojfUDGuT40OutijS6LJw+GLAMXcf2NfkFFmpn2hgMGQ6Go/XNqIvaBmgA== X-Received: by 2002:a17:907:8a23:b0:6f0:14b6:33d9 with SMTP id sc35-20020a1709078a2300b006f014b633d9mr32295955ejc.559.1651152632010; Thu, 28 Apr 2022 06:30:32 -0700 (PDT) Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu. [89.132.245.188]) by smtp.gmail.com with ESMTPSA id d19-20020a170906c21300b006e7f0730353sm8365993ejz.101.2022.04.28.06.30.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Apr 2022 06:30:31 -0700 (PDT) From: Attila Lendvai Date: Thu, 28 Apr 2022 15:28:04 +0200 Message-Id: <20220428132801.8629-3-attila@lendvai.name> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220428132801.8629-1-attila@lendvai.name> References: <20220428132801.8629-1-attila@lendvai.name> MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/idris.scm (make-idris-package): Build the html docs and install it into the doc output. --- gnu/packages/idris.scm | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/gnu/packages/idris.scm b/gnu/packages/idris.scm index 1488996b6a..e03ca3bfbf 100644 --- a/gnu/packages/idris.scm +++ b/gnu/packages/idris.scm @@ -50,7 +50,9 @@ (define-module (gnu packages idris) #:use-module (gnu packages ncurses) #:use-module (gnu packages node) #:use-module (gnu packages perl) + #:use-module (gnu packages python) #:use-module (gnu packages racket) + #:use-module (gnu packages sphinx) #:use-module (gnu packages version-control) #:use-module (guix build-system gnu) #:use-module (guix build-system haskell) @@ -249,11 +251,17 @@ (define* (make-idris-package source idris-version chez-scheme bootstrap-idris) coreutils which git - node ; only for the tests - racket ; only for the tests - sed)) + sed + ;; Only for the tests + node + racket + ;; Only for the docs + python-minimal + python-sphinx + python-sphinx-rtd-theme)) (inputs (list bash-minimal chez-scheme gmp)) + (outputs '("out" "doc")) (arguments (list #:tests? tests? @@ -276,6 +284,15 @@ (define* (make-idris-package source idris-version (delete 'bootstrap) (delete 'configure) (delete 'check) ; check must happen after install and wrap-program + (add-before 'build 'build-doc + (lambda* (#:key outputs #:allow-other-keys) + (invoke "make" "--directory" "docs/" "html"))) + (add-after 'build-doc 'install-doc + (lambda* (#:key outputs #:allow-other-keys) + (let ((doc (assoc-ref outputs "doc"))) + (copy-recursively "docs/build/html" + (string-append doc "/share/doc/" + ,name "-" ,version))))) (add-after 'unpack 'patch-paths (lambda* (#:key inputs #:allow-other-keys) (let ((files-to-patch (filter file-exists?