GNU bug report logs - #60754
[PATCH 1/2] gnu: Add mold.

Previous Next

Package: guix-patches;

Reported by: Zhu Zihao <all_but_last <at> 163.com>

Date: Thu, 12 Jan 2023 14:20:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 60754 <at> debbugs.gnu.org (full text, mbox):

From: Zhu Zihao <all_but_last <at> 163.com>
To: 60754 <at> debbugs.gnu.org
Cc: Zhu Zihao <all_but_last <at> 163.com>
Subject: [PATCH 2/2] gnu: Add mold-wrapper.
Date: Thu, 12 Jan 2023 22:23:35 +0800
* gnu/packages/mold.scm(make-mold-wrapper): New variable.
(mold-wrapper): New variable.
(mold-as-ld-wrapper): New variable.
---
 gnu/packages/mold.scm | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gnu/packages/mold.scm b/gnu/packages/mold.scm
index 9338499b2b..2a02000d04 100644
--- a/gnu/packages/mold.scm
+++ b/gnu/packages/mold.scm
@@ -22,6 +22,8 @@ (define-module (gnu packages mold)
   #:use-module (guix utils)
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system trivial)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages c)
   #:use-module (gnu packages digest)
   #:use-module (gnu packages tbb)
@@ -80,3 +82,41 @@ (define-public mold
 It is designed to increase developer productivity by reducing build time,
 especially in rapid debug-edit-rebuild cycles.")
     (license license:agpl3+)))
+
+(define* (make-mold-wrapper mold #:key mold-as-ld?)
+  "Return a MOLD wrapper.  When MOLD-AS-LD? is true, create a 'ld' symlink that
+points to 'mold'."
+  (package
+    (inherit mold)
+    (name (if mold-as-ld? "mold-as-ld-wrapper" "mold-wrapper"))
+    (source #f)
+    (native-inputs '())
+    (inputs (list (make-ld-wrapper "ld.mold-wrapper" #:binutils mold
+                                   #:linker "ld.mold")
+                  (make-ld-wrapper "mold-wrapper" #:binutils mold #:linker
+                                   "mold")))
+    (propagated-inputs '())
+    (build-system trivial-build-system)
+    (arguments
+     (list #:builder
+           #~(let ((ld.mold (string-append #$(this-package-input
+                                              "ld.mold-wrapper")
+                                           "/bin/ld.mold"))
+                   (mold (string-append #$(this-package-input "mold-wrapper")
+                                        "/bin/mold")))
+               (mkdir #$output)
+               (mkdir (string-append #$output "/bin"))
+               (symlink ld.mold (string-append #$output "/bin/ld.mold"))
+               (symlink mold (string-append #$output "/bin/mold"))
+               (when #$mold-as-ld?
+                 (symlink ld.mold (string-append #$output "/bin/ld"))))))
+    (synopsis "Mold linker wrapper")
+    (description "This is a linker wrapper for Mold; like @code{ld-wrapper}, it
+wraps the linker to add any missing @code{-rpath} flags, and to detect any
+misuse of libraries outside of the store.")))
+
+(define-public mold-wrapper
+  (make-mold-wrapper mold))
+
+(define-public mold-as-ld-wrapper
+  (make-mold-wrapper mold #:mold-as-ld? #t))
-- 
2.38.1





This bug report was last modified 2 years and 99 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.