2017-09-20 03:08:42 +02:00
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
|
|
|
;;; Copyright © 2016 Petter <petter@mykolab.ch>
|
|
|
|
;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
|
2020-01-05 17:13:20 +01:00
|
|
|
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
|
build-system: Rewrite using gexps.
* guix/packages.scm (expand-input): Remove 'store', 'system', and
'cross-system' parameters; add #:native?. Rewrite to return
name/gexp-input tuples.
(bag->derivation): Adjust accordingly. Lower (bag-build bag).
(bag->cross-derivation): Ditto. Instead of #:native-drvs and
#:target-drvs, pass #:build-inputs, #:host-inputs, and #:target-inputs.
(%derivation-cache): Remove.
* gnu/packages/bootstrap.scm (raw-build): Turn into a monadic procedure.
* gnu/packages/commencement.scm (glibc-final)[arguments]: Use
'gexp-input' for the #:allowed-references argument.
* guix/build-system/cmake.scm (cmake-build): Remove 'store' parameter.
Switch to the use of gexps and 'gexp->derivation'.
(lower): Remove #:source from 'private-keywords'.
* guix/build-system/glib-or-gtk.scm (glib-or-gtk-build, lower):
Likewise.
* guix/build-system/font.scm (font-build): Likewise.
* guix/build-system/gnu.scm (gnu-build): Likewise, and remove
'canonicalize-reference'.
(gnu-cross-build): Likewise, and expect #:build-inputs, #:host-inputs,
and #:target-inputs instead of #:native-drvs and #:target-drvs.
(lower): Likewise.
* guix/build-system/perl.scm (perl-build, lower): Likewise.
* guix/build-system/python.scm (python-build, lower): Likewise.
* guix/build-system/ruby.scm (ruby-build, lower): Likewise.
* guix/build-system/waf.scm (waf-build, lower): Likewise.
* guix/build-system/trivial.scm (guile-for-build): Remove.
(trivial-build): Remove 'store' parameter, change to gexps.
(trivial-cross-build): Ditto, and change to #:build-inputs & co.
* guix/build-system/cargo.scm (cargo-build): Change to 'gexp->derivation'.
* guix/build-system/copy.scm (copy-build): Likewise.
* guix/build-system/dune.scm (dune-build): Likewise.
* guix/build-system/guile.scm (guile-build, guile-cross-build):
Likewise.
* guix/build-system/meson.scm (meson-build): Likewise.
* guix/build-system/ocaml.scm (ocaml-build): Likewise.
* guix/build-system/scons.scm (scons-build): Likewise.
* guix/build-system/texlive.scm (texlive-build): Likewise.
* guix/build-system/android-ndk.scm (android-ndk-build): Likewise.
* guix/build-system/ant.scm (ant-build): Likewise.
* guix/build-system/asdf.scm (asdf-build/source, asdf-build): Likewise.
* guix/build-system/chicken.scm (chicken-build): Likewise.
* guix/build-system/clojure.scm (clojure-build): Likewise.
(source->output-path, maybe-guile->guile): Remove.
* guix/build-system/dub.scm (dub-build): Likewise.
* guix/build-system/emacs.scm (emacs-build): Likewise.
* guix/build-system/go.scm (go-build): Likewise.
* guix/build-system/haskell.scm (haskell-build): Likewise.
* guix/build-system/julia.scm (julia-build): Likewise.
* guix/build-system/linux-module.scm (linux-module-build)
(linux-module-build-cross): Likewise.
* guix/build-system/maven.scm (maven-build): Likewise.
* guix/build-system/minify.scm (minify-build): Likewise.
* guix/build-system/node.scm (node-build): Likewise.
* guix/build-system/qt.scm (qt-build, qt-cross-build): Likewise.
* guix/build-system/r.scm (r-build): Likewise.
* guix/build-system/rakudo.scm (rakudo-build): Likewise.
* guix/build-system/renpy.scm (renpy-build): Likewise.
* tests/builders.scm ("gnu-build"): Call 'store-lower' on 'gnu-build'.
Pass #:source parameter.
* tests/packages.scm ("search paths"): Use 'abort-to-prompt' instead of
a normal return from the 'build' method.
("package->bag, sensitivity to %current-target-system"): Change 'build'
to match the new build system signature.
squash! build-system: Rewrite using gexps.
squash! build-system: Rewrite using gexps.
2015-03-28 19:26:39 +01:00
|
|
|
;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
|
2021-04-26 20:13:06 +02:00
|
|
|
;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
|
2017-09-20 03:08:42 +02:00
|
|
|
;;;
|
|
|
|
;;; 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 <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
(define-module (guix build-system go)
|
|
|
|
#:use-module (guix utils)
|
build-system: Rewrite using gexps.
* guix/packages.scm (expand-input): Remove 'store', 'system', and
'cross-system' parameters; add #:native?. Rewrite to return
name/gexp-input tuples.
(bag->derivation): Adjust accordingly. Lower (bag-build bag).
(bag->cross-derivation): Ditto. Instead of #:native-drvs and
#:target-drvs, pass #:build-inputs, #:host-inputs, and #:target-inputs.
(%derivation-cache): Remove.
* gnu/packages/bootstrap.scm (raw-build): Turn into a monadic procedure.
* gnu/packages/commencement.scm (glibc-final)[arguments]: Use
'gexp-input' for the #:allowed-references argument.
* guix/build-system/cmake.scm (cmake-build): Remove 'store' parameter.
Switch to the use of gexps and 'gexp->derivation'.
(lower): Remove #:source from 'private-keywords'.
* guix/build-system/glib-or-gtk.scm (glib-or-gtk-build, lower):
Likewise.
* guix/build-system/font.scm (font-build): Likewise.
* guix/build-system/gnu.scm (gnu-build): Likewise, and remove
'canonicalize-reference'.
(gnu-cross-build): Likewise, and expect #:build-inputs, #:host-inputs,
and #:target-inputs instead of #:native-drvs and #:target-drvs.
(lower): Likewise.
* guix/build-system/perl.scm (perl-build, lower): Likewise.
* guix/build-system/python.scm (python-build, lower): Likewise.
* guix/build-system/ruby.scm (ruby-build, lower): Likewise.
* guix/build-system/waf.scm (waf-build, lower): Likewise.
* guix/build-system/trivial.scm (guile-for-build): Remove.
(trivial-build): Remove 'store' parameter, change to gexps.
(trivial-cross-build): Ditto, and change to #:build-inputs & co.
* guix/build-system/cargo.scm (cargo-build): Change to 'gexp->derivation'.
* guix/build-system/copy.scm (copy-build): Likewise.
* guix/build-system/dune.scm (dune-build): Likewise.
* guix/build-system/guile.scm (guile-build, guile-cross-build):
Likewise.
* guix/build-system/meson.scm (meson-build): Likewise.
* guix/build-system/ocaml.scm (ocaml-build): Likewise.
* guix/build-system/scons.scm (scons-build): Likewise.
* guix/build-system/texlive.scm (texlive-build): Likewise.
* guix/build-system/android-ndk.scm (android-ndk-build): Likewise.
* guix/build-system/ant.scm (ant-build): Likewise.
* guix/build-system/asdf.scm (asdf-build/source, asdf-build): Likewise.
* guix/build-system/chicken.scm (chicken-build): Likewise.
* guix/build-system/clojure.scm (clojure-build): Likewise.
(source->output-path, maybe-guile->guile): Remove.
* guix/build-system/dub.scm (dub-build): Likewise.
* guix/build-system/emacs.scm (emacs-build): Likewise.
* guix/build-system/go.scm (go-build): Likewise.
* guix/build-system/haskell.scm (haskell-build): Likewise.
* guix/build-system/julia.scm (julia-build): Likewise.
* guix/build-system/linux-module.scm (linux-module-build)
(linux-module-build-cross): Likewise.
* guix/build-system/maven.scm (maven-build): Likewise.
* guix/build-system/minify.scm (minify-build): Likewise.
* guix/build-system/node.scm (node-build): Likewise.
* guix/build-system/qt.scm (qt-build, qt-cross-build): Likewise.
* guix/build-system/r.scm (r-build): Likewise.
* guix/build-system/rakudo.scm (rakudo-build): Likewise.
* guix/build-system/renpy.scm (renpy-build): Likewise.
* tests/builders.scm ("gnu-build"): Call 'store-lower' on 'gnu-build'.
Pass #:source parameter.
* tests/packages.scm ("search paths"): Use 'abort-to-prompt' instead of
a normal return from the 'build' method.
("package->bag, sensitivity to %current-target-system"): Change 'build'
to match the new build system signature.
squash! build-system: Rewrite using gexps.
squash! build-system: Rewrite using gexps.
2015-03-28 19:26:39 +01:00
|
|
|
#:use-module (guix gexp)
|
|
|
|
#:use-module (guix store)
|
|
|
|
#:use-module (guix monads)
|
2017-09-20 03:08:42 +02:00
|
|
|
#:use-module (guix search-paths)
|
|
|
|
#:use-module (guix build-system)
|
|
|
|
#:use-module (guix build-system gnu)
|
|
|
|
#:use-module (guix packages)
|
|
|
|
#:use-module (ice-9 match)
|
2020-10-23 02:40:17 +02:00
|
|
|
#:use-module (ice-9 regex)
|
2021-04-26 20:13:06 +02:00
|
|
|
#:use-module (srfi srfi-1)
|
2017-09-20 03:08:42 +02:00
|
|
|
#:export (%go-build-system-modules
|
|
|
|
go-build
|
2020-10-23 02:40:17 +02:00
|
|
|
go-build-system
|
|
|
|
|
2021-03-19 21:41:51 +01:00
|
|
|
go-pseudo-version?
|
2020-10-23 02:40:17 +02:00
|
|
|
go-version->git-ref))
|
2017-09-20 03:08:42 +02:00
|
|
|
|
|
|
|
;; Commentary:
|
|
|
|
;;
|
|
|
|
;; Standard build procedure for packages using the Go build system. It is
|
|
|
|
;; implemented as an extension of 'gnu-build-system'.
|
|
|
|
;;
|
|
|
|
;; Code:
|
|
|
|
|
2021-03-19 21:41:51 +01:00
|
|
|
(define %go-pseudo-version-rx
|
|
|
|
;; Match only the end of the version string; this is so that matching the
|
|
|
|
;; more complex leading semantic version pattern is not required.
|
2020-10-23 02:40:17 +02:00
|
|
|
(make-regexp (string-append
|
2021-03-19 21:41:51 +01:00
|
|
|
"([0-9]{14}-)" ;timestamp
|
|
|
|
"([0-9A-Fa-f]{12})" ;commit hash
|
|
|
|
"(\\+incompatible)?$"))) ;optional +incompatible tag
|
2020-10-23 02:40:17 +02:00
|
|
|
|
|
|
|
(define (go-version->git-ref version)
|
|
|
|
"Parse VERSION, a \"pseudo-version\" as defined at
|
|
|
|
<https://golang.org/ref/mod#pseudo-versions>, and extract the commit hash from
|
2021-03-19 21:41:51 +01:00
|
|
|
it, defaulting to full VERSION (stripped from the \"+incompatible\" suffix if
|
|
|
|
present) if a pseudo-version pattern is not recognized."
|
2020-10-23 02:40:17 +02:00
|
|
|
;; A module version like v1.2.3 is introduced by tagging a revision in the
|
|
|
|
;; underlying source repository. Untagged revisions can be referred to
|
|
|
|
;; using a "pseudo-version" like v0.0.0-yyyymmddhhmmss-abcdefabcdef, where
|
|
|
|
;; the time is the commit time in UTC and the final suffix is the prefix of
|
|
|
|
;; the commit hash (see: https://golang.org/ref/mod#pseudo-versions).
|
|
|
|
(let* ((version
|
|
|
|
;; If a source code repository has a v2.0.0 or later tag for a file
|
|
|
|
;; tree with no go.mod, the version is considered to be part of the
|
|
|
|
;; v1 module's available versions and is given an +incompatible
|
|
|
|
;; suffix
|
|
|
|
;; (see:https://golang.org/cmd/go/#hdr-Module_compatibility_and_semantic_versioning).
|
|
|
|
(if (string-suffix? "+incompatible" version)
|
|
|
|
(string-drop-right version 13)
|
|
|
|
version))
|
2021-03-19 21:41:51 +01:00
|
|
|
(match (regexp-exec %go-pseudo-version-rx version)))
|
2020-10-23 02:40:17 +02:00
|
|
|
(if match
|
2021-03-19 21:41:51 +01:00
|
|
|
(match:substring match 2)
|
2020-10-23 02:40:17 +02:00
|
|
|
version)))
|
|
|
|
|
2021-03-19 21:41:51 +01:00
|
|
|
(define (go-pseudo-version? version)
|
|
|
|
"True if VERSION is a Go pseudo-version, i.e., a version string made of a
|
|
|
|
commit hash and its date rather than a proper release tag."
|
|
|
|
(regexp-exec %go-pseudo-version-rx version))
|
|
|
|
|
2021-04-26 20:13:06 +02:00
|
|
|
(define (go-target target)
|
|
|
|
;; Parse the nix-system equivalent of the target and set the
|
|
|
|
;; target for compilation accordingly.
|
|
|
|
(match (string-split (gnu-triplet->nix-system target) #\-)
|
|
|
|
((arch os)
|
|
|
|
(list (match arch
|
|
|
|
("aarch64" "arm64")
|
|
|
|
("armhf" "arm")
|
|
|
|
("powerpc64le" "ppc64le")
|
|
|
|
("powerpc64" "ppc64")
|
|
|
|
("i686" "386")
|
|
|
|
("x86_64" "amd64")
|
|
|
|
("mips64el" "mips64le")
|
|
|
|
(_ arch))
|
|
|
|
(match os
|
|
|
|
((or "mingw32" "cygwin") "windows")
|
|
|
|
(_ os))))))
|
|
|
|
|
2017-09-20 03:08:42 +02:00
|
|
|
(define %go-build-system-modules
|
|
|
|
;; Build-side modules imported and used by default.
|
|
|
|
`((guix build go-build-system)
|
2018-01-06 21:47:47 +01:00
|
|
|
(guix build union)
|
2017-09-20 03:08:42 +02:00
|
|
|
,@%gnu-build-system-modules))
|
|
|
|
|
|
|
|
(define (default-go)
|
|
|
|
;; Lazily resolve the binding to avoid a circular dependency.
|
|
|
|
(let ((go (resolve-interface '(gnu packages golang))))
|
|
|
|
(module-ref go 'go)))
|
|
|
|
|
|
|
|
(define* (lower name
|
|
|
|
#:key source inputs native-inputs outputs system target
|
|
|
|
(go (default-go))
|
|
|
|
#:allow-other-keys
|
|
|
|
#:rest arguments)
|
|
|
|
"Return a bag for NAME."
|
|
|
|
(define private-keywords
|
build-system: Rewrite using gexps.
* guix/packages.scm (expand-input): Remove 'store', 'system', and
'cross-system' parameters; add #:native?. Rewrite to return
name/gexp-input tuples.
(bag->derivation): Adjust accordingly. Lower (bag-build bag).
(bag->cross-derivation): Ditto. Instead of #:native-drvs and
#:target-drvs, pass #:build-inputs, #:host-inputs, and #:target-inputs.
(%derivation-cache): Remove.
* gnu/packages/bootstrap.scm (raw-build): Turn into a monadic procedure.
* gnu/packages/commencement.scm (glibc-final)[arguments]: Use
'gexp-input' for the #:allowed-references argument.
* guix/build-system/cmake.scm (cmake-build): Remove 'store' parameter.
Switch to the use of gexps and 'gexp->derivation'.
(lower): Remove #:source from 'private-keywords'.
* guix/build-system/glib-or-gtk.scm (glib-or-gtk-build, lower):
Likewise.
* guix/build-system/font.scm (font-build): Likewise.
* guix/build-system/gnu.scm (gnu-build): Likewise, and remove
'canonicalize-reference'.
(gnu-cross-build): Likewise, and expect #:build-inputs, #:host-inputs,
and #:target-inputs instead of #:native-drvs and #:target-drvs.
(lower): Likewise.
* guix/build-system/perl.scm (perl-build, lower): Likewise.
* guix/build-system/python.scm (python-build, lower): Likewise.
* guix/build-system/ruby.scm (ruby-build, lower): Likewise.
* guix/build-system/waf.scm (waf-build, lower): Likewise.
* guix/build-system/trivial.scm (guile-for-build): Remove.
(trivial-build): Remove 'store' parameter, change to gexps.
(trivial-cross-build): Ditto, and change to #:build-inputs & co.
* guix/build-system/cargo.scm (cargo-build): Change to 'gexp->derivation'.
* guix/build-system/copy.scm (copy-build): Likewise.
* guix/build-system/dune.scm (dune-build): Likewise.
* guix/build-system/guile.scm (guile-build, guile-cross-build):
Likewise.
* guix/build-system/meson.scm (meson-build): Likewise.
* guix/build-system/ocaml.scm (ocaml-build): Likewise.
* guix/build-system/scons.scm (scons-build): Likewise.
* guix/build-system/texlive.scm (texlive-build): Likewise.
* guix/build-system/android-ndk.scm (android-ndk-build): Likewise.
* guix/build-system/ant.scm (ant-build): Likewise.
* guix/build-system/asdf.scm (asdf-build/source, asdf-build): Likewise.
* guix/build-system/chicken.scm (chicken-build): Likewise.
* guix/build-system/clojure.scm (clojure-build): Likewise.
(source->output-path, maybe-guile->guile): Remove.
* guix/build-system/dub.scm (dub-build): Likewise.
* guix/build-system/emacs.scm (emacs-build): Likewise.
* guix/build-system/go.scm (go-build): Likewise.
* guix/build-system/haskell.scm (haskell-build): Likewise.
* guix/build-system/julia.scm (julia-build): Likewise.
* guix/build-system/linux-module.scm (linux-module-build)
(linux-module-build-cross): Likewise.
* guix/build-system/maven.scm (maven-build): Likewise.
* guix/build-system/minify.scm (minify-build): Likewise.
* guix/build-system/node.scm (node-build): Likewise.
* guix/build-system/qt.scm (qt-build, qt-cross-build): Likewise.
* guix/build-system/r.scm (r-build): Likewise.
* guix/build-system/rakudo.scm (rakudo-build): Likewise.
* guix/build-system/renpy.scm (renpy-build): Likewise.
* tests/builders.scm ("gnu-build"): Call 'store-lower' on 'gnu-build'.
Pass #:source parameter.
* tests/packages.scm ("search paths"): Use 'abort-to-prompt' instead of
a normal return from the 'build' method.
("package->bag, sensitivity to %current-target-system"): Change 'build'
to match the new build system signature.
squash! build-system: Rewrite using gexps.
squash! build-system: Rewrite using gexps.
2015-03-28 19:26:39 +01:00
|
|
|
'(#:target #:go #:inputs #:native-inputs))
|
2017-09-20 03:08:42 +02:00
|
|
|
|
2021-04-26 20:13:06 +02:00
|
|
|
(bag
|
|
|
|
(name name)
|
|
|
|
(system system)
|
|
|
|
(target target)
|
|
|
|
(build-inputs `(,@(if source
|
|
|
|
`(("source" ,source))
|
|
|
|
'())
|
|
|
|
,@`(("go" ,go))
|
|
|
|
,@native-inputs
|
|
|
|
,@(if target '() inputs)
|
|
|
|
,@(if target
|
|
|
|
;; Use the standard cross inputs of
|
|
|
|
;; 'gnu-build-system'.
|
|
|
|
(standard-cross-packages target 'host)
|
|
|
|
'())
|
|
|
|
;; Keep the standard inputs of 'gnu-build-system'.
|
|
|
|
,@(standard-packages)))
|
|
|
|
(host-inputs (if target inputs '()))
|
|
|
|
|
|
|
|
;; The cross-libc is really a target package, but for bootstrapping
|
|
|
|
;; reasons, we can't put it in 'host-inputs'. Namely, 'cross-gcc' is a
|
|
|
|
;; native package, so it would end up using a "native" variant of
|
|
|
|
;; 'cross-libc' (built with 'gnu-build'), whereas all the other packages
|
|
|
|
;; would use a target variant (built with 'gnu-cross-build'.)
|
|
|
|
(target-inputs (if target
|
|
|
|
(standard-cross-packages target 'target)
|
|
|
|
'()))
|
|
|
|
|
|
|
|
(outputs outputs)
|
|
|
|
(build (if target go-cross-build go-build))
|
|
|
|
(arguments (strip-keyword-arguments private-keywords arguments))))
|
2017-09-20 03:08:42 +02:00
|
|
|
|
build-system: Rewrite using gexps.
* guix/packages.scm (expand-input): Remove 'store', 'system', and
'cross-system' parameters; add #:native?. Rewrite to return
name/gexp-input tuples.
(bag->derivation): Adjust accordingly. Lower (bag-build bag).
(bag->cross-derivation): Ditto. Instead of #:native-drvs and
#:target-drvs, pass #:build-inputs, #:host-inputs, and #:target-inputs.
(%derivation-cache): Remove.
* gnu/packages/bootstrap.scm (raw-build): Turn into a monadic procedure.
* gnu/packages/commencement.scm (glibc-final)[arguments]: Use
'gexp-input' for the #:allowed-references argument.
* guix/build-system/cmake.scm (cmake-build): Remove 'store' parameter.
Switch to the use of gexps and 'gexp->derivation'.
(lower): Remove #:source from 'private-keywords'.
* guix/build-system/glib-or-gtk.scm (glib-or-gtk-build, lower):
Likewise.
* guix/build-system/font.scm (font-build): Likewise.
* guix/build-system/gnu.scm (gnu-build): Likewise, and remove
'canonicalize-reference'.
(gnu-cross-build): Likewise, and expect #:build-inputs, #:host-inputs,
and #:target-inputs instead of #:native-drvs and #:target-drvs.
(lower): Likewise.
* guix/build-system/perl.scm (perl-build, lower): Likewise.
* guix/build-system/python.scm (python-build, lower): Likewise.
* guix/build-system/ruby.scm (ruby-build, lower): Likewise.
* guix/build-system/waf.scm (waf-build, lower): Likewise.
* guix/build-system/trivial.scm (guile-for-build): Remove.
(trivial-build): Remove 'store' parameter, change to gexps.
(trivial-cross-build): Ditto, and change to #:build-inputs & co.
* guix/build-system/cargo.scm (cargo-build): Change to 'gexp->derivation'.
* guix/build-system/copy.scm (copy-build): Likewise.
* guix/build-system/dune.scm (dune-build): Likewise.
* guix/build-system/guile.scm (guile-build, guile-cross-build):
Likewise.
* guix/build-system/meson.scm (meson-build): Likewise.
* guix/build-system/ocaml.scm (ocaml-build): Likewise.
* guix/build-system/scons.scm (scons-build): Likewise.
* guix/build-system/texlive.scm (texlive-build): Likewise.
* guix/build-system/android-ndk.scm (android-ndk-build): Likewise.
* guix/build-system/ant.scm (ant-build): Likewise.
* guix/build-system/asdf.scm (asdf-build/source, asdf-build): Likewise.
* guix/build-system/chicken.scm (chicken-build): Likewise.
* guix/build-system/clojure.scm (clojure-build): Likewise.
(source->output-path, maybe-guile->guile): Remove.
* guix/build-system/dub.scm (dub-build): Likewise.
* guix/build-system/emacs.scm (emacs-build): Likewise.
* guix/build-system/go.scm (go-build): Likewise.
* guix/build-system/haskell.scm (haskell-build): Likewise.
* guix/build-system/julia.scm (julia-build): Likewise.
* guix/build-system/linux-module.scm (linux-module-build)
(linux-module-build-cross): Likewise.
* guix/build-system/maven.scm (maven-build): Likewise.
* guix/build-system/minify.scm (minify-build): Likewise.
* guix/build-system/node.scm (node-build): Likewise.
* guix/build-system/qt.scm (qt-build, qt-cross-build): Likewise.
* guix/build-system/r.scm (r-build): Likewise.
* guix/build-system/rakudo.scm (rakudo-build): Likewise.
* guix/build-system/renpy.scm (renpy-build): Likewise.
* tests/builders.scm ("gnu-build"): Call 'store-lower' on 'gnu-build'.
Pass #:source parameter.
* tests/packages.scm ("search paths"): Use 'abort-to-prompt' instead of
a normal return from the 'build' method.
("package->bag, sensitivity to %current-target-system"): Change 'build'
to match the new build system signature.
squash! build-system: Rewrite using gexps.
squash! build-system: Rewrite using gexps.
2015-03-28 19:26:39 +01:00
|
|
|
(define* (go-build name inputs
|
2017-09-20 03:08:42 +02:00
|
|
|
#:key
|
build-system: Rewrite using gexps.
* guix/packages.scm (expand-input): Remove 'store', 'system', and
'cross-system' parameters; add #:native?. Rewrite to return
name/gexp-input tuples.
(bag->derivation): Adjust accordingly. Lower (bag-build bag).
(bag->cross-derivation): Ditto. Instead of #:native-drvs and
#:target-drvs, pass #:build-inputs, #:host-inputs, and #:target-inputs.
(%derivation-cache): Remove.
* gnu/packages/bootstrap.scm (raw-build): Turn into a monadic procedure.
* gnu/packages/commencement.scm (glibc-final)[arguments]: Use
'gexp-input' for the #:allowed-references argument.
* guix/build-system/cmake.scm (cmake-build): Remove 'store' parameter.
Switch to the use of gexps and 'gexp->derivation'.
(lower): Remove #:source from 'private-keywords'.
* guix/build-system/glib-or-gtk.scm (glib-or-gtk-build, lower):
Likewise.
* guix/build-system/font.scm (font-build): Likewise.
* guix/build-system/gnu.scm (gnu-build): Likewise, and remove
'canonicalize-reference'.
(gnu-cross-build): Likewise, and expect #:build-inputs, #:host-inputs,
and #:target-inputs instead of #:native-drvs and #:target-drvs.
(lower): Likewise.
* guix/build-system/perl.scm (perl-build, lower): Likewise.
* guix/build-system/python.scm (python-build, lower): Likewise.
* guix/build-system/ruby.scm (ruby-build, lower): Likewise.
* guix/build-system/waf.scm (waf-build, lower): Likewise.
* guix/build-system/trivial.scm (guile-for-build): Remove.
(trivial-build): Remove 'store' parameter, change to gexps.
(trivial-cross-build): Ditto, and change to #:build-inputs & co.
* guix/build-system/cargo.scm (cargo-build): Change to 'gexp->derivation'.
* guix/build-system/copy.scm (copy-build): Likewise.
* guix/build-system/dune.scm (dune-build): Likewise.
* guix/build-system/guile.scm (guile-build, guile-cross-build):
Likewise.
* guix/build-system/meson.scm (meson-build): Likewise.
* guix/build-system/ocaml.scm (ocaml-build): Likewise.
* guix/build-system/scons.scm (scons-build): Likewise.
* guix/build-system/texlive.scm (texlive-build): Likewise.
* guix/build-system/android-ndk.scm (android-ndk-build): Likewise.
* guix/build-system/ant.scm (ant-build): Likewise.
* guix/build-system/asdf.scm (asdf-build/source, asdf-build): Likewise.
* guix/build-system/chicken.scm (chicken-build): Likewise.
* guix/build-system/clojure.scm (clojure-build): Likewise.
(source->output-path, maybe-guile->guile): Remove.
* guix/build-system/dub.scm (dub-build): Likewise.
* guix/build-system/emacs.scm (emacs-build): Likewise.
* guix/build-system/go.scm (go-build): Likewise.
* guix/build-system/haskell.scm (haskell-build): Likewise.
* guix/build-system/julia.scm (julia-build): Likewise.
* guix/build-system/linux-module.scm (linux-module-build)
(linux-module-build-cross): Likewise.
* guix/build-system/maven.scm (maven-build): Likewise.
* guix/build-system/minify.scm (minify-build): Likewise.
* guix/build-system/node.scm (node-build): Likewise.
* guix/build-system/qt.scm (qt-build, qt-cross-build): Likewise.
* guix/build-system/r.scm (r-build): Likewise.
* guix/build-system/rakudo.scm (rakudo-build): Likewise.
* guix/build-system/renpy.scm (renpy-build): Likewise.
* tests/builders.scm ("gnu-build"): Call 'store-lower' on 'gnu-build'.
Pass #:source parameter.
* tests/packages.scm ("search paths"): Use 'abort-to-prompt' instead of
a normal return from the 'build' method.
("package->bag, sensitivity to %current-target-system"): Change 'build'
to match the new build system signature.
squash! build-system: Rewrite using gexps.
squash! build-system: Rewrite using gexps.
2015-03-28 19:26:39 +01:00
|
|
|
source
|
2021-02-28 21:30:50 +01:00
|
|
|
(phases '%standard-phases)
|
2017-09-20 03:08:42 +02:00
|
|
|
(outputs '("out"))
|
|
|
|
(search-paths '())
|
2017-10-24 18:17:32 +02:00
|
|
|
(install-source? #t)
|
2017-09-20 03:08:42 +02:00
|
|
|
(import-path "")
|
|
|
|
(unpack-path "")
|
2020-01-05 17:13:20 +01:00
|
|
|
(build-flags ''())
|
2017-09-20 03:08:42 +02:00
|
|
|
(tests? #t)
|
2017-11-14 17:46:22 +01:00
|
|
|
(allow-go-reference? #f)
|
2017-09-20 03:08:42 +02:00
|
|
|
(system (%current-system))
|
2021-10-18 13:39:58 +02:00
|
|
|
(goarch #f)
|
|
|
|
(goos #f)
|
2017-09-20 03:08:42 +02:00
|
|
|
(guile #f)
|
|
|
|
(imported-modules %go-build-system-modules)
|
|
|
|
(modules '((guix build go-build-system)
|
2018-01-06 21:47:47 +01:00
|
|
|
(guix build union)
|
2021-12-14 02:11:47 +01:00
|
|
|
(guix build utils)))
|
|
|
|
(substitutable? #t))
|
2017-09-20 03:08:42 +02:00
|
|
|
(define builder
|
build-system: Rewrite using gexps.
* guix/packages.scm (expand-input): Remove 'store', 'system', and
'cross-system' parameters; add #:native?. Rewrite to return
name/gexp-input tuples.
(bag->derivation): Adjust accordingly. Lower (bag-build bag).
(bag->cross-derivation): Ditto. Instead of #:native-drvs and
#:target-drvs, pass #:build-inputs, #:host-inputs, and #:target-inputs.
(%derivation-cache): Remove.
* gnu/packages/bootstrap.scm (raw-build): Turn into a monadic procedure.
* gnu/packages/commencement.scm (glibc-final)[arguments]: Use
'gexp-input' for the #:allowed-references argument.
* guix/build-system/cmake.scm (cmake-build): Remove 'store' parameter.
Switch to the use of gexps and 'gexp->derivation'.
(lower): Remove #:source from 'private-keywords'.
* guix/build-system/glib-or-gtk.scm (glib-or-gtk-build, lower):
Likewise.
* guix/build-system/font.scm (font-build): Likewise.
* guix/build-system/gnu.scm (gnu-build): Likewise, and remove
'canonicalize-reference'.
(gnu-cross-build): Likewise, and expect #:build-inputs, #:host-inputs,
and #:target-inputs instead of #:native-drvs and #:target-drvs.
(lower): Likewise.
* guix/build-system/perl.scm (perl-build, lower): Likewise.
* guix/build-system/python.scm (python-build, lower): Likewise.
* guix/build-system/ruby.scm (ruby-build, lower): Likewise.
* guix/build-system/waf.scm (waf-build, lower): Likewise.
* guix/build-system/trivial.scm (guile-for-build): Remove.
(trivial-build): Remove 'store' parameter, change to gexps.
(trivial-cross-build): Ditto, and change to #:build-inputs & co.
* guix/build-system/cargo.scm (cargo-build): Change to 'gexp->derivation'.
* guix/build-system/copy.scm (copy-build): Likewise.
* guix/build-system/dune.scm (dune-build): Likewise.
* guix/build-system/guile.scm (guile-build, guile-cross-build):
Likewise.
* guix/build-system/meson.scm (meson-build): Likewise.
* guix/build-system/ocaml.scm (ocaml-build): Likewise.
* guix/build-system/scons.scm (scons-build): Likewise.
* guix/build-system/texlive.scm (texlive-build): Likewise.
* guix/build-system/android-ndk.scm (android-ndk-build): Likewise.
* guix/build-system/ant.scm (ant-build): Likewise.
* guix/build-system/asdf.scm (asdf-build/source, asdf-build): Likewise.
* guix/build-system/chicken.scm (chicken-build): Likewise.
* guix/build-system/clojure.scm (clojure-build): Likewise.
(source->output-path, maybe-guile->guile): Remove.
* guix/build-system/dub.scm (dub-build): Likewise.
* guix/build-system/emacs.scm (emacs-build): Likewise.
* guix/build-system/go.scm (go-build): Likewise.
* guix/build-system/haskell.scm (haskell-build): Likewise.
* guix/build-system/julia.scm (julia-build): Likewise.
* guix/build-system/linux-module.scm (linux-module-build)
(linux-module-build-cross): Likewise.
* guix/build-system/maven.scm (maven-build): Likewise.
* guix/build-system/minify.scm (minify-build): Likewise.
* guix/build-system/node.scm (node-build): Likewise.
* guix/build-system/qt.scm (qt-build, qt-cross-build): Likewise.
* guix/build-system/r.scm (r-build): Likewise.
* guix/build-system/rakudo.scm (rakudo-build): Likewise.
* guix/build-system/renpy.scm (renpy-build): Likewise.
* tests/builders.scm ("gnu-build"): Call 'store-lower' on 'gnu-build'.
Pass #:source parameter.
* tests/packages.scm ("search paths"): Use 'abort-to-prompt' instead of
a normal return from the 'build' method.
("package->bag, sensitivity to %current-target-system"): Change 'build'
to match the new build system signature.
squash! build-system: Rewrite using gexps.
squash! build-system: Rewrite using gexps.
2015-03-28 19:26:39 +01:00
|
|
|
(with-imported-modules imported-modules
|
|
|
|
#~(begin
|
|
|
|
(use-modules #$@modules)
|
|
|
|
(go-build #:name #$name
|
|
|
|
#:source #+source
|
|
|
|
#:system #$system
|
|
|
|
#:phases #$phases
|
|
|
|
#:outputs #$(outputs->gexp outputs)
|
2021-12-14 02:11:47 +01:00
|
|
|
#:substitutable? #$substitutable?
|
2021-09-17 01:25:52 +02:00
|
|
|
#:goarch #$goarch
|
|
|
|
#:goos #$goos
|
2021-02-28 21:30:50 +01:00
|
|
|
#:search-paths '#$(sexp->gexp
|
|
|
|
(map search-path-specification->sexp
|
|
|
|
search-paths))
|
build-system: Rewrite using gexps.
* guix/packages.scm (expand-input): Remove 'store', 'system', and
'cross-system' parameters; add #:native?. Rewrite to return
name/gexp-input tuples.
(bag->derivation): Adjust accordingly. Lower (bag-build bag).
(bag->cross-derivation): Ditto. Instead of #:native-drvs and
#:target-drvs, pass #:build-inputs, #:host-inputs, and #:target-inputs.
(%derivation-cache): Remove.
* gnu/packages/bootstrap.scm (raw-build): Turn into a monadic procedure.
* gnu/packages/commencement.scm (glibc-final)[arguments]: Use
'gexp-input' for the #:allowed-references argument.
* guix/build-system/cmake.scm (cmake-build): Remove 'store' parameter.
Switch to the use of gexps and 'gexp->derivation'.
(lower): Remove #:source from 'private-keywords'.
* guix/build-system/glib-or-gtk.scm (glib-or-gtk-build, lower):
Likewise.
* guix/build-system/font.scm (font-build): Likewise.
* guix/build-system/gnu.scm (gnu-build): Likewise, and remove
'canonicalize-reference'.
(gnu-cross-build): Likewise, and expect #:build-inputs, #:host-inputs,
and #:target-inputs instead of #:native-drvs and #:target-drvs.
(lower): Likewise.
* guix/build-system/perl.scm (perl-build, lower): Likewise.
* guix/build-system/python.scm (python-build, lower): Likewise.
* guix/build-system/ruby.scm (ruby-build, lower): Likewise.
* guix/build-system/waf.scm (waf-build, lower): Likewise.
* guix/build-system/trivial.scm (guile-for-build): Remove.
(trivial-build): Remove 'store' parameter, change to gexps.
(trivial-cross-build): Ditto, and change to #:build-inputs & co.
* guix/build-system/cargo.scm (cargo-build): Change to 'gexp->derivation'.
* guix/build-system/copy.scm (copy-build): Likewise.
* guix/build-system/dune.scm (dune-build): Likewise.
* guix/build-system/guile.scm (guile-build, guile-cross-build):
Likewise.
* guix/build-system/meson.scm (meson-build): Likewise.
* guix/build-system/ocaml.scm (ocaml-build): Likewise.
* guix/build-system/scons.scm (scons-build): Likewise.
* guix/build-system/texlive.scm (texlive-build): Likewise.
* guix/build-system/android-ndk.scm (android-ndk-build): Likewise.
* guix/build-system/ant.scm (ant-build): Likewise.
* guix/build-system/asdf.scm (asdf-build/source, asdf-build): Likewise.
* guix/build-system/chicken.scm (chicken-build): Likewise.
* guix/build-system/clojure.scm (clojure-build): Likewise.
(source->output-path, maybe-guile->guile): Remove.
* guix/build-system/dub.scm (dub-build): Likewise.
* guix/build-system/emacs.scm (emacs-build): Likewise.
* guix/build-system/go.scm (go-build): Likewise.
* guix/build-system/haskell.scm (haskell-build): Likewise.
* guix/build-system/julia.scm (julia-build): Likewise.
* guix/build-system/linux-module.scm (linux-module-build)
(linux-module-build-cross): Likewise.
* guix/build-system/maven.scm (maven-build): Likewise.
* guix/build-system/minify.scm (minify-build): Likewise.
* guix/build-system/node.scm (node-build): Likewise.
* guix/build-system/qt.scm (qt-build, qt-cross-build): Likewise.
* guix/build-system/r.scm (r-build): Likewise.
* guix/build-system/rakudo.scm (rakudo-build): Likewise.
* guix/build-system/renpy.scm (renpy-build): Likewise.
* tests/builders.scm ("gnu-build"): Call 'store-lower' on 'gnu-build'.
Pass #:source parameter.
* tests/packages.scm ("search paths"): Use 'abort-to-prompt' instead of
a normal return from the 'build' method.
("package->bag, sensitivity to %current-target-system"): Change 'build'
to match the new build system signature.
squash! build-system: Rewrite using gexps.
squash! build-system: Rewrite using gexps.
2015-03-28 19:26:39 +01:00
|
|
|
#:install-source? #$install-source?
|
|
|
|
#:import-path #$import-path
|
|
|
|
#:unpack-path #$unpack-path
|
|
|
|
#:build-flags #$build-flags
|
|
|
|
#:tests? #$tests?
|
|
|
|
#:allow-go-reference? #$allow-go-reference?
|
|
|
|
#:inputs #$(input-tuples->gexp inputs)))))
|
2017-09-20 03:08:42 +02:00
|
|
|
|
build-system: Rewrite using gexps.
* guix/packages.scm (expand-input): Remove 'store', 'system', and
'cross-system' parameters; add #:native?. Rewrite to return
name/gexp-input tuples.
(bag->derivation): Adjust accordingly. Lower (bag-build bag).
(bag->cross-derivation): Ditto. Instead of #:native-drvs and
#:target-drvs, pass #:build-inputs, #:host-inputs, and #:target-inputs.
(%derivation-cache): Remove.
* gnu/packages/bootstrap.scm (raw-build): Turn into a monadic procedure.
* gnu/packages/commencement.scm (glibc-final)[arguments]: Use
'gexp-input' for the #:allowed-references argument.
* guix/build-system/cmake.scm (cmake-build): Remove 'store' parameter.
Switch to the use of gexps and 'gexp->derivation'.
(lower): Remove #:source from 'private-keywords'.
* guix/build-system/glib-or-gtk.scm (glib-or-gtk-build, lower):
Likewise.
* guix/build-system/font.scm (font-build): Likewise.
* guix/build-system/gnu.scm (gnu-build): Likewise, and remove
'canonicalize-reference'.
(gnu-cross-build): Likewise, and expect #:build-inputs, #:host-inputs,
and #:target-inputs instead of #:native-drvs and #:target-drvs.
(lower): Likewise.
* guix/build-system/perl.scm (perl-build, lower): Likewise.
* guix/build-system/python.scm (python-build, lower): Likewise.
* guix/build-system/ruby.scm (ruby-build, lower): Likewise.
* guix/build-system/waf.scm (waf-build, lower): Likewise.
* guix/build-system/trivial.scm (guile-for-build): Remove.
(trivial-build): Remove 'store' parameter, change to gexps.
(trivial-cross-build): Ditto, and change to #:build-inputs & co.
* guix/build-system/cargo.scm (cargo-build): Change to 'gexp->derivation'.
* guix/build-system/copy.scm (copy-build): Likewise.
* guix/build-system/dune.scm (dune-build): Likewise.
* guix/build-system/guile.scm (guile-build, guile-cross-build):
Likewise.
* guix/build-system/meson.scm (meson-build): Likewise.
* guix/build-system/ocaml.scm (ocaml-build): Likewise.
* guix/build-system/scons.scm (scons-build): Likewise.
* guix/build-system/texlive.scm (texlive-build): Likewise.
* guix/build-system/android-ndk.scm (android-ndk-build): Likewise.
* guix/build-system/ant.scm (ant-build): Likewise.
* guix/build-system/asdf.scm (asdf-build/source, asdf-build): Likewise.
* guix/build-system/chicken.scm (chicken-build): Likewise.
* guix/build-system/clojure.scm (clojure-build): Likewise.
(source->output-path, maybe-guile->guile): Remove.
* guix/build-system/dub.scm (dub-build): Likewise.
* guix/build-system/emacs.scm (emacs-build): Likewise.
* guix/build-system/go.scm (go-build): Likewise.
* guix/build-system/haskell.scm (haskell-build): Likewise.
* guix/build-system/julia.scm (julia-build): Likewise.
* guix/build-system/linux-module.scm (linux-module-build)
(linux-module-build-cross): Likewise.
* guix/build-system/maven.scm (maven-build): Likewise.
* guix/build-system/minify.scm (minify-build): Likewise.
* guix/build-system/node.scm (node-build): Likewise.
* guix/build-system/qt.scm (qt-build, qt-cross-build): Likewise.
* guix/build-system/r.scm (r-build): Likewise.
* guix/build-system/rakudo.scm (rakudo-build): Likewise.
* guix/build-system/renpy.scm (renpy-build): Likewise.
* tests/builders.scm ("gnu-build"): Call 'store-lower' on 'gnu-build'.
Pass #:source parameter.
* tests/packages.scm ("search paths"): Use 'abort-to-prompt' instead of
a normal return from the 'build' method.
("package->bag, sensitivity to %current-target-system"): Change 'build'
to match the new build system signature.
squash! build-system: Rewrite using gexps.
squash! build-system: Rewrite using gexps.
2015-03-28 19:26:39 +01:00
|
|
|
(mlet %store-monad ((guile (package->derivation (or guile (default-guile))
|
|
|
|
system #:graft? #f)))
|
|
|
|
(gexp->derivation name builder
|
|
|
|
#:system system
|
|
|
|
#:guile-for-build guile)))
|
2017-09-20 03:08:42 +02:00
|
|
|
|
2021-11-18 22:32:25 +01:00
|
|
|
(define* (go-cross-build name
|
2021-04-26 20:13:06 +02:00
|
|
|
#:key
|
2021-11-18 22:32:25 +01:00
|
|
|
source target
|
|
|
|
build-inputs target-inputs host-inputs
|
|
|
|
(phases '%standard-phases)
|
2021-04-26 20:13:06 +02:00
|
|
|
(outputs '("out"))
|
|
|
|
(search-paths '())
|
|
|
|
(native-search-paths '())
|
|
|
|
(install-source? #t)
|
|
|
|
(import-path "")
|
|
|
|
(unpack-path "")
|
|
|
|
(build-flags ''())
|
2021-11-18 22:32:25 +01:00
|
|
|
(tests? #f) ; nothing can be done
|
2021-04-26 20:13:06 +02:00
|
|
|
(allow-go-reference? #f)
|
|
|
|
(system (%current-system))
|
|
|
|
(goarch (first (go-target target)))
|
|
|
|
(goos (last (go-target target)))
|
|
|
|
(guile #f)
|
|
|
|
(imported-modules %go-build-system-modules)
|
|
|
|
(modules '((guix build go-build-system)
|
|
|
|
(guix build union)
|
2021-12-14 02:11:47 +01:00
|
|
|
(guix build utils)))
|
|
|
|
(substitutable? #t))
|
2021-04-26 20:13:06 +02:00
|
|
|
"Cross-build NAME using GO, where TARGET is a GNU triplet and with INPUTS."
|
|
|
|
(define builder
|
2021-11-18 22:32:25 +01:00
|
|
|
#~(begin
|
|
|
|
(use-modules #$@(sexp->gexp modules))
|
2021-04-26 20:13:06 +02:00
|
|
|
|
2021-11-18 22:32:25 +01:00
|
|
|
(define %build-host-inputs
|
|
|
|
#+(input-tuples->gexp build-inputs))
|
2021-04-26 20:13:06 +02:00
|
|
|
|
2021-11-18 22:32:25 +01:00
|
|
|
(define %build-target-inputs
|
|
|
|
(append #$(input-tuples->gexp host-inputs)
|
|
|
|
#+(input-tuples->gexp target-inputs)))
|
|
|
|
|
|
|
|
(define %build-inputs
|
|
|
|
(append %build-host-inputs %build-target-inputs))
|
2021-04-26 20:13:06 +02:00
|
|
|
|
2021-11-18 22:32:25 +01:00
|
|
|
(define %outputs
|
|
|
|
#$(outputs->gexp outputs))
|
2021-04-26 20:13:06 +02:00
|
|
|
|
2021-11-18 22:32:25 +01:00
|
|
|
(go-build #:name #$name
|
|
|
|
#:source #+source
|
|
|
|
#:system #$system
|
|
|
|
#:phases #$phases
|
|
|
|
#:outputs %outputs
|
|
|
|
#:target #$target
|
|
|
|
#:goarch #$goarch
|
|
|
|
#:goos #$goos
|
|
|
|
#:inputs %build-target-inputs
|
|
|
|
#:native-inputs %build-host-inputs
|
|
|
|
#:search-paths '#$(map search-path-specification->sexp
|
|
|
|
search-paths)
|
|
|
|
#:native-search-paths '#$(map
|
|
|
|
search-path-specification->sexp
|
|
|
|
native-search-paths)
|
|
|
|
#:install-source? #$install-source?
|
|
|
|
#:import-path #$import-path
|
|
|
|
#:unpack-path #$unpack-path
|
|
|
|
#:build-flags #$build-flags
|
|
|
|
#:tests? #$tests?
|
|
|
|
#:allow-go-reference? #$allow-go-reference?
|
|
|
|
#:inputs %build-inputs)))
|
|
|
|
|
|
|
|
(mlet %store-monad ((guile (package->derivation (or guile (default-guile))
|
|
|
|
system #:graft? #f)))
|
|
|
|
(gexp->derivation name builder
|
|
|
|
#:system system
|
|
|
|
#:target target
|
|
|
|
#:graft? #f
|
|
|
|
#:substitutable? substitutable?
|
|
|
|
#:guile-for-build guile)))
|
2021-04-26 20:13:06 +02:00
|
|
|
|
2017-09-20 03:08:42 +02:00
|
|
|
(define go-build-system
|
|
|
|
(build-system
|
|
|
|
(name 'go)
|
|
|
|
(description
|
|
|
|
"Build system for Go programs")
|
|
|
|
(lower lower)))
|