all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Attila Lendvai <attila@lendvai.name>
To: 49607@debbugs.gnu.org
Cc: Attila Lendvai <attila@lendvai.name>
Subject: [bug#49607] [PATCH v2 1/3] gnu: idris: Use wrap-program to define IDRIS_CC
Date: Thu, 14 Apr 2022 14:16:11 +0200	[thread overview]
Message-ID: <20220414121612.9815-1-attila@lendvai.name> (raw)
In-Reply-To: <ee2e60c3f133981cc5695ef93e1b4e87dff87c04.1626536112.git.public@yoctocell.xyz>

Idris requires a C compiler at runtime to generate executables.

* gnu/packages/idris.scm (idris): Rename the scheme variable to idris-1.3.3 to
prepare for adding different versions later on.
[inputs]: Add Clang, and bash-minimal (for wrap-program).
[phases]: use (cc-for-target).
---

i think v2 is ready for inclusion. it can bootstrap idris all the way
from GHC, but it also enables a/the bootstrap shortcut for the latest
version, and disables substitution for the so called historical
versions by default.

a bootstrap shortcut is when the makefile builds a checked in build
output, which is a scheme file, using Chez Scheme.

this way the build farm is not loaded unnecessarily with building a
full chain of bootstrap, but at the same time users can trigger/install
any of the old versions manually.

 gnu/packages/idris.scm | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/gnu/packages/idris.scm b/gnu/packages/idris.scm
index cdf76244fb..f84431cab9 100644
--- a/gnu/packages/idris.scm
+++ b/gnu/packages/idris.scm
@@ -21,10 +21,12 @@
 
 (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)
   #:use-module (gnu packages libffi)
+  #:use-module (gnu packages llvm)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages perl)
@@ -33,9 +35,10 @@ (define-module (gnu packages idris)
   #: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))
 
-(define-public idris
+(define-public idris-1.3.3
   (package
     (name "idris")
     (version "1.3.3")
@@ -56,7 +59,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
@@ -95,8 +99,7 @@ (define-public idris
          ;; This allows us to call the 'idris' binary before installing.
          (add-after 'unpack 'set-ld-library-path
            (lambda _
-             (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/dist/build"))
-             #t))
+             (setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/dist/build"))))
          (add-before 'configure 'update-constraints
            (lambda _
              (substitute* "idris.cabal"
@@ -104,8 +107,7 @@ (define-public idris
                 dep))))
          (add-before 'configure 'set-cc-command
            (lambda _
-             (setenv "CC" "gcc")
-             #t))
+             (setenv "CC" ,(cc-for-target))))
          (add-after 'install 'fix-libs-install-location
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
@@ -122,7 +124,6 @@ (define-public idris
              (let ((out (assoc-ref outputs "out")))
                (chmod "test/scripts/timeout" #o755) ;must be executable
                (setenv "TASTY_NUM_THREADS" (number->string (parallel-job-count)))
-               (setenv "IDRIS_CC" "gcc") ;Needed for creating executables
                (setenv "PATH" (string-append out "/bin:" (getenv "PATH")))
                (apply (assoc-ref %standard-phases 'check) args))))
          (add-before 'check 'restore-libidris_rts
@@ -134,8 +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))
-               #t))))))
+                            (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")
@@ -149,6 +155,8 @@ (define-public idris
 Epigram and Agda.")
     (license license:bsd-3)))
 
+(define-public idris idris-1.3.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.35.1





  parent reply	other threads:[~2022-04-14 12:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-17 15:42 [bug#49607] [PATCH] gnu: Add Idris 2 Xinglu Chen
2021-10-05 16:37 ` [bug#49607] [PATCH 1/3] gnu: ghc-cheapskate: Update to 0.1.1.2 Attila Lendvai
2021-10-05 16:37   ` [bug#49607] [PATCH 2/3] gnu: idris: Use wrap-program to define IDRIS_CC Attila Lendvai
2021-10-05 16:37   ` [bug#49607] [PATCH 3/3] gnu: idris: Add idris2 0.5.1, and 1.3.3-1.5545986 Attila Lendvai
2022-04-14 12:16 ` Attila Lendvai [this message]
2022-04-14 12:16   ` [bug#49607] [PATCH 2/3] gnu: idris: Add idris2 0.5.1, and update idris to 1.3.4 Attila Lendvai
2022-04-20 13:50     ` Eric Bavier
2022-04-14 12:16   ` [bug#49607] [PATCH 3/3] gnu: idris: Add doc output and build the html documentation Attila Lendvai
2022-04-14 15:53 ` [bug#49607] a note Attila Lendvai
2022-04-28 13:28 ` [bug#49607] [PATCH v3 1/3] gnu: idris: Use wrap-program to define IDRIS_CC Attila Lendvai
2022-04-28 13:28   ` [bug#49607] [PATCH v3 2/3] gnu: idris: Add idris2 0.5.1 Attila Lendvai
2022-04-28 13:28   ` [bug#49607] [PATCH v3 3/3] gnu: idris: Add doc output and build the html documentation Attila Lendvai
2022-05-17 20:04   ` [bug#49607] [PATCH v3 1/3] gnu: idris: Use wrap-program to define IDRIS_CC Eric Bavier
2022-05-18 17:22     ` Attila Lendvai
2022-07-11 10:41 ` [bug#49607] why not to propagate gcc as a dependency Attila Lendvai
2022-08-23 12:37 ` [bug#49607] Package proposition: Idris2 v0.5.1 contact
2022-12-08  0:42 ` [bug#49607] idris bootstrap, bailing out Attila Lendvai

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

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

  git send-email \
    --in-reply-to=20220414121612.9815-1-attila@lendvai.name \
    --to=attila@lendvai.name \
    --cc=49607@debbugs.gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.