build-system/haskell: Refactor configure step.

* guix/build/haskell-build-system.scm (configure): Replace append
with quasiquotes and splicing.
This commit is contained in:
Ricardo Wurmus 2020-06-24 23:12:06 +02:00
parent 67cb9fa235
commit 0347888a7e
No known key found for this signature in database
GPG key ID: 197A5888235FACAC

View file

@ -85,25 +85,22 @@ (define* (configure #:key outputs inputs tests? (configure-flags '())
dir)
(_ '())))
(ghc-path (getenv "GHC_PACKAGE_PATH"))
(params (append `(,(string-append "--prefix=" out))
`(,(string-append "--libdir=" (or lib out) "/lib"))
`(,(string-append "--bindir=" (or bin out) "/bin"))
`(,(string-append
"--docdir=" (or doc out)
"/share/doc/" name-version))
'("--libsubdir=$compiler/$pkg-$version")
`(,(string-append "--package-db=" %tmp-db-dir))
'("--global")
`(,@(map
(cut string-append "--extra-include-dirs=" <>)
(search-path-as-list '("include") input-dirs)))
`(,@(map
(cut string-append "--extra-lib-dirs=" <>)
(search-path-as-list '("lib") input-dirs)))
(if tests?
'("--enable-tests")
'())
configure-flags)))
(params `(,(string-append "--prefix=" out)
,(string-append "--libdir=" (or lib out) "/lib")
,(string-append "--bindir=" (or bin out) "/bin")
,(string-append "--docdir=" (or doc out)
"/share/doc/" name-version)
"--libsubdir=$compiler/$pkg-$version"
,(string-append "--package-db=" %tmp-db-dir)
"--global"
,@(map (cut string-append "--extra-include-dirs=" <>)
(search-path-as-list '("include") input-dirs))
,@(map (cut string-append "--extra-lib-dirs=" <>)
(search-path-as-list '("lib") input-dirs))
,@(if tests?
'("--enable-tests")
'())
,@configure-flags)))
;; Cabal errors if GHC_PACKAGE_PATH is set during 'configure', so unset
;; and restore it.
(unsetenv "GHC_PACKAGE_PATH")