Subject: [PATCH 1/1] gnu: vlang: Build included tools at package time.

From: Ryan Prior <[email-masked]>
Date: Tue, 06 Oct 2020 05:03:41 +0000

* gnu/packages/vlang.scm (vlang): Updates build stages.
  - Moves the cc-patching logic out of check into an explicit "patch-cc" stage
  - Adds "build-tools" stage to pre-build the included tools
---
 gnu/packages/vlang.scm | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/vlang.scm b/gnu/packages/vlang.scm
index 6f6aa79ce5..47060934d4 100644
--- a/gnu/packages/vlang.scm
+++ b/gnu/packages/vlang.scm
@@ -22,6 +22,7 @@
   #:use-module (gnu packages node)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages version-control)
   #:use-module (gnu packages xorg)
   #:use-module (guix build-system gnu)
   #:use-module (guix git-download)
@@ -61,6 +62,18 @@
               (("rm -rf") "true")
               (("v self") "v -cc gcc cmd/v"))
             #t))
+        (add-after 'build 'patch-cc
+          (lambda _
+            (let* ((bin "tmp/bin")
+                   (gcc (which "gcc")))
+              (mkdir-p bin)
+              (symlink gcc (string-append bin "/cc"))
+              (setenv "PATH" (string-append bin ":" (getenv "PATH")))
+              #t)))
+        (add-after 'patch-cc 'build-tools
+          (lambda _
+            (invoke "./v" "build-tools" "-v")
+            #t))
         (add-before 'check 'delete-failing-tests
           ;; XXX As always, these should eventually be fixed and run.
           (lambda _
@@ -74,13 +87,8 @@
             #t))
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
-            (let* ((bin "tmp/bin")
-                   (gcc (which "gcc")))
-              (when tests?
-                (mkdir-p bin)
-                (symlink gcc (string-append bin "/cc"))
-                (setenv "PATH" (string-append bin ":" (getenv "PATH")))
-                (invoke "./v" "test-fixed")))
+            (when tests?
+              (invoke "./v" "test-fixed"))
             #t))
         (replace 'install
           (lambda _
@@ -121,6 +129,9 @@
             (sha256
              (base32 "052gp5q2k31r3lci3rx4k0vy0vjdjva64xvrbbihn8lgmw63lc9f")))))
 
+      ;; For build-tools
+      ("git" ,git)
+
       ;; For the tests.
       ("libx11" ,libx11)
       ("node" ,node)
-- 
2.17.1