From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id VBtROcr68mBfkwAAgWs5BA (envelope-from ) for ; Sat, 17 Jul 2021 17:44:10 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id iCh6NMr68mBJLAAA1q6Kng (envelope-from ) for ; Sat, 17 Jul 2021 15:44:10 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 49C671C94A for ; Sat, 17 Jul 2021 17:44:10 +0200 (CEST) Received: from localhost ([::1]:40164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4mU5-00011l-39 for larch@yhetil.org; Sat, 17 Jul 2021 11:44:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4mTz-00011O-0I for guix-patches@gnu.org; Sat, 17 Jul 2021 11:44:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43026) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4mTy-0008SX-Mg for guix-patches@gnu.org; Sat, 17 Jul 2021 11:44:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m4mTy-0006dn-JN for guix-patches@gnu.org; Sat, 17 Jul 2021 11:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49607] [PATCH] gnu: Add Idris 2. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 17 Jul 2021 15:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49607 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49607@debbugs.gnu.org Cc: raingloom X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162653659225460 (code B ref -1); Sat, 17 Jul 2021 15:44:02 +0000 Received: (at submit) by debbugs.gnu.org; 17 Jul 2021 15:43:12 +0000 Received: from localhost ([127.0.0.1]:54572 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4mT2-0006cT-Qs for submit@debbugs.gnu.org; Sat, 17 Jul 2021 11:43:12 -0400 Received: from lists.gnu.org ([209.51.188.17]:55888) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4mT0-0006cL-Bk for submit@debbugs.gnu.org; Sat, 17 Jul 2021 11:43:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4mT0-0000zO-3I for guix-patches@gnu.org; Sat, 17 Jul 2021 11:43:02 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:55680 helo=mail.yoctocell.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4mSw-0007i1-O5 for guix-patches@gnu.org; Sat, 17 Jul 2021 11:43:01 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1626536576; bh=RR8ek8J5ILPEZ5m2GHpfTLuXJ5nvRlxabbqwFyKUQz4=; h=From:To:Cc:Subject:Date; b=EXWNI9GjkyJfx/BQrjDN51uMZWDaIcUOg9ETHQ8mTtMUAC/NmNhbcUPyFgq5B6UoA jEA+SUTMIbVYppDK1tdxpvjb3vaf07nwNly2s+eJdWbo+Ome1iBiiOmtvXFAtW4m78 Eux31gQEWkQgFx/Y51q0X75F+O6iyTfNAF3SbxW4= Message-Id: Date: Sat, 17 Jul 2021 17:42:55 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=87.96.130.155; envelope-from=public@yoctocell.xyz; helo=mail.yoctocell.xyz X-Spam_score_int: 23 X-Spam_score: 2.3 X-Spam_bar: ++ X-Spam_report: (2.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, FROM_SUSPICIOUS_NTLD_FP=0.903, PDS_OTHER_BAD_TLD=1.997, PDS_RDNS_DYNAMIC_FP=0.001, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1626536650; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=1vQptg4tSaL1a25goLGZ2wI6kFlFXw6N598Ecqzy1Qs=; b=P+lGZShCbWGHN4Eo9Ed/gSEvGlf2mHBrxBzboEeHEbrRSTy8q3crE9aEfkoRO69SE9JC8h JPxuDl67qnoCyc7JNRCgRfrDxRxqyPPudUHHKdmSlMYm5i/5nTHXxwk5qbglF3YkuCe2Oh AWuLktKUPEPIpkWn7gLJDw820i1n6ESMsp8rqoNsf6rlg1f75POeDEpIvZFBPE/uD+qdNg okDybBjK+L/LzOyo7lX+iw+xnhnz4JS9ej7bkce7x2WePiO3GoSjCay56Z4WCGkw7LjDSE piMdAmZmS11ez90hQfNtz9Qcxzxh/qnPX5708/a7thtvrKEQuBqSjnU9cx8YmQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1626536650; a=rsa-sha256; cv=none; b=tO05OTMoMECxef5gBo4dHzCKdX/H5z77QBAmEUzwTBC3YPHnpJ2fB3wQqyFZ3ptEzM16qy Qd8CEQbAnV9XYeir5sjn/Xx1e7jkG3HIz5on8kTwG3Ba2sI4agbpneQLN0hPAZdKKF5scM oeFtlCwGcW3bNQNBxY6LDIJ7hxbDa+a05qANukW3PX1y/0/F86uWWN1NXvQHCBvMEQfh4a WeGjGkgBVO4IK4xXeNJG6Vko9ugUY6ce7/JISSwOkypA67+9yQOlXSTrfBzqj4pizZXWOv LiWT3L7N4f4e1MZV4rfsaA5sXVrYEjzrISZ473sWglUsSNoj/Cob9u/sOcVA8A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=yoctocell.xyz header.s=mail header.b=EXWNI9Gj; dmarc=fail reason="SPF not aligned (relaxed)" header.from=yoctocell.xyz (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -0.31 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=yoctocell.xyz header.s=mail header.b=EXWNI9Gj; dmarc=fail reason="SPF not aligned (relaxed)" header.from=yoctocell.xyz (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 49C671C94A X-Spam-Score: -0.31 X-Migadu-Scanner: scn0.migadu.com X-TUID: 6qs9nOBGgr6h From: raingloom * gnu/packages/idris.scm (idris2): New variable. Co-authored-by: Xinglu Chen --- Based a previous patch by raingloom[1]. Some changes I made: * Tests are enabled, but only the Chez backend is enabled since that=E2=80= =99s the only backend we have for now. * Some environment have been set, which should make it possible to import third-party packages. * The bin/idris2_app directory has been removed, see the comment in the code below. * The executable is wrapped so some environment variables can be set. * I also changed the synopsis to the one on their GitHub page, and added a copyright line for raingloom. [1]: https://issues.guix.gnu.org/46124#1 gnu/packages/idris.scm | 120 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 119 insertions(+), 1 deletion(-) diff --git a/gnu/packages/idris.scm b/gnu/packages/idris.scm index ca2772b904..64cb4f37f5 100644 --- a/gnu/packages/idris.scm +++ b/gnu/packages/idris.scm @@ -3,6 +3,8 @@ ;;; Copyright =C2=A9 2016, 2017 David Craven ;;; Copyright =C2=A9 2018 Alex ter Weele ;;; Copyright =C2=A9 2019, 2021 Eric Bavier +;;; Copyrignt =C2=A9 2021 raingloom +;;; Copyright =C2=A9 2021 Xinglu Chen ;;; ;;; This file is part of GNU Guix. ;;; @@ -21,6 +23,8 @@ =20 (define-module (gnu packages idris) #:use-module (gnu packages) + #: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) @@ -28,12 +32,16 @@ #:use-module (gnu packages multiprecision) #:use-module (gnu packages ncurses) #:use-module (gnu packages perl) + #:use-module (gnu packages python) + #:use-module (gnu packages sphinx) #:use-module (guix build-system gnu) #:use-module (guix build-system haskell) #:use-module (guix download) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) - #:use-module (guix packages)) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module (ice-9 regex)) =20 (define-public idris (package @@ -150,6 +158,116 @@ can be specified precisely in the type. The language= is closely related to Epigram and Agda.") (license license:bsd-3))) =20 +;; TODO: Add other backends? +(define-public idris2 + (package + (name "idris2") + (version "0.4.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/idris-lang/Idris2") + (commit (string-append "v" version)))) + (sha256 + (base32 + "105jybjf5s0k6003qzfxchzsfcpsxip180bh3mdmi74d464d0h8g")))) + (build-system gnu-build-system) + (arguments + `(#:test-target "bootstrap-test" + #:phases + (modify-phases + %standard-phases + (add-after 'unpack 'patch-paths + (lambda* (#:key outputs inputs #:allow-other-keys) + (substitute* "config.mk" + ((,(regexp-quote "PREFIX ?=3D $(HOME)/.idris2")) + (string-append "PREFIX =3D " + (assoc-ref outputs "out")))) + (substitute* '("src/Compiler/Scheme/Chez.idr" + "src/Compiler/Scheme/Racket.idr" + "bootstrap/idris2_app/idris2.rkt" + "bootstrap/idris2_app/idris2.ss") + ((,(regexp-quote "#!/bin/sh")) + (string-append "#!" (assoc-ref inputs "bash") + "/bin/sh"))))) + ;; This is not the kind of bootstrap we want to run + (delete 'bootstrap) + (delete 'configure) ; no configure script + (replace 'build + (lambda _ + (invoke "make" "bootstrap" + "SCHEME=3Dscheme" + ;; TODO: detect toolchain. + (string-append "CC=3D" ,(cc-for-target))))) + (add-after 'build 'build-doc + (lambda _ + (with-directory-excursion + "docs" + (invoke "make" "html")))) + (add-before 'check 'set-cc + (lambda _ + (setenv "CC" ,(cc-for-target)))) + (add-after 'install 'install-doc + (lambda* (#:key outputs #:allow-other-keys) + (copy-recursively + "docs/build/html" + (string-append + (assoc-ref outputs "out") + "/share/doc/" + ,name "-" ,version)))) + (add-after 'install-doc 'fix-ld-library-path + (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"))) + (delete-file (string-append out "/bin/idris2")) + (copy-file (string-append out "/bin/idris2_app/idris2.so") + (string-append out "/bin/idris2")) + (delete-file-recursively (string-append out "/bin/idris2_ap= p"))))) + (add-after 'fix-ld-library-path '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")) + (idris2 (string-append out "/bin/idris2")) + (version ,version)) + (wrap-program idris2 + `("LD_LIBRARY_PATH" ":" prefix + (,(string-append out "/idris2-" version "/lib"))) + `("CHEZ" ":" =3D (,chez))))))))) + (inputs + `(("bash" ,bash-minimal) + ("chez-scheme" ,chez-scheme) + ("gmp" ,gmp))) + (native-inputs + ;; For building docs. + `(("python-sphinx" ,python-sphinx) + ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme) + ("python" ,python) )) + (native-search-paths + (list (search-path-specification + (variable "IDRIS2_PACKAGE_PATH") + (files (list (string-append "idris2-" version)))) + (search-path-specification + (variable "IDRIS2_LIBS") + (files (list (string-append "idris2-" version "/lib"))) + (file-type 'directory)) + (search-path-specification + (variable "IDRIS2_DATA") + (files (list (string-append "idris2-" version "/support"))) + (file-type 'directory)))) + (home-page "https://idris-lang.org/") + (synopsis "Purely functional programming language with first class typ= es") + (description + "Idris 2 is a general purpose language with dependent linear 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. It can use multiple languages as = code +generation backends.") + (license license:bsd-3))) + ;; Idris modules use the gnu-build-system so that the IDRIS_LIBRARY_PATH i= s set. (define (idris-default-arguments name) `(#:modules ((guix build gnu-build-system) base-commit: 9cb35c02164d929fcb8929e7f454df215df8cf25 --=20 2.32.0