From patchwork Fri Oct 9 09:12:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 24517 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 7F55C27BBE9; Fri, 9 Oct 2020 10:14:10 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4CB9F27BBE8 for ; Fri, 9 Oct 2020 10:14:10 +0100 (BST) Received: from localhost ([::1]:35936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQoTZ-0007h8-En for patchwork@mira.cbaines.net; Fri, 09 Oct 2020 05:14:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQoTT-0007gd-05 for guix-patches@gnu.org; Fri, 09 Oct 2020 05:14:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50801) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kQoTS-0001nM-Mj for guix-patches@gnu.org; Fri, 09 Oct 2020 05:14:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kQoTS-00048F-I0 for guix-patches@gnu.org; Fri, 09 Oct 2020 05:14:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43679] [PATCH v2 1/5] gnu: gcc-toolchain: Add 'GUIX_LOCPATH' to the search paths. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 Oct 2020 09:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43679 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43679@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 43679-submit@debbugs.gnu.org id=B43679.160223478515763 (code B ref 43679); Fri, 09 Oct 2020 09:14:02 +0000 Received: (at 43679) by debbugs.gnu.org; 9 Oct 2020 09:13:05 +0000 Received: from localhost ([127.0.0.1]:34101 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kQoSW-000464-Mx for submit@debbugs.gnu.org; Fri, 09 Oct 2020 05:13:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48812) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kQoSU-00045R-GL for 43679@debbugs.gnu.org; Fri, 09 Oct 2020 05:13:03 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57148) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQoSP-0001jj-9f; Fri, 09 Oct 2020 05:12:57 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=56284 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kQoSO-0001o4-0C; Fri, 09 Oct 2020 05:12:56 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 9 Oct 2020 11:12:27 +0200 Message-Id: <20201009091231.26287-2-ludo@gnu.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009091231.26287-1-ludo@gnu.org> References: <87mu17yzfn.fsf@inria.fr> <20201009091231.26287-1-ludo@gnu.org> MIME-Version: 1.0 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" X-getmail-retrieved-from-mailbox: Patches This allows 'gcc-toolchain' to be used as a drop-in replacement for the default tool chain through '--with-toolchain=gcc-toolchain'. * gnu/packages/commencement.scm (make-gcc-toolchain)[native-search-paths] [search-paths]: Append LIBC's search paths. --- gnu/packages/commencement.scm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index 4041d5bb89..0938bc3d46 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -3856,8 +3856,12 @@ COREUTILS-FINAL vs. COREUTILS, etc." "libc-static"))) #t)))) - (native-search-paths (package-native-search-paths gcc)) - (search-paths (package-search-paths gcc)) + (native-search-paths + (append (package-native-search-paths gcc) + (package-native-search-paths libc))) ;GUIX_LOCPATH + (search-paths + (append (package-search-paths gcc) + (package-search-paths libc))) (license (package-license gcc)) (synopsis "Complete GCC tool chain for C/C++ development") From patchwork Fri Oct 9 09:12:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 24518 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 D4AFF27BBE9; Fri, 9 Oct 2020 10:14:10 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8D3C127BBE8 for ; Fri, 9 Oct 2020 10:14:10 +0100 (BST) Received: from localhost ([::1]:35938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQoTZ-0007hB-OD for patchwork@mira.cbaines.net; Fri, 09 Oct 2020 05:14:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQoTT-0007gr-Rv for guix-patches@gnu.org; Fri, 09 Oct 2020 05:14:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50803) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kQoTT-0001nU-Io for guix-patches@gnu.org; Fri, 09 Oct 2020 05:14:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kQoTT-00048U-E2 for guix-patches@gnu.org; Fri, 09 Oct 2020 05:14:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43679] [PATCH v2 2/5] gnu: clang-toolchain: Add 'GUIX_LOCPATH' to the search paths. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 Oct 2020 09:14:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43679 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43679@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 43679-submit@debbugs.gnu.org id=B43679.160223478715789 (code B ref 43679); Fri, 09 Oct 2020 09:14:03 +0000 Received: (at 43679) by debbugs.gnu.org; 9 Oct 2020 09:13:07 +0000 Received: from localhost ([127.0.0.1]:34108 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kQoSZ-00046a-Eo for submit@debbugs.gnu.org; Fri, 09 Oct 2020 05:13:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48816) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kQoSW-00045U-CO for 43679@debbugs.gnu.org; Fri, 09 Oct 2020 05:13:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57150) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQoSQ-0001jr-DC; Fri, 09 Oct 2020 05:12:58 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=56284 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kQoSP-0001o4-JY; Fri, 09 Oct 2020 05:12:57 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 9 Oct 2020 11:12:28 +0200 Message-Id: <20201009091231.26287-3-ludo@gnu.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009091231.26287-1-ludo@gnu.org> References: <87mu17yzfn.fsf@inria.fr> <20201009091231.26287-1-ludo@gnu.org> MIME-Version: 1.0 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" X-getmail-retrieved-from-mailbox: Patches From: Ludovic Courtès * gnu/packages/llvm.scm (make-clang-toolchain)[native-search-paths]: Add 'GUIX_LOCPATH'. --- gnu/packages/llvm.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 15078a1168..4b42c4921a 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -484,7 +484,11 @@ code analysis tools.") "libc-static"))) #t)))) - (native-search-paths (package-native-search-paths clang)) + (native-search-paths + (append (package-native-search-paths clang) + (list (search-path-specification ;copied from glibc + (variable "GUIX_LOCPATH") + (files '("lib/locale")))))) (search-paths (package-search-paths clang)) (license (package-license clang)) From patchwork Fri Oct 9 09:12:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 24520 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 C372327BBE9; Fri, 9 Oct 2020 10:14:21 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6754927BBE8 for ; Fri, 9 Oct 2020 10:14:21 +0100 (BST) Received: from localhost ([::1]:36508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQoTj-0007yR-Ok for patchwork@mira.cbaines.net; Fri, 09 Oct 2020 05:14:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55830) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQoTU-0007hA-An for guix-patches@gnu.org; Fri, 09 Oct 2020 05:14:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50804) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kQoTU-0001nY-0j for guix-patches@gnu.org; Fri, 09 Oct 2020 05:14:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kQoTT-00048b-Si for guix-patches@gnu.org; Fri, 09 Oct 2020 05:14:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43679] [PATCH v2 3/5] gnu: clang-toolchain: Create 'cc' and 'c++' symlinks. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 Oct 2020 09:14:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43679 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43679@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 43679-submit@debbugs.gnu.org id=B43679.160223478815798 (code B ref 43679); Fri, 09 Oct 2020 09:14:03 +0000 Received: (at 43679) by debbugs.gnu.org; 9 Oct 2020 09:13:08 +0000 Received: from localhost ([127.0.0.1]:34110 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kQoSZ-00046c-Oz for submit@debbugs.gnu.org; Fri, 09 Oct 2020 05:13:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48828) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kQoSX-00045V-5t for 43679@debbugs.gnu.org; Fri, 09 Oct 2020 05:13:05 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57152) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQoSR-0001jx-JN; Fri, 09 Oct 2020 05:12:59 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=56284 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kQoSQ-0001o4-NX; Fri, 09 Oct 2020 05:12:59 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 9 Oct 2020 11:12:29 +0200 Message-Id: <20201009091231.26287-4-ludo@gnu.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009091231.26287-1-ludo@gnu.org> References: <87mu17yzfn.fsf@inria.fr> <20201009091231.26287-1-ludo@gnu.org> MIME-Version: 1.0 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" X-getmail-retrieved-from-mailbox: Patches From: Ludovic Courtès * gnu/packages/llvm.scm (make-clang-toolchain)[arguments]: Create 'cc' and 'c++' symlinks. --- gnu/packages/llvm.scm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 4b42c4921a..361b39710b 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -476,6 +476,12 @@ code analysis tools.") (((names . directories) ...) (union-build out directories))) + ;; Create 'cc' and 'c++' so that one can use it as a + ;; drop-in replacement for the default tool chain and + ;; have configure scripts find the compiler. + (symlink "clang" (string-append out "/bin/cc")) + (symlink "clang++" (string-append out "/bin/c++")) + (union-build (assoc-ref %outputs "debug") (list (assoc-ref %build-inputs "libc-debug"))) From patchwork Fri Oct 9 09:12:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 24521 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 7604427BBE9; Fri, 9 Oct 2020 10:14:27 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CBC6327BBE8 for ; Fri, 9 Oct 2020 10:14:26 +0100 (BST) Received: from localhost ([::1]:36568 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQoTq-0007zr-1k for patchwork@mira.cbaines.net; Fri, 09 Oct 2020 05:14:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQoTU-0007i5-PL for guix-patches@gnu.org; Fri, 09 Oct 2020 05:14:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50805) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kQoTU-0001nc-F4 for guix-patches@gnu.org; Fri, 09 Oct 2020 05:14:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kQoTU-00048k-BF for guix-patches@gnu.org; Fri, 09 Oct 2020 05:14:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43679] [PATCH v2 4/5] packages: Add 'package-with-c-toolchain'. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 Oct 2020 09:14:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43679 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43679@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 43679-submit@debbugs.gnu.org id=B43679.160223478915810 (code B ref 43679); Fri, 09 Oct 2020 09:14:04 +0000 Received: (at 43679) by debbugs.gnu.org; 9 Oct 2020 09:13:09 +0000 Received: from localhost ([127.0.0.1]:34112 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kQoSa-00046k-1i for submit@debbugs.gnu.org; Fri, 09 Oct 2020 05:13:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48834) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kQoSX-00045X-Kr for 43679@debbugs.gnu.org; Fri, 09 Oct 2020 05:13:06 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57154) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQoSS-0001k3-ES; Fri, 09 Oct 2020 05:13:00 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=56284 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kQoSR-0001o4-Te; Fri, 09 Oct 2020 05:13:00 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 9 Oct 2020 11:12:30 +0200 Message-Id: <20201009091231.26287-5-ludo@gnu.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009091231.26287-1-ludo@gnu.org> References: <87mu17yzfn.fsf@inria.fr> <20201009091231.26287-1-ludo@gnu.org> MIME-Version: 1.0 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" X-getmail-retrieved-from-mailbox: Patches * guix/build-system.scm (build-system-with-c-toolchain): New procedure. * guix/packages.scm (package-with-c-toolchain): New procedure. * tests/packages.scm ("package-with-c-toolchain"): New test. * doc/guix.texi (package Reference): Document 'package-with-c-toolchain'. (Build Systems): Mention it. --- doc/guix.texi | 32 ++++++++++++++++++++++++++++++++ guix/build-system.scm | 35 +++++++++++++++++++++++++++++++++-- guix/packages.scm | 9 +++++++++ tests/packages.scm | 20 ++++++++++++++++++++ 4 files changed, 94 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index a6260a12aa..38a8e5d4a6 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -6530,6 +6530,35 @@ cross-compiling: It is an error to refer to @code{this-package} outside a package definition. @end deffn +Because packages are regular Scheme objects that capture a complete +dependency graph and associated build procedures, it is often useful to +write procedures that take a package and return a modified version +thereof according to some parameters. Below are a few examples. + +@cindex tool chain, choosing a package's tool chain +@deffn {Scheme Procedure} package-with-c-toolchain @var{package} @var{toolchain} +Return a variant of @var{package} that uses @var{toolchain} instead of +the default GNU C/C++ toolchain. @var{toolchain} must be a list of +inputs (label/package tuples) providing equivalent functionality, such +as the @code{gcc-toolchain} package. + +The example below returns a variant of the @code{hello} package built +with GCC@tie{}10.x and the rest of the GNU tool chain (Binutils and the +GNU C Library) instead of the default tool chain: + +@lisp +(let ((toolchain (specification->package "gcc-toolchain@@10"))) + (package-with-c-toolchain hello `(("toolchain" ,toolchain)))) +@end lisp + +The build tool chain is part of the @dfn{implicit inputs} of +packages---it's usually not listed as part of the various ``inputs'' +fields and is instead pulled in by the build system. Consequently, this +procedure works by changing the build system of @var{package} so that it +pulls in @var{toolchain} instead of the defaults. @ref{Build Systems}, +for more on build systems. +@end deffn + @node origin Reference @subsection @code{origin} Reference @@ -6666,6 +6695,9 @@ ornamentation---in other words, a bag is a lower-level representation of a package, which includes all the inputs of that package, including some that were implicitly added by the build system. This intermediate representation is then compiled to a derivation (@pxref{Derivations}). +The @code{package-with-c-toolchain} is an example of a way to change the +implicit inputs that a package's build system pulls in (@pxref{package +Reference, @code{package-with-c-toolchain}}). Build systems accept an optional list of @dfn{arguments}. In package definitions, these are passed @i{via} the @code{arguments} field diff --git a/guix/build-system.scm b/guix/build-system.scm index 4174972b98..76d670995c 100644 --- a/guix/build-system.scm +++ b/guix/build-system.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014 Ludovic Courtès +;;; Copyright © 2012, 2013, 2014, 2020 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,6 +18,7 @@ (define-module (guix build-system) #:use-module (guix records) + #:use-module (srfi srfi-1) #:use-module (ice-9 match) #:export (build-system build-system? @@ -37,7 +38,9 @@ bag-arguments bag-build - make-bag)) + make-bag + + build-system-with-c-toolchain)) (define-record-type* build-system make-build-system build-system? @@ -98,3 +101,31 @@ intermediate representation just above derivations." #:outputs outputs #:target target arguments)))) + +(define (build-system-with-c-toolchain bs toolchain) + "Return a variant of BS, a build system, that uses TOOLCHAIN instead of the +default GNU C/C++ toolchain. TOOLCHAIN must be a list of +inputs (label/package tuples) providing equivalent functionality, such as the +'gcc-toolchain' package." + (define lower + (build-system-lower bs)) + + (define toolchain-packages + ;; These are the GNU toolchain packages pulled in by GNU-BUILD-SYSTEM and + ;; all the build systems that inherit from it. Keep the list in sync with + ;; 'standard-packages' in (guix build-system gnu). + '("gcc" "binutils" "libc" "libc:static" "ld-wrapper")) + + (define (lower* . args) + (let ((lowered (apply lower args))) + (bag + (inherit lowered) + (build-inputs + (append (fold alist-delete + (bag-build-inputs lowered) + toolchain-packages) + toolchain))))) + + (build-system + (inherit bs) + (lower lower*))) diff --git a/guix/packages.scm b/guix/packages.scm index 4f2bb432be..24d6417065 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -124,6 +124,7 @@ package-patched-vulnerabilities package-with-patches package-with-extra-patches + package-with-c-toolchain package/inherit transitive-input-references @@ -790,6 +791,14 @@ specifies modules in scope when evaluating SNIPPET." (append (origin-patches (package-source original)) patches))) +(define (package-with-c-toolchain package toolchain) + "Return a variant of PACKAGE that uses TOOLCHAIN instead of the default GNU +C/C++ toolchain. TOOLCHAIN must be a list of inputs (label/package tuples) +providing equivalent functionality, such as the 'gcc-toolchain' package." + (let ((bs (package-build-system package))) + (package/inherit package + (build-system (build-system-with-c-toolchain bs toolchain))))) + (define (transitive-inputs inputs) "Return the closure of INPUTS when considering the 'propagated-inputs' edges. Omit duplicate inputs, except for those already present in INPUTS diff --git a/tests/packages.scm b/tests/packages.scm index 5d5abcbd76..2d13d91344 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -1430,6 +1430,26 @@ (derivation-file-name (package-derivation %store coreutils)))))))) +(test-assert "package-with-c-toolchain" + (let* ((dep (dummy-package "chbouib" + (build-system gnu-build-system) + (native-inputs `(("x" ,grep))))) + (p0 (dummy-package "thingie" + (build-system gnu-build-system) + (inputs `(("foo" ,grep) + ("bar" ,dep))))) + (tc (dummy-package "my-toolchain")) + (p1 (package-with-c-toolchain p0 `(("toolchain" ,tc))))) + (define toolchain-packages + '("gcc" "binutils" "glibc" "ld-wrapper")) + + (match (bag-build-inputs (package->bag p1)) + ((("foo" foo) ("bar" bar) (_ (= package-name packages) . _) ...) + (and (not (any (cut member <> packages) toolchain-packages)) + (member "my-toolchain" packages) + (eq? foo grep) + (eq? bar dep)))))) + (test-equal "package-patched-vulnerabilities" '(("CVE-2015-1234") ("CVE-2016-1234" "CVE-2018-4567") From patchwork Fri Oct 9 09:12:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 24522 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 06A3F27BBE9; Fri, 9 Oct 2020 10:14:39 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 64CF527BBE8 for ; Fri, 9 Oct 2020 10:14:38 +0100 (BST) Received: from localhost ([::1]:37016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQoU1-0008CG-KZ for patchwork@mira.cbaines.net; Fri, 09 Oct 2020 05:14:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kQoTV-0007j8-6y for guix-patches@gnu.org; Fri, 09 Oct 2020 05:14:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50806) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kQoTU-0001nn-TJ for guix-patches@gnu.org; Fri, 09 Oct 2020 05:14:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kQoTU-00048r-PW for guix-patches@gnu.org; Fri, 09 Oct 2020 05:14:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43679] [PATCH v2 5/5] guix build: Add '--with-c-toolchain'. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 09 Oct 2020 09:14:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43679 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43679@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 43679-submit@debbugs.gnu.org id=B43679.160223479415822 (code B ref 43679); Fri, 09 Oct 2020 09:14:04 +0000 Received: (at 43679) by debbugs.gnu.org; 9 Oct 2020 09:13:14 +0000 Received: from localhost ([127.0.0.1]:34114 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kQoSf-000478-SR for submit@debbugs.gnu.org; Fri, 09 Oct 2020 05:13:14 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48842) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kQoSZ-00045f-5F for 43679@debbugs.gnu.org; Fri, 09 Oct 2020 05:13:08 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57157) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kQoST-0001kG-VL; Fri, 09 Oct 2020 05:13:01 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=56284 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kQoSS-0001o4-Ob; Fri, 09 Oct 2020 05:13:01 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 9 Oct 2020 11:12:31 +0200 Message-Id: <20201009091231.26287-6-ludo@gnu.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009091231.26287-1-ludo@gnu.org> References: <87mu17yzfn.fsf@inria.fr> <20201009091231.26287-1-ludo@gnu.org> MIME-Version: 1.0 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" X-getmail-retrieved-from-mailbox: Patches From: Ludovic Courtès * guix/scripts/build.scm (package-dependents/spec) (package-toolchain-rewriting, transform-package-toolchain): New procedures. (%transformations): Add it. (%transformation-options, show-transformation-options-help): Add '--with-c-toolchain'. * tests/scripts-build.scm (depends-on-toolchain?): New procedure. ("options->transformation, with-c-toolchain") ("options->transformation, with-c-toolchain twice") New test. ("options->transformation, with-c-toolchain, no effect"): New tests. * doc/guix.texi (Package Transformation Options): Document it. --- doc/guix.texi | 38 +++++++++++++++++++ guix/scripts/build.scm | 84 +++++++++++++++++++++++++++++++++++++++++ tests/scripts-build.scm | 82 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 204 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 38a8e5d4a6..c955041c61 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -9338,6 +9338,44 @@ must be compatible. If @var{replacement} is somehow incompatible with @var{package}, then the resulting package may be unusable. Use with care! +@cindex tool chain, changing the build tool chain of a package +@item --with-c-toolchain=@var{package}=@var{toolchain} +This option changes the compilation of @var{package} and everything that +depends on it so that they get built with @var{toolchain} instead of the +default GNU tool chain for C/C++. + +Consider this example: + +@example +guix build octave-cli \ + --with-c-toolchain=fftw=gcc-toolchain@@10 \ + --with-c-toolchain=fftwf=gcc-toolchain@@10 +@end example + +The command above builds a variant of the @code{fftw} and @code{fftwf} +packages using version 10 of @code{gcc-toolchain} instead of the default +tool chain, and then builds a variant of the GNU@tie{}Octave +command-line interface using them. GNU@tie{}Octave itself is also built +with @code{gcc-toolchain@@10}. + +This other example builds the Hardware Locality (@code{hwloc}) library +and its dependents up to @code{intel-mpi-benchmarks} with the Clang C +compiler: + +@example +guix build --with-c-toolchain=hwloc=clang-toolchain \ + intel-mpi-benchmarks +@end example + +@quotation Note +There can be application binary interface (ABI) incompatibilities among +tool chains. This is particularly true of the C++ standard library and +run-time support libraries such as that of OpenMP. By rebuilding all +dependents with the same tool chain, @option{--with-c-toolchain} minimizes +the risks of incompatibility but cannot entirely eliminate them. Choose +@var{package} wisely. +@end quotation + @item --with-git-url=@var{package}=@var{url} @cindex Git, using the latest commit @cindex latest commit, building diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index 72a5d46347..e59e0ee67f 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -26,6 +26,7 @@ #:use-module (guix store) #:use-module (guix derivations) #:use-module (guix packages) + #:use-module (guix memoization) #:use-module (guix grafts) #:use-module (guix utils) @@ -396,6 +397,83 @@ a checkout of the Git repository at the given URL." (rewrite obj) obj))) +(define (package-dependents/spec top bottom) + "Return the list of dependents of BOTTOM, a spec string, that are also +dependencies of TOP, a package." + (define-values (name version) + (package-name->name+version bottom)) + + (define dependent? + (mlambda (p) + (and (package? p) + (or (and (string=? name (package-name p)) + (or (not version) + (version-prefix? version (package-version p)))) + (match (bag-direct-inputs (package->bag p)) + (((labels dependencies . _) ...) + (any dependent? dependencies))))))) + + (filter dependent? (package-closure (list top)))) + +(define (package-toolchain-rewriting p bottom toolchain) + "Return a procedure that, when passed a package that's either BOTTOM or one +of its dependents up to P so, changes it so it is built with TOOLCHAIN. +TOOLCHAIN must be an input list." + (define rewriting-property + (gensym " package-toolchain-rewriting")) + + (match (package-dependents/spec p bottom) + (() ;P does not depend on BOTTOM + identity) + (set + ;; SET is the list of packages "between" P and BOTTOM (included) whose + ;; toolchain needs to be changed. + (package-mapping (lambda (p) + (if (or (assq rewriting-property + (package-properties p)) + (not (memq p set))) + p + (let ((p (package-with-c-toolchain p toolchain))) + (package/inherit p + (properties `((,rewriting-property . #t) + ,@(package-properties p))))))) + (lambda (p) + (or (assq rewriting-property (package-properties p)) + (not (memq p set)))) + #:deep? #t)))) + +(define (transform-package-toolchain replacement-specs) + "Return a procedure that, when passed a package, changes its toolchain or +that of its dependencies according to REPLACEMENT-SPECS. REPLACEMENT-SPECS is +a list of strings like \"fftw=gcc-toolchain@10\" meaning that the package to +the left of the equal sign must be built with the toolchain to the right of +the equal sign." + (define split-on-commas + (cute string-tokenize <> (char-set-complement (char-set #\,)))) + + (define (specification->input spec) + (let ((package (specification->package spec))) + (list (package-name package) package))) + + (define replacements + (map (lambda (spec) + (match (string-tokenize spec %not-equal) + ((spec (= split-on-commas toolchain)) + (cons spec (map specification->input toolchain))) + (_ + (leave (G_ "~a: invalid toolchain replacement specification~%") + spec)))) + replacement-specs)) + + (lambda (store obj) + (if (package? obj) + (or (any (match-lambda + ((bottom . toolchain) + ((package-toolchain-rewriting obj bottom toolchain) obj))) + replacements) + obj) + obj))) + (define (transform-package-tests specs) "Return a procedure that, when passed a package, sets #:tests? #f in its 'arguments' field." @@ -426,6 +504,7 @@ a checkout of the Git repository at the given URL." (with-branch . ,transform-package-source-branch) (with-commit . ,transform-package-source-commit) (with-git-url . ,transform-package-source-git-url) + (with-c-toolchain . ,transform-package-toolchain) (without-tests . ,transform-package-tests))) (define (transformation-procedure key) @@ -455,6 +534,8 @@ a checkout of the Git repository at the given URL." (parser 'with-commit)) (option '("with-git-url") #t #f (parser 'with-git-url)) + (option '("with-c-toolchain") #t #f + (parser 'with-c-toolchain)) (option '("without-tests") #t #f (parser 'without-tests))))) @@ -477,6 +558,9 @@ a checkout of the Git repository at the given URL." (display (G_ " --with-git-url=PACKAGE=URL build PACKAGE from the repository at URL")) + (display (G_ " + --with-c-toolchain=PACKAGE=TOOLCHAIN + build PACKAGE and its dependents with TOOLCHAIN")) (display (G_ " --without-tests=PACKAGE build PACKAGE without running its tests"))) diff --git a/tests/scripts-build.scm b/tests/scripts-build.scm index 5f91360953..6925374baa 100644 --- a/tests/scripts-build.scm +++ b/tests/scripts-build.scm @@ -22,6 +22,8 @@ #:use-module (guix derivations) #:use-module (guix packages) #:use-module (guix git-download) + #:use-module (guix build-system) + #:use-module (guix build-system gnu) #:use-module (guix scripts build) #:use-module (guix ui) #:use-module (guix utils) @@ -30,6 +32,8 @@ #:use-module (gnu packages base) #:use-module (gnu packages busybox) #:use-module (ice-9 match) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) #:use-module (srfi srfi-64)) @@ -270,6 +274,80 @@ ((("x" dep3)) (map package-source (list dep1 dep3)))))))))))) +(define* (depends-on-toolchain? p #:optional (toolchain "gcc-toolchain")) + "Return true if P depends on TOOLCHAIN instead of the default tool chain." + (define toolchain-packages + '("gcc" "binutils" "glibc" "ld-wrapper")) + + (define (package-name* obj) + (and (package? obj) (package-name obj))) + + (match (bag-build-inputs (package->bag p)) + (((_ (= package-name* packages) . _) ...) + (and (not (any (cut member <> packages) toolchain-packages)) + (member toolchain packages))))) + +(test-assert "options->transformation, with-c-toolchain" + (let* ((dep0 (dummy-package "chbouib" + (build-system gnu-build-system) + (native-inputs `(("y" ,grep))))) + (dep1 (dummy-package "stuff" + (native-inputs `(("x" ,dep0))))) + (p (dummy-package "thingie" + (build-system gnu-build-system) + (inputs `(("foo" ,grep) + ("bar" ,dep1))))) + (t (options->transformation + '((with-c-toolchain . "chbouib=gcc-toolchain"))))) + ;; Here we check that the transformation applies to DEP0 and all its + ;; dependents: DEP0 must use GCC-TOOLCHAIN, DEP1 must use GCC-TOOLCHAIN + ;; and the DEP0 that uses GCC-TOOLCHAIN, and so on. + (with-store store + (let ((new (t store p))) + (and (depends-on-toolchain? new "gcc-toolchain") + (match (bag-build-inputs (package->bag new)) + ((("foo" dep0) ("bar" dep1) _ ...) + (and (depends-on-toolchain? dep1 "gcc-toolchain") + (not (depends-on-toolchain? dep0 "gcc-toolchain")) + (string=? (package-full-name dep0) + (package-full-name grep)) + (match (bag-build-inputs (package->bag dep1)) + ((("x" dep) _ ...) + (and (depends-on-toolchain? dep "gcc-toolchain") + (match (bag-build-inputs (package->bag dep)) + ((("y" dep) _ ...) ;this one is unchanged + (eq? dep grep)))))))))))))) + +(test-equal "options->transformation, with-c-toolchain twice" + (package-full-name grep) + (let* ((dep0 (dummy-package "chbouib")) + (dep1 (dummy-package "stuff")) + (p (dummy-package "thingie" + (build-system gnu-build-system) + (inputs `(("foo" ,dep0) + ("bar" ,dep1) + ("baz" ,grep))))) + (t (options->transformation + '((with-c-toolchain . "chbouib=clang-toolchain") + (with-c-toolchain . "stuff=clang-toolchain"))))) + (with-store store + (let ((new (t store p))) + (and (depends-on-toolchain? new "clang-toolchain") + (match (bag-build-inputs (package->bag new)) + ((("foo" dep0) ("bar" dep1) ("baz" dep2) _ ...) + (and (depends-on-toolchain? dep0 "clang-toolchain") + (depends-on-toolchain? dep1 "clang-toolchain") + (not (depends-on-toolchain? dep2 "clang-toolchain")) + (package-full-name dep2))))))))) + +(test-assert "options->transformation, with-c-toolchain, no effect" + (let ((p (dummy-package "thingie")) + (t (options->transformation + '((with-c-toolchain . "does-not-exist=gcc-toolchain"))))) + ;; When it has no effect, '--with-c-toolchain' returns P. + (with-store store + (eq? (t store p) p)))) + (test-assert "options->transformation, without-tests" (let* ((dep (dummy-package "dep")) (p (dummy-package "foo" @@ -286,3 +364,7 @@ '(#:tests? #f)))))))) (test-end) + +;;; Local Variables: +;;; eval: (put 'dummy-package 'scheme-indent-function 1) +;;; End: