diff options
| author | Jonas Meeuws <jonas.meeuws@gmail.com> | 2026-08-04 15:12:04 +0200 |
|---|---|---|
| committer | Liliana Marie Prikler <liliana.prikler@gmail.com> | 2026-08-22 16:49:16 +0200 |
| commit | 63b9c42462e7a55f7ae23e7f0d12d3cf57ac628d (patch) | |
| tree | 3426921d7e12d3db0596ed19ea70c9e32eccb6b5 | |
| parent | 43698ec2910b1477fb134a57bc58280eb4c0f424 (diff) | |
gnu: ldc: Add ‘rewrite-references-to-bootstrap’ phase.
* gnu/packages/dlang.scm (ldc)[#:phases]: Add
‘rewrite-references-to-bootstrap’.
Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
| -rw-r--r-- | gnu/packages/dlang.scm | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm index d6362cc0321..4669b5bd616 100644 --- a/gnu/packages/dlang.scm +++ b/gnu/packages/dlang.scm | |||
| @@ -68,6 +68,10 @@ | |||
| 68 | 68 | ||
| 69 | (define-public ldc-bootstrap | 69 | (define-public ldc-bootstrap |
| 70 | (package | 70 | (package |
| 71 | ;; This package is purposefully named just "ldc" and not "ldc-bootstrap", | ||
| 72 | ;; as the final ldc package rewrites references from this one to itself, | ||
| 73 | ;; and their names must have the same length to avoid corrupting the | ||
| 74 | ;; binary. | ||
| 71 | (name "ldc") | 75 | (name "ldc") |
| 72 | (version "1.42.0") | 76 | (version "1.42.0") |
| 73 | (source (origin | 77 | (source (origin |
| @@ -439,7 +443,24 @@ This compiler is based on the DMD frontend version 2.112.1.") | |||
| 439 | "-DBUILD_SHARED_LIBS=OFF")) | 443 | "-DBUILD_SHARED_LIBS=OFF")) |
| 440 | '("-DBUILD_SHARED_LIBS=ON"))) | 444 | '("-DBUILD_SHARED_LIBS=ON"))) |
| 441 | ((#:build-type _ ''()) | 445 | ((#:build-type _ ''()) |
| 442 | "RelWithDebInfo"))) | 446 | "RelWithDebInfo") |
| 447 | ((#:phases phases #~%standard-phases) | ||
| 448 | #~(modify-phases #$phases | ||
| 449 | (add-after 'create-lib-output 'rewrite-references-to-bootstrap | ||
| 450 | ;; D compilers can keep references to the include files used to | ||
| 451 | ;; build a binary in exception messages. For ldc, rewrite the | ||
| 452 | ;; references to ldc-bootstrap to itself, to reduce its closure | ||
| 453 | ;; size. | ||
| 454 | (lambda* (#:key outputs #:allow-other-keys) | ||
| 455 | (let* ((in-ldc-bootstrap #$(this-package-native-input "ldc")) | ||
| 456 | (out (assoc-ref outputs "out")) | ||
| 457 | (out/bin (string-append out "/bin"))) | ||
| 458 | ;; XXX: Use sed, as replace-store-references wouldn't | ||
| 459 | ;; replace the references, while substitute* throws an | ||
| 460 | ;; error. | ||
| 461 | (apply invoke "sed" "-i" | ||
| 462 | (format #f "s,~a,~a,g" in-ldc-bootstrap out) | ||
| 463 | (find-files out/bin))))))))) | ||
| 443 | (native-inputs | 464 | (native-inputs |
| 444 | (modify-inputs (package-native-inputs base) | 465 | (modify-inputs (package-native-inputs base) |
| 445 | (delete "gdmd") | 466 | (delete "gdmd") |
