guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

04/16: gnu: ghc@4: Build without referring to packages in commencement.s


From: guix-commits
Subject: 04/16: gnu: ghc@4: Build without referring to packages in commencement.scm.
Date: Mon, 14 Feb 2022 09:53:39 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit d9df65514c2b4b7b5070284bbb9f2b9e7c70ee05
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Feb 12 22:30:17 2022 +0100

    gnu: ghc@4: Build without referring to packages in commencement.scm.
    
    * 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 | 80 ++++++++++++++++++++----------------------------
 1 file changed, 34 insertions(+), 46 deletions(-)

diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index 60f5a01393..6a1ca7c7e8 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -198,7 +198,6 @@ is itself quite fast.")
     (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 @@ GhcLibWays=u
 #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 @@ SplitObjs=NO
              ;; 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 @@ SplitObjs=NO
                (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 @@ SplitObjs=NO
            (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 @@ SplitObjs=NO
                        (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 @@ SplitObjs=NO
                (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]