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 c)
21 #:use-module (gnu packages gcc)
22 #:use-module (gnu packages glib)
23 #:use-module (guix build-system gnu)
24 #:use-module (guix git-download)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix packages))
36 (url "https://github.com/vlang/v")
38 (file-name (git-file-name name version))
40 (base32 "1d9qhacllvkqif42jaayixhjyhx7pzslh8p1yr5p19447q763fq1"))))
41 (build-system gnu-build-system)
43 '(#:tests? #f ; tests are broken in v 0.1.27
47 "GITFASTCLONE=mkdir -p"
50 ,(string-append "TMPVC=" (assoc-ref %build-inputs "vc"))
53 "V_ALWAYS_CLEAN_TMP=false")
55 (modify-phases %standard-phases
57 (add-before 'build 'patch-makefile
59 (substitute* "Makefile"
61 (("v self") "v -cc gcc cmd/v"))
63 ;; A few tests are broken in v 0.1.27. This function should be
64 ;; enabled to run tests in the next release.
67 ;; (let* ((tmpbin "tmp/bin")
68 ;; (gcc (which "gcc")))
70 ;; (symlink gcc (string-append tmpbin "/cc"))
71 ;; (setenv "PATH" (string-append tmpbin ":" (getenv "PATH")))
72 ;; (invoke "./v" "test-fixed"))
76 (let* ((bin (string-append (assoc-ref %outputs "out") "/bin"))
77 (tools (string-append bin "/cmd/tools"))
78 (thirdparty (string-append bin "/thirdparty"))
79 (vlib (string-append bin "/vlib"))
80 (vmod (string-append bin "/v.mod")))
82 (copy-file "./v" (string-append bin "/v"))
83 ;; v requires as of 0.1.27 that these other components are in the
84 ;; same directory. In a future release we may be able to move
85 ;; these into other output folders.
86 (copy-recursively "cmd/tools" tools)
87 (copy-recursively "thirdparty" thirdparty)
88 (copy-recursively "vlib" vlib)
89 (copy-file "v.mod" vmod))
96 ,(let ((vc-version "0884d7092f4c2a4f8ca16da6f1792efa235247be"))
97 ;; v bootstraps from generated c source code from a dedicated
98 ;; repository. It's readable, as generated source goes, and not at all
99 ;; obfuscated, and it's about 15kb. The original source written in
100 ;; golang is lost to the forces of entropy; modifying the generated c
101 ;; source by hand has been a commonly used technique for iterating on
106 (url "https://github.com/vlang/vc")
107 (commit vc-version)))
108 (file-name (git-file-name "vc" vc-version))
110 (base32 "17bs09iwxfd0si70j48n9nd16gfgcj8imd0azypk3xzzbz4wybnz")))))))
111 (home-page "https://vlang.io/")
112 (synopsis "Compiler for the V programming language")
114 "V is a systems programming language. It provides memory safety and thread
115 safety guarantees with minimal abstraction.")
116 (license license:expat)))