GNU bug report logs - #35932
[PATCH 3/4] guix: haskell-build-system: generate Setup.hs if not exists

Previous Next

Package: guix-patches;

Reported by: Robert Vollmert <rob <at> vllmrt.net>

Date: Mon, 27 May 2019 19:54:03 UTC

Severity: normal

Tags: patch

Done: Robert Vollmert <rob <at> vllmrt.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35932 in the body.
You can then email your comments to 35932 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#35932; Package guix-patches. (Mon, 27 May 2019 19:54:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Robert Vollmert <rob <at> vllmrt.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 27 May 2019 19:54:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Robert Vollmert <rob <at> vllmrt.net>
To: guix-patches <at> gnu.org
Cc: Robert Vollmert <rob <at> vllmrt.net>
Subject: [PATCH 3/4] guix: haskell-build-system: generate Setup.hs if not
 exists
Date: Mon, 27 May 2019 21:52:50 +0200
The default Setup.hs is boilerplate that is frequently left out of
source packages, causing build failure for package definitions as
generated by `guix import hackage`. Compare
<https://github.com/phadej/time-compat/issues/4>

* guix/build/haskell-build-system.scm: Generate Setup.hs if missing,
after unpack phase.
---
 guix/build/haskell-build-system.scm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/guix/build/haskell-build-system.scm b/guix/build/haskell-build-system.scm
index 5c5b32322b..0c648e510f 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-setup #:rest empty)
+  "Generate boilerplate Setup.hs if missing."
+  (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-setup generate-setup)
     (delete 'bootstrap)
     (add-before 'configure 'setup-compiler setup-compiler)
     (add-before 'install 'haddock haddock)
-- 
2.20.1 (Apple Git-117)





bug closed, send any further explanations to 35932 <at> debbugs.gnu.org and Robert Vollmert <rob <at> vllmrt.net> Request was from Robert Vollmert <rob <at> vllmrt.net> to control <at> debbugs.gnu.org. (Mon, 27 May 2019 19:58:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 25 Jun 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 318 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.