Package: guix-patches;
Reported by: Xinglu Chen <public <at> yoctocell.xyz>
Date: Sat, 17 Jul 2021 15:44:02 UTC
Severity: normal
Tags: patch
Merged with 46124
View this message in rfc822 format
From: Attila Lendvai <attila <at> lendvai.name> To: 49607 <at> debbugs.gnu.org Cc: Attila Lendvai <attila <at> 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
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
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.