[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
43/43: gnu: ghc-pandoc-citeproc: Build statically linked executable.
From: |
guix-commits |
Subject: |
43/43: gnu: ghc-pandoc-citeproc: Build statically linked executable. |
Date: |
Wed, 12 Aug 2020 14:17:14 -0400 (EDT) |
rekado pushed a commit to branch wip-haskell
in repository guix.
commit 7dfa05137dafacf74eaec781af0097c55ae37f44
Author: Ricardo Wurmus <rekado@elephly.net>
AuthorDate: Mon Jun 29 12:40:46 2020 +0200
gnu: ghc-pandoc-citeproc: Build statically linked executable.
* gnu/packages/haskell-xyz.scm (ghc-pandoc-citeproc)[arguments]: Add
configure flags to build a statically linked executable; add phase
"create-simple-paths-module" to avoid unnecessary inter-output references;
add
phase "prepare-static-libraries".
[outputs]: Add "doc" output.
[inputs]: Add static variants of the package closure of all Haskell inputs.
---
gnu/packages/haskell-xyz.scm | 118 +++++++++++++++++++++++++++++++++++--------
1 file changed, 98 insertions(+), 20 deletions(-)
diff --git a/gnu/packages/haskell-xyz.scm b/gnu/packages/haskell-xyz.scm
index cc9c8a1..229da3f 100644
--- a/gnu/packages/haskell-xyz.scm
+++ b/gnu/packages/haskell-xyz.scm
@@ -8944,7 +8944,18 @@ provided for those who need a drop-in replacement for
Markdown.pl.")
"15mm17awgi1b5yazwhr5nh8b59qml1qk6pz6gpyijks70fq2arsv"))))
(build-system haskell-build-system)
(arguments
- `(#:phases
+ `(#:configure-flags
+ (list "-fstatic"
+ "--disable-shared"
+ "--disable-executable-dynamic"
+ ;; That's where we place all static libraries
+ "--extra-lib-dirs=static-libs/"
+ "--ghc-option=-static")
+ #:modules ((guix build haskell-build-system)
+ (guix build utils)
+ (ice-9 match)
+ (srfi srfi-1))
+ #:phases
(modify-phases %standard-phases
;; Many YAML tests (44) are failing do to changes in ghc-yaml:
;; <https://github.com/jgm/pandoc-citeproc/issues/342>.
@@ -8956,26 +8967,93 @@ provided for those who need a drop-in replacement for
Markdown.pl.")
;; Tests need to be run after installation.
(delete 'check)
(add-after 'install 'post-install-check
- (assoc-ref %standard-phases 'check)))))
+ (assoc-ref %standard-phases 'check))
+ (add-after 'unpack 'create-simple-paths-module
+ (lambda* (#:key outputs #:allow-other-keys)
+ (call-with-output-file "Paths_pandoc_citeproc.hs"
+ (lambda (port)
+ (format port "\
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE NoRebindableSyntax #-}
+{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
+module Paths_pandoc_citeproc (version,getDataFileName) where
+import Prelude
+import Data.Version (Version(..))
+import System.Info
+version :: Version
+version = Version [~a] []
+
+datadir :: FilePath
+datadir = \"~a/share/\" ++
+ arch ++ \"-\" ++
+ os ++ \"-\" ++
+ compilerName ++ \"-~a/pandoc-citeproc-~a\"
+
+getDataDir :: IO FilePath
+getDataDir = return datadir
+
+getDataFileName :: FilePath -> IO FilePath
+getDataFileName name = do
+ dir <- getDataDir
+ return (dir ++ \"/\" ++ name)
+"
+ (string-map (lambda (chr) (if (eq? chr #\.) #\, chr))
,version)
+ (assoc-ref outputs "out")
+ ,(package-version ghc)
+ ,version)))
+ #t))
+ (add-after 'unpack 'prepare-static-libraries
+ (lambda* (#:key inputs #:allow-other-keys)
+ (mkdir-p (string-append (getcwd) "/static-libs"))
+ (for-each
+ (lambda (input)
+ (when (or (string-prefix? "static-" (car input))
+ (string-prefix? "ghc" (car input)))
+ (match (find-files (cdr input) "\\.a$")
+ ((and (first . rest) libs)
+ (for-each (lambda (lib)
+ (let ((target (string-append (getcwd)
"/static-libs/"
+ (basename lib))))
+ (unless (file-exists? target)
+ (symlink first target))))
+ libs))
+ (_ #f))))
+ inputs)
+ #t)))))
+ (outputs '("out" "lib" "static" "doc"))
(inputs
- `(("ghc-pandoc-types" ,ghc-pandoc-types)
- ("ghc-pandoc" ,ghc-pandoc)
- ("ghc-tagsoup" ,ghc-tagsoup)
- ("ghc-aeson" ,ghc-aeson)
- ("ghc-vector" ,ghc-vector)
- ("ghc-xml-conduit" ,ghc-xml-conduit)
- ("ghc-unordered-containers" ,ghc-unordered-containers)
- ("ghc-data-default" ,ghc-data-default)
- ("ghc-setenv" ,ghc-setenv)
- ("ghc-split" ,ghc-split)
- ("ghc-yaml" ,ghc-yaml)
- ("ghc-hs-bibutils" ,ghc-hs-bibutils)
- ("ghc-rfc5051" ,ghc-rfc5051)
- ("ghc-syb" ,ghc-syb)
- ("ghc-old-locale" ,ghc-old-locale)
- ("ghc-aeson-pretty" ,ghc-aeson-pretty)
- ("ghc-attoparsec" ,ghc-attoparsec)
- ("ghc-temporary" ,ghc-temporary)))
+ (let* ((direct-inputs
+ `(("ghc-pandoc-types" ,ghc-pandoc-types)
+ ("ghc-pandoc" ,ghc-pandoc "lib")
+ ("ghc-tagsoup" ,ghc-tagsoup)
+ ("ghc-aeson" ,ghc-aeson)
+ ("ghc-vector" ,ghc-vector)
+ ("ghc-xml-conduit" ,ghc-xml-conduit)
+ ("ghc-unordered-containers" ,ghc-unordered-containers)
+ ("ghc-data-default" ,ghc-data-default)
+ ("ghc-setenv" ,ghc-setenv)
+ ("ghc-split" ,ghc-split)
+ ("ghc-yaml" ,ghc-yaml)
+ ("ghc-hs-bibutils" ,ghc-hs-bibutils)
+ ("ghc-rfc5051" ,ghc-rfc5051)
+ ("ghc-syb" ,ghc-syb)
+ ("ghc-old-locale" ,ghc-old-locale)
+ ("ghc-aeson-pretty" ,ghc-aeson-pretty)
+ ("ghc-attoparsec" ,ghc-attoparsec)
+ ("ghc-temporary" ,ghc-temporary)))
+ (all-static-inputs
+ (map (lambda (pkg)
+ (list (string-append "static-" (package-name pkg))
+ pkg "static"))
+ (delete-duplicates
+ (append (map cadr direct-inputs)
+ (filter (lambda (pkg)
+ (string-prefix? "ghc-" (package-name
pkg)))
+ (package-closure
+ (map cadr direct-inputs))))))))
+ `(("zlib:static" ,zlib "static")
+ ,@all-static-inputs
+ ,@direct-inputs)))
(home-page "https://github.com/jgm/pandoc-citeproc";)
(synopsis "Library for using pandoc with citeproc")
(description
- 26/43: gnu: ghc-generic-deriving: Add "doc" output., (continued)
- 26/43: gnu: ghc-generic-deriving: Add "doc" output., guix-commits, 2020/08/12
- 34/43: gnu: ghc-rebase: Add "doc" output., guix-commits, 2020/08/12
- 36/43: gnu: ghc-rerebase: Add "doc" output., guix-commits, 2020/08/12
- 38/43: gnu: ghc-unliftio: Add "doc" output., guix-commits, 2020/08/12
- 27/43: gnu: ghc-generics-sop: Add "doc" output., guix-commits, 2020/08/12
- 32/43: gnu: ghc-mono-traversable: Add "doc" output., guix-commits, 2020/08/12
- 35/43: gnu: ghc-regex-tdfa: Add "doc" output., guix-commits, 2020/08/12
- 37/43: gnu: ghc-semigroupoids: Add "doc" output., guix-commits, 2020/08/12
- 39/43: gnu: ghc-distributive: Update to 0.6.2., guix-commits, 2020/08/12
- 42/43: gnu: ghc-pandoc: Build statically linked executable., guix-commits, 2020/08/12
- 43/43: gnu: ghc-pandoc-citeproc: Build statically linked executable.,
guix-commits <=
- 11/43: gnu: ghc-8.6: Remove unnecessary references., guix-commits, 2020/08/12
- 16/43: gnu: ghc-aeson: Add "doc" output., guix-commits, 2020/08/12
- 15/43: gnu: ghc-blaze-html: Add "doc" output., guix-commits, 2020/08/12
- 17/43: gnu: ghc-hxt: Add "doc" output., guix-commits, 2020/08/12
- 19/43: gnu: ghc-basement: Add "doc" output., guix-commits, 2020/08/12
- 20/43: gnu: ghc-base-prelude: Add "doc" output., guix-commits, 2020/08/12
- 22/43: gnu: ghc-conduit: Add "doc" output., guix-commits, 2020/08/12
- 23/43: gnu: ghc-foldl: Add "doc" output., guix-commits, 2020/08/12
- 24/43: gnu: ghc-foundation: Add "doc" output., guix-commits, 2020/08/12
- 25/43: gnu: ghc-free: Add "doc" output., guix-commits, 2020/08/12