diff options
| author | Yarl Baudig <yarl-baudig@mailoo.org> | 2026-01-21 20:05:00 +0100 |
|---|---|---|
| committer | Efraim Flashner <efraim@flashner.co.il> | 2026-01-29 07:50:52 +0200 |
| commit | ae2c2e1f5455a4ab90c862b4e825cca70344a107 (patch) | |
| tree | 78de63538449c1313a35b22e915b3cbaa3c65931 /gnu/packages/haskell.scm | |
| parent | 86d18c125f9fb4a0ff2478f4b60b7442c1cb694c (diff) | |
gnu: ghc: Add support for aarch64.
Fixes guix/guix#1858.
* gnu/packages/haskell.scm (ghc-bootstrap-aarch64-8.10.7,
binary-ghc-8.10.7): New variables.
(ghc-9.2)[[arguments]: Adjust the phases when building on aarch64-linux.
[native-inputs]: When building on aarch64-linux use binary-ghc-8.10.7
instead of the previous ghc version.
Change-Id: I2adfd26a33e92f05561e6d9dc9af41cbb7ecabfa
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
Diffstat (limited to 'gnu/packages/haskell.scm')
| -rw-r--r-- | gnu/packages/haskell.scm | 125 |
1 files changed, 123 insertions, 2 deletions
diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm index 9686cd1f718..fa75fb40871 100644 --- a/gnu/packages/haskell.scm +++ b/gnu/packages/haskell.scm | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com> | 25 | ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com> |
| 26 | ;;; Copyright © 2023 Maxim Cournoyer <maxim@guixotic.coop> | 26 | ;;; Copyright © 2023 Maxim Cournoyer <maxim@guixotic.coop> |
| 27 | ;;; Copyright © 2025 Janneke Nieuwenhuizen <janneke@gnu.org> | 27 | ;;; Copyright © 2025 Janneke Nieuwenhuizen <janneke@gnu.org> |
| 28 | ;;; Copyright © 2026 Yarl Baudig <yarl-baudig@mailoo.org> | ||
| 28 | ;;; | 29 | ;;; |
| 29 | ;;; This file is part of GNU Guix. | 30 | ;;; This file is part of GNU Guix. |
| 30 | ;;; | 31 | ;;; |
| @@ -58,6 +59,7 @@ | |||
| 58 | #:use-module (gnu packages libffi) | 59 | #:use-module (gnu packages libffi) |
| 59 | #:use-module (gnu packages linux) | 60 | #:use-module (gnu packages linux) |
| 60 | #:use-module (gnu packages lisp) | 61 | #:use-module (gnu packages lisp) |
| 62 | #:use-module (gnu packages llvm) | ||
| 61 | #:use-module (gnu packages m4) | 63 | #:use-module (gnu packages m4) |
| 62 | #:use-module (gnu packages multiprecision) | 64 | #:use-module (gnu packages multiprecision) |
| 63 | #:use-module (gnu packages ncurses) | 65 | #:use-module (gnu packages ncurses) |
| @@ -1400,6 +1402,104 @@ interactive environment for the functional language Haskell.") | |||
| 1400 | 1402 | ||
| 1401 | (define-public ghc-8 ghc-8.10) | 1403 | (define-public ghc-8 ghc-8.10) |
| 1402 | 1404 | ||
| 1405 | (define ghc-bootstrap-aarch64-8.10.7 | ||
| 1406 | (origin | ||
| 1407 | (method url-fetch) | ||
| 1408 | (uri | ||
| 1409 | "https://downloads.haskell.org/ghc/8.10.7/ghc-8.10.7-aarch64-deb10-linux.tar.xz") | ||
| 1410 | (sha256 | ||
| 1411 | (base32 "0m8fklyqcd8xrmhwnimyhyg3b5h82kkc0yfyiazk6li9kdzl3lps")))) | ||
| 1412 | |||
| 1413 | (define-public binary-ghc-8.10.7 | ||
| 1414 | (package | ||
| 1415 | ;; Named like this to be able to install it in profile without | ||
| 1416 | ;; ghc-package-cache-file (guix profiles) trying to install ghc... | ||
| 1417 | (name "binary-ghc") | ||
| 1418 | (version "8.10.7") | ||
| 1419 | (source ghc-bootstrap-aarch64-8.10.7) | ||
| 1420 | (build-system gnu-build-system) | ||
| 1421 | (supported-systems '("aarch64-linux")) | ||
| 1422 | ;; We need llvm until 9.2 which introduce aarch64 native code generation. | ||
| 1423 | ;; Make sure you have installed LLVM between [9 and 13) | ||
| 1424 | (inputs (list gcc-13 gmp llvm-12 ncurses/tinfo numactl)) | ||
| 1425 | (native-inputs | ||
| 1426 | (list patchelf perl)) | ||
| 1427 | (arguments | ||
| 1428 | (list | ||
| 1429 | #:configure-flags | ||
| 1430 | #~(list | ||
| 1431 | (string-append "--with-gmp-libraries=" | ||
| 1432 | (assoc-ref %build-inputs "gmp") "/lib") | ||
| 1433 | (string-append "--with-gmp-includes=" | ||
| 1434 | (assoc-ref %build-inputs "gmp") "/include")) | ||
| 1435 | #:phases | ||
| 1436 | #~(modify-phases %standard-phases | ||
| 1437 | (delete 'build) | ||
| 1438 | ;; We don't run the check phase on binary inputs. | ||
| 1439 | (delete 'check) | ||
| 1440 | (add-before 'configure 'fix-lnuma | ||
| 1441 | (lambda* (#:key inputs outputs #:allow-other-keys) | ||
| 1442 | (substitute* "rts/package.conf.in" | ||
| 1443 | (("FFI_LIB_DIR") | ||
| 1444 | (string-append | ||
| 1445 | "FFI_LIB_DIR " | ||
| 1446 | (assoc-ref inputs "numactl") "/lib"))))) | ||
| 1447 | (add-after 'fix-lnuma 'add-rpaths | ||
| 1448 | (lambda* (#:key inputs outputs #:allow-other-keys) | ||
| 1449 | (let* ((libraries | ||
| 1450 | (cons* "rts/dist/build/libffi.so" | ||
| 1451 | (find-files "." "-ghc8\\.10\\.7\\.so$"))) | ||
| 1452 | (binaries | ||
| 1453 | (list "ghc/stage2/build/tmp/ghc-stage2" | ||
| 1454 | "utils/ghc-cabal/dist-install/build/tmp/ghc-cabal" | ||
| 1455 | "utils/ghc-pkg/dist-install/build/tmp/ghc-pkg" | ||
| 1456 | "utils/haddock/dist/build/tmp/haddock" | ||
| 1457 | "utils/hp2ps/dist-install/build/tmp/hp2ps" | ||
| 1458 | "utils/hpc/dist-install/build/tmp/hpc" | ||
| 1459 | "utils/hsc2hs/dist-install/build/tmp/hsc2hs" | ||
| 1460 | "utils/iserv/stage2/build/tmp/ghc-iserv" | ||
| 1461 | "utils/iserv/stage2_dyn/build/tmp/ghc-iserv-dyn" | ||
| 1462 | "utils/iserv/stage2_p/build/tmp/ghc-iserv-prof" | ||
| 1463 | "utils/runghc/dist-install/build/tmp/runghc" | ||
| 1464 | "utils/unlit/dist-install/build/tmp/unlit")) | ||
| 1465 | (ld-so (search-input-file inputs #$(glibc-dynamic-linker)))) | ||
| 1466 | (for-each | ||
| 1467 | (lambda (b) | ||
| 1468 | (invoke "patchelf" "--add-rpath" | ||
| 1469 | (string-append #$gmp "/lib") b) | ||
| 1470 | (invoke "patchelf" "--add-rpath" | ||
| 1471 | (string-append (assoc-ref inputs "ncurses-with-tinfo") "/lib") b) | ||
| 1472 | (invoke "patchelf" "--add-rpath" | ||
| 1473 | (string-append #$gcc-13:lib "/lib") b) | ||
| 1474 | (invoke "patchelf" "--add-rpath" | ||
| 1475 | (string-append #$numactl "/lib") b)) | ||
| 1476 | (append libraries binaries)) | ||
| 1477 | ;; The binaries have "/lib64/ld-linux-aarch64.so.1" hardcoded. | ||
| 1478 | (for-each | ||
| 1479 | (lambda (b) | ||
| 1480 | (invoke "patchelf" "--set-interpreter" ld-so b)) | ||
| 1481 | binaries)))) | ||
| 1482 | (add-before 'add-rpaths 'set-target-programs | ||
| 1483 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 1484 | (setenv "CC" (search-input-file inputs "/bin/gcc")) | ||
| 1485 | (setenv "fp_prog_ar" (search-input-file inputs "/bin/ar")) | ||
| 1486 | (setenv "LD" (search-input-file inputs "/bin/ld")) | ||
| 1487 | (setenv "LLC" (search-input-file inputs "/bin/llc")) | ||
| 1488 | (setenv "OPT" (search-input-file inputs "/bin/opt"))))))) | ||
| 1489 | (native-search-paths | ||
| 1490 | (list (search-path-specification | ||
| 1491 | (variable "GHC_PACKAGE_PATH") | ||
| 1492 | (files (list (string-append "lib/ghc-" version))) | ||
| 1493 | (file-pattern "\\.conf\\.d$") | ||
| 1494 | (file-type 'directory)))) | ||
| 1495 | (home-page "https://www.haskell.org/ghc/") | ||
| 1496 | (synopsis "The Glasgow Haskell Compiler") | ||
| 1497 | (description | ||
| 1498 | "The Glasgow Haskell Compiler (GHC) is a state-of-the-art compiler and | ||
| 1499 | interactive environment for the functional language Haskell.") | ||
| 1500 | (properties '((hidden? . #t))) | ||
| 1501 | (license license:bsd-3))) | ||
| 1502 | |||
| 1403 | (define-public ghc-9.0 | 1503 | (define-public ghc-9.0 |
| 1404 | (package | 1504 | (package |
| 1405 | (inherit ghc-8.10) | 1505 | (inherit ghc-8.10) |
| @@ -1452,6 +1552,7 @@ interactive environment for the functional language Haskell.") | |||
| 1452 | (inherit base) | 1552 | (inherit base) |
| 1453 | (name "ghc") | 1553 | (name "ghc") |
| 1454 | (version "9.2.8") | 1554 | (version "9.2.8") |
| 1555 | (supported-systems '("i686-linux" "x86_64-linux" "aarch64-linux")) | ||
| 1455 | (source (origin | 1556 | (source (origin |
| 1456 | (method url-fetch) | 1557 | (method url-fetch) |
| 1457 | (uri (string-append "https://www.haskell.org/ghc/dist/" version | 1558 | (uri (string-append "https://www.haskell.org/ghc/dist/" version |
| @@ -1474,14 +1575,34 @@ interactive environment for the functional language Haskell.") | |||
| 1474 | (lambda _ | 1575 | (lambda _ |
| 1475 | (substitute* '("testsuite/tests/simplCore/should_compile/all.T") | 1576 | (substitute* '("testsuite/tests/simplCore/should_compile/all.T") |
| 1476 | (("^test\\('T21694', \\[ " all) | 1577 | (("^test\\('T21694', \\[ " all) |
| 1477 | (string-append all "when(arch('i386'), skip), "))))))) | 1578 | (string-append all "when(arch('i386'), skip), "))))) |
| 1579 | #$@(if (target-aarch64?) | ||
| 1580 | ;; Eats up all memory then fail | ||
| 1581 | #~((add-after 'skip-more-tests 'skip-T16992-aarch64 | ||
| 1582 | (lambda _ | ||
| 1583 | (substitute* "libraries/ghc-compact/tests/all.T" | ||
| 1584 | (("^test\\('T16992', \\[" all) | ||
| 1585 | (string-append all "when(arch('aarch64'), skip), "))))) | ||
| 1586 | ;; The RTS linker does not find __aarch64_*_sync symbols, | ||
| 1587 | ;; Fixed in 9.12 : | ||
| 1588 | ;; https://gitlab.haskell.org/ghc/ghc/-/commit/7db8c9927fae3369fc4ecff68f80c4cb32eea757 | ||
| 1589 | (add-before 'configure 'no-outline-atomics | ||
| 1590 | (lambda _ | ||
| 1591 | (with-output-to-file "mk/build.mk" | ||
| 1592 | (lambda () | ||
| 1593 | (display " | ||
| 1594 | SRC_HC_OPTS += -optc-mno-outline-atomics | ||
| 1595 | ")))))) | ||
| 1596 | '()))) | ||
| 1478 | ;; Increase verbosity, so running the test suite does not time out on CI. | 1597 | ;; Increase verbosity, so running the test suite does not time out on CI. |
| 1479 | ((#:make-flags make-flags ''()) | 1598 | ((#:make-flags make-flags ''()) |
| 1480 | #~(cons "VERBOSE=4" #$make-flags)))) | 1599 | #~(cons "VERBOSE=4" #$make-flags)))) |
| 1481 | (properties '((max-silent-time . 36000))) ; 10 hours, for i686. | 1600 | (properties '((max-silent-time . 36000))) ; 10 hours, for i686. |
| 1482 | (native-inputs | 1601 | (native-inputs |
| 1483 | `(;; GHC 9.2 must be built with GHC >= 8.6. | 1602 | `(;; GHC 9.2 must be built with GHC >= 8.6. |
| 1484 | ("ghc-bootstrap" ,base) | 1603 | ("ghc-bootstrap" ,(if (target-aarch64?) |
| 1604 | binary-ghc-8.10.7 | ||
| 1605 | base)) | ||
| 1485 | ("ghc-testsuite" | 1606 | ("ghc-testsuite" |
| 1486 | ,(origin | 1607 | ,(origin |
| 1487 | (method url-fetch) | 1608 | (method url-fetch) |
