Commit | Line | Data |
---|---|---|
aeefe531 RP |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com> | |
3 | ;;; | |
4 | ;;; This file is part of GNU Guix. | |
5 | ;;; | |
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. | |
10 | ;;; | |
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. | |
15 | ;;; | |
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/>. | |
18 | ||
19 | (define-module (gnu packages vlang) | |
aeefe531 RP |
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)) | |
25 | ||
26 | (define-public v | |
27 | (package | |
28 | (name "v") | |
29 | (version "0.1.27") | |
30 | (source | |
31 | (origin | |
32 | (method git-fetch) | |
33 | (uri (git-reference | |
b0e7b699 | 34 | (url "https://github.com/vlang/v") |
aeefe531 RP |
35 | (commit version))) |
36 | (file-name (git-file-name name version)) | |
37 | (sha256 | |
38 | (base32 "1d9qhacllvkqif42jaayixhjyhx7pzslh8p1yr5p19447q763fq1")))) | |
39 | (build-system gnu-build-system) | |
40 | (arguments | |
41 | '(#:tests? #f ; tests are broken in v 0.1.27 | |
42 | #:make-flags | |
43 | `("CC=gcc" | |
44 | "GITCLEANPULL=true" | |
45 | "GITFASTCLONE=mkdir -p" | |
46 | "TCCREPO=" | |
47 | "TMPTCC=tcc" | |
48 | ,(string-append "TMPVC=" (assoc-ref %build-inputs "vc")) | |
49 | "VCREPO=" | |
50 | "VERBOSE=1" | |
51 | "V_ALWAYS_CLEAN_TMP=false") | |
52 | #:phases | |
53 | (modify-phases %standard-phases | |
54 | (delete 'configure) | |
55 | (add-before 'build 'patch-makefile | |
56 | (lambda _ | |
57 | (substitute* "Makefile" | |
58 | (("rm -rf") "true") | |
59 | (("v self") "v -cc gcc cmd/v")) | |
60 | #t)) | |
61 | ;; A few tests are broken in v 0.1.27. This function should be | |
62 | ;; enabled to run tests in the next release. | |
63 | ;; (replace 'check | |
64 | ;; (lambda _ | |
65 | ;; (let* ((tmpbin "tmp/bin") | |
66 | ;; (gcc (which "gcc"))) | |
67 | ;; (mkdir-p tmpbin) | |
68 | ;; (symlink gcc (string-append tmpbin "/cc")) | |
69 | ;; (setenv "PATH" (string-append tmpbin ":" (getenv "PATH"))) | |
70 | ;; (invoke "./v" "test-fixed")) | |
71 | ;; #t)) | |
72 | (replace 'install | |
73 | (lambda _ | |
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"))) | |
79 | (mkdir-p bin) | |
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)) | |
88 | #t))))) | |
89 | (inputs | |
d4167233 | 90 | `(("glib" ,glib))) |
aeefe531 RP |
91 | (native-inputs |
92 | `(("vc" | |
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 | |
99 | ;; the codebase. | |
100 | (origin | |
101 | (method git-fetch) | |
102 | (uri (git-reference | |
b0e7b699 | 103 | (url "https://github.com/vlang/vc") |
aeefe531 RP |
104 | (commit vc-version))) |
105 | (file-name (git-file-name "vc" vc-version)) | |
106 | (sha256 | |
107 | (base32 "17bs09iwxfd0si70j48n9nd16gfgcj8imd0azypk3xzzbz4wybnz"))))))) | |
108 | (home-page "https://vlang.io/") | |
109 | (synopsis "Compiler for the V programming language") | |
110 | (description | |
111 | "V is a systems programming language. It provides memory safety and thread | |
112 | safety guarantees with minimal abstraction.") | |
113 | (license license:expat))) |