Archived
1
0
Fork 0

gnu: ghc-8.4: Modernize package.

* gnu/packages/haskell.scm (ghc-8.4)[inputs]: Use inherited inputs.
[arguments]: Rewrite using g-exps. Adjust to use inherited package
arguments. Use inherited 'unpack-testsuite, 'fix environment phases.
Remove redundant 'fix-references phase.
(ghc-8.8)[arguments]: Adjust phases based on changed inherited phases.
This commit is contained in:
Efraim Flashner 2022-08-22 09:49:06 +03:00
parent 63e01d01b1
commit ab8c83dd48
No known key found for this signature in database
GPG key ID: 41AAE7DCCA3D8351

View file

@ -681,13 +681,11 @@ interactive environment for the functional language Haskell.")
version "/" name "-" version "-src.tar.xz")) version "/" name "-" version "-src.tar.xz"))
(sha256 (sha256
(base32 "1ch4j2asg7pr52ai1hwzykxyj553wndg7wq93i47ql4fllspf48i")))) (base32 "1ch4j2asg7pr52ai1hwzykxyj553wndg7wq93i47ql4fllspf48i"))))
(inputs
(list gmp ncurses libffi))
(native-inputs (native-inputs
`(("perl" ,perl) `(("perl" ,perl)
("python" ,python) ; for tests ("python" ,python) ; for tests
("ghostscript" ,ghostscript) ; for tests ("ghostscript" ,ghostscript) ; for tests
;; GHC 8.4.3 is built with GHC 8. ;; GHC 8.4.4 is built with GHC >= 8.0.
("ghc-bootstrap" ,ghc-8.0) ("ghc-bootstrap" ,ghc-8.0)
("ghc-testsuite" ("ghc-testsuite"
,(origin ,(origin
@ -699,92 +697,39 @@ interactive environment for the functional language Haskell.")
(base32 (base32
"0s8lf9sxj7n89pjagi58b3fahnp34qvmwhnn0j1fbg6955vbrfj6")))))) "0s8lf9sxj7n89pjagi58b3fahnp34qvmwhnn0j1fbg6955vbrfj6"))))))
(arguments (arguments
`(#:test-target "test" (substitute-keyword-arguments (package-arguments ghc-8.0)
;; We get a smaller number of test failures by disabling parallel test ((#:phases phases)
;; execution. #~(modify-phases #$phases
#:parallel-tests? #f ;; This phase patches the 'ghc-pkg' command so that it sorts the list
;; of packages in the binary cache it generates.
;; Don't pass --build=<triplet>, because the configure script (add-before 'build 'fix-ghc-pkg-nondeterminism
;; auto-detects slightly different triplets for --host and --target and (lambda _
;; then complains that they don't match. (substitute* "utils/ghc-pkg/Main.hs"
#:build #f (("confs = map \\(path </>\\) \\$ filter \\(\".conf\" `isSuffixOf`\\) fs")
"confs = map (path </>) $ filter (\".conf\" `isSuffixOf`) (sort fs)"))))
#:configure-flags (add-after 'unpack-testsuite 'fix-shell-wrappers
(list (lambda _
(string-append "--with-gmp-libraries=" (substitute* '("driver/ghci/ghc.mk"
(assoc-ref %build-inputs "gmp") "/lib") "utils/mkdirhier/ghc.mk"
(string-append "--with-gmp-includes=" "rules/shell-wrapper.mk")
(assoc-ref %build-inputs "gmp") "/include") (("echo '#!/bin/sh'")
"--with-system-libffi" (format #f "echo '#!~a'" (which "sh"))))))
(string-append "--with-ffi-libraries=" ;; This is necessary because the configure system no longer uses
(assoc-ref %build-inputs "libffi") "/lib") ;; “AC_PATH_” but “AC_CHECK_”, setting the variables to just the
(string-append "--with-ffi-includes=" ;; plain command names.
(assoc-ref %build-inputs "libffi") "/include") (add-before 'configure 'set-target-programs
(string-append "--with-curses-libraries=" (lambda* (#:key inputs #:allow-other-keys)
(assoc-ref %build-inputs "ncurses") "/lib") (let ((binutils (assoc-ref inputs "binutils"))
(string-append "--with-curses-includes=" (gcc (assoc-ref inputs "gcc"))
(assoc-ref %build-inputs "ncurses") "/include")) (ld-wrapper (assoc-ref inputs "ld-wrapper")))
#:phases (setenv "CC" (string-append gcc "/bin/gcc"))
(modify-phases %standard-phases (setenv "CXX" (string-append gcc "/bin/g++"))
(add-after 'unpack 'unpack-testsuite (setenv "LD" (string-append ld-wrapper "/bin/ld"))
(lambda* (#:key inputs #:allow-other-keys) (setenv "NM" (string-append binutils "/bin/nm"))
(invoke "tar" "xvf" (setenv "RANLIB" (string-append binutils "/bin/ranlib"))
(assoc-ref inputs "ghc-testsuite") (setenv "STRIP" (string-append binutils "/bin/strip"))
"--strip-components=1") ;; The 'ar' command does not follow the same pattern.
#t)) (setenv "fp_prog_ar" (string-append binutils "/bin/ar")))))))))
;; This phase patches the 'ghc-pkg' command so that it sorts the list
;; of packages in the binary cache it generates.
(add-before 'build 'fix-ghc-pkg-nondeterminism
(lambda _
(substitute* "utils/ghc-pkg/Main.hs"
(("confs = map \\(path </>\\) \\$ filter \\(\".conf\" `isSuffixOf`\\) fs")
"confs = map (path </>) $ filter (\".conf\" `isSuffixOf`) (sort fs)"))
#t))
(add-after 'unpack-testsuite 'fix-shell-wrappers
(lambda _
(substitute* '("driver/ghci/ghc.mk"
"utils/mkdirhier/ghc.mk"
"rules/shell-wrapper.mk")
(("echo '#!/bin/sh'")
(format #f "echo '#!~a'" (which "sh"))))
#t))
;; This is necessary because the configure system no longer uses
;; “AC_PATH_” but “AC_CHECK_”, setting the variables to just the
;; plain command names.
(add-before 'configure 'set-target-programs
(lambda* (#:key inputs #:allow-other-keys)
(let ((binutils (assoc-ref inputs "binutils"))
(gcc (assoc-ref inputs "gcc"))
(ld-wrapper (assoc-ref inputs "ld-wrapper")))
(setenv "CC" (string-append gcc "/bin/gcc"))
(setenv "CXX" (string-append gcc "/bin/g++"))
(setenv "LD" (string-append ld-wrapper "/bin/ld"))
(setenv "NM" (string-append binutils "/bin/nm"))
(setenv "RANLIB" (string-append binutils "/bin/ranlib"))
(setenv "STRIP" (string-append binutils "/bin/strip"))
;; The 'ar' command does not follow the same pattern.
(setenv "fp_prog_ar" (string-append binutils "/bin/ar"))
#t)))
(add-before 'build 'fix-references
(lambda _
(substitute* '("testsuite/timeout/Makefile"
"testsuite/timeout/timeout.py"
"testsuite/timeout/timeout.hs"
"testsuite/tests/programs/life_space_leak/life.test"
;; libraries
"libraries/process/System/Process/Posix.hs"
"libraries/process/tests/process001.hs"
"libraries/process/tests/process002.hs"
"libraries/unix/cbits/execvpe.c")
(("/bin/sh") (which "sh"))
(("/bin/ls") (which "ls"))
(("/bin/rm") "rm"))
#t))
(add-before 'build 'fix-environment
(lambda _
(unsetenv "GHC_PACKAGE_PATH")
(setenv "CONFIG_SHELL" (which "bash"))
#t)))))
(native-search-paths (list (search-path-specification (native-search-paths (list (search-path-specification
(variable "GHC_PACKAGE_PATH") (variable "GHC_PACKAGE_PATH")
(files (list (files (list
@ -903,7 +848,7 @@ interactive environment for the functional language Haskell.")
(substitute-keyword-arguments (package-arguments ghc-8.6) (substitute-keyword-arguments (package-arguments ghc-8.6)
((#:phases phases '%standard-phases) ((#:phases phases '%standard-phases)
`(modify-phases ,phases `(modify-phases ,phases
(add-after 'fix-references 'fix-cc-reference (add-before 'build 'fix-cc-reference
(lambda _ (lambda _
(substitute* "utils/hsc2hs/Common.hs" (substitute* "utils/hsc2hs/Common.hs"
(("\"cc\"") "\"gcc\"")) (("\"cc\"") "\"gcc\""))