From patchwork Thu Aug 17 19:43:18 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: 52966 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 1DB3327BBE9; Thu, 17 Aug 2023 20:44:17 +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=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 0C91C27BBE2 for ; Thu, 17 Aug 2023 20:44:15 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWiuZ-0006ea-1K; Thu, 17 Aug 2023 15:44: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 1qWiuY-0006eQ-2x for guix-patches@gnu.org; Thu, 17 Aug 2023 15:44: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 1qWiuX-0008IX-Qy for guix-patches@gnu.org; Thu, 17 Aug 2023 15:44:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qWiuX-0005Qx-PL for guix-patches@gnu.org; Thu, 17 Aug 2023 15:44:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65317] [PATCH v3 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: Thu, 17 Aug 2023 19:44: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: moreinfo patch To: 65317@debbugs.gnu.org Cc: Katherine Cox-Buday Received: via spool by 65317-submit@debbugs.gnu.org id=B65317.169230141320844 (code B ref 65317); Thu, 17 Aug 2023 19:44:01 +0000 Received: (at 65317) by debbugs.gnu.org; 17 Aug 2023 19:43:33 +0000 Received: from localhost ([127.0.0.1]:45666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWiu4-0005Q7-PA for submit@debbugs.gnu.org; Thu, 17 Aug 2023 15:43:33 -0400 Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e]:61535) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWiu2-0005Pt-Rc for 65317@debbugs.gnu.org; Thu, 17 Aug 2023 15:43:31 -0400 Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-56ce1bd7fc4so164543eaf.2 for <65317@debbugs.gnu.org>; Thu, 17 Aug 2023 12:43:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692301405; x=1692906205; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=yfSqEfeMwaQHJLlNZzA4pXjbtZwjvD6JczuOq+RCFfQ=; b=G7zFkUNGc2EEaGduO2J3of0FcY9XS8YFwZa/GfmxvcaB6m5TTrpCVXKeHNLu/cM2l5 JKHfhPKMvV3n1lGPzI+J4AVBH/BqHewwxiMBH+TkZScKbFM/DHamYrLKCCfR/QkgKass F4xCEAo6JtPHCfnWGy/EtxW7+Mb49M4wKTSln36UdabhDYaq1oo80+obWjnLplo6vxCz UdzW2qiSgCn0OienQPAFWt0Ds3aiUcrKSONJsz1z2z1Qy+x90DYCscMgd/63CfyQzqRE iEuj0rVP6YeAND8n/39RHLrqWQS5MjvVDG9syGvcmxBXz0rrcX3efBLXZoMOZxjwTEem 7hrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692301405; x=1692906205; 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=yfSqEfeMwaQHJLlNZzA4pXjbtZwjvD6JczuOq+RCFfQ=; b=V1gx1rDlp0YeurMx6vezw9W0Nob7r/irC6Je4rszpDKydYKYSlVl3iVtudnlKlOQUm V0L53iJ0dU14uWDUU8nxUD7mM4S/PV0FN6cvcfdlxBESNfzOPB8Nm963WXuH/8mUOqva FPojvXbBrW2cwe8bGqTK2nlBkNpMTATT04O1KL9zDg+QDpR45OHgs+dSP7s8O/dIQeVZ PWt3jDVlT0j5DTO74csPur7POvOrytCoyVkXo2dpYeaWyM6ZGhsHULspSVKnusXouE4B V/AMVG89cHheQLSEeCH/h2Le2vVBMFXUhsxGRjpxQ+b5gGhDaLb/+jlU7CpfsofyjwLR gbfQ== X-Gm-Message-State: AOJu0YyA5pGOEhctGs3FVYySTlNCmjYV3z2fbCSmHU4fe1vQo4y3gTg6 TVjTXvVWegxICP/QchtYcia5p4+cVQk= X-Google-Smtp-Source: AGHT+IHlhlpHgy1AeGcmOsFGormhHZA8V+0hlQ6Tyzqcv2zEMEx5MbpXt4rYfJsU3IkWKIyuSUHQJw== X-Received: by 2002:a4a:2a0d:0:b0:56d:2cbf:2315 with SMTP id k13-20020a4a2a0d000000b0056d2cbf2315mr746209oof.9.1692301404873; Thu, 17 Aug 2023 12:43:24 -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 1-20020a4a0d01000000b00565d41ba4d0sm84816oob.35.2023.08.17.12.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Aug 2023 12:43:24 -0700 (PDT) From: Katherine Cox-Buday Date: Thu, 17 Aug 2023 13:43:18 -0600 Message-ID: <20230817194323.11985-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..b5f2195ed5 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" "go.env" "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