me
/
guix
Archived
1
0
Fork 0

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.
Ludovic Courtès 2022-02-12 22:30:17 +01:00
parent 6ef0cd9ade
commit d9df65514c
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 34 additions and 46 deletions

View File

@ -198,7 +198,6 @@ is itself quite fast.")
(supported-systems '("i686-linux" "x86_64-linux")) (supported-systems '("i686-linux" "x86_64-linux"))
(arguments (arguments
`(#:system "i686-linux" `(#:system "i686-linux"
#:implicit-inputs? #f
#:strip-binaries? #f #:strip-binaries? #f
#:phases #:phases
(modify-phases %standard-phases (modify-phases %standard-phases
@ -223,8 +222,8 @@ GhcLibWays=u
#HsLibsFor=hugs #HsLibsFor=hugs
# Setting this leads to building the interpreter. # Setting this leads to building the interpreter.
GhcHcOpts=-DDEBUG GhcHcOpts=-DDEBUG
GhcRtsHcOpts=-optc-DDEBUG -optc-D__HUGS__ -unreg -optc-g GhcRtsHcOpts=-optc-DDEBUG -optc-D__HUGS__ -unreg -optc-g -optc-D_GNU_SOURCE=1
GhcRtsCcOpts=-optc-DDEBUG -optc-g -optc-D__HUGS__ GhcRtsCcOpts=-optc-DDEBUG -optc-g -optc-D__HUGS__ -optc-D_GNU_SOURCE=1
SplitObjs=NO SplitObjs=NO
"))) ")))
@ -247,8 +246,8 @@ SplitObjs=NO
;; this old linker understands. ;; this old linker understands.
(substitute* "ghc/interpreter/Makefile" (substitute* "ghc/interpreter/Makefile"
(("-lbfd -liberty") (("-lbfd -liberty")
(string-append (assoc-ref inputs "binutils") "/lib/libbfd.a " (string-append (search-input-file inputs "/lib/libbfd.a") " "
(assoc-ref inputs "binutils") "/lib/libiberty.a"))) (search-input-file inputs "/lib/libiberty.a"))))
(let ((bash (which "bash"))) (let ((bash (which "bash")))
(substitute* '("configure.in" (substitute* '("configure.in"
@ -271,7 +270,13 @@ SplitObjs=NO
(setenv "CONFIG_SHELL" bash) (setenv "CONFIG_SHELL" bash)
(setenv "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"))) (invoke "autoreconf" "--verbose" "--force")))
(add-before 'configure 'configure-gmp (add-before 'configure 'configure-gmp
(lambda* (#:key build inputs outputs #:allow-other-keys) (lambda* (#:key build inputs outputs #:allow-other-keys)
@ -283,6 +288,12 @@ SplitObjs=NO
(lambda* (#:key build inputs outputs #:allow-other-keys) (lambda* (#:key build inputs outputs #:allow-other-keys)
(let ((bash (which "bash")) (let ((bash (which "bash"))
(out (assoc-ref outputs "out"))) (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" (invoke bash "./configure"
"--enable-hc-boot" "--enable-hc-boot"
(string-append "--prefix=" out) (string-append "--prefix=" out)
@ -290,14 +301,15 @@ SplitObjs=NO
(string-append "--host=" build))))) (string-append "--host=" build)))))
(add-before 'build 'make-boot (add-before 'build 'make-boot
(lambda _ (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 ;; Only when building with more recent GCC
(when #false (when #false
;; GCC 2.95 is fine with these comments, but GCC 4.6 is not. ;; GCC 2.95 is fine with these comments, but GCC 4.6 is not.
(substitute* "ghc/rts/universal_call_c.S" (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 ;; Only when using more recent Perl
(when #false (when #false
@ -334,45 +346,21 @@ SplitObjs=NO
(copy-recursively "ghc/interpreter/lib" lib) (copy-recursively "ghc/interpreter/lib" lib)
(install-file "ghc/interpreter/nHandle.so" lib))))))) (install-file "ghc/interpreter/nHandle.so" lib)))))))
(native-inputs (native-inputs
`(("findutils" ,findutils) (list autoconf-2.13
("tar" ,tar) automake
("bzip2" ,bzip2) bison ;for parser.y
("xz" ,xz)
("diffutils" ,diffutils)
("file" ,file)
("gawk" ,gawk)
("autoconf" ,autoconf-2.13)
("automake" ,automake)
("bison" ,bison) ;for parser.y
("make" ,gnu-make) ;; Needed to support lvalue casts.
("sed" ,sed) gcc-2.95
("grep" ,grep)
("coreutils" ,coreutils)
("bash" ,bash-minimal)
("libc" ,glibc-2.2.5) ;; Use an older assembler to work around this error in GMP:
;; Lazily resolve binutils-mesboot in (gnu packages commencement) to ;; Error: `%edx' not allowed with `testb'
;; avoid a cycle. binutils-2.33
("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)
;; TODO: Perl used to allow setting $* to enable multi-line ;; TODO: Perl used to allow setting $* to enable multi-line
;; matching. If we want to use a more recent Perl we need to ;; matching. If we want to use a more recent Perl we need to patch
;; patch all expressions that require multi-line matching. Hard ;; all expressions that require multi-line matching. Hard to tell.
;; to tell. perl-5.14))
("perl" ,perl-5.14)))
(home-page "https://www.haskell.org/ghc") (home-page "https://www.haskell.org/ghc")
(synopsis "The Glasgow Haskell Compiler") (synopsis "The Glasgow Haskell Compiler")
(description (description