unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: raingloom <raingloom@riseup.net>
To: Maxime Devos <maximedevos@telenet.be>
Cc: Xinglu Chen <public@yoctocell.xyz>, 46124@debbugs.gnu.org
Subject: [bug#46124] [PATCH] Idris 2
Date: Thu, 29 Apr 2021 20:43:17 +0200	[thread overview]
Message-ID: <20210429204317.7e3a707c@riseup.net> (raw)
In-Reply-To: <5003aa160dc82b35b06e60d425a09309199e1670.camel@telenet.be>

[-- Attachment #1: Type: text/plain, Size: 1356 bytes --]

On Mon, 26 Apr 2021 23:27:39 +0200
Maxime Devos <maximedevos@telenet.be> wrote:

> raingloom schreef op ma 26-04-2021 om 17:22 [+0200]:
> > There hasn't been a tagged release since then, so I'm sending my
> > original patch, but I should note that in my channel I've been
> > tracking the latest commit, which does seem to work, although it's
> > been a while since I used Idris for anything complicated.
> > 
> > +                     ;; TODO detect toolchain
> > +                     "CC=gcc")))  
> 
> Unless idris has a compiler built in that uses gcc for compiling
> idris to machine code, this should likely be
> ,(string-append "CC=" (cc-for-target)) instead, such that the
> cross-compiler is used when cross-compiling.
> 
> Teaching (cc-for-target) to detect which toolchain should be used
> is a separate matter.  Maybe it could be a macro that looks at
> (package-native-inputs this-package) or something.
> 
> Greetings,
> Maxime.

Oh, that's a leftover, I was using clang for a while, since it's
said to use less RAM. I switched back to gcc and left that in.

Here is the updated patch. No idea if this actually works cross
compiled, but I don't have much time to test it. My suspicion is that
it's likely broken and requires changes to Idris 2's code generators,
because they almost definitely call Chez, GCC, etc, with the wrong
arguments.

[-- Attachment #2: 0001-gnu-Added-Idris-2.patch --]
[-- Type: text/x-patch, Size: 4639 bytes --]

From e3c942454af34879393d073be755fa53390891bc Mon Sep 17 00:00:00 2001
From: raingloom <raingloom@riseup.net>
Date: Wed, 27 Jan 2021 06:21:01 +0100
Subject: [PATCH] gnu: Added Idris 2.

* gnu/packages/idris.scm (idris2): New variable.
---
 gnu/packages/idris.scm | 80 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 79 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/idris.scm b/gnu/packages/idris.scm
index ca2772b904..da66f7b0d8 100644
--- a/gnu/packages/idris.scm
+++ b/gnu/packages/idris.scm
@@ -21,6 +21,8 @@
 
 (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 +30,15 @@
   #: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 (ice-9 regex))
 
 (define-public idris
   (package
@@ -150,6 +155,79 @@ can be specified precisely in the type.  The language is closely related to
 Epigram and Agda.")
     (license license:bsd-3)))
 
+(define-public idris2
+  (package
+    (name "idris2")
+    (version "0.3.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/idris-lang/Idris2")
+                    (commit (string-append "v" version))))
+              (sha256
+               (base32
+                "0sa2lpb7n6xqfknwld9rzm4bnb6qcd0ja1n63cnc5v8wdzr8q7kh"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ;; they are run as part of other targets
+       #:phases
+       (modify-phases
+           %standard-phases
+         (add-after 'unpack 'patch-paths
+           (lambda* (#:key outputs inputs #:allow-other-keys)
+             (substitute* "config.mk"
+               ((,(regexp-quote "PREFIX ?= $(HOME)/.idris2"))
+                (string-append "PREFIX = "
+                               (assoc-ref outputs "out"))))
+             (for-each
+              (lambda (f)
+                (substitute* f
+                  ((,(regexp-quote "#!/bin/sh"))
+                   (string-append "#!" (assoc-ref inputs "sh")
+                                  "/bin/sh"))))
+              (list "src/Compiler/Scheme/Chez.idr"
+                    "src/Compiler/Scheme/Racket.idr"
+                    "bootstrap/idris2_app/idris2.rkt"
+                    "bootstrap/idris2_app/idris2.ss"))))
+         ;; this is not the kind of bootstrap we want to run
+         (delete 'bootstrap)
+         (delete 'configure)
+         (replace 'build
+           (lambda _
+             (invoke "make" "bootstrap"
+                     "SCHEME=scheme"
+                     ;; TODO detect toolchain
+                     ,(string-append "CC=" (cc-for-target)))))
+         (add-after 'build 'build-doc
+           (lambda _
+             (with-directory-excursion
+                 "docs"
+               (invoke "make" "html"))))
+         (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)))))))
+    (inputs
+     `(("sh" ,bash-minimal)
+       ("chez-scheme" ,chez-scheme)))
+    (native-inputs
+     `(("python-sphinx" ,python-sphinx)
+       ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
+       ("python" ,python)))
+    (home-page "https://idris-lang.org/")
+    (synopsis "A dependently typed programming language, a successor to Idris")
+    (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 is set.
 (define (idris-default-arguments name)
   `(#:modules ((guix build gnu-build-system)
-- 
2.31.1


  reply	other threads:[~2021-04-29 23:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-27  5:43 [bug#46124] [PATCH] Idris 2 raingloom
     [not found] ` <87r1j267c6.fsf@yoctocell.xyz>
2021-04-26 15:22   ` raingloom
2021-04-26 21:27     ` Maxime Devos
2021-04-29 18:43       ` raingloom [this message]
2021-04-30  8:24         ` Xinglu Chen
2021-05-03  2:10           ` raingloom
2021-05-04 17:12             ` Xinglu Chen
2021-05-11 21:47               ` raingloom
2021-05-14 12:08                 ` Xinglu Chen
2021-04-30  8:50         ` Maxime Devos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210429204317.7e3a707c@riseup.net \
    --to=raingloom@riseup.net \
    --cc=46124@debbugs.gnu.org \
    --cc=maximedevos@telenet.be \
    --cc=public@yoctocell.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).