build-system/haskell: Use 'strip-store-file-name'.
See the discussion at <https://lists.gnu.org/archive/html/guix-devel/2018-10/msg00250.html>. * guix/build/haskell-build-system.scm (package-name-version): Remove it. (configure): Use 'strip-store-file-name' instead of 'package-name-version'. (setup-compiler): Likewise. (make-ghc-package-database): Likewise. (register): Likewise. * gnu/packages/haskell.scm (ghc-cairo)[arguments]: Likewise. * gnu/packages/agda.scm (agda)[arguments]: Likewise. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
be200ef316
commit
58352f269e
|
@ -1,6 +1,7 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2018 Alex ter Weele <alex.ter.weele@gmail.com>
|
;;; Copyright © 2018 Alex ter Weele <alex.ter.weele@gmail.com>
|
||||||
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
|
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
|
||||||
|
;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -85,6 +86,7 @@
|
||||||
(lambda* (#:key outputs inputs tests? (configure-flags '())
|
(lambda* (#:key outputs inputs tests? (configure-flags '())
|
||||||
#: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))
|
||||||
(input-dirs (match inputs
|
(input-dirs (match inputs
|
||||||
(((_ . dir) ...)
|
(((_ . dir) ...)
|
||||||
dir)
|
dir)
|
||||||
|
@ -95,8 +97,7 @@
|
||||||
`(,(string-append "--bindir=" out "/bin"))
|
`(,(string-append "--bindir=" out "/bin"))
|
||||||
`(,(string-append
|
`(,(string-append
|
||||||
"--docdir=" out
|
"--docdir=" out
|
||||||
"/share/doc/" ((@@ (guix build haskell-build-system)
|
"/share/doc/" name-version))
|
||||||
package-name-version) out)))
|
|
||||||
'("--libsubdir=$compiler/$pkg-$version")
|
'("--libsubdir=$compiler/$pkg-$version")
|
||||||
'("--package-db=../package.conf.d")
|
'("--package-db=../package.conf.d")
|
||||||
'("--global")
|
'("--global")
|
||||||
|
|
|
@ -10619,6 +10619,7 @@ expose it from another module in the hierarchy.
|
||||||
(lambda* (#:key outputs inputs tests? (configure-flags '())
|
(lambda* (#:key outputs inputs tests? (configure-flags '())
|
||||||
#: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))
|
||||||
(input-dirs (match inputs
|
(input-dirs (match inputs
|
||||||
(((_ . dir) ...)
|
(((_ . dir) ...)
|
||||||
dir)
|
dir)
|
||||||
|
@ -10629,8 +10630,7 @@ expose it from another module in the hierarchy.
|
||||||
`(,(string-append "--bindir=" out "/bin"))
|
`(,(string-append "--bindir=" out "/bin"))
|
||||||
`(,(string-append
|
`(,(string-append
|
||||||
"--docdir=" out
|
"--docdir=" out
|
||||||
"/share/doc/" ((@@ (guix build haskell-build-system)
|
"/share/doc/" name-version))
|
||||||
package-name-version) out)))
|
|
||||||
'("--libsubdir=$compiler/$pkg-$version")
|
'("--libsubdir=$compiler/$pkg-$version")
|
||||||
'("--package-db=../package.conf.d")
|
'("--package-db=../package.conf.d")
|
||||||
'("--global")
|
'("--global")
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
|
;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
|
||||||
;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
|
;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
|
||||||
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
|
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
|
||||||
|
;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -78,6 +79,7 @@ and parameters ~s~%"
|
||||||
(doc (assoc-ref outputs "doc"))
|
(doc (assoc-ref outputs "doc"))
|
||||||
(lib (assoc-ref outputs "lib"))
|
(lib (assoc-ref outputs "lib"))
|
||||||
(bin (assoc-ref outputs "bin"))
|
(bin (assoc-ref outputs "bin"))
|
||||||
|
(name-version (strip-store-file-name out))
|
||||||
(input-dirs (match inputs
|
(input-dirs (match inputs
|
||||||
(((_ . dir) ...)
|
(((_ . dir) ...)
|
||||||
dir)
|
dir)
|
||||||
|
@ -88,7 +90,7 @@ and parameters ~s~%"
|
||||||
`(,(string-append "--bindir=" (or bin out) "/bin"))
|
`(,(string-append "--bindir=" (or bin out) "/bin"))
|
||||||
`(,(string-append
|
`(,(string-append
|
||||||
"--docdir=" (or doc out)
|
"--docdir=" (or doc out)
|
||||||
"/share/doc/" (package-name-version out)))
|
"/share/doc/" name-version))
|
||||||
'("--libsubdir=$compiler/$pkg-$version")
|
'("--libsubdir=$compiler/$pkg-$version")
|
||||||
`(,(string-append "--package-db=" %tmp-db-dir))
|
`(,(string-append "--package-db=" %tmp-db-dir))
|
||||||
'("--global")
|
'("--global")
|
||||||
|
@ -127,12 +129,6 @@ and parameters ~s~%"
|
||||||
"Install a given Haskell package."
|
"Install a given Haskell package."
|
||||||
(run-setuphs "copy" '()))
|
(run-setuphs "copy" '()))
|
||||||
|
|
||||||
(define (package-name-version store-dir)
|
|
||||||
"Given a store directory STORE-DIR return 'name-version' of the package."
|
|
||||||
(let* ((base (basename store-dir)))
|
|
||||||
(string-drop base
|
|
||||||
(+ 1 (string-index base #\-)))))
|
|
||||||
|
|
||||||
(define (grep rx port)
|
(define (grep rx port)
|
||||||
"Given a regular-expression RX including a group, read from PORT until the
|
"Given a regular-expression RX including a group, read from PORT until the
|
||||||
first match and return the content of the group."
|
first match and return the content of the group."
|
||||||
|
@ -147,7 +143,7 @@ first match and return the content of the group."
|
||||||
(define* (setup-compiler #:key system inputs outputs #:allow-other-keys)
|
(define* (setup-compiler #:key system inputs outputs #:allow-other-keys)
|
||||||
"Setup the compiler environment."
|
"Setup the compiler environment."
|
||||||
(let* ((haskell (assoc-ref inputs "haskell"))
|
(let* ((haskell (assoc-ref inputs "haskell"))
|
||||||
(name-version (package-name-version haskell)))
|
(name-version (strip-store-file-name haskell)))
|
||||||
(cond
|
(cond
|
||||||
((string-match "ghc" name-version)
|
((string-match "ghc" name-version)
|
||||||
(make-ghc-package-database system inputs outputs))
|
(make-ghc-package-database system inputs outputs))
|
||||||
|
@ -164,6 +160,7 @@ first match and return the content of the group."
|
||||||
(define (make-ghc-package-database system inputs outputs)
|
(define (make-ghc-package-database system inputs outputs)
|
||||||
"Generate the GHC package database."
|
"Generate the GHC package database."
|
||||||
(let* ((haskell (assoc-ref inputs "haskell"))
|
(let* ((haskell (assoc-ref inputs "haskell"))
|
||||||
|
(name-version (strip-store-file-name haskell))
|
||||||
(input-dirs (match inputs
|
(input-dirs (match inputs
|
||||||
(((_ . dir) ...)
|
(((_ . dir) ...)
|
||||||
dir)
|
dir)
|
||||||
|
@ -171,7 +168,7 @@ first match and return the content of the group."
|
||||||
;; Silence 'find-files' (see 'evaluate-search-paths')
|
;; Silence 'find-files' (see 'evaluate-search-paths')
|
||||||
(conf-dirs (with-null-error-port
|
(conf-dirs (with-null-error-port
|
||||||
(search-path-as-list
|
(search-path-as-list
|
||||||
`(,(string-append "lib/" (package-name-version haskell)))
|
`(,(string-append "lib/" name-version))
|
||||||
input-dirs #:pattern ".*\\.conf.d$")))
|
input-dirs #:pattern ".*\\.conf.d$")))
|
||||||
(conf-files (append-map (cut find-files <> "\\.conf$") conf-dirs)))
|
(conf-files (append-map (cut find-files <> "\\.conf$") conf-dirs)))
|
||||||
(mkdir-p %tmp-db-dir)
|
(mkdir-p %tmp-db-dir)
|
||||||
|
@ -231,9 +228,10 @@ given Haskell package."
|
||||||
|
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
(haskell (assoc-ref inputs "haskell"))
|
(haskell (assoc-ref inputs "haskell"))
|
||||||
|
(name-verion (strip-store-file-name haskell))
|
||||||
(lib (string-append out "/lib"))
|
(lib (string-append out "/lib"))
|
||||||
(config-dir (string-append lib "/"
|
(config-dir (string-append lib
|
||||||
(package-name-version haskell)
|
"/" name-verion
|
||||||
"/" name ".conf.d"))
|
"/" name ".conf.d"))
|
||||||
(id-rx (make-regexp "^id: *(.*)$"))
|
(id-rx (make-regexp "^id: *(.*)$"))
|
||||||
(config-file (string-append out "/" name ".conf"))
|
(config-file (string-append out "/" name ".conf"))
|
||||||
|
|
Loading…
Reference in New Issue