From 58352f269e46942c34d7ee4e29f91144576ca661 Mon Sep 17 00:00:00 2001 From: Alex Vong Date: Thu, 18 Oct 2018 02:53:32 +0800 Subject: build-system/haskell: Use 'strip-store-file-name'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See the discussion at . * 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 --- guix/build/haskell-build-system.scm | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'guix/build') diff --git a/guix/build/haskell-build-system.scm b/guix/build/haskell-build-system.scm index 72714a29ad..7b556f6431 100644 --- a/guix/build/haskell-build-system.scm +++ b/guix/build/haskell-build-system.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2015 Eric Bavier ;;; Copyright © 2015 Paul van der Walt ;;; Copyright © 2018 Ricardo Wurmus +;;; Copyright © 2018 Alex Vong ;;; ;;; This file is part of GNU Guix. ;;; @@ -78,6 +79,7 @@ (define* (configure #:key outputs inputs tests? (configure-flags '()) (doc (assoc-ref outputs "doc")) (lib (assoc-ref outputs "lib")) (bin (assoc-ref outputs "bin")) + (name-version (strip-store-file-name out)) (input-dirs (match inputs (((_ . dir) ...) dir) @@ -88,7 +90,7 @@ (define* (configure #:key outputs inputs tests? (configure-flags '()) `(,(string-append "--bindir=" (or bin out) "/bin")) `(,(string-append "--docdir=" (or doc out) - "/share/doc/" (package-name-version out))) + "/share/doc/" name-version)) '("--libsubdir=$compiler/$pkg-$version") `(,(string-append "--package-db=" %tmp-db-dir)) '("--global") @@ -127,12 +129,6 @@ (define* (install #:rest empty) "Install a given Haskell package." (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) "Given a regular-expression RX including a group, read from PORT until the first match and return the content of the group." @@ -147,7 +143,7 @@ (define (grep rx port) (define* (setup-compiler #:key system inputs outputs #:allow-other-keys) "Setup the compiler environment." (let* ((haskell (assoc-ref inputs "haskell")) - (name-version (package-name-version haskell))) + (name-version (strip-store-file-name haskell))) (cond ((string-match "ghc" name-version) (make-ghc-package-database system inputs outputs)) @@ -164,6 +160,7 @@ (define-syntax-rule (with-null-error-port exp) (define (make-ghc-package-database system inputs outputs) "Generate the GHC package database." (let* ((haskell (assoc-ref inputs "haskell")) + (name-version (strip-store-file-name haskell)) (input-dirs (match inputs (((_ . dir) ...) dir) @@ -171,7 +168,7 @@ (define (make-ghc-package-database system inputs outputs) ;; Silence 'find-files' (see 'evaluate-search-paths') (conf-dirs (with-null-error-port (search-path-as-list - `(,(string-append "lib/" (package-name-version haskell))) + `(,(string-append "lib/" name-version)) input-dirs #:pattern ".*\\.conf.d$"))) (conf-files (append-map (cut find-files <> "\\.conf$") conf-dirs))) (mkdir-p %tmp-db-dir) @@ -231,9 +228,10 @@ (define (install-transitive-deps conf-file src dest) (let* ((out (assoc-ref outputs "out")) (haskell (assoc-ref inputs "haskell")) + (name-verion (strip-store-file-name haskell)) (lib (string-append out "/lib")) - (config-dir (string-append lib "/" - (package-name-version haskell) + (config-dir (string-append lib + "/" name-verion "/" name ".conf.d")) (id-rx (make-regexp "^id: *(.*)$")) (config-file (string-append out "/" name ".conf")) -- cgit v1.2.3