Message ID | 20220428132801.8629-1-attila@lendvai.name |
---|---|
State | New |
Headers | show |
Series | [bug#49607,v3,1/3] gnu: idris: Use wrap-program to define IDRIS_CC | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
Hi, On Thu, 2022-04-28 at 15:28 +0200, Attila Lendvai wrote: > Idris requires a C compiler at runtime to generate executables. > > * gnu/packages/idris.scm (idris) [inputs]: Add bash-minimal (for > wrap-program). > [phases]: Add wrap-program phase to define IDRIS_CC, use (cc-for- > target). > --- I believe this would prevent someone from effectively setting `IDRIS_CC` to a different compiler from within their environment, correct? I would like to leave that option available to users. Also, can this be a simple compiler reference, or does it need to be a "toolchain compiler"? E.g. I usually set `IDRIS_CC` to gcc from a "gcc-toolchain" package. Could we possibly instead override the default C compiler in the compiler's C backend? Either way we'd be embedding a reference to some compiler/toolchain. `~Eric
> > * gnu/packages/idris.scm (idris) [inputs]: Add bash-minimal (for > > wrap-program). > > [phases]: Add wrap-program phase to define IDRIS_CC, use (cc-for- > > target). > > --- > > > I believe this would prevent someone from effectively setting > `IDRIS_CC` to a different compiler from within their environment, > correct? I would like to leave that option available to users. Also, good point! and i think you're correct, because wrapper scripts set the value unconditionally. would it work if we set CC instead? idris first tries IDRIS_CC, and then CC (and then falls back to "cc"). or would you prefer to use substitute* in the build to replace cc = "cc" with a full path to gcc in the source code of idris? > can this be a simple compiler reference, or does it need to be a > "toolchain compiler"? i'm unable to answer that, i don't know the difference. i just noticed that i can't use idris as-is when trying the examples, because it couldn't invoke the c compiler to produce executables. this is my attempt at fixing this issue. -- • attila lendvai • PGP: 963F 5D5F 45C7 DFCD 0A39 -- If ethics are pure subjective preference, then rape is just competing preferences.
diff --git a/gnu/packages/idris.scm b/gnu/packages/idris.scm index 8f08ed3a3e..61de4883b1 100644 --- a/gnu/packages/idris.scm +++ b/gnu/packages/idris.scm @@ -22,6 +22,7 @@ (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) @@ -35,7 +36,8 @@ (define-module (gnu packages idris) #:use-module (guix git-download) #:use-module (guix utils) #:use-module ((guix licenses) #:prefix license:) - #:use-module (guix packages)) + #:use-module (guix packages) + #:use-module (guix utils)) (define-public idris (package @@ -56,7 +58,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 @@ -132,7 +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)))))))) + (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")