diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2020-06-16 22:34:37 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2020-08-12 14:45:49 +0200 |
commit | 3f7922cbf5f43418d0cb6d44ba4903f33db8ac61 (patch) | |
tree | c78fabaef76945f914ad3c8f3e4c1512fb0ecbd8 /guix | |
parent | 75bda3c648ae06a08c7512240698837ddf297182 (diff) |
haskell-build-system: register: Remove references to the doc output.
* guix/build/haskell-build-system.scm (register): Strip references to the doc
output from the generated package config files; move the haddock files from
the "doc" output to the "lib" output.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/build/haskell-build-system.scm | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/guix/build/haskell-build-system.scm b/guix/build/haskell-build-system.scm index 86681bb7a7..d587962b8b 100644 --- a/guix/build/haskell-build-system.scm +++ b/guix/build/haskell-build-system.scm @@ -244,6 +244,7 @@ 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 (or (assoc-ref outputs "lib") out) "/lib")) @@ -258,8 +259,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 "/" |