1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com>
3 ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages vlang)
22 #:use-module (gnu packages glib)
23 #:use-module (gnu packages node)
24 #:use-module (gnu packages sqlite)
25 #:use-module (gnu packages tls)
26 #:use-module (gnu packages xorg)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix git-download)
29 #:use-module ((guix licenses) #:prefix license:)
30 #:use-module (guix utils)
31 #:use-module (guix packages))
41 (url "https://github.com/vlang/v")
43 (file-name (git-file-name name version))
45 (base32 "1rqi7cah5nq8aggrib9xvdpfjxq20li91svv0w9yny6nn1ag7snx"))))
46 (build-system gnu-build-system)
49 (list (string-append "CC=" ,(cc-for-target))
51 (string-append "VC=" (assoc-ref %build-inputs "vc"))
53 "GITFASTCLONE=mkdir -p"
58 (modify-phases %standard-phases
60 (add-before 'build 'patch-makefile
62 (substitute* "Makefile"
64 (("v self") (string-append "v -cc " ,(cc-for-target) " cmd/v")))
66 (add-before 'check 'delete-failing-tests
67 ;; XXX As always, these should eventually be fixed and run.
70 '("vlib/v/gen/x64/tests/x64_test.v"
71 "vlib/v/tests/repl/repl_test.v"
72 "vlib/v/tests/valgrind/valgrind_test.v"
73 "vlib/v/tests/valgrind/strings_and_arrays.vv"
74 "vlib/v/tests/live_test.v"
75 "vlib/net/websocket/ws_test.v"))
78 (lambda* (#:key tests? #:allow-other-keys)
79 (let* ((bin "tmp/bin")
83 (symlink gcc (string-append bin "/cc"))
84 (setenv "PATH" (string-append bin ":" (getenv "PATH")))
85 (invoke "./v" "test-fixed")))
88 (lambda* (#:key outputs #:allow-other-keys)
89 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
90 (tools (string-append bin "/cmd/tools"))
91 (thirdparty (string-append bin "/thirdparty"))
92 (vlib (string-append bin "/vlib"))
93 (vmod (string-append bin "/v.mod")))
95 (copy-file "./v" (string-append bin "/v"))
96 ;; v requires as of 0.1.27 that these other components are in the
97 ;; same directory. In a future release we may be able to move
98 ;; these into other output folders.
99 (copy-recursively "cmd/tools" tools)
100 (copy-recursively "thirdparty" thirdparty)
101 (copy-recursively "vlib" vlib)
102 (copy-file "v.mod" vmod))
108 ;; Versions are not consistently tagged, but the matching commit will
109 ;; probably have ‘v0.x.y’ in the commit message.
110 ,(let ((vc-version "b01d0fcda4b55861baa4be82e307cca4834b1641"))
111 ;; v bootstraps from generated c source code from a dedicated
112 ;; repository. It's readable, as generated source goes, and not at all
113 ;; obfuscated, and it's about 15kb. The original source written in
114 ;; golang is lost to the forces of entropy; modifying the generated c
115 ;; source by hand has been a commonly used technique for iterating on
120 (url "https://github.com/vlang/vc")
121 (commit vc-version)))
122 (file-name (git-file-name "vc" vc-version))
124 (base32 "052gp5q2k31r3lci3rx4k0vy0vjdjva64xvrbbihn8lgmw63lc9f")))))
131 (home-page "https://vlang.io/")
132 (synopsis "Compiler for the V programming language")
134 "V is a systems programming language. It provides memory safety and thread
135 safety guarantees with minimal abstraction.")
136 (license license:expat)))
139 ;; We used to provide 'vlang' under the name 'v'.
140 (deprecated-package "v" vlang))