diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2020-06-29 12:40:46 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2020-08-13 16:44:58 +0200 |
commit | e380ef14cfc0126bb75e43fc237b2fbc05a7c7d2 (patch) | |
tree | d76eadbaea0d53565d2d1a7e632dd5fa89c5109d /gnu/packages/haskell-xyz.scm | |
parent | d4e4a3824d380e576b56a74aa714db205fcc59a4 (diff) | |
download | guix-e380ef14cfc0126bb75e43fc237b2fbc05a7c7d2.tar guix-e380ef14cfc0126bb75e43fc237b2fbc05a7c7d2.tar.gz |
gnu: Add pandoc-citeproc.
* gnu/packages/haskell-xyz.scm (pandoc-citeproc): New variable.
Diffstat (limited to 'gnu/packages/haskell-xyz.scm')
-rw-r--r-- | gnu/packages/haskell-xyz.scm | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/gnu/packages/haskell-xyz.scm b/gnu/packages/haskell-xyz.scm index c07a141db3..cc251b1934 100644 --- a/gnu/packages/haskell-xyz.scm +++ b/gnu/packages/haskell-xyz.scm @@ -9007,6 +9007,108 @@ and also has a mode for converting bibliographic databases a YAML format suitable for inclusion in pandoc YAML metadata.") (license license:bsd-3))) +(define-public pandoc-citeproc + (package (inherit ghc-pandoc-citeproc) + (name "pandoc-citeproc") + (arguments + `(#: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>. + (add-before 'configure 'patch-tests + (lambda _ + (substitute* "tests/test-pandoc-citeproc.hs" + (("let allTests = citeprocTests \\+\\+ biblio2yamlTests") + "let allTests = citeprocTests")))) + ;; Tests need to be run after installation. + (delete 'check) + (add-after 'install 'post-install-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)) + ,(package-version ghc-pandoc-citeproc)) + (assoc-ref outputs "out") + ,(package-version ghc) + ,(package-version ghc-pandoc-citeproc)))) + #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))))) + (inputs + (let* ((direct-inputs + (cons `("ghc-pandoc" ,pandoc) + (alist-delete "ghc-pandoc" + (package-inputs ghc-pandoc-citeproc)))) + (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") + ("pandoc" ,pandoc "lib") + ,@all-static-inputs + ,@direct-inputs))) + (synopsis "Pandoc filter for bibliographic references"))) + (define-public ghc-pandoc-types (package (name "ghc-pandoc-types") |