Commit | Line | Data |
---|---|---|
aeefe531 RP |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com> | |
84fa2ced | 3 | ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr> |
6450070b | 4 | ;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> |
aeefe531 RP |
5 | ;;; |
6 | ;;; This file is part of GNU Guix. | |
7 | ;;; | |
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. | |
12 | ;;; | |
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. | |
17 | ;;; | |
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/>. | |
20 | ||
21 | (define-module (gnu packages vlang) | |
aeefe531 | 22 | #:use-module (gnu packages glib) |
ec7da7d6 TGR |
23 | #:use-module (gnu packages node) |
24 | #:use-module (gnu packages sqlite) | |
25 | #:use-module (gnu packages tls) | |
26 | #:use-module (gnu packages xorg) | |
aeefe531 RP |
27 | #:use-module (guix build-system gnu) |
28 | #:use-module (guix git-download) | |
29 | #:use-module ((guix licenses) #:prefix license:) | |
6450070b | 30 | #:use-module (guix utils) |
aeefe531 RP |
31 | #:use-module (guix packages)) |
32 | ||
42a3db8c | 33 | (define-public vlang |
aeefe531 | 34 | (package |
42a3db8c | 35 | (name "vlang") |
84fa2ced | 36 | (version "0.1.29") |
aeefe531 RP |
37 | (source |
38 | (origin | |
39 | (method git-fetch) | |
40 | (uri (git-reference | |
b0e7b699 | 41 | (url "https://github.com/vlang/v") |
aeefe531 RP |
42 | (commit version))) |
43 | (file-name (git-file-name name version)) | |
44 | (sha256 | |
84fa2ced | 45 | (base32 "1rqi7cah5nq8aggrib9xvdpfjxq20li91svv0w9yny6nn1ag7snx")))) |
aeefe531 RP |
46 | (build-system gnu-build-system) |
47 | (arguments | |
6450070b EF |
48 | `(#:make-flags |
49 | (list (string-append "CC=" ,(cc-for-target)) | |
50 | "TMPTCC=tcc" | |
51 | (string-append "VC=" (assoc-ref %build-inputs "vc")) | |
52 | "GITCLEANPULL=true" | |
53 | "GITFASTCLONE=mkdir -p" | |
54 | "TCCREPO=" | |
55 | "VCREPO=" | |
56 | "VERBOSE=1") | |
aeefe531 RP |
57 | #:phases |
58 | (modify-phases %standard-phases | |
59 | (delete 'configure) | |
60 | (add-before 'build 'patch-makefile | |
61 | (lambda _ | |
62 | (substitute* "Makefile" | |
63 | (("rm -rf") "true") | |
6450070b | 64 | (("v self") (string-append "v -cc " ,(cc-for-target) " cmd/v"))) |
aeefe531 | 65 | #t)) |
ec7da7d6 TGR |
66 | (add-before 'check 'delete-failing-tests |
67 | ;; XXX As always, these should eventually be fixed and run. | |
68 | (lambda _ | |
69 | (for-each delete-file | |
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")) | |
76 | #t)) | |
77 | (replace 'check | |
78 | (lambda* (#:key tests? #:allow-other-keys) | |
79 | (let* ((bin "tmp/bin") | |
80 | (gcc (which "gcc"))) | |
81 | (when tests? | |
82 | (mkdir-p bin) | |
83 | (symlink gcc (string-append bin "/cc")) | |
84 | (setenv "PATH" (string-append bin ":" (getenv "PATH"))) | |
85 | (invoke "./v" "test-fixed"))) | |
86 | #t)) | |
aeefe531 | 87 | (replace 'install |
527b27f1 EF |
88 | (lambda* (#:key outputs #:allow-other-keys) |
89 | (let* ((bin (string-append (assoc-ref outputs "out") "/bin")) | |
aeefe531 RP |
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"))) | |
94 | (mkdir-p bin) | |
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)) | |
103 | #t))))) | |
104 | (inputs | |
d4167233 | 105 | `(("glib" ,glib))) |
aeefe531 RP |
106 | (native-inputs |
107 | `(("vc" | |
84fa2ced TGR |
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")) | |
aeefe531 RP |
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 | |
116 | ;; the codebase. | |
117 | (origin | |
118 | (method git-fetch) | |
119 | (uri (git-reference | |
b0e7b699 | 120 | (url "https://github.com/vlang/vc") |
aeefe531 RP |
121 | (commit vc-version))) |
122 | (file-name (git-file-name "vc" vc-version)) | |
123 | (sha256 | |
ec7da7d6 TGR |
124 | (base32 "052gp5q2k31r3lci3rx4k0vy0vjdjva64xvrbbihn8lgmw63lc9f"))))) |
125 | ||
126 | ;; For the tests. | |
127 | ("libx11" ,libx11) | |
128 | ("node" ,node) | |
129 | ("openssl" ,openssl) | |
130 | ("sqlite" ,sqlite))) | |
aeefe531 RP |
131 | (home-page "https://vlang.io/") |
132 | (synopsis "Compiler for the V programming language") | |
133 | (description | |
134 | "V is a systems programming language. It provides memory safety and thread | |
135 | safety guarantees with minimal abstraction.") | |
136 | (license license:expat))) | |
42a3db8c MW |
137 | |
138 | (define-public v | |
139 | ;; We used to provide 'vlang' under the name 'v'. | |
140 | (deprecated-package "v" vlang)) |