[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#49607] [PATCH 2/3] gnu: idris: Use wrap-program to define IDRIS_CC
From: |
Attila Lendvai |
Subject: |
[bug#49607] [PATCH 2/3] gnu: idris: Use wrap-program to define IDRIS_CC |
Date: |
Tue, 5 Oct 2021 18:37:57 +0200 |
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).
---
gnu/packages/idris.scm | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/gnu/packages/idris.scm b/gnu/packages/idris.scm
index 058d679c1f..1f6e984a90 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 @@
#: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")
@@ -51,12 +54,15 @@
(build-system haskell-build-system)
(native-inputs ;For tests
`(("perl" ,perl)
+ ("clang" ,clang) ; the tests want to generate exeutables
("ghc-cheapskate" ,ghc-cheapskate)
("ghc-tasty" ,ghc-tasty)
("ghc-tasty-golden" ,ghc-tasty-golden)
("ghc-tasty-rerun" ,ghc-tasty-rerun)))
(inputs
- `(("gmp" ,gmp)
+ `(("bash" ,bash-minimal)
+ ("clang" ,clang) ; FIXME clang compiles faster than gcc, but
(cc-for-target) ignores it
+ ("gmp" ,gmp)
("ncurses" ,ncurses)
("ghc-aeson" ,ghc-aeson)
("ghc-annotated-wl-pprint" ,ghc-annotated-wl-pprint)
@@ -105,7 +111,7 @@
#t))
(add-before 'configure 'set-cc-command
(lambda _
- (setenv "CC" "gcc")
+ (setenv "CC" ,(cc-for-target))
#t))
(add-after 'install 'fix-libs-install-location
(lambda* (#:key outputs #:allow-other-keys)
@@ -116,14 +122,14 @@
(lambda (module)
(symlink (string-append modules "/" module)
(string-append lib "/" module)))
- '("prelude" "base" "contrib" "effects" "pruviloj")))))
+ '("prelude" "base" "contrib" "effects" "pruviloj")))
+ #t))
(delete 'check) ;Run check later
(add-after 'install 'check
(lambda* (#:key outputs #:allow-other-keys #:rest args)
(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
@@ -135,8 +141,15 @@
(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)))
+ #t))
+ (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)))))
+ #true)))))
(native-search-paths
(list (search-path-specification
(variable "IDRIS_LIBRARY_PATH")
@@ -150,6 +163,8 @@ can be specified precisely in the type. The language is
closely related to
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.33.0