From patchwork Tue Aug 15 23:20:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Katherine Cox-Buday X-Patchwork-Id: 52877 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 6B3EB27BBEA; Wed, 16 Aug 2023 00:22:38 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham 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 CBB2927BBE9 for ; Wed, 16 Aug 2023 00:22:36 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qW3MR-0001SU-K5; Tue, 15 Aug 2023 19:22:03 -0400 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 1qW3MQ-0001SF-FV for guix-patches@gnu.org; Tue, 15 Aug 2023 19:22:02 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qW3MQ-0005TE-7D for guix-patches@gnu.org; Tue, 15 Aug 2023 19:22:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qW3MP-000137-Lu for guix-patches@gnu.org; Tue, 15 Aug 2023 19:22:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65317] [PATCH v2 1/1] gnu: Add go-1.21. References: <20230815195313.46418-1-cox.katherine.e@gmail.com> In-Reply-To: <20230815195313.46418-1-cox.katherine.e@gmail.com> Resent-From: Katherine Cox-Buday Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 15 Aug 2023 23:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65317 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65317@debbugs.gnu.org Cc: Katherine Cox-Buday Received: via spool by 65317-submit@debbugs.gnu.org id=B65317.16921417144018 (code B ref 65317); Tue, 15 Aug 2023 23:22:01 +0000 Received: (at 65317) by debbugs.gnu.org; 15 Aug 2023 23:21:54 +0000 Received: from localhost ([127.0.0.1]:37061 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qW3MH-00012i-Cc for submit@debbugs.gnu.org; Tue, 15 Aug 2023 19:21:53 -0400 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]:46301) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qW3ME-00012U-4V for 65317@debbugs.gnu.org; Tue, 15 Aug 2023 19:21:52 -0400 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-6bcade59b24so4888654a34.0 for <65317@debbugs.gnu.org>; Tue, 15 Aug 2023 16:21:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692141704; x=1692746504; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=VHXZM0iJu03BUTFaoGAWKS4SKttxXqC1gdbrxXmojng=; b=mlOYG1SbsCdu4ICOM/MLxzpaQC6rlM6WovzwquoyNEc8X0g7MI9vkpn9+SFuX0JQLo D8dxV3w/47JXRmoP+U8KhSwiNUrh4n8UCrHb0w5JLVIu3N0NbQpmGfDmF0jaqEfhd4QH K/O9jlAVLC+0/No3Ru1dPIa5mapMtWwDnrpyUeiU4Ep6VnHsLijHHo+IqpZJqbDbnqKX KosaNpdCjXlOq0NiBUKSbYQF8wFSzvBG2CWkzGy6zJisuNajtON5qM6Ph38Gsqi8BlQd /ZCPg4sU4A12PdUHRlwInO6e/GwduRLzafU0Y4y+3jpWh68CAB2pvSmUMFUBMUP/F+Tp dcrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692141704; x=1692746504; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VHXZM0iJu03BUTFaoGAWKS4SKttxXqC1gdbrxXmojng=; b=BUT7jN9pmBtgseccoB/nAnyFRLOITXbpQlqKpNoWiNm0gSeZ/3GYOhhTOweq+S6kkF WS63nZoQK8ImtLhD2CYZ9LzJioXdsgT5srphJA6zy1cRmPMbrzk9Sy+99htQsZfl5hjr v7RMAIpToPPTD2RQP72v9Nd/5mKojNoslg7ZAhUa2lv2jHlVACrk7ZWzC9AkujMx5owB cT8P6wfT0Jq4wGKBrUOU6DHbtRnAd5IbSpqj5fJ9S4qFm0437/xwi0oTZVIyudZHlHb0 7KUp47J9hbHK4Dki1P4Z+/svib57GWvM2QDGjlf3+QQluApq14vtWLhzc34OqfkWisYQ DesQ== X-Gm-Message-State: AOJu0YzMkvvq/lNW977Qs2XT/WI8836qdZI20aKePefDHvw0WuAv1urw yx5crS3TQzPvdMBAHYffm/RTEZBqucU= X-Google-Smtp-Source: AGHT+IGWEJ2pubyITxRZ6QP01xuJmO2AaH+Ol/Yk4tSzRlRWR6Kh0dnRyUyAdn5Rmgarpi5T/uDv2w== X-Received: by 2002:a05:6870:56a9:b0:1bc:f15:c9ef with SMTP id p41-20020a05687056a900b001bc0f15c9efmr131460oao.19.1692141704233; Tue, 15 Aug 2023 16:21:44 -0700 (PDT) Received: from washu-v4.home.cox-buday.com (c-174-51-218-141.hsd1.co.comcast.net. [174.51.218.141]) by smtp.gmail.com with ESMTPSA id g6-20020a02b706000000b0041d73d0a412sm3942043jam.19.2023.08.15.16.21.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Aug 2023 16:21:43 -0700 (PDT) From: Katherine Cox-Buday Date: Tue, 15 Aug 2023 17:20:40 -0600 Message-ID: <20230815232142.79498-1-cox.katherine.e@gmail.com> X-Mailer: git-send-email 2.41.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/golang.scm (go-1.21): New variable. --- gnu/packages/golang.scm | 132 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) base-commit: a4bed14c438dc0cbc1c1885a38f8409c7fef7957 diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm index 5a53838435..26022ea211 100644 --- a/gnu/packages/golang.scm +++ b/gnu/packages/golang.scm @@ -967,6 +967,138 @@ (define-public go-1.20 ;; https://go.dev/issue/44505 (alist-replace "go" (list go-1.17) (package-native-inputs go-1.17))))) +(define-public go-1.21 + (package + (inherit go-1.20) + (name "go") + (version "1.21.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/golang/go") + (commit (string-append "go" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "04cpahl10i1sncymdfm0vzcj3czv6lv0axwa1sisl9cz3rdrp7hj")))) + (arguments + (substitute-keyword-arguments (package-arguments go-1.20) + ;; Source patching phases are broken up into discrete steps to allow + ;; future versions to discard individual phases without having to + ;; discard all source patching. + ((#:phases phases) + #~(modify-phases #$phases + (delete 'skip-TestGoPathShlibGccgo-tests) + (delete 'patch-source) + (add-after 'unpack 'patch-os-tests + (lambda _ + (substitute* "src/os/os_test.go" + (("/usr/bin") (getcwd)) + (("/bin/sh") (which "sh"))))) + + (add-after 'unpack 'apply-patches + (lambda* (#:key inputs #:allow-other-keys) + ;; Having the patch in the 'patches' field of breaks + ;; the 'TestServeContent' test due to the fact that + ;; timestamps are reset. Thus, apply it from here. + (invoke "patch" "-p1" "--force" "-i" + (assoc-ref inputs "go-fix-script-tests.patch")))) + + (add-after 'unpack 'patch-src/net + (lambda* (#:key inputs #:allow-other-keys) + (let ((net-base (assoc-ref inputs "net-base"))) + (substitute* "src/net/lookup_unix.go" + (("/etc/protocols") + (string-append net-base "/etc/protocols"))) + (substitute* "src/net/port_unix.go" + (("/etc/services") + (string-append net-base "/etc/services")))))) + + (add-after 'unpack 'patch-zoneinfo + (lambda* (#:key inputs #:allow-other-keys) + ;; Add the path to this specific version of tzdata's zoneinfo + ;; file to the top of the list to search. We don't want to + ;; replace any sources because it will affect how binaries + ;; compiled with this Go toolchain behave on non-guix + ;; platforms. + (substitute* "src/time/zoneinfo_unix.go" + (("var platformZoneSources.+" all) + (format #f "~a~%\"~a/share/zoneinfo\",~%" + all + (assoc-ref inputs "tzdata")))))) + + (add-after 'unpack 'patch-cmd/go/testdata/script + (lambda _ + (substitute* "src/cmd/go/testdata/script/cgo_path_space.txt" + (("/bin/sh") (which "sh"))))) + + (add-after 'enable-external-linking 'enable-external-linking-1.21 + (lambda _ + ;; Invoke GCC to link any archives created with GCC (that is, any + ;; packages built using 'cgo'), because Go doesn't know how to + ;; handle the runpaths but GCC does. Use substitute* rather than + ;; a patch since these files are liable to change often. + ;; + ;; XXX: Replace with GO_EXTLINK_ENABLED=1 or similar when + ;; and/or + ;; are resolved. + (substitute* "src/cmd/link/internal/ld/config.go" + (("\\(iscgo && \\(.+\\)") "iscgo")) + (substitute* "src/internal/testenv/testenv.go" + (("!CanInternalLink.+") "true {\n")) + (substitute* "src/syscall/exec_linux_test.go" + (("testenv.MustHaveExecPath\\(t, \"whoami\"\\)") + "t.Skipf(\"no passwd file present\")")))) + + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + ;; Notably, we do not install archives (180M), which Go will + ;; happily recompile quickly (and cache) if needed, almost + ;; surely faster than they could be substituted. + ;; + ;; The main motivation for pre-compiled archives is to use + ;; libc-linked `net' or `os' packages without a C compiler, + ;; but on Guix a C compiler is necessary to properly link the + ;; final binaries anyway. Many build flags also invalidate + ;; these pre-compiled archives, so in practice Go often + ;; recompiles them anyway. + ;; + ;; Upstream is also planning to no longer install these + ;; archives: + ;; + ;; When necessary, a custom pre-compiled library package can + ;; be created with `#:import-path "std"' and used with + ;; `-pkgdir'. + ;; + ;; When moving files into place, any files that come from + ;; GOROOT should remain in GOROOT to continue functioning. If + ;; they need to be referenced from some other directory, they + ;; need to be symlinked from GOROOT. For more information, + ;; please see https://github.com/golang/go/issues/61921 + (let* ((out (assoc-ref outputs "out")) + (tests (assoc-ref outputs "tests"))) + (for-each + (lambda (file) + (copy-recursively file (string-append out "/lib/go/" file))) + '("bin" "lib" "VERSION" "pkg/include" "pkg/tool")) + + (symlink "lib/go/bin" (string-append out "/bin")) + + (for-each + (match-lambda + ((file dest output) + ;; Copy to output/dest and symlink from output/lib/go/file. + (let ((file* (string-append output "/lib/go/" file)) + (dest* (string-append output "/" dest))) + (copy-recursively file dest*) + (mkdir-p (dirname file*)) + (symlink (string-append "../../" dest) file*)))) + `(("src" "share/go/src" ,out) + ("misc" "share/go/misc" ,out) + ("doc" "share/doc/go/doc" ,out) + ("api" "share/go/api" ,tests) + ("test" "share/go/test" ,tests)))))))))))) + (define-public go go-1.17) (define make-go-std