Subject: [bug#67921] [PATCH v2 21/23] gnu: Add hadrian-for-ghc-9.6

From: Saku Laesvuori <[email-masked]>
Date: Thu, 15 Feb 2024 10:50:02 +0200

* gnu/packages/haskell.scm (hadrian-for-ghc-9.6): New variable.

Change-Id: I4205c888afa7b03b4b1622a3af7d1d538fa5c9b1
---
 gnu/packages/haskell.scm | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index 4127d7d4a7..9e1e659cf1 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -2016,4 +2016,44 @@ (define ghc-primitive-bootstrap-for-9.6
      "This package provides various primitive memory-related operations.")
     (license license:bsd-3)))
 
+(define hadrian-for-ghc-9.6
+  (package
+    (name "hadrian")
+    (version "9.6.4")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://www.haskell.org/ghc/dist/" version
+                                  "/ghc-" version "-src.tar.xz"))
+              (sha256
+               (base32
+                "1h6lpx8kd4xycjwb8iv2rgnz23kwq5b0qp4bhvczsx3in2w2bgqh"))))
+    (build-system haskell-build-system)
+    (inputs
+     (list ghc-base16-bytestring-bootstrap-for-9.6
+           ghc-cryptohash-sha256-bootstrap-for-9.6
+           ghc-extra-bootstrap-for-9.6
+           ghc-shake-bootstrap-for-9.6
+           ghc-unordered-containers-bootstrap-for-9.6
+           bash-minimal))
+    (arguments
+     (list #:configure-flags ''("--flags=-selftest")
+           #:tests? #f
+           #:haskell ghc-bootstrap-for-9.6
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'cd-to-hadrian
+                 (lambda _
+                   (chdir "hadrian")))
+               (add-after 'cd-to-hadrian 'fix-shell-wrappers
+                 (lambda _
+                   (substitute*
+                     "src/Rules/Test.hs"
+                     (("\"#!/bin/sh\"")
+                      (format #f "\"#!~a/bin/sh\"" #$(this-package-input "bash-minimal")))))))))
+    (home-page "https://gitlab.haskell.org/ghc/ghc/-/tree/master/hadrian")
+    (synopsis "Build system for the Glasgow Haskell Compiler (@code{ghc})")
+    (description "Hadrian is the build system for the Glasgow Haskell Compiler.
+It is based on the Shake library and replaces @{make} in building GHC")
+    (license license:expat)))
+
 ;;; haskell.scm ends here
-- 
2.41.0