diff options
author | Robert Vollmert <rob@vllmrt.net> | 2019-05-27 21:56:18 +0200 |
---|---|---|
committer | Timothy Sample <samplet@ngyro.com> | 2019-06-13 13:30:24 -0400 |
commit | ed8d3f33a5236a1b9fde80bf4ad04e0ecc22a47a (patch) | |
tree | 1eb581bcb3a4ade1381d449f89187b46136872bc /guix | |
parent | 5f9f2c82e6829823cf5bb1cc27f8b1333a1e2096 (diff) |
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>
Diffstat (limited to 'guix')
-rw-r--r-- | guix/build/haskell-build-system.scm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/guix/build/haskell-build-system.scm b/guix/build/haskell-build-system.scm index 513c08096d..91f62138d0 100644 --- a/guix/build/haskell-build-system.scm +++ b/guix/build/haskell-build-system.scm @@ -275,9 +275,21 @@ given Haskell package." (_ (error "Could not find a Cabal file to patch.")))) #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 (modify-phases gnu:%standard-phases (add-after 'unpack 'patch-cabal-file patch-cabal-file) + (add-after 'unpack 'generate-setuphs generate-setuphs) (delete 'bootstrap) (add-before 'configure 'setup-compiler setup-compiler) (add-before 'install 'haddock haddock) |