From patchwork Thu Jul 15 10:04:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 31430 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 B2E5427BC82; Thu, 15 Jul 2021 11:07:28 +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,SPF_HELO_PASS 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 8696D27BC6B for ; Thu, 15 Jul 2021 11:07:28 +0100 (BST) Received: from localhost ([::1]:58212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m3yH9-0002be-I9 for patchwork@mira.cbaines.net; Thu, 15 Jul 2021 06:07:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3yGk-0002Xt-9N for guix-patches@gnu.org; Thu, 15 Jul 2021 06:07:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35335) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m3yGk-0005Ky-11 for guix-patches@gnu.org; Thu, 15 Jul 2021 06:07:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m3yGj-0000Uz-PL for guix-patches@gnu.org; Thu, 15 Jul 2021 06:07:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49569] [PATCH] gnu: Add make-single-arch-llvm procedure. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 15 Jul 2021 10:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49569 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49569@debbugs.gnu.org Cc: Efraim Flashner X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16263435941866 (code B ref -1); Thu, 15 Jul 2021 10:07:01 +0000 Received: (at submit) by debbugs.gnu.org; 15 Jul 2021 10:06:34 +0000 Received: from localhost ([127.0.0.1]:46878 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m3yGI-0000U2-J5 for submit@debbugs.gnu.org; Thu, 15 Jul 2021 06:06:34 -0400 Received: from lists.gnu.org ([209.51.188.17]:44728) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m3yGH-0000Tu-2c for submit@debbugs.gnu.org; Thu, 15 Jul 2021 06:06:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3yGG-0001uc-Sl for guix-patches@gnu.org; Thu, 15 Jul 2021 06:06:32 -0400 Received: from flashner.co.il ([178.62.234.194]:32976) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m3yGE-0004ZQ-V3 for guix-patches@gnu.org; Thu, 15 Jul 2021 06:06:32 -0400 Received: from localhost (unknown [31.210.177.125]) by flashner.co.il (Postfix) with ESMTPSA id D9174402D0; Thu, 15 Jul 2021 10:05:52 +0000 (UTC) From: Efraim Flashner Date: Thu, 15 Jul 2021 13:04:52 +0300 Message-Id: <77ec80a001bb04229289f1e3efff7633c94c71dc.1626343320.git.efraim@flashner.co.il> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Received-SPF: pass client-ip=178.62.234.194; envelope-from=efraim@flashner.co.il; helo=flashner.co.il X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-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" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/llvm.scm (make-single-arch-llvm): New procedure. (llvm-native-12, llvm-native): New variables. --- Using this copy of llvm for packages like mesa will reduce the closure of those packages. I don't suppose it would work as well for compilers like rust which use LLVM for compiling and targeting different architectures. This drops the size of llvm-12 from 167M to 111M. gnu/packages/llvm.scm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) base-commit: 17c8fedc256406047c7a1e8317bc52641c621286 diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 575c63c713..35cecdfd84 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -1347,3 +1347,27 @@ LLVM.")))) (define-public ocaml-llvm-9 (make-ocaml-llvm llvm-9)) (define-public ocaml-llvm-10 (make-ocaml-llvm llvm-10)) (define-public ocaml-llvm-11 (make-ocaml-llvm llvm-11)) + +(define* (make-single-arch-llvm llvm #:optional (system (or (%current-target-system) + (%current-system)))) + (package + (inherit llvm) + (name (string-append "llvm-for-" (string-downcase + (system->llvm-target system)))) + (arguments + (substitute-keyword-arguments (package-arguments llvm) + ((#:configure-flags cf) + `(cons* ,(string-append "-DLLVM_TARGETS_TO_BUILD=" + (system->llvm-target system)) + ,cf)))) + (synopsis "Compiler with support for a single architecture"))) + +(define-public llvm-native-12 + (package + (inherit (make-single-arch-llvm llvm-12)) + (name "llvm-native"))) + +(define-public llvm-native + (package + (inherit (make-single-arch-llvm llvm)) + (name "llvm-native")))