Commit | Line | Data |
---|---|---|
7a2941a8 | 1 | ;;; GNU Guix --- Functional package management for GNU |
dda785f6 | 2 | ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il> |
7a2941a8 MJ |
3 | ;;; Copyright © 2016 Matthew Jordan <matthewjordandevops@yandex.com> |
4 | ;;; Copyright © 2016 Andy Wingo <wingo@igalia.com> | |
ec91bcb5 | 5 | ;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org> |
c04ef86e | 6 | ;;; Copyright © 2016, 2017 Petter <petter@mykolab.ch> |
17399545 | 7 | ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name> |
c04ef86e | 8 | ;;; Copyright © 2017 Sergei Trofimovich <slyfox@inbox.ru> |
eaca9ff0 | 9 | ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com> |
247064c3 | 10 | ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
c4d2cffa | 11 | ;;; Copyright © 2018 Christopher Baines <mail@cbaines.net> |
7a2941a8 | 12 | ;;; |
8a610eb6 | 13 | ;;; This file is part of GNU Guix. |
7a2941a8 MJ |
14 | ;;; |
15 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
16 | ;;; under the terms of the GNU General Public License as published by | |
17 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
18 | ;;; your option) any later version. | |
19 | ;;; | |
20 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
21 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 | ;;; GNU General Public License for more details. | |
24 | ;;; | |
25 | ;;; You should have received a copy of the GNU General Public License | |
26 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
27 | ||
28 | (define-module (gnu packages golang) | |
29 | #:use-module ((guix licenses) #:prefix license:) | |
30 | #:use-module (guix utils) | |
31 | #:use-module (guix download) | |
d3878e88 | 32 | #:use-module (guix git-download) |
7a2941a8 MJ |
33 | #:use-module (guix packages) |
34 | #:use-module (guix build-system gnu) | |
d3878e88 | 35 | #:use-module (guix build-system go) |
7a2941a8 MJ |
36 | #:use-module (gnu packages admin) |
37 | #:use-module (gnu packages gcc) | |
38 | #:use-module (gnu packages base) | |
39 | #:use-module (gnu packages perl) | |
40 | #:use-module (gnu packages pkg-config) | |
41 | #:use-module (gnu packages pcre) | |
42 | #:use-module (ice-9 match) | |
43 | #:use-module (srfi srfi-1)) | |
44 | ||
45 | ;; According to https://golang.org/doc/install/gccgo, gccgo-4.8.2 includes a | |
46 | ;; complete go-1.1.2 implementation, gccgo-4.9 includes a complete go-1.2 | |
47 | ;; implementation, and gccgo-5 a complete implementation of go-1.4. Ultimately | |
48 | ;; we hope to build go-1.5+ with a bootstrap process using gccgo-5. As of | |
49 | ;; go-1.5, go cannot be bootstrapped without go-1.4, so we need to use go-1.4 or | |
50 | ;; gccgo-5. Mips is not officially supported, but it should work if it is | |
51 | ;; bootstrapped. | |
52 | ||
53 | (define-public go-1.4 | |
54 | (package | |
55 | (name "go") | |
56 | (version "1.4.3") | |
57 | (source (origin | |
58 | (method url-fetch) | |
59 | (uri (string-append "https://storage.googleapis.com/golang/" | |
60 | name version ".src.tar.gz")) | |
61 | (sha256 | |
62 | (base32 | |
63 | "0na9yqilzpvq0bjndbibfp07wr796gf252y471cip10bbdqgqiwr")))) | |
64 | (build-system gnu-build-system) | |
65 | (outputs '("out" | |
66 | "doc" | |
67 | "tests")) | |
68 | (arguments | |
69 | `(#:modules ((ice-9 match) | |
70 | (guix build gnu-build-system) | |
1d698a8b ST |
71 | (guix build utils) |
72 | (srfi srfi-1)) | |
7a2941a8 MJ |
73 | #:tests? #f ; Tests are run by the all.bash script. |
74 | #:phases | |
75 | (modify-phases %standard-phases | |
76 | (delete 'configure) | |
77 | (add-after 'patch-generated-file-shebangs 'chdir | |
78 | (lambda _ | |
79 | (chdir "src"))) | |
80 | (add-before 'build 'prebuild | |
81 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
82 | (let* ((gcclib (string-append (assoc-ref inputs "gcc:lib") "/lib")) | |
83 | (ld (string-append (assoc-ref inputs "libc") "/lib")) | |
84 | (loader (car (find-files ld "^ld-linux.+"))) | |
85 | (net-base (assoc-ref inputs "net-base")) | |
86 | (tzdata-path | |
87 | (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")) | |
88 | (output (assoc-ref outputs "out"))) | |
89 | ||
90 | ;; Removing net/ tests, which fail when attempting to access | |
91 | ;; network resources not present in the build container. | |
92 | (for-each delete-file | |
93 | '("net/multicast_test.go" "net/parse_test.go" | |
94 | "net/port_test.go")) | |
95 | ||
96 | ;; Add libgcc to the RUNPATH. | |
97 | (substitute* "cmd/go/build.go" | |
98 | (("cgoldflags := \\[\\]string\\{\\}") | |
99 | (string-append "cgoldflags := []string{" | |
100 | "\"-rpath=" gcclib "\"}")) | |
101 | (("ldflags := buildLdflags") | |
102 | (string-append | |
103 | "ldflags := buildLdflags\n" | |
104 | "ldflags = append(ldflags, \"-r\")\n" | |
105 | "ldflags = append(ldflags, \"" gcclib "\")\n"))) | |
106 | ||
107 | (substitute* "os/os_test.go" | |
108 | (("/usr/bin") (getcwd)) | |
109 | (("/bin/pwd") (which "pwd"))) | |
110 | ||
111 | ;; Disable failing tests: these tests attempt to access | |
112 | ;; commands or network resources which are neither available or | |
113 | ;; necessary for the build to succeed. | |
114 | (for-each | |
115 | (match-lambda | |
116 | ((file regex) | |
117 | (substitute* file | |
118 | ((regex all before test_name) | |
119 | (string-append before "Disabled" test_name))))) | |
120 | '(("net/net_test.go" "(.+)(TestShutdownUnix.+)") | |
121 | ("net/dial_test.go" "(.+)(TestDialTimeout.+)") | |
122 | ("os/os_test.go" "(.+)(TestHostname.+)") | |
123 | ("time/format_test.go" "(.+)(TestParseInSydney.+)") | |
4b0bac4b LF |
124 | |
125 | ;; Tzdata 2016g changed the name of the time zone used in this | |
126 | ;; test, and the patch for Go 1.7 does not work for 1.4.3: | |
127 | ;; https://github.com/golang/go/issues/17545 | |
128 | ;; https://github.com/golang/go/issues/17276 | |
129 | ("time/time_test.go" "(.+)(TestLoadFixed.+)") | |
f826c8c7 | 130 | ("time/format_test.go" "(.+)(TestParseInLocation.+)") |
4b0bac4b | 131 | |
7a2941a8 MJ |
132 | ("os/exec/exec_test.go" "(.+)(TestEcho.+)") |
133 | ("os/exec/exec_test.go" "(.+)(TestCommandRelativeName.+)") | |
134 | ("os/exec/exec_test.go" "(.+)(TestCatStdin.+)") | |
135 | ("os/exec/exec_test.go" "(.+)(TestCatGoodAndBadFile.+)") | |
136 | ("os/exec/exec_test.go" "(.+)(TestExitStatus.+)") | |
137 | ("os/exec/exec_test.go" "(.+)(TestPipes.+)") | |
138 | ("os/exec/exec_test.go" "(.+)(TestStdinClose.+)") | |
139 | ("syscall/syscall_unix_test.go" "(.+)(TestPassFD\\(.+)") | |
140 | ("os/exec/exec_test.go" "(.+)(TestExtraFiles.+)"))) | |
141 | ||
142 | (substitute* "net/lookup_unix.go" | |
143 | (("/etc/protocols") (string-append net-base "/etc/protocols"))) | |
144 | (substitute* "time/zoneinfo_unix.go" | |
145 | (("/usr/share/zoneinfo/") tzdata-path)) | |
146 | (substitute* (find-files "cmd" "asm.c") | |
147 | (("/lib/ld-linux.*\\.so\\.[0-9]") loader)) | |
148 | #t))) | |
149 | ||
150 | (replace 'build | |
151 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
152 | ;; FIXME: Some of the .a files are not bit-reproducible. | |
153 | (let* ((output (assoc-ref outputs "out"))) | |
154 | (setenv "CC" (which "gcc")) | |
155 | (setenv "GOOS" "linux") | |
156 | (setenv "GOROOT" (dirname (getcwd))) | |
157 | (setenv "GOROOT_FINAL" output) | |
04a95a4f LF |
158 | ;; Go 1.4's cgo will not work with binutils >= 2.27: |
159 | ;; https://github.com/golang/go/issues/16906 | |
160 | (setenv "CGO_ENABLED" "0") | |
7a2941a8 MJ |
161 | (zero? (system* "sh" "all.bash"))))) |
162 | ||
163 | (replace 'install | |
164 | (lambda* (#:key outputs inputs #:allow-other-keys) | |
165 | (let* ((output (assoc-ref outputs "out")) | |
166 | (doc_out (assoc-ref outputs "doc")) | |
167 | (bash (string-append (assoc-ref inputs "bash") "bin/bash")) | |
168 | (docs (string-append doc_out "/share/doc/" ,name "-" ,version)) | |
169 | (tests (string-append | |
170 | (assoc-ref outputs "tests") "/share/" ,name "-" ,version))) | |
171 | (mkdir-p tests) | |
172 | (copy-recursively "../test" (string-append tests "/test")) | |
173 | (delete-file-recursively "../test") | |
174 | (mkdir-p docs) | |
175 | (copy-recursively "../api" (string-append docs "/api")) | |
176 | (delete-file-recursively "../api") | |
177 | (copy-recursively "../doc" (string-append docs "/doc")) | |
178 | (delete-file-recursively "../doc") | |
179 | ||
180 | (for-each (lambda (file) | |
181 | (let ((file (string-append "../" file))) | |
182 | (install-file file docs) | |
183 | (delete-file file))) | |
184 | '("README" "CONTRIBUTORS" "AUTHORS" "PATENTS" | |
185 | "LICENSE" "VERSION" "robots.txt")) | |
186 | (copy-recursively "../" output) | |
187 | #t)))))) | |
188 | (inputs | |
189 | `(("tzdata" ,tzdata) | |
190 | ("pcre" ,pcre) | |
fcbb8461 LF |
191 | ;; Building Go 1.10 with the Go 1.4 bootstrap, Thread Sanitizer from GCC |
192 | ;; 5 finds a data race during the the test suite of Go 1.10. With GCC 6, | |
193 | ;; the race doesn't seem to be present: | |
194 | ;; https://github.com/golang/go/issues/24046 | |
195 | ("gcc:lib" ,gcc-6 "lib"))) | |
7a2941a8 MJ |
196 | (native-inputs |
197 | `(("pkg-config" ,%pkg-config) | |
198 | ("which" ,which) | |
199 | ("net-base" ,net-base) | |
200 | ("perl" ,perl))) | |
201 | ||
202 | (home-page "https://golang.org/") | |
203 | (synopsis "Compiler and libraries for Go, a statically-typed language") | |
204 | (description "Go, also commonly referred to as golang, is an imperative | |
247064c3 TGR |
205 | programming language designed primarily for systems programming. Go is a |
206 | compiled, statically typed language in the tradition of C and C++, but adds | |
207 | garbage collection, various safety features, and concurrent programming features | |
208 | in the style of communicating sequential processes (@dfn{CSP}).") | |
dda785f6 | 209 | (supported-systems '("x86_64-linux" "i686-linux" "armhf-linux")) |
7a2941a8 | 210 | (license license:bsd-3))) |
ec91bcb5 | 211 | |
35131bab | 212 | (define-public go-1.9 |
ec91bcb5 MJ |
213 | (package |
214 | (inherit go-1.4) | |
215 | (name "go") | |
95a396f4 | 216 | (version "1.9.4") |
ec91bcb5 MJ |
217 | (source |
218 | (origin | |
219 | (method url-fetch) | |
220 | (uri (string-append "https://storage.googleapis.com/golang/" | |
221 | name version ".src.tar.gz")) | |
222 | (sha256 | |
223 | (base32 | |
95a396f4 | 224 | "01nw8rfvf10naja0wq0kabsm012sbqq76hd4b8c7g28n6ggshwq5")))) |
ec91bcb5 MJ |
225 | (arguments |
226 | (substitute-keyword-arguments (package-arguments go-1.4) | |
227 | ((#:phases phases) | |
228 | `(modify-phases ,phases | |
229 | (replace 'prebuild | |
230 | ;; TODO: Most of this could be factorized with Go 1.4. | |
231 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
232 | (let* ((gcclib (string-append (assoc-ref inputs "gcc:lib") "/lib")) | |
233 | (ld (string-append (assoc-ref inputs "libc") "/lib")) | |
234 | (loader (car (find-files ld "^ld-linux.+"))) | |
235 | (net-base (assoc-ref inputs "net-base")) | |
236 | (tzdata-path | |
237 | (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")) | |
238 | (output (assoc-ref outputs "out"))) | |
239 | ||
240 | ;; Removing net/ tests, which fail when attempting to access | |
241 | ;; network resources not present in the build container. | |
242 | (for-each delete-file | |
a6169621 P |
243 | '("net/listen_test.go" |
244 | "net/parse_test.go" | |
245 | "net/cgo_unix_test.go")) | |
ec91bcb5 MJ |
246 | |
247 | (substitute* "os/os_test.go" | |
248 | (("/usr/bin") (getcwd)) | |
a6169621 P |
249 | (("/bin/pwd") (which "pwd")) |
250 | (("/bin/sh") (which "sh"))) | |
ec91bcb5 MJ |
251 | |
252 | ;; Add libgcc to runpath | |
253 | (substitute* "cmd/link/internal/ld/lib.go" | |
254 | (("!rpath.set") "true")) | |
35131bab | 255 | (substitute* "cmd/go/internal/work/build.go" |
ec91bcb5 MJ |
256 | (("cgoldflags := \\[\\]string\\{\\}") |
257 | (string-append "cgoldflags := []string{" | |
258 | "\"-rpath=" gcclib "\"" | |
259 | "}")) | |
260 | (("ldflags = setextld\\(ldflags, compiler\\)") | |
261 | (string-append | |
262 | "ldflags = setextld(ldflags, compiler)\n" | |
263 | "ldflags = append(ldflags, \"-r\")\n" | |
264 | "ldflags = append(ldflags, \"" gcclib "\")\n")) | |
265 | (("\"-lgcc_s\", ") | |
266 | (string-append | |
267 | "\"-Wl,-rpath=" gcclib "\", \"-lgcc_s\", "))) | |
268 | ||
269 | ;; Disable failing tests: these tests attempt to access | |
1c797d4b LF |
270 | ;; commands or network resources which are neither available |
271 | ;; nor necessary for the build to succeed. | |
ec91bcb5 MJ |
272 | (for-each |
273 | (match-lambda | |
274 | ((file regex) | |
275 | (substitute* file | |
276 | ((regex all before test_name) | |
277 | (string-append before "Disabled" test_name))))) | |
278 | '(("net/net_test.go" "(.+)(TestShutdownUnix.+)") | |
279 | ("net/dial_test.go" "(.+)(TestDialTimeout.+)") | |
280 | ("os/os_test.go" "(.+)(TestHostname.+)") | |
281 | ("time/format_test.go" "(.+)(TestParseInSydney.+)") | |
f826c8c7 | 282 | ("time/format_test.go" "(.+)(TestParseInLocation.+)") |
ec91bcb5 MJ |
283 | ("os/exec/exec_test.go" "(.+)(TestEcho.+)") |
284 | ("os/exec/exec_test.go" "(.+)(TestCommandRelativeName.+)") | |
285 | ("os/exec/exec_test.go" "(.+)(TestCatStdin.+)") | |
286 | ("os/exec/exec_test.go" "(.+)(TestCatGoodAndBadFile.+)") | |
287 | ("os/exec/exec_test.go" "(.+)(TestExitStatus.+)") | |
288 | ("os/exec/exec_test.go" "(.+)(TestPipes.+)") | |
289 | ("os/exec/exec_test.go" "(.+)(TestStdinClose.+)") | |
290 | ("os/exec/exec_test.go" "(.+)(TestIgnorePipeErrorOnSuccess.+)") | |
291 | ("syscall/syscall_unix_test.go" "(.+)(TestPassFD\\(.+)") | |
292 | ("os/exec/exec_test.go" "(.+)(TestExtraFiles/areturn.+)") | |
293 | ("cmd/go/go_test.go" "(.+)(TestCoverageWithCgo.+)") | |
294 | ("os/exec/exec_test.go" "(.+)(TestOutputStderrCapture.+)") | |
295 | ("os/exec/exec_test.go" "(.+)(TestExtraFiles.+)") | |
296 | ("os/exec/exec_test.go" "(.+)(TestExtraFilesRace.+)") | |
297 | ("net/lookup_test.go" "(.+)(TestLookupPort.+)") | |
298 | ("syscall/exec_linux_test.go" | |
17399545 | 299 | "(.+)(TestCloneNEWUSERAndRemapNoRootDisableSetgroups.+)"))) |
ec91bcb5 MJ |
300 | |
301 | (substitute* "../misc/cgo/testsanitizers/test.bash" | |
302 | (("(CC=)cc" all var) (string-append var "gcc"))) | |
303 | ||
304 | ;; fix shebang for testar script | |
305 | ;; note the target script is generated at build time. | |
a6169621 | 306 | (substitute* "../misc/cgo/testcarchive/carchive_test.go" |
ec91bcb5 MJ |
307 | (("#!/usr/bin/env") (string-append "#!" (which "env")))) |
308 | ||
309 | (substitute* "net/lookup_unix.go" | |
310 | (("/etc/protocols") (string-append net-base "/etc/protocols"))) | |
311 | (substitute* "net/port_unix.go" | |
312 | (("/etc/services") (string-append net-base "/etc/services"))) | |
313 | (substitute* "time/zoneinfo_unix.go" | |
314 | (("/usr/share/zoneinfo/") tzdata-path)) | |
c04ef86e P |
315 | (substitute* (find-files "cmd" "\\.go") |
316 | (("/lib(64)?/ld-linux.*\\.so\\.[0-9]") loader)) | |
ec91bcb5 MJ |
317 | #t))) |
318 | (add-before 'build 'set-bootstrap-variables | |
319 | (lambda* (#:key outputs inputs #:allow-other-keys) | |
320 | ;; Tell the build system where to find the bootstrap Go. | |
321 | (let ((go (assoc-ref inputs "go")) | |
322 | (out (assoc-ref outputs "out"))) | |
323 | (setenv "GOROOT_BOOTSTRAP" go) | |
324 | (setenv "PATH" | |
325 | (string-append out "/bin:" | |
326 | (dirname (getcwd)) "/bin:" | |
327 | (getenv "PATH"))) | |
328 | ||
329 | ;; XXX: The following variables seem unrelated. | |
330 | (setenv "GOGC" "400") | |
331 | (setenv "GO_TEST_TIMEOUT_SCALE" "9999") | |
332 | #t))) | |
04a95a4f LF |
333 | |
334 | (replace 'build | |
335 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
336 | ;; FIXME: Some of the .a files are not bit-reproducible. | |
337 | (let* ((output (assoc-ref outputs "out"))) | |
338 | (setenv "CC" (which "gcc")) | |
339 | (setenv "GOOS" "linux") | |
340 | (setenv "GOROOT" (dirname (getcwd))) | |
341 | (setenv "GOROOT_FINAL" output) | |
342 | (setenv "CGO_ENABLED" "1") | |
343 | (zero? (system* "sh" "all.bash"))))) | |
344 | ||
ec91bcb5 MJ |
345 | (replace 'install |
346 | ;; TODO: Most of this could be factorized with Go 1.4. | |
347 | (lambda* (#:key outputs #:allow-other-keys) | |
348 | (let* ((output (assoc-ref outputs "out")) | |
349 | (doc_out (assoc-ref outputs "doc")) | |
350 | (docs (string-append doc_out "/share/doc/" ,name "-" ,version)) | |
351 | (src (string-append | |
352 | (assoc-ref outputs "tests") "/share/" ,name "-" ,version))) | |
353 | (delete-file-recursively "../pkg/bootstrap") | |
354 | ||
355 | (mkdir-p src) | |
356 | (copy-recursively "../test" (string-append src "/test")) | |
357 | (delete-file-recursively "../test") | |
358 | (mkdir-p docs) | |
359 | (copy-recursively "../api" (string-append docs "/api")) | |
360 | (delete-file-recursively "../api") | |
361 | (copy-recursively "../doc" (string-append docs "/doc")) | |
362 | (delete-file-recursively "../doc") | |
363 | ||
364 | (for-each | |
365 | (lambda (file) | |
366 | (let* ((filein (string-append "../" file)) | |
367 | (fileout (string-append docs "/" file))) | |
368 | (copy-file filein fileout) | |
369 | (delete-file filein))) | |
370 | ;; Note the slightly different file names compared to 1.4. | |
371 | '("README.md" "CONTRIBUTORS" "AUTHORS" "PATENTS" | |
372 | "LICENSE" "VERSION" "CONTRIBUTING.md" "robots.txt")) | |
373 | ||
374 | (copy-recursively "../" output)))))))) | |
375 | (native-inputs | |
376 | `(("go" ,go-1.4) | |
dda785f6 EF |
377 | ,@(package-native-inputs go-1.4))) |
378 | (supported-systems %supported-systems))) | |
ec91bcb5 | 379 | |
fcbb8461 LF |
380 | (define-public go-1.10 |
381 | (package | |
382 | (inherit go-1.9) | |
383 | (name "go") | |
384 | (version "1.10") | |
385 | (source | |
386 | (origin | |
387 | (method url-fetch) | |
388 | (uri (string-append "https://storage.googleapis.com/golang/" | |
389 | name version ".src.tar.gz")) | |
390 | (sha256 | |
391 | (base32 | |
392 | "093z1h0gmi458kv7smpx0ph6jm7ss9mzxa432kysbz85jhl4kppk")))) | |
393 | (arguments | |
394 | (substitute-keyword-arguments (package-arguments go-1.9) | |
395 | ((#:phases phases) | |
396 | `(modify-phases ,phases | |
397 | (replace 'prebuild | |
398 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
399 | (let* ((gcclib (string-append (assoc-ref inputs "gcc:lib") "/lib")) | |
400 | (ld (string-append (assoc-ref inputs "libc") "/lib")) | |
401 | (loader (car (find-files ld "^ld-linux.+"))) | |
402 | (net-base (assoc-ref inputs "net-base")) | |
403 | (tzdata-path | |
404 | (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")) | |
405 | (output (assoc-ref outputs "out"))) | |
406 | ||
407 | ;; Removing net/ tests, which fail when attempting to access | |
408 | ;; network resources not present in the build container. | |
409 | (for-each delete-file | |
410 | '("net/listen_test.go" | |
411 | "net/parse_test.go" | |
412 | "net/cgo_unix_test.go")) | |
413 | ||
414 | (substitute* "os/os_test.go" | |
415 | (("/usr/bin") (getcwd)) | |
416 | (("/bin/pwd") (which "pwd")) | |
417 | (("/bin/sh") (which "sh"))) | |
418 | ||
419 | ;; Add libgcc to runpath | |
420 | (substitute* "cmd/link/internal/ld/lib.go" | |
421 | (("!rpath.set") "true")) | |
422 | (substitute* "cmd/go/internal/work/gccgo.go" | |
423 | (("cgoldflags := \\[\\]string\\{\\}") | |
424 | (string-append "cgoldflags := []string{" | |
425 | "\"-rpath=" gcclib "\"" | |
426 | "}")) | |
427 | (("\"-lgcc_s\", ") | |
428 | (string-append | |
429 | "\"-Wl,-rpath=" gcclib "\", \"-lgcc_s\", "))) | |
430 | (substitute* "cmd/go/internal/work/gc.go" | |
431 | (("ldflags = setextld\\(ldflags, compiler\\)") | |
432 | (string-append | |
433 | "ldflags = setextld(ldflags, compiler)\n" | |
434 | "ldflags = append(ldflags, \"-r\")\n" | |
435 | "ldflags = append(ldflags, \"" gcclib "\")\n"))) | |
436 | ||
437 | ;; Disable failing tests: these tests attempt to access | |
438 | ;; commands or network resources which are neither available | |
439 | ;; nor necessary for the build to succeed. | |
440 | (for-each | |
441 | (match-lambda | |
442 | ((file regex) | |
443 | (substitute* file | |
444 | ((regex all before test_name) | |
445 | (string-append before "Disabled" test_name))))) | |
446 | '(("net/net_test.go" "(.+)(TestShutdownUnix.+)") | |
447 | ("net/dial_test.go" "(.+)(TestDialTimeout.+)") | |
448 | ("os/os_test.go" "(.+)(TestHostname.+)") | |
449 | ("time/format_test.go" "(.+)(TestParseInSydney.+)") | |
450 | ("time/format_test.go" "(.+)(TestParseInLocation.+)") | |
451 | ("os/exec/exec_test.go" "(.+)(TestEcho.+)") | |
452 | ("os/exec/exec_test.go" "(.+)(TestCommandRelativeName.+)") | |
453 | ("os/exec/exec_test.go" "(.+)(TestCatStdin.+)") | |
454 | ("os/exec/exec_test.go" "(.+)(TestCatGoodAndBadFile.+)") | |
455 | ("os/exec/exec_test.go" "(.+)(TestExitStatus.+)") | |
456 | ("os/exec/exec_test.go" "(.+)(TestPipes.+)") | |
457 | ("os/exec/exec_test.go" "(.+)(TestStdinClose.+)") | |
458 | ("os/exec/exec_test.go" "(.+)(TestIgnorePipeErrorOnSuccess.+)") | |
459 | ("syscall/syscall_unix_test.go" "(.+)(TestPassFD\\(.+)") | |
460 | ("os/exec/exec_test.go" "(.+)(TestExtraFiles/areturn.+)") | |
461 | ("cmd/go/go_test.go" "(.+)(TestCoverageWithCgo.+)") | |
462 | ("os/exec/exec_test.go" "(.+)(TestOutputStderrCapture.+)") | |
463 | ("os/exec/exec_test.go" "(.+)(TestExtraFiles.+)") | |
464 | ("os/exec/exec_test.go" "(.+)(TestExtraFilesRace.+)") | |
465 | ("net/lookup_test.go" "(.+)(TestLookupPort.+)") | |
466 | ("syscall/exec_linux_test.go" | |
467 | "(.+)(TestCloneNEWUSERAndRemapNoRootDisableSetgroups.+)"))) | |
468 | ||
469 | ;; fix shebang for testar script | |
470 | ;; note the target script is generated at build time. | |
471 | (substitute* "../misc/cgo/testcarchive/carchive_test.go" | |
472 | (("#!/usr/bin/env") (string-append "#!" (which "env")))) | |
473 | ||
474 | (substitute* "net/lookup_unix.go" | |
475 | (("/etc/protocols") (string-append net-base "/etc/protocols"))) | |
476 | (substitute* "net/port_unix.go" | |
477 | (("/etc/services") (string-append net-base "/etc/services"))) | |
478 | (substitute* "time/zoneinfo_unix.go" | |
479 | (("/usr/share/zoneinfo/") tzdata-path)) | |
480 | (substitute* (find-files "cmd" "\\.go") | |
481 | (("/lib(64)?/ld-linux.*\\.so\\.[0-9]") loader)) | |
482 | #t))) | |
483 | (replace 'set-bootstrap-variables | |
484 | (lambda* (#:key outputs inputs #:allow-other-keys) | |
485 | ;; Tell the build system where to find the bootstrap Go. | |
486 | (let ((go (assoc-ref inputs "go"))) | |
487 | (setenv "GOROOT_BOOTSTRAP" go) | |
488 | (setenv "GOGC" "400") | |
489 | ;; Go 1.10 tries to write to $HOME in a test | |
490 | (setenv "HOME" "/tmp") | |
491 | #t))))))))) | |
492 | ||
35131bab | 493 | (define-public go go-1.9) |
d3878e88 LF |
494 | |
495 | (define-public go-github-com-alsm-ioprogress | |
496 | (let ((commit "063c3725f436e7fba0c8f588547bee21ffec7ac5") | |
497 | (revision "0")) | |
498 | (package | |
499 | (name "go-github-com-alsm-ioprogress") | |
500 | (version (git-version "0.0.0" revision commit)) | |
501 | (source (origin | |
502 | (method git-fetch) | |
503 | (uri (git-reference | |
504 | (url "https://github.com/alsm/ioprogress.git") | |
505 | (commit commit))) | |
fdbece74 | 506 | (file-name (git-file-name name version)) |
d3878e88 LF |
507 | (sha256 |
508 | (base32 | |
509 | "10ym5qlq77nynmkxbk767f2hfwyxg2k7hrzph05hvgzv833dhivh")))) | |
510 | (build-system go-build-system) | |
511 | (arguments | |
512 | '(#:import-path "github.com/alsm/ioprogress")) | |
513 | (synopsis "Textual progress bars in Go") | |
514 | (description "@code{ioprogress} is a Go library with implementations of | |
515 | @code{io.Reader} and @code{io.Writer} that draws progress bars. The primary use | |
516 | case for these are for command-line applications but alternate progress bar | |
517 | writers can be supplied for alternate environments.") | |
518 | (home-page "https://github.com/alsm/ioprogress") | |
519 | (license license:expat)))) | |
11b12655 LF |
520 | |
521 | (define-public go-github-com-aki237-nscjar | |
522 | (let ((commit "e2df936ddd6050d30dd90c7214c02b5019c42f06") | |
523 | (revision "0")) | |
524 | (package | |
525 | (name "go-github-com-aki237-nscjar") | |
526 | (version (git-version "0.0.0" revision commit)) | |
527 | (source (origin | |
528 | (method git-fetch) | |
529 | (uri (git-reference | |
530 | (url "https://github.com/aki237/nscjar.git") | |
531 | (commit commit))) | |
82f09c0e | 532 | (file-name (git-file-name name version)) |
11b12655 LF |
533 | (sha256 |
534 | (base32 | |
535 | "03y7zzq12qvhsq86lb06sgns8xrkblbn7i7wd886wk3zr5574b96")))) | |
536 | (build-system go-build-system) | |
537 | (arguments | |
538 | '(#:import-path "github.com/aki237/nscjar")) | |
539 | (synopsis "Handle Netscape / Mozilla cookies") | |
540 | (description "@code{nscjar} is a Go library used to parse and output | |
541 | Netscape/Mozilla's old-style cookie files. It also implements a simple cookie | |
542 | jar struct to manage the cookies added to the cookie jar.") | |
543 | (home-page "https://github.com/aki237/nscjar") | |
544 | (license license:expat)))) | |
12f496ba LF |
545 | |
546 | (define-public go-github-com-davidjpeacock-cli | |
547 | (let ((commit "8ba6f23b6e36d03666a14bd9421f5e3efcb59aca") | |
548 | (revision "0")) | |
549 | (package | |
550 | (name "go-github-com-davidjpeacock-cli") | |
551 | (version (git-version "1.19.1" revision commit)) | |
552 | (source (origin | |
553 | (method git-fetch) | |
554 | (uri (git-reference | |
555 | (url "https://github.com/davidjpeacock/cli.git") | |
556 | (commit commit))) | |
6de107b0 | 557 | (file-name (git-file-name name version)) |
12f496ba LF |
558 | (sha256 |
559 | (base32 | |
560 | "01s53ny3p0fdx64rnwcnmjj4xpc5adihnh6islsfq5z1ph2phhnj")))) | |
561 | (build-system go-build-system) | |
562 | (arguments | |
563 | '(#:import-path "github.com/davidjpeacock/cli")) | |
564 | (synopsis "Build command-line interfaces in Go") | |
565 | (description "@code{cli} is a package for building command line | |
566 | interfaces in Go. The goal is to enable developers to write fast and | |
567 | distributable command line applications in an expressive way.") | |
568 | (home-page "https://github.com/davidjpeacock/cli") | |
569 | (license license:expat)))) | |
60a8cbc4 CB |
570 | |
571 | (define-public go-github.com-jessevdk-go-flags | |
572 | (package | |
573 | (name "go-github.com-jessevdk-go-flags") | |
574 | (version "1.3.0") | |
575 | (source (origin | |
576 | (method git-fetch) | |
577 | (uri (git-reference | |
578 | (url "https://github.com/jessevdk/go-flags") | |
579 | (commit (string-append "v" version)))) | |
580 | (file-name (git-file-name name version)) | |
581 | (sha256 | |
582 | (base32 | |
583 | "1jk2k2l10lwrn1r3nxdvbs0yz656830j4khzirw8p4ahs7c5zz36")))) | |
584 | (build-system go-build-system) | |
585 | (arguments | |
586 | '(#:import-path "github.com/jessevdk/go-flags")) | |
587 | (synopsis "Go library for parsing command line arguments") | |
588 | (description | |
589 | "The @code{flags} package provides a command line option parser. The | |
590 | functionality is similar to the go builtin @code{flag} package, but | |
591 | @code{flags} provides more options and uses reflection to provide a succinct | |
592 | way of specifying command line options.") | |
593 | (home-page "https://github.com/jessevdk/go-flags") | |
594 | (license license:bsd-3))) | |
210c6d95 CB |
595 | |
596 | (define-public go-gopkg.in-tomb.v2 | |
597 | (let ((commit "d5d1b5820637886def9eef33e03a27a9f166942c") | |
598 | (revision "0")) | |
599 | (package | |
600 | (name "go-gopkg.in-tomb.v2") | |
601 | (version (string-append "0.0.0-" revision "." (string-take commit 7))) | |
602 | (source (origin | |
603 | (method git-fetch) | |
604 | (uri (git-reference | |
605 | (url "https://github.com/go-tomb/tomb.git") | |
606 | (commit commit))) | |
607 | (file-name (string-append name "-" version ".tar.gz")) | |
608 | (sha256 | |
609 | (base32 | |
610 | "1sv15sri99szkdz1bkh0ir46w9n8prrwx5hfai13nrhkawfyfy10")))) | |
611 | (build-system go-build-system) | |
612 | (arguments | |
613 | '(#:import-path "gopkg.in/tomb.v2")) | |
614 | (synopsis "@code{tomb} handles clean goroutine tracking and termination") | |
615 | (description | |
616 | "The @code{tomb} package handles clean goroutine tracking and | |
617 | termination.") | |
618 | (home-page "https://gopkg.in/tomb.v2") | |
619 | (license license:bsd-3)))) | |
da6f9d41 CB |
620 | |
621 | (define-public go-github.com-jtolds-gls | |
622 | (package | |
623 | (name "go-github.com-jtolds-gls") | |
624 | (version "4.2.1") | |
625 | (source (origin | |
626 | (method git-fetch) | |
627 | (uri (git-reference | |
628 | (url "https://github.com/jtolds/gls") | |
629 | (commit (string-append "v" version)))) | |
630 | (file-name (git-file-name name version)) | |
631 | (sha256 | |
632 | (base32 | |
633 | "1vm37pvn0k4r6d3m620swwgama63laz8hhj3pyisdhxwam4m2g1h")))) | |
634 | (build-system go-build-system) | |
635 | (arguments | |
636 | '(#:import-path "github.com/jtolds/gls")) | |
637 | (synopsis "@code{gls} provides Goroutine local storage") | |
638 | (description | |
639 | "The @code{gls} package provides a way to store a retrieve values | |
640 | per-goroutine.") | |
641 | (home-page "https://github.com/jtolds/gls") | |
642 | (license license:expat))) | |
c4d2cffa CB |
643 | |
644 | (define-public go-github-com-tj-docopt | |
645 | (package | |
646 | (name "go-github-com-tj-docopt") | |
647 | (version "1.0.0") | |
648 | (source (origin | |
649 | (method git-fetch) | |
650 | (uri (git-reference | |
651 | (url "https://github.com/tj/docopt") | |
652 | (commit (string-append "v" version)))) | |
653 | (file-name (git-file-name name version)) | |
654 | (sha256 | |
655 | (base32 | |
656 | "06h8hdg1mh3s78zqlr01g4si7k0f0g6pr7fj7lnvfg446hgc7080")))) | |
657 | (build-system go-build-system) | |
658 | (arguments | |
659 | '(#:import-path "github.com/tj/docopt")) | |
660 | (synopsis "Go implementation of docopt") | |
661 | (description | |
662 | "This library allows the user to define a command-line interface from a | |
663 | program's help message rather than specifying it programatically with | |
664 | command-line parsers.") | |
665 | (home-page "https://github.com/tj/docopt") | |
666 | (license license:expat))) | |
ed0c6a76 CB |
667 | |
668 | (define-public go-github-com-hashicorp-hcl | |
669 | (let ((commit "23c074d0eceb2b8a5bfdbb271ab780cde70f05a8") | |
670 | (revision "0")) | |
671 | (package | |
672 | (name "go-github-com-hashicorp-hcl") | |
673 | (version (git-version "0.0.0" revision commit)) | |
674 | (source (origin | |
675 | (method git-fetch) | |
676 | (uri (git-reference | |
677 | (url "https://github.com/hashicorp/hcl") | |
678 | (commit commit))) | |
679 | (file-name (git-file-name name version)) | |
680 | (sha256 | |
681 | (base32 | |
682 | "0db4lpqb5m130rmfy3s3gjjf4dxllypmyrzxv6ggqhkmwmc7w4mc")))) | |
683 | (build-system go-build-system) | |
684 | (arguments | |
685 | '(#:tests? #f | |
686 | #:import-path "github.com/hashicorp/hcl")) | |
687 | (synopsis "Go implementation of HashiCorp Configuration Language") | |
688 | (description | |
689 | "This package contains the main implementation of the @acronym{HCL, | |
690 | HashiCorp Configuration Language}. HCL is designed to be a language for | |
691 | expressing configuration which is easy for both humans and machines to read.") | |
692 | (home-page "https://github.com/hashicorp/hcl") | |
693 | (license license:mpl2.0)))) |