From patchwork Sat Feb 12 21:45:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 37220 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 1835F27BBEA; Sat, 12 Feb 2022 21:46:18 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7773F27BBE9 for ; Sat, 12 Feb 2022 21:46:17 +0000 (GMT) Received: from localhost ([::1]:47696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nJ0Dg-0004KP-KF for patchwork@mira.cbaines.net; Sat, 12 Feb 2022 16:46:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52300) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJ0DS-0004CH-Nh for guix-patches@gnu.org; Sat, 12 Feb 2022 16:46:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:41933) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nJ0DS-0002ws-Bm for guix-patches@gnu.org; Sat, 12 Feb 2022 16:46:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nJ0DS-0008Ur-9y for guix-patches@gnu.org; Sat, 12 Feb 2022 16:46:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53964] [PATCH 3/4] gnu: ghc@4: Build without referring to packages in commencement.scm. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 12 Feb 2022 21:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53964 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53964@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 53964-submit@debbugs.gnu.org id=B53964.164470235132047 (code B ref 53964); Sat, 12 Feb 2022 21:46:02 +0000 Received: (at 53964) by debbugs.gnu.org; 12 Feb 2022 21:45:51 +0000 Received: from localhost ([127.0.0.1]:35825 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJ0DG-0008KL-GU for submit@debbugs.gnu.org; Sat, 12 Feb 2022 16:45:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:45594) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nJ0DB-0008As-Px for 53964@debbugs.gnu.org; Sat, 12 Feb 2022 16:45:46 -0500 Received: from [2001:470:142:3::e] (port=50940 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nJ0D6-0002ok-H4; Sat, 12 Feb 2022 16:45:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=/4EUAAdCkImrVqyDctEiP86lChukfdr0xNIJzt+TtLs=; b=ldyWt4lsUIati3g5E6Dc aJRjYtgzcey1mG4Xgmq/LNk8IcUMcxEm+MPtqN3WwzKq45P1cJuEvAIwKCao2uKcYiHCo1IKvzgPi Q+k+twI2DStVqwX2kj7QlCdGxM2xEKAubKHi6hJIXluT+h1ZyeOzeQTM5570h8kT/Kjo8arXau8Tb guNqIspOZLU+y+BsWKFaDKpkq3zCk1acphJgFfcl1R5+B/Qgl0YOP9UTrYDa+DkEWzzzYvqu6JcuL nUUL9FGZj2aiZWXBMgqillWrfgt+MnWHRq9E4MMtaGtSKaxj6Vx2VdxX3raEirUm9KuvqgRxOpvxQ XeH7mLjn/xwe7w==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:56748 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nJ0D6-00034N-55; Sat, 12 Feb 2022 16:45:40 -0500 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 12 Feb 2022 22:45:31 +0100 Message-Id: <20220212214532.23087-3-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220212214532.23087-1-ludo@gnu.org> References: <20220212214532.23087-1-ludo@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/haskell.scm (ghc-4)[arguments]: Remove #:implicit-inputs?. In 'bootstrap' phase, pass '-optc-D_GNU_SOURCE=1'. Use 'search-input-file' to locate lib{bfd,iberty}.a, and 'which' for cpp. Patch 'mk/config.mk.in'. In 'configure' phase, emit "config.cache". In 'make-boot' phase, replace "CLK_TCK" in 'nHandle.c'. [native-inputs]: Remove now-implicit inputs; remove GLIBC-2.2.5, GCC-MESBOOT0, and BINUTILS-MESBOOT. Add GCC-2.95 and BINUTILS-2.33. Remove input labels. --- gnu/packages/haskell.scm | 82 +++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 47 deletions(-) diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm index c3706fca6c..6a1ca7c7e8 100644 --- a/gnu/packages/haskell.scm +++ b/gnu/packages/haskell.scm @@ -193,12 +193,11 @@ (define-public ghc-4 (sha256 (base32 "0ar4nxy4cr5vwvfj71gmc174vx0n3lg9ka05sa1k60c8z0g3xp1q")) - (patches (list (search-patch "ghc-4.patch"))))) + (patches (search-patches "ghc-4.patch")))) (build-system gnu-build-system) (supported-systems '("i686-linux" "x86_64-linux")) (arguments `(#:system "i686-linux" - #:implicit-inputs? #f #:strip-binaries? #f #:phases (modify-phases %standard-phases @@ -223,8 +222,8 @@ (define-public ghc-4 #HsLibsFor=hugs # Setting this leads to building the interpreter. GhcHcOpts=-DDEBUG -GhcRtsHcOpts=-optc-DDEBUG -optc-D__HUGS__ -unreg -optc-g -GhcRtsCcOpts=-optc-DDEBUG -optc-g -optc-D__HUGS__ +GhcRtsHcOpts=-optc-DDEBUG -optc-D__HUGS__ -unreg -optc-g -optc-D_GNU_SOURCE=1 +GhcRtsCcOpts=-optc-DDEBUG -optc-g -optc-D__HUGS__ -optc-D_GNU_SOURCE=1 SplitObjs=NO "))) @@ -247,8 +246,8 @@ (define-public ghc-4 ;; this old linker understands. (substitute* "ghc/interpreter/Makefile" (("-lbfd -liberty") - (string-append (assoc-ref inputs "binutils") "/lib/libbfd.a " - (assoc-ref inputs "binutils") "/lib/libiberty.a"))) + (string-append (search-input-file inputs "/lib/libbfd.a") " " + (search-input-file inputs "/lib/libiberty.a")))) (let ((bash (which "bash"))) (substitute* '("configure.in" @@ -271,7 +270,13 @@ (define-public ghc-4 (setenv "CONFIG_SHELL" bash) (setenv "SHELL" bash)) - (setenv "CPP" (string-append (assoc-ref inputs "gcc") "/bin/cpp")) + ;; The 'hscpp' script invokes GCC 2.95's 'cpp' (RAWCPP), which + ;; segfaults unless passed '-x c'. + (substitute* "mk/config.mk.in" + (("-traditional") + "-traditional -x c")) + + (setenv "CPP" (which "cpp")) (invoke "autoreconf" "--verbose" "--force"))) (add-before 'configure 'configure-gmp (lambda* (#:key build inputs outputs #:allow-other-keys) @@ -283,6 +288,12 @@ (define-public ghc-4 (lambda* (#:key build inputs outputs #:allow-other-keys) (let ((bash (which "bash")) (out (assoc-ref outputs "out"))) + (call-with-output-file "config.cache" + (lambda (port) + ;; GCC 2.95 fails to deal with anonymous unions in glibc's + ;; 'struct_rusage.h', so skip that. + (display "ac_cv_func_getrusage=no\n" port))) + (invoke bash "./configure" "--enable-hc-boot" (string-append "--prefix=" out) @@ -290,14 +301,15 @@ (define-public ghc-4 (string-append "--host=" build))))) (add-before 'build 'make-boot (lambda _ + ;; CLK_TCK has been removed from recent libc. + (substitute* "ghc/interpreter/nHandle.c" + (("CLK_TCK") "sysconf (_SC_CLK_TCK)")) + ;; Only when building with more recent GCC (when #false ;; GCC 2.95 is fine with these comments, but GCC 4.6 is not. (substitute* "ghc/rts/universal_call_c.S" - (("^# .*") "")) - ;; CLK_TCK has been removed - (substitute* "ghc/interpreter/nHandle.c" - (("CLK_TCK") "sysconf(_SC_CLK_TCK)"))) + (("^# .*") ""))) ;; Only when using more recent Perl (when #false @@ -334,45 +346,21 @@ (define-public ghc-4 (copy-recursively "ghc/interpreter/lib" lib) (install-file "ghc/interpreter/nHandle.so" lib))))))) (native-inputs - `(("findutils" ,findutils) - ("tar" ,tar) - ("bzip2" ,bzip2) - ("xz" ,xz) - ("diffutils" ,diffutils) - ("file" ,file) - ("gawk" ,gawk) - ("autoconf" ,autoconf-2.13) - ("automake" ,automake) - ("bison" ,bison) ;for parser.y + (list autoconf-2.13 + automake + bison ;for parser.y - ("make" ,gnu-make) - ("sed" ,sed) - ("grep" ,grep) - ("coreutils" ,coreutils) - ("bash" ,bash-minimal) + ;; Needed to support lvalue casts. + gcc-2.95 - ("libc" ,glibc-2.2.5) - ;; Lazily resolve binutils-mesboot in (gnu packages commencement) to - ;; avoid a cycle. - ("gcc-wrapper" - ,(module-ref (resolve-interface - '(gnu packages commencement)) - 'gcc-2.95-wrapper)) - ("gcc" - ,(module-ref (resolve-interface - '(gnu packages commencement)) - 'gcc-mesboot0)) - ("binutils" - ,(module-ref (resolve-interface - '(gnu packages commencement)) - 'binutils-mesboot)) - ("kernel-headers" ,linux-libre-headers) + ;; Use an older assembler to work around this error in GMP: + ;; Error: `%edx' not allowed with `testb' + binutils-2.33 - ;; TODO: Perl used to allow setting $* to enable multi-line - ;; matching. If we want to use a more recent Perl we need to - ;; patch all expressions that require multi-line matching. Hard - ;; to tell. - ("perl" ,perl-5.14))) + ;; TODO: Perl used to allow setting $* to enable multi-line + ;; matching. If we want to use a more recent Perl we need to patch + ;; all expressions that require multi-line matching. Hard to tell. + perl-5.14)) (home-page "https://www.haskell.org/ghc") (synopsis "The Glasgow Haskell Compiler") (description