mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 22:08:16 -05:00
build-system/haskell: Generate Setup.hs if needed.
The default Setup.hs is boilerplate that is frequently left out of source packages. Several packages already add a phase to generate it, so moving this phase to the build system is just factoring out an existing pattern. See <https://github.com/phadej/time-compat/issues/4>. * guix/build/haskell-build-system.scm (generate-setuphs): New procedure. (%standard-phases): Add it after 'unpack'. * gnu/packages/haskell.scm (ghc-foundation, ghc-inline-c, ghc-inline-c-cpp, ghc-rio): Remove 'arguments'. Signed-off-by: Timothy Sample <samplet@ngyro.com>
This commit is contained in:
parent
5f9f2c82e6
commit
ed8d3f33a5
2 changed files with 12 additions and 42 deletions
|
@ -9703,16 +9703,6 @@ (define-public ghc-foundation
|
||||||
(base32
|
(base32
|
||||||
"1q43y8wfj0wf9gdq2kzphwjwq6m5pvryy1lqgk954aq5z3ks1lsf"))))
|
"1q43y8wfj0wf9gdq2kzphwjwq6m5pvryy1lqgk954aq5z3ks1lsf"))))
|
||||||
(build-system haskell-build-system)
|
(build-system haskell-build-system)
|
||||||
(arguments
|
|
||||||
`(#:phases
|
|
||||||
(modify-phases %standard-phases
|
|
||||||
(add-after 'unpack 'add-setup-script
|
|
||||||
(lambda _
|
|
||||||
;; The usual "Setup.hs" script is missing from the source.
|
|
||||||
(with-output-to-file "Setup.hs"
|
|
||||||
(lambda ()
|
|
||||||
(format #t "import Distribution.Simple~%")
|
|
||||||
(format #t "main = defaultMain~%"))))))))
|
|
||||||
(inputs `(("ghc-basement" ,ghc-basement)))
|
(inputs `(("ghc-basement" ,ghc-basement)))
|
||||||
(home-page "https://github.com/haskell-foundation/foundation")
|
(home-page "https://github.com/haskell-foundation/foundation")
|
||||||
(synopsis "Alternative prelude with batteries and no dependencies")
|
(synopsis "Alternative prelude with batteries and no dependencies")
|
||||||
|
@ -10590,16 +10580,6 @@ (define-public ghc-rio
|
||||||
(base32
|
(base32
|
||||||
"064h8a4hp53a479d3ak0vmqbx8hi0cpg7zn4wp23rjy26dka8p7g"))))
|
"064h8a4hp53a479d3ak0vmqbx8hi0cpg7zn4wp23rjy26dka8p7g"))))
|
||||||
(build-system haskell-build-system)
|
(build-system haskell-build-system)
|
||||||
(arguments
|
|
||||||
`(#:phases
|
|
||||||
(modify-phases %standard-phases
|
|
||||||
(add-after 'unpack 'add-setup-script
|
|
||||||
(lambda _
|
|
||||||
;; The usual "Setup.hs" script is missing from the source.
|
|
||||||
(with-output-to-file "Setup.hs"
|
|
||||||
(lambda ()
|
|
||||||
(format #t "import Distribution.Simple~%")
|
|
||||||
(format #t "main = defaultMain~%"))))))))
|
|
||||||
(inputs
|
(inputs
|
||||||
`(("ghc-exceptions" ,ghc-exceptions)
|
`(("ghc-exceptions" ,ghc-exceptions)
|
||||||
("ghc-hashable" ,ghc-hashable)
|
("ghc-hashable" ,ghc-hashable)
|
||||||
|
@ -11122,17 +11102,6 @@ (define-public ghc-inline-c
|
||||||
(base32
|
(base32
|
||||||
"0vbfrsqsi7mdziqsnj68bsqlwbqxxhvrmy9rv6w8z18d1m8w3n6h"))))
|
"0vbfrsqsi7mdziqsnj68bsqlwbqxxhvrmy9rv6w8z18d1m8w3n6h"))))
|
||||||
(build-system haskell-build-system)
|
(build-system haskell-build-system)
|
||||||
(arguments
|
|
||||||
`(#:phases
|
|
||||||
(modify-phases %standard-phases
|
|
||||||
(add-after 'unpack 'create-Setup.hs
|
|
||||||
(lambda _
|
|
||||||
(with-output-to-file "Setup.hs"
|
|
||||||
(lambda _
|
|
||||||
(display "\
|
|
||||||
import Distribution.Simple
|
|
||||||
main = defaultMain")))
|
|
||||||
#t)))))
|
|
||||||
(inputs
|
(inputs
|
||||||
`(("ghc-ansi-wl-pprint" ,ghc-ansi-wl-pprint)
|
`(("ghc-ansi-wl-pprint" ,ghc-ansi-wl-pprint)
|
||||||
("ghc-cryptohash" ,ghc-cryptohash)
|
("ghc-cryptohash" ,ghc-cryptohash)
|
||||||
|
@ -11266,17 +11235,6 @@ (define-public ghc-inline-c-cpp
|
||||||
(base32
|
(base32
|
||||||
"1rk7fmpkmxw9hhwr8df29kadnf0ybnwj64ggdbnsdrpfyhnkisci"))))
|
"1rk7fmpkmxw9hhwr8df29kadnf0ybnwj64ggdbnsdrpfyhnkisci"))))
|
||||||
(build-system haskell-build-system)
|
(build-system haskell-build-system)
|
||||||
(arguments
|
|
||||||
`(#:phases
|
|
||||||
(modify-phases %standard-phases
|
|
||||||
(add-after 'unpack 'create-Setup.hs
|
|
||||||
(lambda _
|
|
||||||
(with-output-to-file "Setup.hs"
|
|
||||||
(lambda _
|
|
||||||
(display "\
|
|
||||||
import Distribution.Simple
|
|
||||||
main = defaultMain")))
|
|
||||||
#t)))))
|
|
||||||
(inputs
|
(inputs
|
||||||
`(("ghc-inline-c" ,ghc-inline-c)
|
`(("ghc-inline-c" ,ghc-inline-c)
|
||||||
("ghc-safe-exceptions" ,ghc-safe-exceptions)))
|
("ghc-safe-exceptions" ,ghc-safe-exceptions)))
|
||||||
|
|
|
@ -275,9 +275,21 @@ (define* (patch-cabal-file #:key cabal-revision #:allow-other-keys)
|
||||||
(_ (error "Could not find a Cabal file to patch."))))
|
(_ (error "Could not find a Cabal file to patch."))))
|
||||||
#t)
|
#t)
|
||||||
|
|
||||||
|
(define* (generate-setuphs #:rest empty)
|
||||||
|
"Generate a default Setup.hs if needed."
|
||||||
|
(when (not (or (file-exists? "Setup.hs")
|
||||||
|
(file-exists? "Setup.lhs")))
|
||||||
|
(format #t "generating missing Setup.hs~%")
|
||||||
|
(with-output-to-file "Setup.hs"
|
||||||
|
(lambda ()
|
||||||
|
(format #t "import Distribution.Simple~%")
|
||||||
|
(format #t "main = defaultMain~%"))))
|
||||||
|
#t)
|
||||||
|
|
||||||
(define %standard-phases
|
(define %standard-phases
|
||||||
(modify-phases gnu:%standard-phases
|
(modify-phases gnu:%standard-phases
|
||||||
(add-after 'unpack 'patch-cabal-file patch-cabal-file)
|
(add-after 'unpack 'patch-cabal-file patch-cabal-file)
|
||||||
|
(add-after 'unpack 'generate-setuphs generate-setuphs)
|
||||||
(delete 'bootstrap)
|
(delete 'bootstrap)
|
||||||
(add-before 'configure 'setup-compiler setup-compiler)
|
(add-before 'configure 'setup-compiler setup-compiler)
|
||||||
(add-before 'install 'haddock haddock)
|
(add-before 'install 'haddock haddock)
|
||||||
|
|
Loading…
Reference in a new issue