1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (gnu packages vlang)
20 #:use-module (gnu packages glib)
21 #:use-module (guix build-system gnu)
22 #:use-module (guix git-download)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages))
34 (url "https://github.com/vlang/v")
36 (file-name (git-file-name name version))
38 (base32 "1d9qhacllvkqif42jaayixhjyhx7pzslh8p1yr5p19447q763fq1"))))
39 (build-system gnu-build-system)
41 '(#:tests? #f ; tests are broken in v 0.1.27
45 "GITFASTCLONE=mkdir -p"
48 ,(string-append "TMPVC=" (assoc-ref %build-inputs "vc"))
51 "V_ALWAYS_CLEAN_TMP=false")
53 (modify-phases %standard-phases
55 (add-before 'build 'patch-makefile
57 (substitute* "Makefile"
59 (("v self") "v -cc gcc cmd/v"))
61 ;; A few tests are broken in v 0.1.27. This function should be
62 ;; enabled to run tests in the next release.
65 ;; (let* ((tmpbin "tmp/bin")
66 ;; (gcc (which "gcc")))
68 ;; (symlink gcc (string-append tmpbin "/cc"))
69 ;; (setenv "PATH" (string-append tmpbin ":" (getenv "PATH")))
70 ;; (invoke "./v" "test-fixed"))
74 (let* ((bin (string-append (assoc-ref %outputs "out") "/bin"))
75 (tools (string-append bin "/cmd/tools"))
76 (thirdparty (string-append bin "/thirdparty"))
77 (vlib (string-append bin "/vlib"))
78 (vmod (string-append bin "/v.mod")))
80 (copy-file "./v" (string-append bin "/v"))
81 ;; v requires as of 0.1.27 that these other components are in the
82 ;; same directory. In a future release we may be able to move
83 ;; these into other output folders.
84 (copy-recursively "cmd/tools" tools)
85 (copy-recursively "thirdparty" thirdparty)
86 (copy-recursively "vlib" vlib)
87 (copy-file "v.mod" vmod))
93 ,(let ((vc-version "0884d7092f4c2a4f8ca16da6f1792efa235247be"))
94 ;; v bootstraps from generated c source code from a dedicated
95 ;; repository. It's readable, as generated source goes, and not at all
96 ;; obfuscated, and it's about 15kb. The original source written in
97 ;; golang is lost to the forces of entropy; modifying the generated c
98 ;; source by hand has been a commonly used technique for iterating on
103 (url "https://github.com/vlang/vc")
104 (commit vc-version)))
105 (file-name (git-file-name "vc" vc-version))
107 (base32 "17bs09iwxfd0si70j48n9nd16gfgcj8imd0azypk3xzzbz4wybnz")))))))
108 (home-page "https://vlang.io/")
109 (synopsis "Compiler for the V programming language")
111 "V is a systems programming language. It provides memory safety and thread
112 safety guarantees with minimal abstraction.")
113 (license license:expat)))