From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Jordan Subject: Re: [Patch] go@1.4 Updated patch Date: Sun, 26 Jun 2016 18:14:48 -0400 Message-ID: <87vb0vvbqf.fsf@devserver.i-did-not-set--mail-host-address--so-tickle-me> References: <87fusuh52h.fsf@mailerver.i-did-not-set--mail-host-address--so-tickle-me> <1464968435.2613720.627094929.3FEBB927@webmail.messagingengine.com> <87d1nygoiq.fsf@mailerver.i-did-not-set--mail-host-address--so-tickle-me> <871t4a7mkr.fsf@igalia.com> <8737omgukj.fsf@mailerver.i-did-not-set--mail-host-address--so-tickle-me> <877fdukya9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHILH-0002ps-7e for guix-devel@gnu.org; Sun, 26 Jun 2016 18:15:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHILD-0004TE-AW for guix-devel@gnu.org; Sun, 26 Jun 2016 18:15:51 -0400 In-reply-to: <877fdukya9.fsf@gnu.org> 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" To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Good Day, > Since there are parts I don=E2=80=99t fully understand, I thought I=E2=80= =99d leave it > up to you. In particular, could you could at least replace the =E2=80=9C= why=E2=80=9D in > the comments below with explanations of why this is done? I updated the patch with additional comments as suggested. Let me know if more information is needed. > Also, why do we need this =E2=80=9Csrc=E2=80=9D output? IIUC, it conta= ins the source of > some of the unit tests, right? I changed the "src" output to "tests", to clarify. > Thank you for persevering in spite of all the nitpicks! :-) No problem, just been a bit busy with work lately. But more than happy to help. Plus it's been quite the learning experience. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-gnu-Add-go-1.4.patch Content-Description: Patch to add go@1.4 compiler. Content-Transfer-Encoding: quoted-printable >From 9063100cfec1b8f31d3da31465b03ed54a9469e5 Mon Sep 17 00:00:00 2001 From: Matthew Jordan Date: Thu, 26 May 2016 08:57:16 -0400 Subject: [PATCH] gnu: Add go@1.4 * gnu/local.mk: Modified file. * gnu/packages/golang.scm: New file. Co-author: Efraim Flashner Co-author: Andy Wingo --- gnu/local.mk | 1 + gnu/packages/golang.scm | 193 ++++++++++++++++++++++++++++++++++++++++++= ++++++ 2 files changed, 194 insertions(+) create mode 100644 gnu/packages/golang.scm diff --git a/gnu/local.mk b/gnu/local.mk index 956be9b..32b46b9 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -150,6 +150,7 @@ GNU_SYSTEM_MODULES =3D \ %D%/packages/gnustep.scm \ %D%/packages/gnuzilla.scm \ %D%/packages/gnu-pw-mgr.scm \ + %D%/packages/golang.scm \ %D%/packages/gperf.scm \ %D%/packages/gprolog.scm \ %D%/packages/gps.scm \ diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm new file mode 100644 index 0000000..9bbfd81 --- /dev/null +++ b/gnu/packages/golang.scm @@ -0,0 +1,193 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2015, 2016 Efraim Flashner +;;; Copyright =C2=A9 2016 Matthew Jordan +;;; Copyright =C2=A9 2016 Andy Wingo +;;; +;;; This file is an addendum 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 (a= t +;;; 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 utils) + #:use-module (guix build-system gnu) + #:use-module (gnu packages admin) + #:use-module (gnu packages gcc) + #:use-module ((gnu packages base) #:prefix system:) + #:use-module (gnu packages perl) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages pcre) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1)) + +;; According to https://golang.org/doc/install/gccgo, gccgo-4.8.2 includ= es 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. Ult= imately +;; 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 g= o-1.4 or +;; gccgo-5. Mips is not officially supported, but it should work if it = is +;; bootstrapped. + +(define-public go-1.4 + (package + (name "go") + (version "1.4.3") + (source + (origin + (method url-fetch) + (uri (string-append "https://storage.googleapis.com/golang/" + name version ".src.tar.gz")) + (sha256 + (base32 + "0na9yqilzpvq0bjndbibfp07wr796gf252y471cip10bbdqgqiwr")))) + (build-system gnu-build-system) + (outputs '("out" + "doc" + "tests")) + (arguments + `(#:modules ((ice-9 match) + (guix build gnu-build-system) + (guix build utils)) + #:tests? #f ; Tests are run by the all.bash script. + #:phases + (modify-phases %standard-phases + (delete 'configure) + (add-after 'patch-generated-file-shebangs 'chdir + (lambda _ (chdir "src"))) + (add-before 'build 'prebuild + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((gcclib (string-append (assoc-ref inputs "gcc:lib") = "/lib")) + (ld (string-append + (assoc-ref inputs "glibc") "/lib")) + (loader (car (find-files ld "^ld-linux.+"))) + (net-base (assoc-ref inputs "net-base")) + (tzdata-path + (string-append (assoc-ref inputs "tzdata") "/share/= zoneinfo")) + (output (assoc-ref outputs "out"))) + + ;; Removing net/ tests + ;; Reason: Build fails when tests attempt to access netwo= rk resources + ;; not present in the build container + (for-each + (lambda (srcfile) + (let ((srcfile (string-append "net/" srcfile))) + (delete-file srcfile))) + '("multicast_test.go" "parse_test.go" "port_test.go")) + + ;; Add libgcc to runpath + (substitute* "cmd/go/build.go" + (("cgoldflags :=3D \\[\\]string\\{\\}") + (string-append "cgoldflags :=3D []string{" + "\"-rpath=3D" gcclib "\"" + "}")) + (("ldflags :=3D buildLdflags") + (string-append + "ldflags :=3D buildLdflags\n" + "ldflags =3D append(ldflags, \"-r\")\n" + "ldflags =3D append(ldflags, \"" gcclib "\")\n"))) + + (substitute* "os/os_test.go" + (("/usr/bin") (getcwd)) + (("/bin/pwd") (which "pwd"))) + + ;; Disable failing tests + ;; Reason: These tests attempt to access commands or netw= ork resources + ;; which are neither available or necessary for the build= to succeed. + (map + (match-lambda + ((file regex) + (substitute* file + ((regex all before test_name) + (string-append before "Disabled" test_name))))) + '(("net/net_test.go" "(.+)(TestShutdownUnix.+)") + ("net/dial_test.go" "(.+)(TestDialTimeout.+)") + ("os/os_test.go" "(.+)(TestHostname.+)") + ("time/format_test.go" "(.+)(TestParseInSydney.+)") + ("os/exec/exec_test.go" "(.+)(TestEcho.+)") + ("os/exec/exec_test.go" "(.+)(TestCommandRelativeName.= +)") + ("os/exec/exec_test.go" "(.+)(TestCatStdin.+)") + ("os/exec/exec_test.go" "(.+)(TestCatGoodAndBadFile.+)= ") + ("os/exec/exec_test.go" "(.+)(TestExitStatus.+)") + ("os/exec/exec_test.go" "(.+)(TestPipes.+)") + ("os/exec/exec_test.go" "(.+)(TestStdinClose.+)") + ("syscall/syscall_unix_test.go" "(.+)(TestPassFD\\(.+)= ") + ("os/exec/exec_test.go" "(.+)(TestExtraFiles.+)"))) + + (substitute* "net/lookup_unix.go" + (("/etc/protocols") (string-append net-base "/etc/proto= cols"))) + (substitute* "time/zoneinfo_unix.go" + (("/usr/share/zoneinfo/") tzdata-path)) + (substitute* + (find-files "cmd" "asm.c") + (("/lib/ld-linux.*\\.so\\.[0-9]") loader))))) + + (replace 'build + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((output (assoc-ref outputs "out"))) + (setenv "CC" (which "gcc")) + (setenv "GOOS" "linux") + (setenv "GOROOT" (dirname (getcwd))) + (setenv "GOROOT_FINAL" output) + (setenv "CGO_ENABLED" "1") + (zero? (system* "sh" "all.bash"))))) + + (replace 'install + (lambda* (#:key outputs inputs #:allow-other-keys) + (let* ((output (assoc-ref outputs "out")) + (doc_out (assoc-ref outputs "doc")) + (bash (string-append (assoc-ref inputs "bash") "bin/= bash")) + (docs (string-append doc_out "/share/doc/" ,name "-"= ,version)) + (tests (string-append + (assoc-ref outputs "tests") "/share/" ,name = "-" ,version))) + (mkdir-p tests) + (copy-recursively "../test" (string-append tests "/test")= ) + (delete-file-recursively "../test") + (mkdir-p docs) + (copy-recursively "../api" (string-append docs "/api")) + (delete-file-recursively "../api") + (copy-recursively "../doc" (string-append docs "/doc")) + (delete-file-recursively "../doc") + + (for-each + (lambda (file) + (let* ((filein (string-append "../" file)) + (fileout (string-append docs "/" file))) + (copy-file filein fileout) + (delete-file filein))) + '("README" "CONTRIBUTORS" "AUTHORS" "PATENTS" + "LICENSE" "VERSION" "robots.txt")) + (copy-recursively "../" output))))))) + (inputs + `(("tzdata" ,system:tzdata) + ("pcre" ,pcre))) + (native-inputs + `(("pkg-config" ,%pkg-config) + ("which" ,system:which) + ("gcc:out" ,gcc-4.9 "out") + ("net-base" ,net-base) + ("perl" ,perl))) + (propagated-inputs + `(("gcc:lib" ,gcc-4.9 "lib") + ("glibc" ,system:glibc))) + (home-page "https://golang.org/") + (synopsis "Compiled, statically typed language developed by Google") + (description "Go, also commonly referred to as golang, is a programm= ing + language developed at Google. Designed primarily for systems programmi= ng, it + is a compiled, statically typed language in the tradition of C and C++,= with +garbage collection, various safety features and in the style of communic= ating +sequential processes (CSP) concurrent programming features added.") + (license license:bsd-3))) --=20 2.8.3 --=-=-= Content-Type: text/plain Sincerely, -- Matthew Jordan Sent with my mu4e --=-=-=--