From mboxrd@z Thu Jan 1 00:00:00 1970 From: Efraim Flashner Subject: Re: Is anybody working on a go build system in guix? Date: Sat, 27 Feb 2016 21:12:42 +0200 Message-ID: <20160227211242.72e930a5@debian-netbook> References: <2019146fd9825fb890cc846c652252fa@riseup.net> <20160226213656.GA29131@jasmine> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/=zlTu/+zkRZtnRbfQObk8t_"; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59949) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZkIS-00046n-8x for guix-devel@gnu.org; Sat, 27 Feb 2016 14:12:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aZkIO-0002Co-3A for guix-devel@gnu.org; Sat, 27 Feb 2016 14:12:56 -0500 Received: from flashner.co.il ([178.62.234.194]:59484) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aZkIN-0002Ce-Oe for guix-devel@gnu.org; Sat, 27 Feb 2016 14:12:52 -0500 In-Reply-To: <20160226213656.GA29131@jasmine> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Leo Famulari Cc: guix-devel --Sig_/=zlTu/+zkRZtnRbfQObk8t_ Content-Type: multipart/mixed; boundary="MP_/QF7nAdoIGA1HKf=KS7dT4Lt" --MP_/QF7nAdoIGA1HKf=KS7dT4Lt Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Fri, 26 Feb 2016 16:36:56 -0500 Leo Famulari wrote: > On Fri, Feb 26, 2016 at 03:59:49PM -0500, Thompson, David wrote: > > On Fri, Feb 26, 2016 at 2:31 PM, wrote: =20 > > > I have lately looked closer at IPFS and I would like to compile and r= un it > > > on GuixSD but don't know how to succeed without a build system. =20 > >=20 > > We would need a Go toolchain first. I recall at least two people > > trying to package Go but no patches have shown up here. Seems it's > > not a straightforward process. =20 >=20 > IIRC, Efraim and "codemacs" (from IRC) have mentioned working on this. > My impression is that it's getting very close, but you may want to ask > them if they want help. >=20 I've attached what my current go patches are. Here[1] is codemac's go packa= ges. quoting codemac from mid-january: They still fail if you ever link against anything that dynamically links against glibc. This means any go program that uses the net, os/user, runtime or cgo packages fail to execute complaining they can't find libgcc_s. I've tried just about everything imagineable, and it's unclear to me how the nix gcc + glibc packages differ from the guix ones. I'd love help / suggestions, I use golang at my day job so I'm motivated to get this fixed. I have a pretty good idea of what the go package system could look like for guix without us distributing PILES of statically linked go poop as well, but that's a separate discussion. I haven't tested it so much yet, never actually coded in go. Tzdata is bundled, but it wouldn't be the only program we have with tzdata being bundled, and after codemac's issues with go programs after replacing it, I'm not really in a rush to do so. 1: https://github.com/codemac/guix-pkgs/blob/master/tmp/codemac/packages/go= .scm --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --MP_/QF7nAdoIGA1HKf=KS7dT4Lt Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0001-gnu-Add-go-1.4.patch =46rom 38625c70a470ecdab0d8a57c9273611694cfe440 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Mon, 28 Dec 2015 19:27:18 +0200 Subject: [PATCH 1/2] gnu: Add go-1.4. * gnu/packages/golang.scm: New file. * gnu-system.am (GNU_SYSTEM_MODULES): Add golang.scm. --- gnu-system.am | 1 + gnu/packages/golang.scm | 91 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 92 insertions(+) create mode 100644 gnu/packages/golang.scm diff --git a/gnu-system.am b/gnu-system.am index 20e38ae..04925db 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -140,6 +140,7 @@ GNU_SYSTEM_MODULES =3D \ gnu/packages/gnustep.scm \ gnu/packages/gnuzilla.scm \ gnu/packages/gnu-pw-mgr.scm \ + gnu/packages/golang.scm \ gnu/packages/gperf.scm \ gnu/packages/gprolog.scm \ gnu/packages/gps.scm \ diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm new file mode 100644 index 0000000..f02d4a8 --- /dev/null +++ b/gnu/packages/golang.scm @@ -0,0 +1,91 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2015 Efraim Flashner +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu packages golang) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix utils) + #:use-module (guix download) + #:use-module (guix packages) + #:use-module (guix build-system gnu) + #:use-module (gnu packages gcc) + #:use-module (gnu packages perl)) + +;; 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. Ultim= ately +;; we hope to build go-1.5 with a bootstrap process using gccgo-5. As of +;; go-1.5, go cannot be bootstrapped without go-1.4, so we need to use go-= 1.4 or +;; gccgo-5. Mips is not officially supported, but it should work if it is +;; bootstrapped. + +(define go-1.4 + (package + (name "go") + (version "1.4.3") + (source + (origin + (method url-fetch) + (uri (string-append "https://storage.googleapis.com/golang/go" + version ".src.tar.gz")) + (sha256 + (base32 + "0na9yqilzpvq0bjndbibfp07wr796gf252y471cip10bbdqgqiwr")))) + (build-system gnu-build-system) + (outputs '("out" "doc" "tests")) + (arguments + `(#:phases + (modify-phases %standard-phases + (delete 'configure) + (add-after 'patch-generated-file-shebangs 'chdir + (lambda _ (chdir "src"))) + (replace 'build + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((gccgo (assoc-ref inputs "gccgo")) + (output (assoc-ref outputs "out"))) + (setenv "CC" "gcc") + (setenv "GOROOT" (getcwd)) + (setenv "GOROOT_BOOTSTRAP" gccgo) + (setenv "GOROOT_FINAL" output) + (setenv "CGO_ENABLED" "0") + ;; all.bash includes the tests, which fail because they + ;; require network access, and access to /bin + (zero? (system* "bash" "make.bash"))))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((output (assoc-ref outputs "out")) + (docs (assoc-ref outputs "doc")) + (tests (assoc-ref outputs "tests"))) + (copy-recursively "../test" tests) + (delete-file-recursively "../test") + (copy-recursively "../api" (string-append docs "/api")) + (delete-file-recursively "../api") + (copy-recursively "../doc" (string-append docs "/doc")) + (delete-file-recursively "../doc") + (copy-recursively "../" output))))) + #:tests? #f)) + (native-inputs + `(("gccgo" ,gccgo-4.9) + ("perl" ,perl))) + (home-page "https://golang.org/") + (synopsis "Compiled, statically typed language developed by Google") + (description "Go, also commonly referred to as golang, is a programming + language developed at Google. Designed primarily for systems programming= , it + is a compiled, statically typed language in the tradition of C and C++, w= ith +garbage collection, various safety features and in the style of communicat= ing +sequential processes (CSP) concurrent programming features added.") + (license license:bsd-3))) --=20 2.7.0 --MP_/QF7nAdoIGA1HKf=KS7dT4Lt Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0002-gnu-Add-go.patch =46rom 35354eed31abebff6977544cee7578d4ba1dcbd1 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Tue, 12 Jan 2016 16:23:50 +0200 Subject: [PATCH 2/2] gnu: Add go. * gnu/packages/golang.scm (go): New variable. --- gnu/packages/golang.scm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm index f02d4a8..d94bd2c 100644 --- a/gnu/packages/golang.scm +++ b/gnu/packages/golang.scm @@ -23,7 +23,8 @@ #:use-module (guix packages) #:use-module (guix build-system gnu) #:use-module (gnu packages gcc) - #:use-module (gnu packages perl)) + #:use-module (gnu packages perl) + #:use-module (srfi srfi-1)) =20 ;; 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 @@ -89,3 +90,18 @@ garbage collection, various safety features and in the style of communicat= ing sequential processes (CSP) concurrent programming features added.") (license license:bsd-3))) + +(define-public go + (package (inherit go-1.4) + (version "1.6") + (source + (origin + (method url-fetch) + (uri (string-append "https://storage.googleapis.com/golang/go" + version ".src.tar.gz")) + (sha256 + (base32 + "0ipivhc34df8h439h5d81m0h1jz0gsy71m67ljrgk6rswj6cwv59")))) + (native-inputs + `(("gccgo" ,go-1.4) + ,@(alist-delete "gccgo" (package-native-inputs go-1.4)))))) --=20 2.7.0 --MP_/QF7nAdoIGA1HKf=KS7dT4Lt-- --Sig_/=zlTu/+zkRZtnRbfQObk8t_ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCgAGBQJW0fUrAAoJEPTB05F+rO6TI6QQAJrOMEJ4EComDHIV7JIcWdGL LFkkXfjaOmpv1VCj+ISfmKWpJAT7e8OwCTraavr/iauug0kfeS0oYoKkdhMttSD9 JFZZ/hd+PQYwzQfAvFbloByapbSNv7TTYRFzhhi4EiB1TCebnf/Nz4j9gKNi1gIJ WOY7j/VUAM1C8KAklhMSOeG3jRavXM0O3rRT+dHejJ0SeYk3COSwqlKpntBe9S4x 8LeGpR4Hg1mEfBN4bbD2stES1f8IofLOeIOT5d1Fg7+k03CVQLHjctk3YcOLG2pG q8vjmKfdwmGFQS5dRjKNDZtdgrNcSu759QcD0oiFQGGzujp36TBaSAxVtq4HTTg2 WhVAJFGcawRkLzw+rXm+2m7cU9S1uurcGUJ/9dfl4pc9vM4yweSqFckRyuwihuGw aKU48VCoOMJ5cvrBDGlyehcs2c0idu4SI74aXaurp6rDNHKOdgIkJu2ZisRqB7Wu 8fW0ZzfoG+8PhUosbmcTg1CwBJ3PiB0nb78FA+Deo6S1OpfAlXAwk0D6aL6Ik1g6 3pTArymyrcv+b6gSFJNsXtRfemICIrGOQvPs+jvg6OcGwWJEWkdVg5MC24GNpa4o kK7U9uzBMlj2sxHVydbLYHjtzgHvzLDCWA1N+xh0bg9xrCNRYPePtp/8RFqwuWcc 2XbfgpdydGZOvylTXpYr =br0K -----END PGP SIGNATURE----- --Sig_/=zlTu/+zkRZtnRbfQObk8t_--