| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 |
|
| 22 | (define-module (gnu packages vlang)
|
| 23 | #:use-module (gnu packages glib)
|
| 24 | #:use-module (gnu packages node)
|
| 25 | #:use-module (gnu packages sqlite)
|
| 26 | #:use-module (gnu packages tls)
|
| 27 | #:use-module (gnu packages version-control)
|
| 28 | #:use-module (gnu packages xorg)
|
| 29 | #:use-module (guix build-system gnu)
|
| 30 | #:use-module (guix git-download)
|
| 31 | #:use-module ((guix licenses) #:prefix license:)
|
| 32 | #:use-module (guix utils)
|
| 33 | #:use-module (guix packages))
|
| 34 |
|
| 35 | (define-public vlang
|
| 36 | (package
|
| 37 | (name "vlang")
|
| 38 | (version "0.2.4")
|
| 39 | (source
|
| 40 | (origin
|
| 41 | (method git-fetch)
|
| 42 | (uri (git-reference
|
| 43 | (url "https://github.com/vlang/v")
|
| 44 | (commit version)))
|
| 45 | (file-name (git-file-name name version))
|
| 46 | (sha256
|
| 47 | (base32 "17wmjxssmg6kd4j8i6pgib452zzwvkyi3n1znd1jj3xkf2l92fw8"))))
|
| 48 | (build-system gnu-build-system)
|
| 49 | (arguments
|
| 50 | `(#:make-flags
|
| 51 | (list (string-append "CC=" ,(cc-for-target))
|
| 52 | "TMPTCC=tcc"
|
| 53 | (string-append "VC=" (assoc-ref %build-inputs "vc"))
|
| 54 | "GITCLEANPULL=true"
|
| 55 | "GITFASTCLONE=mkdir -p"
|
| 56 | "TCCREPO="
|
| 57 | "VCREPO="
|
| 58 | (string-append "VFLAGS=-cc " ,(cc-for-target))
|
| 59 | "VERBOSE=1")
|
| 60 | #:phases
|
| 61 | (modify-phases %standard-phases
|
| 62 | (delete 'configure)
|
| 63 | (add-before 'build 'change-home
|
| 64 | (lambda _
|
| 65 | (setenv "HOME" "/tmp")
|
| 66 | #t))
|
| 67 | (add-before 'build 'patch-makefile
|
| 68 | (lambda _
|
| 69 | (substitute* "Makefile"
|
| 70 | (("--branch thirdparty-unknown-unknown") "")
|
| 71 | (("rm -rf") "true"))
|
| 72 | #t))
|
| 73 | (add-before 'check 'delete-failing-tests
|
| 74 | |
| 75 | (lambda _
|
| 76 | (for-each delete-file
|
| 77 | '("vlib/os/notify/notify_test.v"
|
| 78 | "vlib/v/doc/doc_private_fn_test.v"
|
| 79 | "vlib/v/live/live_test.v"
|
| 80 | "vlib/v/tests/repl/repl_test.v"
|
| 81 | "vlib/v/tests/valgrind/valgrind_test.v"))
|
| 82 | #t))
|
| 83 | (replace 'check
|
| 84 | (lambda* (#:key tests? #:allow-other-keys)
|
| 85 | (let* ((bin "tmp/bin")
|
| 86 | (gcc (which "gcc")))
|
| 87 | (when tests?
|
| 88 | (mkdir-p bin)
|
| 89 | (symlink gcc (string-append bin "/cc"))
|
| 90 | (setenv "PATH" (string-append bin ":" (getenv "PATH")))
|
| 91 | (invoke "./v" "test-self")))
|
| 92 | #t))
|
| 93 | (replace 'install
|
| 94 | (lambda* (#:key outputs #:allow-other-keys)
|
| 95 | (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
|
| 96 | (docs (string-append bin "/cmd/v/help"))
|
| 97 | (tools (string-append bin "/cmd/tools"))
|
| 98 | (thirdparty (string-append bin "/thirdparty"))
|
| 99 | (vlib (string-append bin "/vlib"))
|
| 100 | (vmod (string-append bin "/v.mod")))
|
| 101 | (mkdir-p bin)
|
| 102 | (copy-file "./v" (string-append bin "/v"))
|
| 103 | |
| 104 | |
| 105 | |
| 106 | (copy-recursively "cmd/tools" tools)
|
| 107 | (copy-recursively "cmd/v/help" docs)
|
| 108 | (copy-recursively "thirdparty" thirdparty)
|
| 109 | (copy-recursively "vlib" vlib)
|
| 110 | (copy-file "v.mod" vmod))
|
| 111 | #t)))))
|
| 112 | (inputs
|
| 113 | (list glib))
|
| 114 | (native-inputs
|
| 115 | `(("vc"
|
| 116 | |
| 117 | |
| 118 | ,(let ((vc-version "5e876c1491db50b136499d3397b57b7c062040e5"))
|
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | (origin
|
| 126 | (method git-fetch)
|
| 127 | (uri (git-reference
|
| 128 | (url "https://github.com/vlang/vc")
|
| 129 | (commit vc-version)))
|
| 130 | (file-name (git-file-name "vc" vc-version))
|
| 131 | (sha256
|
| 132 | (base32 "1gxdkgc7aqw5f0fhch1n6nhzgzvgb49p77idx1zj7wcp53lpx5ng")))))
|
| 133 | ("git" ,git-minimal/pinned)
|
| 134 | |
| 135 | ("libx11" ,libx11)
|
| 136 | ("node" ,node-lts)
|
| 137 | ("openssl" ,openssl)
|
| 138 | ("sqlite" ,sqlite)))
|
| 139 | (home-page "https://vlang.io/")
|
| 140 | (synopsis "Compiler for the V programming language")
|
| 141 | (description
|
| 142 | "V is a systems programming language. It provides memory safety and thread
|
| 143 | safety guarantees with minimal abstraction.")
|
| 144 | (license license:expat)))
|