guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

05/44: build-system/haskell: Add default output "static".


From: guix-commits
Subject: 05/44: build-system/haskell: Add default output "static".
Date: Thu, 13 Aug 2020 10:46:29 -0400 (EDT)

rekado pushed a commit to branch wip-haskell
in repository guix.

commit 718dc7d4a5e5d26cac80c79d78535677e0379dc8
Author: Ricardo Wurmus <rekado@elephly.net>
AuthorDate: Tue Jun 16 22:28:54 2020 +0200

    build-system/haskell: Add default output "static".
    
    * guix/build-system/haskell.scm (lower): Add OUTPUTS keyword and add the
    "static" output in the common case.
    (haskell-build): Set the default value for the OUTPUTS keyword to include 
the
    "static" output.
    * guix/build/haskell-build-system.scm (install): Move static libraries to 
the
    "static" output if it exists.
---
 guix/build-system/haskell.scm       |  9 ++++++---
 guix/build/haskell-build-system.scm | 17 ++++++++++++++---
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/guix/build-system/haskell.scm b/guix/build-system/haskell.scm
index ab93c96..f92fbcd 100644
--- a/guix/build-system/haskell.scm
+++ b/guix/build-system/haskell.scm
@@ -67,7 +67,7 @@ version REVISION."
                 #:rest arguments)
   "Return a bag for NAME."
   (define private-keywords
-    '(#:target #:haskell #:cabal-revision #:inputs #:native-inputs))
+    '(#:target #:haskell #:cabal-revision #:inputs #:native-inputs #:outputs))
 
   (define (cabal-revision->origin cabal-revision)
     (match cabal-revision
@@ -95,7 +95,10 @@ version REVISION."
                         ,@(standard-packages)))
          (build-inputs `(("haskell" ,haskell)
                          ,@native-inputs))
-         (outputs outputs)
+         ;; XXX: this is a hack to get around issue #41569.
+         (outputs (match outputs
+                    (("out") (cons "static" outputs))
+                    (_ outputs)))
          (build haskell-build)
          (arguments (strip-keyword-arguments private-keywords arguments)))))
 
@@ -109,7 +112,7 @@ version REVISION."
                         (configure-flags ''())
                         (phases '(@ (guix build haskell-build-system)
                                     %standard-phases))
-                        (outputs '("out"))
+                        (outputs '("out" "static"))
                         (search-paths '())
                         (system (%current-system))
                         (guile #f)
diff --git a/guix/build/haskell-build-system.scm 
b/guix/build/haskell-build-system.scm
index f579815..46104cf 100644
--- a/guix/build/haskell-build-system.scm
+++ b/guix/build/haskell-build-system.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
 ;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
-;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2018, 2020 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -131,9 +131,20 @@ and parameters ~s~%"
                    `(,(string-append "--ghc-option=-j" (number->string 
(parallel-job-count))))
                    '())))
 
-(define* (install #:rest empty)
+(define* (install #:key outputs #:allow-other-keys)
   "Install a given Haskell package."
-  (run-setuphs "copy" '()))
+  (run-setuphs "copy" '())
+  (when (assoc-ref outputs "static")
+    (let ((static (assoc-ref outputs "static"))
+          (lib (or (assoc-ref outputs "lib")
+                   (assoc-ref outputs "out"))))
+      (for-each (lambda (static-lib)
+                  (let* ((subdir (string-drop static-lib (string-length lib)))
+                         (new    (string-append static subdir)))
+                    (mkdir-p (dirname new))
+                    (rename-file static-lib new)))
+                (find-files lib "\\.a$"))))
+  #t)
 
 (define (grep rx port)
   "Given a regular-expression RX including a group, read from PORT until the



reply via email to

[Prev in Thread] Current Thread [Next in Thread]