diff mbox series

[bug#67921,haskell-team,22/23] gnu: Add ghc-9.6

Message ID aa782edc1fd49a3da3c843888bd91d1759d7b41f.1717746077.git.saku@laesvuori.fi
State New
Headers show
Series None | expand

Commit Message

Saku Laesvuori June 7, 2024, 7:49 a.m. UTC
* gnu/packages/haskell.scm (ghc-9.6): New variable.

Change-Id: I6883ed973bdd1d6eaf981605c1bc8f855f850187
---
 gnu/packages/haskell.scm | 157 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 155 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index 5070833a94..158bdd41bd 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -2115,14 +2115,14 @@  (define ghc-primitive-bootstrap-for-9.6
 (define hadrian-for-ghc-9.6
   (package
     (name "hadrian")
-    (version "9.6.4")
+    (version "9.6.5")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://www.haskell.org/ghc/dist/" version
                                   "/ghc-" version "-src.tar.xz"))
               (sha256
                (base32
-                "1h6lpx8kd4xycjwb8iv2rgnz23kwq5b0qp4bhvczsx3in2w2bgqh"))))
+                "0g5r68j788i6lbx71xpws4xb7nn871rpa8ji41na5hcq9y98kcw7"))))
     (build-system haskell-build-system)
     (inputs
      (list ghc-base16-bytestring-bootstrap-for-9.6
@@ -2152,4 +2152,157 @@  (define hadrian-for-ghc-9.6
 It is based on the Shake library and replaces @{make} in building GHC")
     (license license:expat)))
 
+(define-public ghc-9.6
+  (let ((base ghc-9.4))
+    (package
+      (inherit base)
+      (name "ghc-next")
+      (version "9.6.5")
+      (source (origin
+                (inherit (package-source base))
+                (uri (string-append "https://www.haskell.org/ghc/dist/" version
+                                    "/ghc-" version "-src.tar.xz"))
+                (sha256
+                 (base32
+                  "0g5r68j788i6lbx71xpws4xb7nn871rpa8ji41na5hcq9y98kcw7"))))
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+        ((#:make-flags flags ''())
+         #~(list "-V" "--docs=no-sphinx"))
+        ((#:phases phases '%standard-phases)
+         #~(let* ((run-hadrian (lambda args
+                                 (apply invoke "hadrian" args))))
+             (modify-phases #$phases
+               (delete 'fix-shell-wrappers)
+               ;; https://gitlab.haskell.org/ghc/ghc/-/issues/22557
+               (replace 'fix-lib-paths
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (substitute*
+                     (list "libraries/process/System/Process/Posix.hs"
+                           "libraries/unix/cbits/execvpe.c")
+                     (("/bin/sh") (search-input-file inputs "/bin/sh")))))
+               (add-before 'build 'fix-iserv-rpath
+                 (lambda _
+                   (mkdir-p "_build")
+                   (call-with-output-file
+                    "_build/hadrian.settings"
+                    (lambda (port)
+                      (display
+                       (string-append
+                        "*.iserv.ghc.link.opts += -optl-Wl,-rpath,"
+                        #$output "/lib/ghc-" #$(package-version this-package)
+                        "/lib/" #$(or (%current-target-system)
+                                      (%current-system))
+                        "-ghc-" #$(package-version this-package) "/")
+                       port)))))
+               (replace 'build
+                 (lambda* (#:key (parallel-build? #f) (make-flags '())
+                           #:allow-other-keys)
+                   (apply run-hadrian
+                          `("binary-dist-dir"
+                            ,@(if parallel-build?
+                                `(,(string-append "-j" (number->string (parallel-job-count))))
+                                '())
+                            ,@make-flags))))
+               (replace 'check
+                 (lambda* (#:key (tests? #t) (parallel-tests? #f) (make-flags '()) #:allow-other-keys)
+                   (if tests?
+                     (apply run-hadrian
+                            `(,@(if parallel-tests?
+                                  `(,(string-append "-j" (number->string (parallel-job-count))))
+                                  '())
+                              ,@make-flags
+                              "test"
+                              ,(string-append "--broken-test="
+                                (string-join
+                                 (list "bkpcabal01"
+                                       "cabal01"
+                                       "cabal06"
+                                       "cabal08"
+                                       "haddock_parser_perf"
+                                       "haddock_renamer_perf"
+                                       "package-imports-20779"
+                                       "plugins01"
+                                       "plugins08"
+                                       "plugins10"
+                                       "recomp007"
+                                       "recompChangedPackage"
+                                       "recompPkgLink"
+                                       "recompPluginPackage"
+                                       "recompTHpackage"
+                                       "T10420"
+                                       "T10458"
+                                       "T12504"
+                                       "T13340"
+                                       "T1372"
+                                       "T14304"
+                                       "T16219"
+                                       "T20218b"
+                                       "T22333"
+                                       "T3007"
+                                       "T7014"
+                                       "T8832"
+                                       "test-defaulting-plugin"
+                                       "plugin-recomp-change"
+                                       "plugin-recomp-change-2"
+                                       "plugin-recomp-change-prof"
+                                       "plugin-recomp-flags"
+                                       "plugin-recomp-impure"
+                                       "plugin-recomp-pure"
+                                       "plugins-order"
+                                       "plugins-order-pragma"
+                                       "T15633a"
+                                       "T15633b"
+                                       "T15858"
+                                       "T20417")))
+                              "--skip-perf"))
+                     (format #t "test suite not run~%"))))
+               (replace 'install
+                 (lambda* (#:key (make-flags '()) #:allow-other-keys)
+                   (apply run-hadrian
+                          `("install"
+                            ,@make-flags
+                            ,(string-append "--prefix=" #$output)))))
+               (add-after 'install 'replace-$pkgroot
+                 (lambda _
+                   (substitute*
+                     (find-files
+                      (string-append #$output "/lib/ghc-"
+                                     #$(package-version this-package)
+                                     "/lib/package.conf.d/")
+                      "^.*\\.conf$")
+                     (("\\$\\{pkgroot\\}/")
+                      (string-append #$output "/lib/ghc-"
+                                     #$(package-version this-package)
+                                     "/lib/"))))))))))
+      (inputs (list bash-minimal gmp ncurses libffi))
+      (native-inputs
+       `(("perl" ,perl)
+         ("python" ,python)
+         ("git" ,git-minimal/pinned)
+         ("which" ,which)
+         ("ghostscript" ,ghostscript)
+         ("autoconf" ,autoconf)
+         ("automake" ,automake)
+
+         ("hadrian" ,hadrian-for-ghc-9.6)
+         ("ghc-bootstrap" ,ghc-bootstrap-for-9.6)
+         ("ghc-alex" ,ghc-alex-bootstrap-for-9.4)
+         ("ghc-happy" ,ghc-happy-bootstrap-for-9.4)
+         ("ghc-testsuite"
+          ,(origin
+             (method url-fetch)
+             (uri (string-append
+                   "https://www.haskell.org/ghc/dist/"
+                   version "/ghc-" version "-testsuite.tar.xz"))
+             (sha256
+              (base32
+               "0k521601lgbs03ii66nb6y1y9327x4965zz3niyr3xswjx4dz8yw"))))))
+      (native-search-paths
+       (list (search-path-specification
+              (variable "GHC_PACKAGE_PATH")
+              (files (list (string-append "lib/ghc-" version)))
+              (file-pattern ".*\\.conf\\.d$")
+              (file-type 'directory)))))))
+
 ;;; haskell.scm ends here