Received: (at 74374) by debbugs.gnu.org; 9 Dec 2024 18:51:41 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 09 13:51:41 2024 Received: from localhost ([127.0.0.1]:55623 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tKir7-0006Ne-8S for submit <at> debbugs.gnu.org; Mon, 09 Dec 2024 13:51:41 -0500 Received: from mail-lj1-f169.google.com ([209.85.208.169]:47518) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <sharlatanus@HIDDEN>) id 1tKir1-0006NG-07 for 74374 <at> debbugs.gnu.org; Mon, 09 Dec 2024 13:51:39 -0500 Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-300479ca5c6so20536121fa.3 for <74374 <at> debbugs.gnu.org>; Mon, 09 Dec 2024 10:51:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733770234; x=1734375034; darn=debbugs.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=DjK5aHSe0AZXWoOUcTmPAd2viagIwQgc0ZTE8k3m0zU=; b=eFNhtdZ9DY2ZUbCBZy9B8PiEbQI0uUEz+1bjFJozWqrGPeYHFJjxExQF2EMIgQHHuN vAyupY2JtUFtfbw7Znd9cb87xwgdCJz8ZrKjIvK9mc2V8ZLbf4ZecyzenZ77g8Z3nB8F x+9EkYrit9oXJ9MZSWig9lXmJLwcvCK2+KwbPIkH4dnellEOYjzu78iz6kOzgYbZ5oPX ZX2OMCV/4ALACdAqjiuhoS2ZfpzT9xdk+7kF54YZE/6t6pJiIcsRxPei+bIZZBSyju7Z 2Sx6mexw66M2Tx7zo6jiXfNHYHfSVsd8cQuFwBxfsLMfC0o8ZCOFRWU7MXHMEOKeGZjb eTDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733770234; x=1734375034; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=DjK5aHSe0AZXWoOUcTmPAd2viagIwQgc0ZTE8k3m0zU=; b=DzKvxGvluG/uX+XpnwuzaTbbLS/67aYD5/itHv+tmatATy3F0EeqLc6eNcCf7RqvGU A+hr7zPhy1IAbDm32Ttf8oZSHtY4zW4vCdozuxDmJQgzi0wdUY8evrLr85nNZm1h0gUz MsCLEMtoKElgs7lB3c95v7zZMC7pmfgDCA+yEN/6rctjBW1Cjisq9zasKBYrNk5P/ax2 4GCMgtxQHlcg7McCkYSh1bmFgY0mSJ3pEpI8ki7s5wTi4wYLUWvIeTYU2UwmoxfSYa3I sYlZ5itpHMIxouQQO7rqyqiKNrjUmKET9tSbLYZCrg3P9xw40+rd8sYHu6DPA2K6XAkM fxSw== X-Gm-Message-State: AOJu0Ywqot1RVXM/QsDhEyO/W3u+EHaKhH8rnqEK0NouOitjhT/eRtNc qls0aPpHPmvuDjC5ag/f9YVb5ZuLFTFjrs79rr9cYx8nDwqrHdSPCvOAm08NSMOEzzkOgpnPOO2 UFvmtjcsQEWi60Vi86g5C7a7MAksuiw== X-Gm-Gg: ASbGncu/C90v9QAbedM8Vv08deJqtEeI1Q9aTNMdBdwOM3MBXm4TApXapM5QDuRuKzL +jpf3bVx9EoKEk5LDSHYPs/iiPF/6NWQ= X-Google-Smtp-Source: AGHT+IE8WOHlydg0KkoRNVHarZA19QJSewmPAuiqOaqKwaU7swp2S7Ic4bUHRoajtolvV5zHYzfcQzNAiogRCKUwi8I= X-Received: by 2002:a05:651c:996:b0:2ff:d49f:dd4b with SMTP id 38308e7fff4ca-3022fb4e932mr4131191fa.15.1733770233807; Mon, 09 Dec 2024 10:50:33 -0800 (PST) MIME-Version: 1.0 From: Sharlatan Hellseher <sharlatanus@HIDDEN> Date: Mon, 9 Dec 2024 18:50:22 +0000 Message-ID: <CAO+9K5pJfQSEPbZ7ju7YgrKbHY8TgPfEzMiJUHBkcpj=P-jM0A@HIDDEN> Subject: [PATCH 2/4] guix: add go module aware build system To: 74374 <at> debbugs.gnu.org Content-Type: multipart/alternative; boundary="000000000000e889860628dad693" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74374 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --000000000000e889860628dad693 Content-Type: text/plain; charset="UTF-8" Hi, I try to work on this, which issue or problem did you solve with this variant of go-build-system? Thanks, Oleg --000000000000e889860628dad693 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto">Hi,<div dir=3D"auto"><br></div><div dir=3D"auto">I try to= work on this, which issue or problem did you solve=C2=A0</div><div dir=3D"= auto">with this variant of go-build-system?</div><div dir=3D"auto"><br></di= v><div dir=3D"auto">Thanks,</div><div dir=3D"auto">Oleg=C2=A0</div></div> --000000000000e889860628dad693--
guix-patches@HIDDEN
:bug#74374
; Package guix-patches
.
Full text available.Received: (at submit) by debbugs.gnu.org; 15 Nov 2024 21:11:51 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 15 16:11:51 2024 Received: from localhost ([127.0.0.1]:51081 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tC3ba-0000F9-O7 for submit <at> debbugs.gnu.org; Fri, 15 Nov 2024 16:11:51 -0500 Received: from lists.gnu.org ([209.51.188.17]:48722) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <j@HIDDEN>) id 1tC3bT-0000EX-2l for submit <at> debbugs.gnu.org; Fri, 15 Nov 2024 16:11:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <j@HIDDEN>) id 1tC3bN-0002Br-Tm for guix-patches@HIDDEN; Fri, 15 Nov 2024 16:11:37 -0500 Received: from mx.kolabnow.com ([212.103.80.155]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <j@HIDDEN>) id 1tC3bE-00066J-1T for guix-patches@HIDDEN; Fri, 15 Nov 2024 16:11:31 -0500 Received: from localhost (unknown [127.0.0.1]) by mx.kolabnow.com (Postfix) with ESMTP id 76A9220B3656 for <guix-patches@HIDDEN>; Fri, 15 Nov 2024 22:11:18 +0100 (CET) Authentication-Results: ext-mx-out011.mykolab.com (amavis); dkim=pass (2048-bit key) reason="pass (just generated, assumed good)" header.d=kolabnow.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kolabnow.com; h= content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:date:subject:subject:from:from:received :received:received; s=dkim20240523; t=1731705075; x=1733519476; bh=/Tam8bTEpdah4I/zAuQauL0yU7P6UfKtDyyJgKinirU=; b=mlQ13lq4hd9z dhcXLTT4yfyXal1Stck3vN3Ql6bL90IBQsc35Pa8jQlVMUqkFk4TYQBeSVxxp8Yq 2FGBUBYeYWnS7Sdwhl9PM7zakYe2BZn54+XnerflwqfIlZWIaD5uaEckEjyqy3KU xcW0cnKAvi7pdPN+y/YeVRNs8wKlECaQLC1e44L2svemIsKl9SrIJkNZCBZwfush cTiQeGjULmcdS+L1vXYdG0ZWXrXd8udfG7TeUqsCh+ifjEKIkGY0tU9KjZ5Int81 XBBOBF0OOrjd5qstCHBiXGe7So8QkJRnguWBropXUsk4wMGeRNWxm/wmc3V8QADC KKnieru8cQ== X-Virus-Scanned: amavis at mykolab.com X-Spam-Flag: NO X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-1 tagged_above=-10 required=5 tests=[ALL_TRUSTED=-1] autolearn=ham autolearn_force=no Received: from mx.kolabnow.com ([127.0.0.1]) by localhost (ext-mx-out011.mykolab.com [127.0.0.1]) (amavis, port 10024) with ESMTP id TrsSp77ntU42 for <guix-patches@HIDDEN>; Fri, 15 Nov 2024 22:11:15 +0100 (CET) Received: from int-mx009.mykolab.com (unknown [10.9.13.9]) by mx.kolabnow.com (Postfix) with ESMTPS id 5DCA820B3658 for <guix-patches@HIDDEN>; Fri, 15 Nov 2024 22:11:15 +0100 (CET) Received: from ext-subm010.mykolab.com (unknown [10.9.6.10]) by int-mx009.mykolab.com (Postfix) with ESMTPS id 3141D2097183 for <guix-patches@HIDDEN>; Fri, 15 Nov 2024 22:11:15 +0100 (CET) From: =?UTF-8?q?J=C3=B8rgen=20Kvalsvik?= <j@HIDDEN> To: guix-patches@HIDDEN Subject: [PATCH 2/4] guix: add go module aware build system Date: Fri, 15 Nov 2024 22:11:04 +0100 Message-Id: <20241115211106.2759121-3-j@HIDDEN> In-Reply-To: <20241115211106.2759121-1-j@HIDDEN> References: <20241115211106.2759121-1-j@HIDDEN> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=212.103.80.155; envelope-from=j@HIDDEN; helo=mx.kolabnow.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?J=C3=B8rgen=20Kvalsvik?= <j@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.4 (--) Add a go module aware build system, and make it available through build-system/go.scm. The go-mod-build and supporting functions is largely a copy-and-paste job of the go-build and could probably be refactored. The build process when using go modules is slightly different from the non-module version, and relies on sources already being fetched with go-mod-fetch. This revision does not do anything clever with reusing compiled packages, but it might be possible to store precompiled modules to the store path without adding explicit entries in golang-*.scm * guix/build-system/go.scm (%go-mod-build-system-modules): New define. (mod-lower): New function. (go-mod-build): New function. (go-mod-build-system): New function. * guix/build-system/go-mod-build-system.scm: New file. * gnu/local.mk: Register it. Change-Id: I394089073b894e8cf9da5aa18759c939fca45a31 --- Makefile.am | 1 + guix/build-system/go.scm | 120 ++++++++++++++++++++++ guix/build/go-mod-build-system.scm | 154 +++++++++++++++++++++++++++++ 3 files changed, 275 insertions(+) create mode 100644 guix/build/go-mod-build-system.scm diff --git a/Makefile.am b/Makefile.am index fc00947f4f..5768b721aa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -226,6 +226,7 @@ MODULES = \ guix/build/minify-build-system.scm \ guix/build/font-build-system.scm \ guix/build/go-build-system.scm \ + guix/build/go-mod-build-system.scm \ guix/build/android-repo.scm \ guix/build/asdf-build-system.scm \ guix/build/bzr.scm \ diff --git a/guix/build-system/go.scm b/guix/build-system/go.scm index 226688f2d2..1e60fd9471 100644 --- a/guix/build-system/go.scm +++ b/guix/build-system/go.scm @@ -38,6 +38,8 @@ (define-module (guix build-system go) #:export (%go-build-system-modules go-build go-build-system + go-mod-build + go-mod-build-system go-pseudo-version? go-target @@ -117,6 +119,12 @@ (define %go-build-system-modules (guix build union) ,@%default-gnu-imported-modules)) +(define %go-mod-build-system-modules + ;; Build-side modules imported and used by default. + `((guix build go-mod-build-system) + (guix build union) + ,@%default-gnu-imported-modules)) + (define (default-go) ;; Lazily resolve the binding to avoid a circular dependency. (let ((go (resolve-interface '(gnu packages golang)))) @@ -181,6 +189,57 @@ (define inputs-with-cache (build (if target go-cross-build go-build)) (arguments (strip-keyword-arguments private-keywords arguments)))) +(define* (mod-lower name + #:key source inputs native-inputs outputs system target + (go (if (supported-package? (default-go)) + (default-go) + (default-gccgo))) + #:allow-other-keys + #:rest arguments) + "Return a bag for NAME." + (define private-keywords + '(#:target #:go #:inputs #:native-inputs)) + + (define inputs-with-cache + ;; XXX: Avoid a circular dependency. This should be rewritten with + ;; 'package-mapping' or similar. + (let ((go-std-name (string-append (package-name go) "-std"))) + (if (string-prefix? go-std-name name) + inputs + (cons `(,go-std-name ,((make-go-std) go)) inputs)))) + + (bag + (name name) + (system system) + (target target) + (build-inputs `(,@(if source + `(("source" ,source)) + '()) + ,@`(("go" ,go)) + ,@native-inputs + ,@(if target '() inputs-with-cache) + ,@(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-with-cache '())) + + ;; 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 go-mod-build) + (arguments (strip-keyword-arguments private-keywords arguments)))) + (define* (go-build name inputs #:key source @@ -310,9 +369,70 @@ (define %outputs #:substitutable? substitutable? #:guile-for-build guile))) +(define* (go-mod-build name inputs + #:key + source + (phases '%standard-phases) + (outputs '("out")) + (search-paths '()) + (install-source? #t) + (import-path "") + (unpack-path "") + (build-flags ''()) + (tests? #t) + (parallel-build? #t) + (parallel-tests? #t) + (allow-go-reference? #f) + (system (%current-system)) + (goarch #f) + (goos #f) + (guile #f) + (imported-modules %go-mod-build-system-modules) + (modules '((guix build go-mod-build-system) + (guix build union) + (guix build utils))) + (substitutable? #t)) + (define builder + (with-imported-modules imported-modules + #~(begin + (use-modules #$@modules) + (go-build #:name #$name + #:source #+source + #:system #$system + #:phases #$phases + #:outputs #$(outputs->gexp outputs) + #:substitutable? #$substitutable? + #:goarch #$goarch + #:goos #$goos + #:search-paths '#$(sexp->gexp + (map search-path-specification->sexp + search-paths)) + #:install-source? #$install-source? + #:import-path #$import-path + #:unpack-path #$unpack-path + #:build-flags #$build-flags + #:tests? #$tests? + #:parallel-build? #$parallel-build? + #:parallel-tests? #$parallel-tests? + #:allow-go-reference? #$allow-go-reference? + #:inputs #$(input-tuples->gexp inputs))))) + + (mlet %store-monad ((guile (package->derivation (or guile (default-guile)) + system #:graft? #f))) + (gexp->derivation name builder + #:system system + #:guile-for-build guile))) + (define go-build-system (build-system (name 'go) (description "Build system for Go programs") (lower lower))) + +(define go-mod-build-system + (build-system + (name 'go) + (description + "Build system for Go programs, module aware") + (lower mod-lower))) diff --git a/guix/build/go-mod-build-system.scm b/guix/build/go-mod-build-system.scm new file mode 100644 index 0000000000..80a43a6a60 --- /dev/null +++ b/guix/build/go-mod-build-system.scm @@ -0,0 +1,154 @@ +;;; GNU Guix --- Functional package management for GNU +;;; +;;; 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 go-mod-build-system) + #:use-module ((guix build gnu-build-system) #:prefix gnu:) + #:use-module (guix build utils) + #:use-module (ice-9 match) + #:export (%standard-phases + go-build)) + +;; Commentary: +;; +;; Build procedures for Go packages, using go modules. This is the +;; builder-side code. +;; +;; Software written in Go is either a 'package' (i.e. library) or 'command' +;; (i.e. executable). The module approach is currently heavily biased towards +;; building executables. +;; +;; Unlike the go build system, this builder does not rely on the workspace +;; or GOPATH, but instead assumes all modules are a part of the input source +;; (otherwise, go build tries to download it which would fail). Go projects +;; rigidly specify dependencies which is handled by the sources being resolved +;; and downloaded together. The compiler is fast enough that building +;; everything from source on a per-package basis is not a great speed loss, +;; and the benefit from precompiling libraries is reduced by go statically +;; linking everything anyway. +;; +;; TODO: +;; * Re-use compiled packages +;; +;; Code: + +(define* (setup-go-environment #:key inputs outputs import-path goos goarch + #:allow-other-keys) + "Prepare a Go build environment. We need to tell go to use the specific +toolchain even if a module specifies a (slightly) newer one. We must also +tell the go build command where to find downloaded packages (go/pkg) and +where executables (\"commands\") are installed to." + (let* ((mod-cache (string-append (getcwd) "/go/pkg")) + (src-dir (string-append (getcwd) "/source")) + (go-dir (assoc-ref inputs "go")) + (out-dir (assoc-ref outputs "out"))) + + ;; TODO: Get toolchain from the program itself or package.version, not the + ;; store path + (setenv "GOTOOLCHAIN" (string-delete #\- (strip-store-file-name go-dir))) + (setenv "GOMODCACHE" mod-cache) + (setenv "GOCACHE" (string-append (getcwd) "/go/cache")) + (setenv "GOBIN" (string-append out-dir "/bin")) + (setenv "GO111MODULE" "on") + (setenv "GOARCH" (or goarch (getenv "GOHOSTARCH"))) + (setenv "GOOS" (or goos (getenv "GOHOSTOS"))) + (match goarch + ("arm" + (setenv "GOARM" "7")) + ((or "mips" "mipsel") + (setenv "GOMIPS" "hardfloat")) + ((or "mips64" "mips64le") + (setenv "GOMIPS64" "hardfloat")) + ((or "ppc64" "ppc64le") + (setenv "GOPPC64" "power8")) + (_ #t)))) + +(define* (build #:key import-path build-flags (parallel-build? #t) + #:allow-other-keys) + "Build the package named by IMPORT-PATH." + (let* ((njobs (if parallel-build? (parallel-job-count) 1))) + (setenv "GOMAXPROCS" (number->string njobs))) + + (with-throw-handler + #t + (lambda _ + ;; TODO: This should maybe support list to install multiple commands + ;; from the same project in the same package + (with-directory-excursion (string-append "source/" import-path) + (apply invoke "go" "build" + "-v" ; print the name of packages as they are compiled + "-x" ; print each command as it is invoked + ;; Respectively, strip the symbol table and debug + ;; information, and the DWARF symbol table. + "-ldflags=-s -w" + `(,@build-flags)))) + (lambda (key . args) + (display (string-append "Building '" import-path "' failed.\n" + "Here are the results of `go env`:\n")) + (invoke "go" "env")))) + +(define* (check #:key tests? import-path (parallel-tests? #t) + #:allow-other-keys) + "Run the tests for the package named by IMPORT-PATH." + (when tests? + (let* ((njobs (if parallel-tests? (parallel-job-count) 1))) + (setenv "GOMAXPROCS" (number->string njobs))) + (with-directory-excursion (string-append "source/" import-path) + (invoke "go" "test"))) + #t) + +(define* (install #:key install-source? source outputs import-path + #:allow-other-keys) + (with-directory-excursion (string-append "source/" import-path) + (display "INSTALLING PROGRAM\n") + (invoke "go" "install" + "-v" ; print the name of packages as they are compiled + "-x" ; print each command as it is invoked + ;; Respectively, strip the symbol table and debug + ;; information, and the DWARF symbol table. + "-ldflags=-s -w")) + + ;; TODO: This is probably less interesting when using the go-mod builder + (when install-source? + (let* ((out (assoc-ref outputs "out")) + (src (string-append source "/source")) + (dest (string-append out "/src"))) + (mkdir-p dest) + (copy-recursively src dest #:keep-mtime? #t))) + #t) + +(define* (install-license-files #:rest args) + "Install license files matching LICENSE-FILE-REGEXP to 'share/doc'. Adjust +the standard install-license-files phase to first enter the correct directory." + (with-directory-excursion "source" + (apply (assoc-ref gnu:%standard-phases 'install-license-files) args))) + + +(define %standard-phases + (modify-phases gnu:%standard-phases + (delete 'bootstrap) + (delete 'configure) + (delete 'patch-generated-file-shebangs) + (add-before 'build 'setup-go-environment setup-go-environment) + (replace 'build build) + (replace 'check check) + (replace 'install install) + (replace 'install-license-files install-license-files))) + +(define* (go-build #:key inputs (phases %standard-phases) + #:allow-other-keys #:rest args) + "Build the given Go package, applying all of PHASES in order." + (apply gnu:gnu-build #:inputs inputs #:phases phases args)) -- 2.39.5
Jørgen Kvalsvik <j@HIDDEN>
:guix-patches@HIDDEN
.
Full text available.guix-patches@HIDDEN
:bug#74374
; Package guix-patches
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.