summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnu/packages/haskell-check.scm5
-rw-r--r--gnu/packages/haskell-crypto.scm6
-rw-r--r--gnu/packages/haskell-web.scm23
-rw-r--r--gnu/packages/haskell-xyz.scm330
-rw-r--r--gnu/packages/haskell.scm78
-rw-r--r--guix/build-system/haskell.scm28
-rw-r--r--guix/build/haskell-build-system.scm96
7 files changed, 501 insertions, 65 deletions
diff --git a/gnu/packages/haskell-check.scm b/gnu/packages/haskell-check.scm
index c2cffbad9e..7f7bc22da5 100644
--- a/gnu/packages/haskell-check.scm
+++ b/gnu/packages/haskell-check.scm
@@ -489,7 +489,7 @@ use HUnit assertions as QuickCheck properties.")
(package
(name "ghc-quickcheck")
(version "2.13.2")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -651,7 +651,7 @@ using Template Haskell")
(package
(name "ghc-hunit")
(version "1.6.0.0")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -766,6 +766,7 @@ used to test the in-development version of Hspec.")
(base32
"1x8rcr7j1azcaw0fg1xzp8j0gr4ias36z09aj24i4xp8pnyfp341"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-hspec-core" ,ghc-hspec-core)
("hspec-discover" ,hspec-discover)
diff --git a/gnu/packages/haskell-crypto.scm b/gnu/packages/haskell-crypto.scm
index b9b350b61a..c92dec9932 100644
--- a/gnu/packages/haskell-crypto.scm
+++ b/gnu/packages/haskell-crypto.scm
@@ -150,6 +150,7 @@ algorithm (ex: padding) is within scope of this package.")
(base32
"0w3j43jdrlj28jryp18hc6q84nkl2yf4vs1hhgrsk7gb9kfyqjpl"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs `(("ghc-test-framework-quickcheck2" ,ghc-test-framework-quickcheck2)
("ghc-crypto-api" ,ghc-crypto-api)
("ghc-cereal" ,ghc-cereal)
@@ -310,6 +311,7 @@ the C implementation.")
;; FIXME: tests are broken.
;; See https://github.com/haskell-crypto/cryptonite/issues/260
(arguments '(#:tests? #f))
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-basement" ,ghc-basement)
("ghc-memory" ,ghc-memory)
@@ -343,6 +345,8 @@ generators, and more.")
(base32
"04gy2zp8yzvv7j9bdfvmfzcz3sqyqa6rwslqcn4vyair2vmif5v4"))))
(build-system haskell-build-system)
+ (arguments
+ `(#:extra-directories ("zlib")))
(inputs
`(("zlib" ,zlib)))
(home-page
@@ -790,6 +794,8 @@ extensions.")
(base32
"0qivl9clmybfglwxqp2sq308rv4ia4rhwshcsc8b029bvpp0mpsi"))))
(build-system haskell-build-system)
+ (arguments
+ `(#:extra-directories ("openssl")))
(inputs
`(("ghc-network" ,ghc-network)
("openssl" ,openssl)))
diff --git a/gnu/packages/haskell-web.scm b/gnu/packages/haskell-web.scm
index c53dc064b1..b9474c973a 100644
--- a/gnu/packages/haskell-web.scm
+++ b/gnu/packages/haskell-web.scm
@@ -171,7 +171,7 @@ both client and server code).")
(package
(name "ghc-http")
(version "4000.3.14")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -197,7 +197,23 @@ both client and server code).")
("ghc-network-uri" ,ghc-network-uri)
("ghc-split" ,ghc-split)))
(arguments
- `(#:tests? #f)) ; FIXME: currently missing libraries used for tests.
+ `(#:tests? #f ; FIXME: currently missing libraries used for tests.
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'create-simple-paths-module
+ (lambda _
+ (call-with-output-file "Paths_HTTP.hs"
+ (lambda (port)
+ (format port "\
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE NoRebindableSyntax #-}
+{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
+module Paths_HTTP (version) where
+import Data.Version (Version(..))
+version :: Version
+version = Version [~a] []
+" (string-map (lambda (chr) (if (eq? chr #\.) #\, chr)) ,version))))
+ #t)))))
(home-page "https://github.com/haskell/HTTP")
(synopsis "Library for client-side HTTP")
(description
@@ -904,6 +920,7 @@ entity decoding bugfixes applied.")
(base32
"0k1r1hddjgqighazcazxrx6xfhvy2gm8il8l82ainv3cai13yl30"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-blaze-builder" ,ghc-blaze-builder)
("ghc-blaze-markup" ,ghc-blaze-markup)))
@@ -934,6 +951,7 @@ entity decoding bugfixes applied.")
"1jhabz1lbbv6yqxqiybifi86cb5xlsadrn368n5dd0wzzc7ja4iz"))))
(build-system haskell-build-system)
(arguments `(#:tests? #f)) ; FIXME: testing libraries are missing.
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-attoparsec" ,ghc-attoparsec)
("ghc-base-compat" ,ghc-base-compat)
@@ -1470,6 +1488,7 @@ derivations of regular expressions.")
(base32
"0836k65px3w9c5h1h2bmzq5a7mp6ajxwvfg3pfr2kbxwkgc0j63j"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-hxt-charproperties" ,ghc-hxt-charproperties)
("ghc-hxt-unicode" ,ghc-hxt-unicode)
diff --git a/gnu/packages/haskell-xyz.scm b/gnu/packages/haskell-xyz.scm
index a9a5f8afe6..cc251b1934 100644
--- a/gnu/packages/haskell-xyz.scm
+++ b/gnu/packages/haskell-xyz.scm
@@ -50,6 +50,7 @@
#:use-module (gnu packages gl)
#:use-module (gnu packages graphviz)
#:use-module (gnu packages gtk)
+ #:use-module (gnu packages haskell)
#:use-module (gnu packages haskell-apps)
#:use-module (gnu packages haskell-check)
#:use-module (gnu packages haskell-crypto)
@@ -71,7 +72,8 @@
#:use-module (guix git-download)
#:use-module (guix utils)
#:use-module ((guix licenses) #:prefix license:)
- #:use-module (guix packages))
+ #:use-module (guix packages)
+ #:use-module (srfi srfi-1))
(define-public ghc-abstract-deque
(package
@@ -327,6 +329,8 @@ tool lex or flex for C/C++.")
(base32
"1avh4a419h9d2zsslg6j8hm87ppgsgqafz8ll037rk2yy1g4jl7b"))))
(build-system haskell-build-system)
+ (arguments
+ `(#:extra-directories ("alsa-lib")))
(inputs
`(("ghc-extensible-exceptions" ,ghc-extensible-exceptions)
("alsa-lib" ,alsa-lib)))
@@ -799,6 +803,7 @@ Haskell @code{ByteString}s.")
(base32
"0hgvlqcr852hfp52jp99snhbj550mvxxpi8qn15d8ml9aqhyl2lr"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(native-inputs
`(("ghc-quickcheck" ,ghc-quickcheck)
("ghc-hspec" ,ghc-hspec)
@@ -856,6 +861,7 @@ than @code{base-compat}, which has no dependencies.")
(base32
"0srlws74yiraqaapgcjd9p5d1fwb3zr9swcz74jpjm55fls2nn37"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(home-page "https://github.com/haskell-foundation/foundation")
(synopsis "Basic primitives for Foundation starter pack")
(description
@@ -902,6 +908,7 @@ available in later versions of base to a wider (older) range of compilers.")
(base32
"1zk728sd09hh2r4xwz4lazsrrgg5cshydn64932sm0vckplndk73"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(home-page "https://github.com/nikita-volkov/base-prelude")
(synopsis "The most complete prelude formed solely from the Haskell's base
package")
@@ -1517,7 +1524,7 @@ call stacks with different versions of the compiler.")
(package
(name "ghc-case-insensitive")
(version "1.2.0.11")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -2061,6 +2068,7 @@ of the C library.")
(base32
"0cbkmgrcnwgigg6z88y3c09gm7g6dwm7gzbgr53h8k1xik29s9hf"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(home-page
"http://community.haskell.org/~ndm/cmdargs/")
(synopsis "Command line argument processing")
@@ -2262,6 +2270,7 @@ concurrent threads. Can be used for progress displays etc.")
(base32
"18izjgff4pmrknc8py06yvg3g6x27nx0rzmlwjxcflwm5v4szpw4"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-exceptions" ,ghc-exceptions)
("ghc-lifted-base" ,ghc-lifted-base)
@@ -3234,7 +3243,7 @@ disk space usage.")
(define-public ghc-distributive
(package
(name "ghc-distributive")
- (version "0.6.1")
+ (version "0.6.2")
(source
(origin
(method url-fetch)
@@ -3244,7 +3253,7 @@ disk space usage.")
".tar.gz"))
(sha256
(base32
- "1wnayzzb4vk8rhh9gzhdpd9f64366k4vmbhximavmqqmp3cv2jbp"))))
+ "1j93zkfffm6s16kgr0j0z87y5ds28rw0r2gyc5ncwcylvrqy4kl2"))))
(build-system haskell-build-system)
(inputs
`(("ghc-tagged" ,ghc-tagged)
@@ -4088,7 +4097,7 @@ consuming feeds in both RSS (Really Simple Syndication) and Atom format.")
(package
(name "ghc-fgl")
(version "5.7.0.1")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -4335,6 +4344,7 @@ completely unverified though.")
(base32
"19qjmzc7gaxfwgqbgy0kq4vhbxvh3qjnwsxnc7pzwws2if5bv80b"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs `(("ghc-mwc-randam" ,ghc-mwc-random)
("ghc-primitive" ,ghc-primitive)
("ghc-vector" ,ghc-vector)
@@ -4377,6 +4387,7 @@ and are often as efficient as hand-written folds.")
(substitute* "tests/Test/Foundation/Number.hs"
((", testDividible proxy") ""))
#t)))))
+ (outputs '("out" "static" "doc"))
(inputs `(("ghc-basement" ,ghc-basement)))
(home-page "https://github.com/haskell-foundation/foundation")
(synopsis "Alternative prelude with batteries and no dependencies")
@@ -4413,6 +4424,7 @@ Foundation has the following goals:
(base32
"0vlf3f2ckl3cr7z2zl8c9c8qkdlfgvmh04gxkp2fg0z9dz80nlyb"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-prelude-extras" ,ghc-prelude-extras)
("ghc-profunctors" ,ghc-profunctors)
@@ -4479,6 +4491,7 @@ specific Windows, Mac, and Linux file system event notification.")
(base32
"0vdg9qdq35jl3m11a87wk8cq1y71qm4i1g1b2pxki0wk70yw20a4"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-th-abstraction" ,ghc-th-abstraction)))
(native-inputs
@@ -4558,6 +4571,7 @@ and @code{withBaseCase}) or implicitly (@code{genericArbitrary'}).")
(base32
"160knr2phnzh2gldfv954lz029jzc7y8kz5xpmbf4z3vb5ngm6fw"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-sop-core" ,ghc-sop-core)
("ghc-transformers-compat" ,ghc-transformers-compat)))
@@ -5204,7 +5218,7 @@ Happy works in a similar way to the yacc tool for C.")
(package
(name "ghc-hashable")
(version "1.2.7.0")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -5391,6 +5405,7 @@ package are to parse or generate Haskell 98 code.")
(base32
"0q1y8n3d82gid9bcx8wxsqqmj9mq11fg3gp5yzpfbw958dhi3j9f"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs
`(("cpphs" ,cpphs)
("ghc-happy" ,ghc-happy)
@@ -5636,6 +5651,8 @@ accessed or modified.")
(sha256
(base32 "1sqy1aci5zfagkb34mz3xdil7cl96z4b4cx28cha54vc5sx1lhpg"))))
(build-system haskell-build-system)
+ (arguments
+ `(#:extra-directories ("lapack")))
(inputs
`(("ghc-random" ,ghc-random)
("ghc-split" ,ghc-split)
@@ -5667,6 +5684,8 @@ numerical computations based on BLAS and LAPACK.")
(sha256
(base32 "0v6dla426x4ywaq59jm89ql1i42n39iw6z0j378xwb676v9kfxhm"))))
(build-system haskell-build-system)
+ (arguments
+ `(#:extra-directories ("gsl")))
(inputs
`(("ghc-hmatrix" ,ghc-hmatrix)
("ghc-vector" ,ghc-vector)
@@ -5884,7 +5903,8 @@ handler built in.")
"183bgl5jcx5y2r94lviqfw0a5w9089nxjd1z40k8vx9y2h60pm6j"))))
(build-system haskell-build-system)
(arguments
- `(#:configure-flags '("-fsystem-lua")))
+ `(#:configure-flags '("-fsystem-lua")
+ #:extra-directories ("lua")))
(inputs
`(("lua" ,lua)
("ghc-exceptions" ,ghc-exceptions)
@@ -6494,6 +6514,8 @@ instances for conversion to and from JSON .ipynb files.")
(sha256
(base32 "0khmfwql4vwj55idsxmhjhrbqzfir3g9wm5lmpvnf77mm95cfpdz"))))
(build-system haskell-build-system)
+ (arguments
+ `(#:extra-directories ("wireless-tools")))
(inputs
`(("wireless-tools" ,wireless-tools)))
(home-page "https://github.com/jaor/iwlib")
@@ -6539,6 +6561,7 @@ JSON (JavaScript Object Notation) is a lightweight data-interchange format.")
(base32
"0qacrnz2qcykj3f6c4k2p8qd31pa2slpv3ykfblgizrfh3401q6x"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-zlib" ,ghc-zlib)
("ghc-vector" ,ghc-vector)
@@ -6672,6 +6695,7 @@ with @code{wc} (for a web service).")
(base32
"1gpkc53l2cggnfrgg5k4ih82rycjbdvpj9pnbi5cq8ms0dbvs4a7"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-base-orphans" ,ghc-base-orphans)
("ghc-bifunctors" ,ghc-bifunctors)
@@ -6820,6 +6844,7 @@ Music Player Daemon.")
(base32
"12gsh994pr13bsybwlravmi21la66dyw74pk74yfw2pnz682wv10"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc")) ; documentation is 39M
(native-inputs
`(("ghc-alex" ,ghc-alex)
("ghc-happy" ,ghc-happy)))
@@ -6876,7 +6901,8 @@ compiler versions.")
#t))))
(build-system haskell-build-system)
(arguments
- `(#:configure-flags `("--flags=system-libyaml")))
+ `(#:configure-flags `("--flags=system-libyaml")
+ #:extra-directories ("libyaml")))
(inputs
`(("ghc-conduit" ,ghc-conduit)
("ghc-resourcet" ,ghc-resourcet)
@@ -7900,6 +7926,7 @@ the @code{mtl-tf} package.")
(base32
"1bqy982lpdb83lacfy76n8kqw5bvd31avxj25kg8gkgycdh0g0ma"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs `(("ghc-unordered-containers" ,ghc-unordered-containers)
("ghc-hashable" ,ghc-hashable)
("ghc-vector" ,ghc-vector)
@@ -8090,7 +8117,8 @@ between 2 and 3 times faster than the Mersenne Twister.")
"0gsyyaqyh5r9zc0rhwpj5spyd6i4w2vj61h4nihgmmh0yyqvf3z5"))))
(build-system haskell-build-system)
(arguments
- '(#:phases
+ '(#:extra-directories ("ncurses")
+ #:phases
(modify-phases %standard-phases
(add-before 'build 'fix-includes
(lambda _
@@ -8116,7 +8144,7 @@ ncurses.")
(package
(name "ghc-network")
(version "2.8.0.1")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -8210,7 +8238,7 @@ IPv4, IPv6 and MAC addresses.")
(package
(name "ghc-network-uri")
(version "2.6.1.0")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -8458,6 +8486,8 @@ version 1.3).")
(base32
"0zgllb4bcash2i2cispa3j565aw3dpxs41ghmhpvyvi4a6xmyldx"))))
(build-system haskell-build-system)
+ (arguments
+ `(#:extra-directories ("glu")))
(inputs
`(("ghc-half" ,ghc-half)
("ghc-fixed" ,ghc-fixed)
@@ -8734,6 +8764,17 @@ code. It was designed for use in @code{Pandoc}.")
(base32
"0dpjrr40h54cljzhvixyym07z792a9izg6b9dmqpjlgcg4rj0xx8"))))
(build-system haskell-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'find-library
+ (lambda _
+ (substitute* "test/Tests/Command.hs"
+ (("= dynlibEnv")
+ (format #f "= [(\"LD_LIBRARY_PATH\" , \"~a/dist/build\")]"
+ (getcwd))))
+ #t)))))
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-aeson" ,ghc-aeson)
("ghc-aeson-pretty" ,ghc-aeson-pretty)
@@ -8796,6 +8837,117 @@ definition lists, tables, and other features. A compatibility mode is
provided for those who need a drop-in replacement for Markdown.pl.")
(license license:gpl2+)))
+(define-public pandoc
+ (package
+ (inherit ghc-pandoc)
+ (name "pandoc")
+ (arguments
+ `(#:configure-flags
+ (list "-fstatic"
+ ;; Do not build trypandoc; this is the default but it's better to
+ ;; be explicit.
+ "-f-trypandoc"
+ ;; TODO: Without these we cannot link the Haskell libraries
+ ;; statically. It would be nice if we could also build the
+ ;; shared libraries.
+ "--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
+ (add-after 'unpack 'create-simple-paths-module
+ (lambda* (#:key outputs #:allow-other-keys)
+ (call-with-output-file "Paths_pandoc.hs"
+ (lambda (port)
+ (format port "\
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE NoRebindableSyntax #-}
+{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
+module Paths_pandoc (version,getDataDir,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-~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))
+ (assoc-ref outputs "out")
+ ,(package-version ghc)
+ ,(package-version ghc-pandoc))))
+ #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))
+ (delete 'check)
+ (add-after 'install 'post-install-check
+ (assoc-ref %standard-phases 'check)))))
+ (outputs '("out" "lib" "static" "doc"))
+ (inputs
+ (let* ((direct-inputs (package-inputs ghc-pandoc))
+ (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)))
+ (native-inputs
+ (let* ((direct-inputs (package-native-inputs ghc-pandoc))
+ (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))))))))
+ `(,@all-static-inputs
+ ,@direct-inputs)))))
+
(define-public ghc-pandoc-citeproc
(package
(name "ghc-pandoc-citeproc")
@@ -8855,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")
@@ -8868,6 +9122,26 @@ suitable for inclusion in pandoc YAML metadata.")
(base32
"1d6ygq991ddria71l7hg9yd7lq94sjy4m71rdws1v8hq943c4d0q"))))
(build-system haskell-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ ;; None of the directory names are actually used. By generating a
+ ;; simpler module without references to store names we avoid
+ ;; introducing references in the pandoc executable.
+ (add-after 'unpack 'create-simple-paths-module
+ (lambda _
+ (call-with-output-file "Paths_pandoc_types.hs"
+ (lambda (port)
+ (format port "\
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE NoRebindableSyntax #-}
+{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
+module Paths_pandoc_types (version) where
+import Data.Version (Version(..))
+version :: Version
+version = Version [~a] []
+" (string-map (lambda (chr) (if (eq? chr #\.) #\, chr)) ,version))))
+ #t)))))
(inputs
`(("ghc-syb" ,ghc-syb)
("ghc-aeson" ,ghc-aeson)
@@ -8890,7 +9164,7 @@ building up, manipulating and serialising @code{Pandoc} structures.")
(package
(name "ghc-parallel")
(version "3.2.2.0")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -9056,7 +9330,7 @@ files/directories, and more.")
(package
(name "ghc-paths")
(version "0.1.0.12")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -9660,7 +9934,7 @@ Show instance.")
(package
(name "ghc-primitive")
(version "0.6.4.0")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -9727,6 +10001,7 @@ API.")
(base32
"1dx3nkc27yxsrbrhh3iwhq7dl1xn6bj7n62yx6nh8vmpbg62lqvl"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-base-orphans" ,ghc-base-orphans)
("ghc-bifunctors" ,ghc-bifunctors)
@@ -9929,7 +10204,7 @@ usable.")
(package
(name "ghc-random")
(version "1.1")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -10005,6 +10280,7 @@ includes efficient implementations for common data types.")
(base32
"0q4m2fa7wkgxs0grir8rlqwibasmi3s1x7c107ynndwfm62nzv0a"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs `(("ghc-hashable" ,ghc-hashable)
("ghc-vector" ,ghc-vector)
("ghc-unordered-containers" ,ghc-unordered-containers)
@@ -10350,6 +10626,7 @@ Haskell library @code{regex-base}.")
(base32
"03yhpqrqz977nwlnhnyz9dacnbzw8xb6j18h365rkgmbc05sb3hf"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-regex-base" ,ghc-regex-base)))
(home-page "https://github.com/haskell-hvr/regex-tdfa")
@@ -10438,6 +10715,7 @@ normal mtl transformers.")
(base32
"1jbqif6k249rkknm2zwk8v8jil3kgi9ar53358v8l4ffx346rm82"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-rebase" ,ghc-rebase)))
(home-page "https://github.com/nikita-volkov/rerebase")
@@ -11108,6 +11386,7 @@ class, forming lattice-like structure.")
(base32
"016hc4imr9l4szs3p7f1aahvxr5wv4clvr3qzrm3nibssg5vrs61"))))
(build-system haskell-build-system)
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-base-orphans" ,ghc-base-orphans)
("ghc-transformers-compat" ,ghc-transformers-compat)
@@ -11597,7 +11876,7 @@ used for example by QuickCheck, see quickcheck-special." )
(package
(name "ghc-split")
(version "0.2.3.3")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -12132,7 +12411,7 @@ building Scalable Vector Graphics (SVG).")
(package
(name "ghc-syb")
(version "0.7.1")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -12577,7 +12856,7 @@ string metrics efficiently.")
(package
(name "ghc-tf-random")
(version "0.5")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -13525,6 +13804,7 @@ for Unix time in Haskell.")
"02gy1zrxgzg4xmzm8lafsf1nyr3as1q20r8ld73xg3q7rkag9acg"))))
(build-system haskell-build-system)
(arguments `(#:tests? #f)) ; FIXME: hspec-discover not in PATH
+ (outputs '("out" "static" "doc"))
(inputs
`(("ghc-async" ,ghc-async)
("ghc-unliftio-core" ,ghc-unliftio-core)))
@@ -13566,7 +13846,7 @@ functions.")
(package
(name "ghc-unordered-containers")
(version "0.2.10.0")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -13921,7 +14201,7 @@ representing a store for a single element.")
(package
(name "ghc-vector")
(version "0.12.0.3")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -14292,6 +14572,9 @@ modernized interface.")
(sha256
(base32 "0gg6852mrlgl8zng1j84fismz7k81jr5fk92glgkscf8q6ryg0bm"))))
(build-system haskell-build-system)
+ (arguments
+ `(#:extra-directories
+ ("libx11" "libxrandr" "libxinerama" "libxscrnsaver")))
(inputs
`(("libx11" ,libx11)
("libxrandr" ,libxrandr)
@@ -14316,6 +14599,8 @@ bindings are a direct translation of the C bindings.")
"X11-xft-" version ".tar.gz"))
(sha256
(base32 "1lgqb0s2qfwwgbvwxhjbi23rbwamzdi0l0slfr20c3jpcbp3zfjf"))))
+ (arguments
+ `(#:extra-directories ("libx11" "libxft" "xorgproto")))
(inputs
`(("ghc-x11" ,ghc-x11)
("ghc-utf8-string" ,ghc-utf8-string)
@@ -14503,7 +14788,7 @@ modifying, and extracting files from zip archives in Haskell.")
(package
(name "ghc-zlib")
(version "0.6.2.1")
- (outputs '("out" "doc"))
+ (outputs '("out" "static" "doc"))
(source
(origin
(method url-fetch)
@@ -14516,7 +14801,8 @@ modifying, and extracting files from zip archives in Haskell.")
"1l11jraslcrp9d4wnhwfyhwk4fsiq1aq8i6vj81vcq1m2zzi1y7h"))))
(build-system haskell-build-system)
(arguments
- `(#:phases
+ `(#:extra-directories ("zlib")
+ #:phases
(modify-phases %standard-phases
(add-before 'configure 'strip-test-framework-constraints
(lambda _
diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index 94671ee54d..09732fc594 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -6,7 +6,7 @@
;;; Copyright © 2016, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016, 2017 Nikita <nikita@n0.is>
;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2016, 2017 David Craven <david@craven.ch>
;;; Copyright © 2017 Danny Milosavljevic <dannym@scratchpost.org>
;;; Copyright © 2017 Peter Mikkelsen <petermikkelsen10@gmail.com>
@@ -14,7 +14,7 @@
;;; Copyright © 2017 rsiddharth <s@ricketyspace.net>
;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 Tonton <tonton@riseup.net>
-;;; Copyright © 2018, 2019 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2018, 2019, 2020 Timothy Sample <samplet@ngyro.com>
;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2018, 2019 Gabriel Hondet <gabrielhondet@gmail.com>
;;; Copyright © 2019 Robert Vollmert <rob@vllmrt.net>
@@ -47,6 +47,7 @@
#:use-module (gnu packages ncurses)
#:use-module (gnu packages perl)
#:use-module (gnu packages python)
+ #:use-module (gnu packages version-control)
#:use-module (guix build-system gnu)
#:use-module (guix download)
#:use-module (guix git-download)
@@ -567,6 +568,32 @@ interactive environment for the functional language Haskell.")
,make-flags))
((#:phases phases '%standard-phases)
`(modify-phases ,phases
+ (add-after 'install 'remove-unnecessary-references
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* (find-files (string-append (assoc-ref outputs "out") "/lib/")
+ "settings")
+ (("/gnu/store/.*/bin/(.*)" m program) program))
+
+ ;; Remove references to "doc" output from "out" by rewriting
+ ;; the "haddock-interfaces" fields and removing the optional
+ ;; "haddock-html" field in the generated .conf files.
+ (let ((doc (assoc-ref outputs "doc"))
+ (out (assoc-ref outputs "out")))
+ (with-fluids ((%default-port-encoding #f))
+ (for-each (lambda (config-file)
+ (substitute* config-file
+ (("^haddock-html: .*") "\n")
+ (((format #f "^haddock-interfaces: ~a" doc))
+ (string-append "haddock-interfaces: " out))))
+ (find-files (string-append out "/lib") ".conf")))
+ ;; Move the referenced files to the "out" output.
+ (for-each (lambda (haddock-file)
+ (let* ((subdir (string-drop haddock-file (string-length doc)))
+ (new (string-append out subdir)))
+ (mkdir-p (dirname new))
+ (rename-file haddock-file new)))
+ (find-files doc "\\.haddock$")))
+ #t))
(add-after 'unpack-testsuite 'skip-tests
(lambda _
;; These two tests refer to the root user, which doesn't exist
@@ -583,6 +610,53 @@ interactive environment for the functional language Haskell.")
(file-pattern ".*\\.conf\\.d$")
(file-type 'directory))))))
+(define-public ghc-8.8
+ (package (inherit ghc-8.6)
+ (name "ghc")
+ (version "8.8.3")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://www.haskell.org/ghc/dist/"
+ version "/ghc-" version "-src.tar.xz"))
+ (sha256
+ (base32 "128g932i3wix6ic03v04nh5755vyjiidzri9iybwad72yfmc1p70"))))
+ (native-inputs
+ `(("ghc-bootstrap" ,ghc-8.6)
+ ("ghc-testsuite"
+ ,(origin
+ (method url-fetch)
+ (uri (string-append
+ "https://www.haskell.org/ghc/dist/"
+ version "/ghc-" version "-testsuite.tar.xz"))
+ (patches (search-patches "ghc-testsuite-dlopen-pie.patch"))
+ (sha256
+ (base32
+ "1l32mp94ll72skfsq1g2fqax4bkiw8b85gr3wd0bbqsqyi9a9jpr"))))
+ ("git" ,git) ; invoked during tests
+ ,@(filter (match-lambda
+ (("ghc-bootstrap" . _) #f)
+ (("ghc-testsuite" . _) #f)
+ (_ #t))
+ (package-native-inputs ghc-8.6))))
+ (arguments
+ (substitute-keyword-arguments (package-arguments ghc-8.6)
+ ((#:phases phases '%standard-phases)
+ `(modify-phases ,phases
+ (add-after 'unpack-testsuite 'skip-more-tests
+ (lambda _
+ ;; XXX: This test fails because our ld-wrapper script
+ ;; mangles the response file passed to the linker.
+ (substitute* "testsuite/tests/hp2ps/all.T"
+ (("^test\\('T15904'") "# guix skipped: test('T15904'"))
+ #t))))))
+ (native-search-paths (list (search-path-specification
+ (variable "GHC_PACKAGE_PATH")
+ (files (list
+ (string-append "lib/ghc-" version)))
+ (file-pattern ".*\\.conf\\.d$")
+ (file-type 'directory))))))
+
(define-public ghc-8 ghc-8.6)
(define-public ghc ghc-8)
diff --git a/guix/build-system/haskell.scm b/guix/build-system/haskell.scm
index 1ec11c71d8..8304e3b222 100644
--- a/guix/build-system/haskell.scm
+++ b/guix/build-system/haskell.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
+;;; Copyright © 2020 Timothy Sample <samplet@ngyro.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -26,6 +27,7 @@
#:use-module (guix build-system)
#:use-module (guix build-system gnu)
#:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (%haskell-build-system-modules
haskell-build
@@ -67,7 +69,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,9 +97,23 @@ 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)))))
+ (arguments
+ (substitute-keyword-arguments
+ (strip-keyword-arguments private-keywords arguments)
+ ((#:extra-directories extra-directories)
+ `(list ,@(append-map
+ (lambda (name)
+ (match (assoc name inputs)
+ ((_ pkg)
+ (match (package-transitive-propagated-inputs pkg)
+ (((propagated-names . _) ...)
+ (cons name propagated-names))))))
+ extra-directories))))))))
(define* (haskell-build store name inputs
#:key source
@@ -105,10 +121,12 @@ version REVISION."
(haddock-flags ''())
(tests? #t)
(test-target "test")
+ (parallel-build? #t)
(configure-flags ''())
+ (extra-directories ''())
(phases '(@ (guix build haskell-build-system)
%standard-phases))
- (outputs '("out"))
+ (outputs '("out" "static"))
(search-paths '())
(system (%current-system))
(guile #f)
@@ -134,10 +152,12 @@ provides a 'Setup.hs' file as its build system."
(derivation->output-path revision))
(revision revision))
#:configure-flags ,configure-flags
+ #:extra-directories ,extra-directories
#:haddock-flags ,haddock-flags
#:system ,system
#:test-target ,test-target
#:tests? ,tests?
+ #:parallel-build? ,parallel-build?
#:haddock? ,haddock?
#:phases ,phases
#:outputs %outputs
diff --git a/guix/build/haskell-build-system.scm b/guix/build/haskell-build-system.scm
index 91f62138d0..28253ce2f0 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.
@@ -73,37 +73,35 @@ and parameters ~s~%"
(error "no Setup.hs nor Setup.lhs found"))))
(define* (configure #:key outputs inputs tests? (configure-flags '())
- #:allow-other-keys)
+ (extra-directories '()) #:allow-other-keys)
"Configure a given Haskell package."
(let* ((out (assoc-ref outputs "out"))
(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)
- (_ '())))
+ (extra-dirs (filter-map (cut assoc-ref inputs <>) extra-directories))
(ghc-path (getenv "GHC_PACKAGE_PATH"))
- (params (append `(,(string-append "--prefix=" out))
- `(,(string-append "--libdir=" (or lib out) "/lib"))
- `(,(string-append "--bindir=" (or bin out) "/bin"))
- `(,(string-append
- "--docdir=" (or doc out)
- "/share/doc/" name-version))
- '("--libsubdir=$compiler/$pkg-$version")
- `(,(string-append "--package-db=" %tmp-db-dir))
- '("--global")
- `(,@(map
- (cut string-append "--extra-include-dirs=" <>)
- (search-path-as-list '("include") input-dirs)))
- `(,@(map
- (cut string-append "--extra-lib-dirs=" <>)
- (search-path-as-list '("lib") input-dirs)))
- (if tests?
- '("--enable-tests")
- '())
- configure-flags)))
+ (params `(,(string-append "--prefix=" out)
+ ,(string-append "--libdir=" (or lib out) "/lib")
+ ,(string-append "--docdir=" (or doc out)
+ "/share/doc/" name-version)
+ "--libsubdir=$compiler/$pkg-$version"
+ ,(string-append "--package-db=" %tmp-db-dir)
+ "--global"
+ ,@(map (cut string-append "--extra-include-dirs=" <>)
+ (search-path-as-list '("include") extra-dirs))
+ ,@(map (cut string-append "--extra-lib-dirs=" <>)
+ (search-path-as-list '("lib") extra-dirs))
+ ,@(if tests?
+ '("--enable-tests")
+ '())
+ ;; Build and link with shared libraries
+ "--enable-shared"
+ "--enable-executable-dynamic"
+ "--ghc-option=-fPIC"
+ ,(string-append "--ghc-option=-optl=-Wl,-rpath=" (or lib out)
+ "/lib/$compiler/$pkg-$version")
+ ,@configure-flags)))
;; Cabal errors if GHC_PACKAGE_PATH is set during 'configure', so unset
;; and restore it.
(unsetenv "GHC_PACKAGE_PATH")
@@ -121,13 +119,27 @@ and parameters ~s~%"
(setenv "GHC_PACKAGE_PATH" ghc-path)
#t))
-(define* (build #:rest empty)
+(define* (build #:key parallel-build? #:allow-other-keys)
"Build a given Haskell package."
- (run-setuphs "build" '()))
+ (run-setuphs "build"
+ (if parallel-build?
+ `(,(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
@@ -227,9 +239,10 @@ given Haskell package."
(loop seen tail))))))
(let* ((out (assoc-ref outputs "out"))
+ (doc (assoc-ref outputs "doc"))
(haskell (assoc-ref inputs "haskell"))
(name-verion (strip-store-file-name haskell))
- (lib (string-append out "/lib"))
+ (lib (string-append (or (assoc-ref outputs "lib") out) "/lib"))
(config-dir (string-append lib
"/" name-verion
"/" name ".conf.d"))
@@ -241,8 +254,25 @@ given Haskell package."
;; The conf file is created only when there is a library to register.
(when (file-exists? config-file)
(mkdir-p config-dir)
- (let* ((config-file-name+id
- (call-with-ascii-input-file config-file (cut grep id-rx <>))))
+ (let ((config-file-name+id
+ (call-with-ascii-input-file config-file (cut grep id-rx <>))))
+
+ ;; Remove reference to "doc" output from "lib" (or "out") by rewriting the
+ ;; "haddock-interfaces" field and removing the optional "haddock-html"
+ ;; field in the generated .conf file.
+ (when doc
+ (substitute* config-file
+ (("^haddock-html: .*") "\n")
+ (((format #f "^haddock-interfaces: ~a" doc))
+ (string-append "haddock-interfaces: " lib)))
+ ;; Move the referenced file to the "lib" (or "out") output.
+ (match (find-files doc "\\.haddock$")
+ ((haddock-file . rest)
+ (let* ((subdir (string-drop haddock-file (string-length doc)))
+ (new (string-append lib subdir)))
+ (mkdir-p (dirname new))
+ (rename-file haddock-file new)))
+ (_ #f)))
(install-transitive-deps config-file %tmp-db-dir config-dir)
(rename-file config-file
(string-append config-dir "/"