From patchwork Thu Jan 12 14:18:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhu Zihao X-Patchwork-Id: 46066 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D81FA27BBEB; Thu, 12 Jan 2023 14:24:55 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 633C127BBE9 for ; Thu, 12 Jan 2023 14:24:55 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFyR6-0003oN-6I; Thu, 12 Jan 2023 09:20:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFyR1-0003mI-KM for guix-patches@gnu.org; Thu, 12 Jan 2023 09:20:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFyR0-0000SF-R9 for guix-patches@gnu.org; Thu, 12 Jan 2023 09:20:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pFyR0-0002kL-L1 for guix-patches@gnu.org; Thu, 12 Jan 2023 09:20:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60754] [PATCH 1/2] gnu: Add mold. Resent-From: Zhu Zihao Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 12 Jan 2023 14:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 60754 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 60754@debbugs.gnu.org Cc: Zhu Zihao X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.167353316710504 (code B ref -1); Thu, 12 Jan 2023 14:20:02 +0000 Received: (at submit) by debbugs.gnu.org; 12 Jan 2023 14:19:27 +0000 Received: from localhost ([127.0.0.1]:45064 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFyQQ-0002jM-QY for submit@debbugs.gnu.org; Thu, 12 Jan 2023 09:19:27 -0500 Received: from lists.gnu.org ([209.51.188.17]:47540) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFyQN-0002j5-BT for submit@debbugs.gnu.org; Thu, 12 Jan 2023 09:19:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFyQC-0003SM-Na for guix-patches@gnu.org; Thu, 12 Jan 2023 09:19:12 -0500 Received: from m12.mail.163.com ([220.181.12.198]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFyQ9-0000NP-Vt for guix-patches@gnu.org; Thu, 12 Jan 2023 09:19:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version: Content-Type; bh=z8E8qf15a1bUusQLWJ/Rim0Uj1BjQ33A656R1PCxap0=; b=ZuNnJSWgEjhU0Dc1IFYyOPWfU5wtPfKA4h4kwCbtRV7JD5YyKU7VITX0Q5C6W0 e5aQC0JjO0GLhl5vrBvGJbvfTRUYSiztT0E/VPadHd8SMLj7urQXIs/VvYP720bF 73oaqWUIsswrZwrkpbMMWMM9Iqqaq73B4oz6BVk05RoOU= Received: from localhost.localdomain (unknown [113.100.122.236]) by zwqz-smtp-mta-g4-1 (Coremail) with SMTP id _____wBXjjq5FsBjJLOHAA--.34664S2; Thu, 12 Jan 2023 22:18:53 +0800 (CST) From: Zhu Zihao Date: Thu, 12 Jan 2023 22:18:30 +0800 Message-Id: <20230112141830.28179-1-all_but_last@163.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-CM-TRANSID: _____wBXjjq5FsBjJLOHAA--.34664S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxZrWUZryfXrWUuF18AFyDGFg_yoWrXw4Upr 1fCr1avw1kGF13Jw4fWF47Wr13uFZ3AF4UKas3uanrtwsI9348CFW7tay5Aan7JF17Aa13 u3yIgay3GFykArJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0JUkfQ_UUUUU= X-Originating-IP: [113.100.122.236] X-CM-SenderInfo: pdoosuxxwbztlvw6il2tof0z/xtbBoRH0r2I0WiNTQgAAsV Received-SPF: pass client-ip=220.181.12.198; envelope-from=all_but_last@163.com; helo=m12.mail.163.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/local.mk (GNU_SYSTEM_MODULES): Add new file. * gnu/packages/mold.scm: New file. * gnu/packages/mold.scm (mold): New variable. --- gnu/local.mk | 1 + gnu/packages/mold.scm | 82 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 gnu/packages/mold.scm diff --git a/gnu/local.mk b/gnu/local.mk index 184f43e753..1e80dab53f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -426,6 +426,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/mingw.scm \ %D%/packages/microcom.scm \ %D%/packages/moe.scm \ + %D%/packages/mold.scm \ %D%/packages/motti.scm \ %D%/packages/monitoring.scm \ %D%/packages/moreutils.scm \ diff --git a/gnu/packages/mold.scm b/gnu/packages/mold.scm new file mode 100644 index 0000000000..9338499b2b --- /dev/null +++ b/gnu/packages/mold.scm @@ -0,0 +1,82 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2023 Zhu Zihao +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu packages mold) + #:use-module (guix gexp) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module (guix git-download) + #:use-module (guix build-system cmake) + #:use-module (gnu packages c) + #:use-module (gnu packages digest) + #:use-module (gnu packages tbb) + #:use-module (gnu packages tls) + #:use-module (gnu packages compression) + #:use-module ((guix licenses) #:prefix license:)) + +(define-public mold + (package + (name "mold") + (version "1.9.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/rui314/mold") + (commit (string-append "v" version)))) + (sha256 + (base32 "03qkl9qw5l5kg1awij40hcrfxq6jj70mvq4iscdy9dsn8qw8r3wb")) + (modules '((guix build utils))) + (snippet + #~(begin + (for-each + (lambda (x) + (delete-file-recursively (string-append "third-party/" x))) + '("mimalloc" "tbb" "xxhash" "zlib" "zstd")))))) + (build-system cmake-build-system) + (arguments + (list + #:configure-flags #~(list "-DMOLD_USE_SYSTEM_MIMALLOC=ON" + "-DMOLD_USE_SYSTEM_TBB=ON") + #:phases + #~(modify-phases %standard-phases + (add-before 'configure 'force-system-xxhash + (lambda _ + (substitute* "mold.h" + (("#include \"third-party/xxhash/xxhash.h\"") + "#include ")))) + (add-before 'configure 'fix-compiler-name-in-test + (lambda _ + (substitute* "test/elf/common.inc" + (("CC=\"\\$\\{TEST_CC:-cc\\}\"") "CC=gcc") + (("CXX=\"\\$\\{TEST_CXX:-c\\+\\+\\}\"") + "CXX=g++")))) + (add-before 'configure 'disable-rpath-test + (lambda _ + ;; This test fails because mold expect the RUNPATH as-is, + ;; but compiler in Guix will insert the path of gcc-lib and + ;; glibc into the output binary. + (delete-file "test/elf/rpath.sh")))))) + (inputs (list mimalloc openssl tbb xxhash zlib `(,zstd "lib"))) + (home-page "https://github.com/rui314/mold") + (synopsis "Faster drop-in replacement for Unix linkers") + (description + "Mold is a faster drop-in replacement for existing Unix linkers. +It is designed to increase developer productivity by reducing build time, +especially in rapid debug-edit-rebuild cycles.") + (license license:agpl3+))) From patchwork Thu Jan 12 14:23:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Zihao X-Patchwork-Id: 46069 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 7AB2127BBE9; Thu, 12 Jan 2023 14:46:52 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 61F1527BBEB for ; Thu, 12 Jan 2023 14:46:51 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFyVs-0006ez-6j; Thu, 12 Jan 2023 09:25:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFyVq-0006dN-Bf for guix-patches@gnu.org; Thu, 12 Jan 2023 09:25:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFyVq-0001Ff-0p for guix-patches@gnu.org; Thu, 12 Jan 2023 09:25:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pFyVp-0002t3-Oa for guix-patches@gnu.org; Thu, 12 Jan 2023 09:25:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60754] [PATCH 2/2] gnu: Add mold-wrapper. References: <20230112141830.28179-1-all_but_last@163.com> In-Reply-To: <20230112141830.28179-1-all_but_last@163.com> Resent-From: Zhu Zihao Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 12 Jan 2023 14:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60754 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 60754@debbugs.gnu.org Cc: Zhu Zihao Received: via spool by 60754-submit@debbugs.gnu.org id=B60754.167353344611014 (code B ref 60754); Thu, 12 Jan 2023 14:25:01 +0000 Received: (at 60754) by debbugs.gnu.org; 12 Jan 2023 14:24:06 +0000 Received: from localhost ([127.0.0.1]:45073 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFyUw-0002rZ-7K for submit@debbugs.gnu.org; Thu, 12 Jan 2023 09:24:06 -0500 Received: from m12.mail.163.com ([220.181.12.215]:60630) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFyUm-0002qg-IL for 60754@debbugs.gnu.org; Thu, 12 Jan 2023 09:24:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=Rpzjd KOoHlj9GW7RPVZghdqes2W9/Ak+hZC/XUEBDOY=; b=D8NIwGWD5koIC3VTKrlt6 4XVrAL10pxP17ak+96j+a8v1gtcVhaiNePcH3qXXQgQwub+F07QB8LL2otEGvpWb eXMkjHIS4FEV2nwhbHzrp2arVCEfaFQrznnnlLw6vQb4wAJX0MHTyRbc+YjWDtrN 1SqTsgXAUgrH+hCaTtdmOg= Received: from localhost.localdomain (unknown [113.100.122.236]) by zwqz-smtp-mta-g0-4 (Coremail) with SMTP id _____wA3I9XpF8BjQEOJAA--.46396S2; Thu, 12 Jan 2023 22:23:40 +0800 (CST) From: Zhu Zihao Date: Thu, 12 Jan 2023 22:23:35 +0800 Message-Id: <20230112142335.28708-1-all_but_last@163.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-CM-TRANSID: _____wA3I9XpF8BjQEOJAA--.46396S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7CF18Jw4DGrykJF4UArWfGrg_yoW8Kw1xpa 15Kr1Ygr1rGrnrJws3Wa17tr4rXFZavFyYg3yayr9rCw4UK3W2vF42yay5AF17J3ZrJ3Z7 Gr48Xa15CFWUu3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0JU94SOUUUUU= X-Originating-IP: [113.100.122.236] X-CM-SenderInfo: pdoosuxxwbztlvw6il2tof0z/1tbiTxD0r1sGdAjPnwAAs1 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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))