unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Vollmert <rob@vllmrt.net>
To: 35932@debbugs.gnu.org
Cc: Robert Vollmert <rob@vllmrt.net>
Subject: [bug#35932] [PATCH 3/4] guix: haskell-build-system: generate Setup.hs if not exists
Date: Mon, 27 May 2019 21:52:50 +0200	[thread overview]
Message-ID: <20190527195251.59801-4-rob@vllmrt.net> (raw)
In-Reply-To: <20190527195251.59801-1-rob@vllmrt.net>

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)

  parent reply	other threads:[~2019-05-27 19:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-27 19:52 [bug#35930] haskell Setup.hs-related changes Robert Vollmert
2019-05-27 19:52 ` [bug#35934] [PATCH 1/4] gnu: ghc-easy-plot: remove superfluous Setup.hs rename step Robert Vollmert
2019-05-27 19:52 ` [bug#35931] [PATCH 2/4] guix: haskell-build-system: correct haddock phase documentation Robert Vollmert
2019-05-27 19:52 ` Robert Vollmert [this message]
2019-05-27 19:52 ` [bug#35933] [PATCH 4/4] gnu: haskell: leave Setup.hs generation to build system Robert Vollmert
2019-05-27 19:56 ` [bug#35930] [PATCH 1/4] gnu: ghc-easy-plot: remove superfluous Setup.hs rename step Robert Vollmert
2019-05-27 19:56   ` [bug#35930] [PATCH 2/4] guix: haskell-build-system: correct haddock phase documentation Robert Vollmert
2019-05-27 19:56   ` [bug#35930] [PATCH 3/4] guix: haskell-build-system: generate Setup.hs if not exists Robert Vollmert
2019-05-27 19:56   ` [bug#35930] [PATCH 4/4] gnu: haskell: leave Setup.hs generation to build system Robert Vollmert
2019-06-13  8:36 ` [bug#35930] haskell Setup.hs-related changes Ludovic Courtès
2019-06-13 15:57   ` Timothy Sample
2019-06-13 16:20     ` Robert Vollmert
2019-06-14  3:05       ` bug#35930: " Timothy Sample

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190527195251.59801-4-rob@vllmrt.net \
    --to=rob@vllmrt.net \
    --cc=35932@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).