gnu: git-annex: Build and install man pages.

* gnu/packages/haskell-apps.scm (git-annex)[arguments]: Add phases for
building and installing the man pages.
[native-inputs]: Add perl.

Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
This commit is contained in:
Kyle Meyer 2020-07-01 20:50:41 -04:00 committed by Efraim Flashner
parent 09502e0233
commit 64fc2293ca
No known key found for this signature in database
GPG key ID: 41AAE7DCCA3D8351

View file

@ -9,7 +9,7 @@
;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net> ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name> ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org> ;;; Copyright © 2015 Paul van der Walt <paul@denknerd.org>
;;; Copyright © 2019 Kyle Meyer <kyle@kyleam.com> ;;; Copyright © 2019, 2020 Kyle Meyer <kyle@kyleam.com>
;;; Copyright © 2015 John Soo <jsoo1@asu.edu> ;;; Copyright © 2015 John Soo <jsoo1@asu.edu>
;;; Copyright © 2019, 2020 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2019 Alex Griffin <a@ajgrf.com> ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
@ -370,8 +370,7 @@ (define-public git-annex
;; Factor out necessary build logic from the provided ;; Factor out necessary build logic from the provided
;; `Setup.hs' script. The script as-is does not work because ;; `Setup.hs' script. The script as-is does not work because
;; it cannot find its dependencies, and there is no obvious way ;; it cannot find its dependencies, and there is no obvious way
;; to tell it where to look. Note that we do not preserve the ;; to tell it where to look.
;; code that installs man pages here.
(call-with-output-file "PreConf.hs" (call-with-output-file "PreConf.hs"
(lambda (out) (lambda (out)
(format out "import qualified Build.Configure as Configure~%") (format out "import qualified Build.Configure as Configure~%")
@ -385,6 +384,18 @@ (define-public git-annex
(lambda _ (lambda _
(invoke "runhaskell" "PreConf.hs") (invoke "runhaskell" "PreConf.hs")
#t)) #t))
(add-after 'build 'build-manpages
(lambda _
;; The Setup.hs rewrite above removed custom code for building
;; the man pages. In addition to that code, git-annex's source
;; tree has a file that's not included in the tarball but is used
;; by the Makefile to build man pages. Copy the core bits here.
(call-with-output-file "Build/MakeMans.hs"
(lambda (out)
(format out "module Main where~%")
(format out "import Build.Mans~%")
(format out "main = buildMansOrWarn~%")))
(invoke "runhaskell" "Build/MakeMans.hs")))
(replace 'check (replace 'check
(lambda _ (lambda _
;; We need to set the path so that Git recognizes ;; We need to set the path so that Git recognizes
@ -400,6 +411,14 @@ (define-public git-annex
;; Undo `patch-shell-for-tests'. ;; Undo `patch-shell-for-tests'.
(copy-file "/tmp/Shell.hs" "Utility/Shell.hs") (copy-file "/tmp/Shell.hs" "Utility/Shell.hs")
(apply (assoc-ref %standard-phases 'build) args))) (apply (assoc-ref %standard-phases 'build) args)))
(add-after 'install 'install-manpages
(lambda* (#:key outputs #:allow-other-keys)
(let ((man (string-append (assoc-ref outputs "out")
"/man/man1/")))
(mkdir-p man)
(for-each (lambda (file) (install-file file man))
(find-files "man")))
#t))
(add-after 'install 'install-symlinks (add-after 'install 'install-symlinks
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
@ -465,7 +484,8 @@ (define-public git-annex
`(("ghc-tasty" ,ghc-tasty) `(("ghc-tasty" ,ghc-tasty)
("ghc-tasty-hunit" ,ghc-tasty-hunit) ("ghc-tasty-hunit" ,ghc-tasty-hunit)
("ghc-tasty-quickcheck" ,ghc-tasty-quickcheck) ("ghc-tasty-quickcheck" ,ghc-tasty-quickcheck)
("ghc-tasty-rerun" ,ghc-tasty-rerun))) ("ghc-tasty-rerun" ,ghc-tasty-rerun)
("perl" ,perl)))
(home-page "https://git-annex.branchable.com/") (home-page "https://git-annex.branchable.com/")
(synopsis "Manage files with Git, without checking in their contents") (synopsis "Manage files with Git, without checking in their contents")
(description "This package allows managing files with Git, without (description "This package allows managing files with Git, without