gnu: agda: Adjust for using shared libraries.

See also 9e5496e0ae.

* gnu/packages/agda.scm (agda)[arguments]: Add a phase that sets
'LD_LIBRARY_PATH'; update the 'configure' phase to match the current
Haskell build system code.
This commit is contained in:
Timothy Sample 2020-08-19 23:44:59 -04:00
parent 856def7bb3
commit 8d06906017
No known key found for this signature in database
GPG key ID: 2AC6A5EC1C357C59

View file

@ -79,6 +79,11 @@ (define-public agda
(ice-9 match)) (ice-9 match))
#:phases #:phases
(modify-phases %standard-phases (modify-phases %standard-phases
;; This allows us to call the 'agda' binary before installing.
(add-after 'unpack 'set-ld-library-path
(lambda _
(setenv "LD_LIBRARY_PATH" (string-append (getcwd) "/dist/build"))
#t))
;; FIXME: This is a copy of the standard configure phase with a tiny ;; FIXME: This is a copy of the standard configure phase with a tiny
;; difference: this package needs the -package-db flag to be passed ;; difference: this package needs the -package-db flag to be passed
;; to "runhaskell" in addition to the "configure" action, because ;; to "runhaskell" in addition to the "configure" action, because
@ -90,30 +95,25 @@ (define-public agda
#:allow-other-keys) #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(name-version (strip-store-file-name out)) (name-version (strip-store-file-name out))
(input-dirs (match inputs
(((_ . dir) ...)
dir)
(_ '())))
(ghc-path (getenv "GHC_PACKAGE_PATH")) (ghc-path (getenv "GHC_PACKAGE_PATH"))
(params (append `(,(string-append "--prefix=" out)) (params
`(,(string-append "--libdir=" out "/lib")) `(,(string-append "--prefix=" out)
`(,(string-append "--bindir=" out "/bin")) ,(string-append "--libdir=" out "/lib")
`(,(string-append ,(string-append "--docdir=" out
"--docdir=" out "/share/doc/" name-version)
"/share/doc/" name-version)) "--libsubdir=$compiler/$pkg-$version"
'("--libsubdir=$compiler/$pkg-$version") "--package-db=../package.conf.d"
'("--package-db=../package.conf.d") "--global"
'("--global") ,@(if tests?
`(,@(map '("--enable-tests")
(cut string-append "--extra-include-dirs=" <>) '())
(search-path-as-list '("include") input-dirs))) ;; Build and link with shared libraries
`(,@(map "--enable-shared"
(cut string-append "--extra-lib-dirs=" <>) "--enable-executable-dynamic"
(search-path-as-list '("lib") input-dirs))) "--ghc-option=-fPIC"
(if tests? ,(string-append "--ghc-option=-optl=-Wl,-rpath=" out
'("--enable-tests") "/lib/$compiler/$pkg-$version")
'()) ,@configure-flags)))
configure-flags)))
(unsetenv "GHC_PACKAGE_PATH") (unsetenv "GHC_PACKAGE_PATH")
(apply invoke "runhaskell" "-package-db=../package.conf.d" (apply invoke "runhaskell" "-package-db=../package.conf.d"
"Setup.hs" "configure" params) "Setup.hs" "configure" params)