From patchwork Mon Jun 13 06:56:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\\(" X-Patchwork-Id: 39898 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 7823E27BBEA; Mon, 13 Jun 2022 07:57:25 +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_INVALID, DKIM_SIGNED,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 4318427BBE9 for ; Mon, 13 Jun 2022 07:57:24 +0100 (BST) Received: from localhost ([::1]:43548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o0e0p-0001yy-DM for patchwork@mira.cbaines.net; Mon, 13 Jun 2022 02:57:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o0e0X-0001xL-Q6 for guix-patches@gnu.org; Mon, 13 Jun 2022 02:57:06 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:34896) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o0e0X-0002Oq-HB for guix-patches@gnu.org; Mon, 13 Jun 2022 02:57:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o0e0X-0007zf-Fj for guix-patches@gnu.org; Mon, 13 Jun 2022 02:57:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55903] [PATCH v2 02/35] gnu: Add go-github-com-creack-pty. Resent-From: "(" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 Jun 2022 06:57:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55903 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55903@debbugs.gnu.org Cc: "\(unmatched-parenthesis" Received: via spool by 55903-submit@debbugs.gnu.org id=B55903.165510341030502 (code B ref 55903); Mon, 13 Jun 2022 06:57:05 +0000 Received: (at 55903) by debbugs.gnu.org; 13 Jun 2022 06:56:50 +0000 Received: from localhost ([127.0.0.1]:56983 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0e0H-0007vg-Pj for submit@debbugs.gnu.org; Mon, 13 Jun 2022 02:56:50 -0400 Received: from knopi.disroot.org ([178.21.23.139]:41814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o0e0A-0007uX-Qo for 55903@debbugs.gnu.org; Mon, 13 Jun 2022 02:56:45 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 16E7B43DBF; Mon, 13 Jun 2022 08:56:42 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id e9R3IdPh6dV5; Mon, 13 Jun 2022 08:56:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1655103400; bh=OpcUFTUFFK/TErGxd3sGMZWpm0eOu0Uw4jfwoDXG/BU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WPDfSAeXN0j7Oywix1q1C4Up30+xriQSW1cZ2akmVyfS9SBEs1sqqnNJ9dvnbehoh y3+kwVrCl+rtSs1vEyFIR0GPD9RqhUQ8K7zr4EGNRIarBT9LdKezf0Mzbt2mXr6ETB sPOsRualOau5a3HDSnRe6b7Iz79e3E0mPFX/GgSmNqph48gJa2NTq5ScOQ1kvVNwTu S41mbuu2JaZ+n6LbdVSOx4wvyArO61M5ohDIKWmvMQ8cXMDfpGWwXTatVw29LQWd5x +mFLNEp5HI5HVzAEAg6k6YV6arkOMd7KQfKMye4x3nhrpJrssB+s4CHw/KxSqJFFie EF6inlx4OMMZQ== Date: Mon, 13 Jun 2022 07:56:01 +0100 Message-Id: <20220613065634.25256-2-paren@disroot.org> In-Reply-To: <20220613065634.25256-1-paren@disroot.org> References: <20220613065634.25256-1-paren@disroot.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" Reply-to: "\(" X-ACL-Warn: , "\( via Guix-patches" X-Patchwork-Original-From: "\( via Guix-patches" via From: "\\(" X-getmail-retrieved-from-mailbox: Patches From: "(unmatched-parenthesis" * gnu/packages/golang.scm (go-github-com-creack-pty): New variable. --- gnu/packages/golang.scm | 63 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm index 6f1ed9eda2..50b7ac2e23 100644 --- a/gnu/packages/golang.scm +++ b/gnu/packages/golang.scm @@ -86,6 +86,23 @@ (define-module (gnu packages golang) #:use-module (ice-9 match) #:use-module (srfi srfi-1)) +(define (gnu-triplet->go-architecture target) + (letrec-syntax + ((matches (syntax-rules (=>) + ((_ (target-prefix => architecture) rest ...) + (if (string-prefix? target-prefix target) + architecture + (matches rest ...))) + ((_) (error "unsupported target" target))))) + (matches ("x86_64" => "amd64") + ("i686" => "386") + ("aarch64" => "arm64") + ("arm" => "arm") + ("powerpc64le" => "ppc64le") + ("powerpc" => "ppc") + ("mips64el" => "mips64le") + ("riscv64" => "riscv64")))) + ;; According to https://golang.org/doc/install/gccgo, gccgo-4.8.2 includes a ;; complete go-1.1.2 implementation, gccgo-4.9 includes a complete go-1.2 ;; implementation, and gccgo-5 a complete implementation of go-1.4. Ultimately @@ -9862,3 +9879,49 @@ (define-public go-github-com-zenhack-go-notmuch (description "The notmuch package provides a Go language binding to the notmuch email library.") (license license:gpl3+))) + +(define-public go-github-com-creack-pty + (package + (name "go-github-com-creack-pty") + (version "1.1.18") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/creack/pty") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1qqhcgfym0napz8damj7dhfw28g2qn2f5h3lr93i0sxawq926yzc")))) + (build-system go-build-system) + (arguments + (list #:import-path "github.com/creack/pty" + #:modules '((ice-9 popen) + (ice-9 textual-ports) + (guix build go-build-system) + (guix build utils)) + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'regenerate-types + (lambda* (#:key import-path #:allow-other-keys) + ;; Generated files are included (ztypes_*). We need to remake + ;; them with Cgo. + (with-directory-excursion (string-append "src/" import-path) + (let* ((go-arch + #$(gnu-triplet->go-architecture + (or (%current-target-system) + (nix-system->gnu-triplet (%current-system))))) + (file (string-append "ztypes_" go-arch ".go")) + (pipe (open-input-pipe "go tool cgo -godefs types.go")) + (text (get-string-all pipe))) + (close-pipe pipe) + (for-each delete-file + (find-files (getcwd) (file-name-predicate + "ztypes_[a-zA-Z0-9_]+.go"))) + (with-output-to-file file + (lambda () (display text)))))))))) + (home-page "https://github.com/creack/pty") + (synopsis "Pseudoterminal handling in Go") + (description + "The pty package provides functions for working with Unix pseudoterminals.") + (license license:expat)))