From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:49416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVLh7-00020M-De for guix-patches@gnu.org; Mon, 27 May 2019 15:54:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hVLh6-0003tq-AT for guix-patches@gnu.org; Mon, 27 May 2019 15:54:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:40620) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hVLh6-0003td-7j for guix-patches@gnu.org; Mon, 27 May 2019 15:54:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hVLh6-0005zp-61 for guix-patches@gnu.org; Mon, 27 May 2019 15:54:04 -0400 Subject: [bug#35932] [PATCH 3/4] guix: haskell-build-system: generate Setup.hs if not exists Resent-Message-ID: Received: from eggs.gnu.org ([209.51.188.92]:49254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hVLgL-0001x9-29 for guix-patches@gnu.org; Mon, 27 May 2019 15:53:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hVLgH-0003MJ-AZ for guix-patches@gnu.org; Mon, 27 May 2019 15:53:15 -0400 Received: from mx1.mailbox.org ([2001:67c:2050:104:0:1:25:1]:11180) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hVLgF-0003Iy-EK for guix-patches@gnu.org; Mon, 27 May 2019 15:53:13 -0400 From: Robert Vollmert Date: Mon, 27 May 2019 21:52:50 +0200 Message-Id: <20190527195251.59801-4-rob@vllmrt.net> In-Reply-To: <20190527195251.59801-1-rob@vllmrt.net> References: <20190527195251.59801-1-rob@vllmrt.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 35932@debbugs.gnu.org Cc: Robert Vollmert 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 * 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-bui= ld-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) =20 +(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 =3D 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) --=20 2.20.1 (Apple Git-117)