From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id gEE9Ff0kSGFARgEAgWs5BA (envelope-from ) for ; Mon, 20 Sep 2021 08:06:53 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id QHveEP0kSGGKRwAAB5/wlQ (envelope-from ) for ; Mon, 20 Sep 2021 06:06:53 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 7C8E61F5A5 for ; Mon, 20 Sep 2021 08:06:52 +0200 (CEST) Received: from localhost ([::1]:44586 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSBjt-0002mI-TW for larch@yhetil.org; Mon, 20 Sep 2021 01:21:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSBjj-0002m1-CL for bug-guix@gnu.org; Mon, 20 Sep 2021 01:21:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:57271) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mSBjj-00034O-3j for bug-guix@gnu.org; Mon, 20 Sep 2021 01:21:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mSBji-0007Wg-Vd for bug-guix@gnu.org; Mon, 20 Sep 2021 01:21:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#50493: [PATCH 3/4] build-system/go: Add pre-built standard library as implicit input. Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Mon, 20 Sep 2021 05:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50493 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 50493@debbugs.gnu.org Received: via spool by 50493-submit@debbugs.gnu.org id=B50493.163211526128902 (code B ref 50493); Mon, 20 Sep 2021 05:21:02 +0000 Received: (at 50493) by debbugs.gnu.org; 20 Sep 2021 05:21:01 +0000 Received: from localhost ([127.0.0.1]:40579 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mSBjh-0007Vv-7E for submit@debbugs.gnu.org; Mon, 20 Sep 2021 01:21:01 -0400 Received: from out1.migadu.com ([91.121.223.63]:20574) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mSBje-0007VY-Sr for 50493@debbugs.gnu.org; Mon, 20 Sep 2021 01:20:59 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1632115257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n1MhkWHxf2MGqQvKmtMdO7XKu38ptsalVmfg5r3MLa4=; b=fphj8nCZ1k7ZyFD3xzhMkyCVJUHmXRDo5UwDNl0tOERFvWGvypL0uEE8jkiT1A2NhQjZCA ZGNnQqItMnCUz/8RalZnlfP6Oidy97j+rGojlcmbt/35t9R7a/zWQLMEilWYjizhsfFeMg A27Ov4X4yiN2OGzsgF9aI6FViuLjBGg= From: Sarah Morgensen Date: Sun, 19 Sep 2021 22:20:50 -0700 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1632118012; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=n1MhkWHxf2MGqQvKmtMdO7XKu38ptsalVmfg5r3MLa4=; b=QqasOcQm0jHhphsWwZfJ2+TCh4uCB2AmMBRZvoIPqTZDTzYZxyHFcYcx9TWEyJO4eBsyzV AsEx61YIL4RO7sKoCGSb++dTsuQh1ixgw7rKSkIe73j3+SuGThCtfCPjjxiSTiD2x/4Af2 BN5rFSN3OQ9zBY1eEu9As2NHQJy/aRF9UabXu5nfHSEDwiaoZqYT6X/M6/KfvsJovYa5/5 cVGjeRJDDoY9wC8FgZCEY5PKpwPGIICkWTlZK/8lco8QSymIP5Utq6TnGrAAxKKBRYfRBW TynKT7acvwboOdJzst/veeTxWBxoYecmyY/c9xhTw85oi21xg186+zZOf2hyBA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632118012; a=rsa-sha256; cv=none; b=rLwqLNlIBvQ7q09mAa5Q3OnWE8ilhxxDxnqMB5vLO+/hCorRVvCtPvo0SDGQEvzK25XDhz 9UINv2SuSYoNCodAo5Xlqr+7mrIEw+pNIE0cafU7rqHoNIqJz0LCDUNRdF80nqjqRLxkuz Oa2clWp3IIK3qlhL0FhWbMmOSIqbX+b78WSq8DJInOSjSoN5G+83wMl5oFyXi5Boojq+en D952tuXE4Vo9imUYM0QR8mmjUpfdAarC7URJ2BY9DF01EWUjRsDgB4CdFCpJ4jvJUGotAo jkcNQGIJ7Upl09RzfUD4k7tQa9XQd2Qa2oC6MhzQy5GzzpcL6+NYn3THftiUVA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=fphj8nCZ; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Spam-Score: 1.21 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=fphj8nCZ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: 7C8E61F5A5 X-Spam-Score: 1.21 X-Migadu-Scanner: scn0.migadu.com X-TUID: 1hMUR0H2BdPF * gnu/packages/golang.scm (make-go-std): New procedure. * guix/build-system/go.scm (make-go-std): New procedure. (lower): Use it. Add pre-built standard library to inputs. --- gnu/packages/golang.scm | 30 ++++++++++++++++++++++++++++++ guix/build-system/go.scm | 16 ++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm index f02d0aa9df..19f1ef37d5 100644 --- a/gnu/packages/golang.scm +++ b/gnu/packages/golang.scm @@ -792,6 +792,36 @@ (define-public go-1.17 (define-public go go-1.14) +(define-public (make-go-std go) + "Return a package which builds the standard library for Go compiler GO." + (package + (name (string-append (package-name go) "-std")) + (version (package-version go)) + (source #f) + (build-system go-build-system) + (arguments + `(#:import-path "std" + #:build-flags `("-pkgdir" "pkg") ; "Install" to build directory. + #:allow-go-reference? #t + #:substitutable? #f ; Faster to build than download. + #:tests? #f ; Already tested in the main Go build. + #:go ,go + #:phases + (modify-phases %standard-phases + (delete 'unpack) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (out-cache (string-append out "/var/cache/go/build"))) + (copy-recursively (getenv "GOCACHE") out-cache) + (delete-file (string-append out-cache "/trim.txt")) + (delete-file (string-append out-cache "/README"))))) + (delete 'install-license-files)))) + (home-page (package-home-page go)) + (synopsis "Cached standard library build for Go") + (description (package-description go)) + (license (package-license go)))) + (define-public go-0xacab-org-leap-shapeshifter (let ((commit "0aa6226582efb8e563540ec1d3c5cfcd19200474") (revision "12")) diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm index 8aa065c4ff..a579477500 100644 --- a/guix/build-system/go.scm +++ b/guix/build-system/go.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2017 Leo Famulari ;;; Copyright © 2020 Jakub Kądziołka ;;; Copyright © 2021 Efraim Flashner +;;; Copyright © 2021 Sarah Morgensen ;;; ;;; This file is part of GNU Guix. ;;; @@ -109,6 +110,9 @@ (define (default-go) (let ((go (resolve-interface '(gnu packages golang)))) (module-ref go 'go))) +(define (make-go-std) + (module-ref (resolve-interface '(gnu packages golang)) 'make-go-std)) + (define* (lower name #:key source inputs native-inputs outputs system target (go (default-go)) @@ -118,6 +122,14 @@ (define* (lower name (define private-keywords '(#:source #:target #:go #:inputs #:native-inputs)) + (define inputs-with-cache + ;; XXX: Avoid a circular dependency. This should be rewritten with + ;; 'package-mapping' or similar. + (let ((go-std-name (string-append (package-name go) "-std"))) + (if (string-prefix? go-std-name name) + inputs + (cons `(,go-std-name ,((make-go-std) go)) inputs)))) + (bag (name name) (system system) @@ -127,7 +139,7 @@ (define* (lower name '()) ,@`(("go" ,go)) ,@native-inputs - ,@(if target '() inputs) + ,@(if target '() inputs-with-cache) ,@(if target ;; Use the standard cross inputs of ;; 'gnu-build-system'. @@ -135,7 +147,7 @@ (define* (lower name '()) ;; Keep the standard inputs of 'gnu-build-system'. ,@(standard-packages))) - (host-inputs (if target inputs '())) + (host-inputs (if target inputs-with-cache '())) ;; The cross-libc is really a target package, but for bootstrapping ;; reasons, we can't put it in 'host-inputs'. Namely, 'cross-gcc' is a -- 2.33.0