[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnu: Add Go build system.

From: Leo Famulari
Subject: Re: gnu: Add Go build system.
Date: Thu, 15 Dec 2016 21:05:26 -0500
User-agent: Mutt/1.7.1 (2016-10-04)

On Sun, Dec 11, 2016 at 01:17:48AM +0100, Petter wrote:
> I've made an attempt at making a build system for Go. It seems to
> work, but it's not pretty. My Guix/Guile skills are bad, so keep your
> expectations to a minimum. Consider it something where there was
> nothing.

Thank you for working on this!

> I started with a copy of the GNU build system, removed code I felt
> wasn't necessary, then adapted to Go's needs. Note, comments and those
> first text string after a (define) have not been updated. Unnecessary
> #:use-modules have not been removed. In short, it's bad and there's a
> lot to do make it ok-ish. That's where you come in :)

I haven't contributed or carefully studied the other build systems yet,
so my feedback will be rather superficial. I hope somebody with some
more knowledge will jump in :)

> Subject: [PATCH] gnu: Add Go build system.
> * guix/build-system/go.scm: New file
> * guix/build/go-build-system.scm: New file.

> diff --git a/guix/build/go-build-system.scm b/guix/build/go-build-system.scm

> +(define* (build #:key import-path #:allow-other-keys)
> +  (system* "go" "install" import-path))
> +
> +(define* (install #:key inputs outputs #:allow-other-keys)
> +  (copy-recursively "bin" (string-append (assoc-ref outputs "out") "/bin"))
> +  (copy-recursively "pkg" (string-append (assoc-ref outputs "out") "/pkg"))
> +  (copy-recursively "src" (string-append (assoc-ref outputs "out") "/src")))

It looks like `go install` knows "where" to install the files, but
installs them in the wrong place, and then we copy them into place in
the install phase. I think it's inefficient to move the files twice.

Can the build phase use something like `go build`, followed by the
install phase using `go install` to move the files directly to the
package's output directory in /gnu/store?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]