unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 3bdbf36f9dfac18351d6e5033b163c4c8087f451 8737 bytes (raw)
name: gnu/packages/vlang.scm 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
 
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com>
;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages vlang)
  #:use-module (gnu packages datastructures)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages maths)
  #:use-module (gnu packages node)
  #:use-module (gnu packages sqlite)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages valgrind)
  #:use-module (gnu packages version-control)
  #:use-module (gnu packages javascript)
  #:use-module (gnu packages xorg)
  #:use-module (gnu packages)
  #:use-module (guix build-system gnu)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix utils)
  #:use-module (guix packages))

(define markdown-origin
  (let ((markdown-version "1ccfbcba945b649b61738b9c0455d31cf99564b2"))
    (origin
      (method git-fetch)
      (uri (git-reference
            (url "https://github.com/vlang/markdown")
            (commit markdown-version)))
      (file-name (git-file-name "vlang-markdown" markdown-version))
      (sha256
       (base32 "0s982qiwy4s9y07x9fsy4yn642schplhp9hrw2libg2bx4sw43as")))))

(define-public vlang
  (package
   (name "vlang")
   (version "0.2")
   (source
    (origin
     (method git-fetch)
     (uri (git-reference
           (url "https://github.com/vlang/v")
           (commit version)))
     (file-name (git-file-name name version))
     (sha256
      (base32 "1x2sf2j6xl11kjvv0i0anjqwsfb1la11xr7yhdnbix9808442wm2"))
     (modules '((guix build utils)))
     ;; This patch is already accepted upstream but is required for version
     ;; 0.2. The package will build without it, but it will fail to run any v
     ;; tools afterwards because of how Guix changes modified timestamps in
     ;; the package files.
     (patches (search-patches
               "vlang-accommodate-timestamps.patch"))
     (snippet
      '(begin
         ;; Eventually remove the whole thirdparty directory.
         (for-each delete-file-recursively
                   '("thirdparty/bignum"
                     "thirdparty/cJSON"
                     "thirdparty/wyhash"))))))
   (build-system gnu-build-system)
   (arguments
    `(#:make-flags
      (list (string-append "CC=" ,(cc-for-target))
            "TMPTCC=tcc"
            (string-append "VC=" (assoc-ref %build-inputs "vc"))
            "GITCLEANPULL=true"
            "GITFASTCLONE=mkdir -p"
            "TCCREPO="
            "VCREPO="
            "VERBOSE=1")
      #:phases
      (modify-phases %standard-phases
        (delete 'configure)
        (add-before 'build 'patch-files
          (lambda* (#:key inputs #:allow-other-keys)
            (substitute* "Makefile"
              (("rm -rf") "true")
              (("--branch") ""))
            (substitute* "vlib/math/big/big.v"
              (("@VROOT/thirdparty/bignum")
               (string-append (assoc-ref inputs "tiny-bignum") "/share")))
            (substitute* "vlib/json/json_primitives.v"
              (("@VROOT/thirdparty/cJSON")
               (assoc-ref inputs "cJSON")))
            (substitute* "vlib/hash/wyhash.c.v"
              (("@VROOT/thirdparty/wyhash")
               (string-append (assoc-ref inputs "wyhash") "/include")))))
        (add-before 'build 'patch-cc
          (lambda _
            (let* ((bin "tmp/bin")
                   (gcc (which "gcc")))
              (mkdir-p bin)
              (symlink gcc (string-append bin "/cc"))
              (setenv "PATH" (string-append bin ":" (getenv "PATH"))))
            #t))
        (add-after 'build 'build-tools
          (lambda* (#:key inputs #:allow-other-keys)
            (copy-recursively (assoc-ref inputs "vmodules/markdown") "vmodules/markdown")
            (setenv "VMODULES" (string-append (getcwd) "/vmodules"))
            (invoke "./v" "build-tools" "-v")
            #t))
        (add-before 'check 'fix-or-delete-failing-tests
          (lambda _
            ;; The x64 tests copy .vv files into the test directory and then
            ;; write to them, so we need to make them writeable.
            (for-each (lambda (vv) (chmod vv #o644))
                      (find-files "vlib/v/gen/x64/tests/" "\\.vv$"))
            ;; The process test explicitly calls "/bin/sleep" and "/bin/date"
            (substitute* "vlib/os/process_test.v"
              (("/bin/sleep") (which "sleep"))
              (("/bin/date") (which "date")))
            ;; The valgrind test can't find `cc' even though it's on PATH, so
            ;; we pass it as an explicit argument.
            (substitute* "vlib/v/tests/valgrind/valgrind_test.v"
              (("\\$vexe") "$vexe -cc gcc"))
            (for-each delete-file
                      '(;; XXX As always, these should eventually be fixed and run.
                        "vlib/vweb/tests/vweb_test.v"
                        "vlib/v/tests/live_test.v"
                        "vlib/v/tests/repl/repl_test.v"))
            #t))
        (replace 'check
          (lambda* (#:key tests? #:allow-other-keys)
            (when tests?
              (invoke "./v" "test-fixed"))
            #t))
        (replace 'install
          (lambda* (#:key outputs #:allow-other-keys)
            (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
                   (cmd (string-append bin "/cmd"))
                   (thirdparty (string-append bin "/thirdparty"))
                   (vlib (string-append bin "/vlib"))
                   (vmodules (string-append bin "/vmodules"))
                   (vmod (string-append bin "/v.mod")))
              (mkdir-p bin)
              (copy-file "./v" (string-append bin "/v"))
              ;; v requires as of 0.1.27 that these other components are in the
              ;; same directory. In a future release we may be able to move
              ;; these into other output folders.
              (copy-recursively "cmd" cmd)
              (copy-recursively "thirdparty" thirdparty)
              (copy-recursively "vlib" vlib)
              (copy-file "v.mod" vmod))
            #t)))))
   (inputs
    `(("glib" ,glib)
      ("tiny-bignum" ,tiny-bignum)
      ("cJSON" ,(package-source cjson))
      ("wyhash" ,wyhash)))
   (native-inputs
    `(("vc"
       ;; Versions are not consistently tagged, but the matching commit will
       ;; probably have ‘v0.x.y’ in the commit message.
       ,(let ((vc-version "047460a4ae5f4a1ba8c31dc50ec5e50ebe80b7f6"))
          ;; v bootstraps from generated c source code from a dedicated
          ;; repository. It's readable, as generated source goes, and not at all
          ;; obfuscated, and it's about 15kb. The original source written in
          ;; golang is lost to the forces of entropy; modifying the generated c
          ;; source by hand has been a commonly used technique for iterating on
          ;; the codebase.
          (origin
            (method git-fetch)
            (uri (git-reference
                  (url "https://github.com/vlang/vc")
                  (commit vc-version)))
            (file-name (git-file-name "vc" vc-version))
            (sha256
             (base32 "1wlr9yzxz4bc7pbzbplzhjjr9sz5mwy2k2z5d3vwsnz56g245146")))))
      ("vmodules/markdown" ,markdown-origin)

      ;; For the tests.
      ("libx11" ,libx11)
      ("node" ,node)
      ("openssl" ,openssl)
      ("ps" ,procps)
      ("sqlite" ,sqlite)
      ("valgrind" ,valgrind)))
   (native-search-paths
    (list (search-path-specification
           (variable "VMODULES")
           (files '("bin/")))))
   (home-page "https://vlang.io/")
   (synopsis "Compiler for the V programming language")
   (description
    "V is a systems programming language.  It provides memory safety and thread
safety guarantees with minimal abstraction.")
   (license license:expat)))

(define-public v
  ;; We used to provide 'vlang' under the name 'v'.
  (deprecated-package "v" vlang))

debug log:

solving 3bdbf36f9d ...
found 3bdbf36f9d in https://yhetil.org/guix-patches/20210101192713.23655-6-rprior@protonmail.com/
found 92d178a3e1 in https://yhetil.org/guix-patches/20210101192713.23655-5-rprior@protonmail.com/
found db7438d7f7 in https://yhetil.org/guix-patches/20210101192713.23655-4-rprior@protonmail.com/
found a2f6e93945 in https://yhetil.org/guix-patches/20210101192713.23655-3-rprior@protonmail.com/
found 212862cb1d in https://yhetil.org/guix-patches/20210101192713.23655-2-rprior@protonmail.com/
found e0b2e7bcfc in https://git.savannah.gnu.org/cgit/guix.git
preparing index
index prepared:
100644 e0b2e7bcfc28ba7398bc6bfd510b26d6ed1a670d	gnu/packages/vlang.scm

applying [1/5] https://yhetil.org/guix-patches/20210101192713.23655-2-rprior@protonmail.com/
diff --git a/gnu/packages/vlang.scm b/gnu/packages/vlang.scm
index e0b2e7bcfc..212862cb1d 100644


applying [2/5] https://yhetil.org/guix-patches/20210101192713.23655-3-rprior@protonmail.com/
diff --git a/gnu/packages/vlang.scm b/gnu/packages/vlang.scm
index 212862cb1d..a2f6e93945 100644


applying [3/5] https://yhetil.org/guix-patches/20210101192713.23655-4-rprior@protonmail.com/
diff --git a/gnu/packages/vlang.scm b/gnu/packages/vlang.scm
index a2f6e93945..db7438d7f7 100644


applying [4/5] https://yhetil.org/guix-patches/20210101192713.23655-5-rprior@protonmail.com/
diff --git a/gnu/packages/vlang.scm b/gnu/packages/vlang.scm
index db7438d7f7..92d178a3e1 100644


applying [5/5] https://yhetil.org/guix-patches/20210101192713.23655-6-rprior@protonmail.com/
diff --git a/gnu/packages/vlang.scm b/gnu/packages/vlang.scm
index 92d178a3e1..3bdbf36f9d 100644

Checking patch gnu/packages/vlang.scm...
Applied patch gnu/packages/vlang.scm cleanly.
Checking patch gnu/packages/vlang.scm...
Applied patch gnu/packages/vlang.scm cleanly.
Checking patch gnu/packages/vlang.scm...
Applied patch gnu/packages/vlang.scm cleanly.
Checking patch gnu/packages/vlang.scm...
Applied patch gnu/packages/vlang.scm cleanly.
Checking patch gnu/packages/vlang.scm...
Applied patch gnu/packages/vlang.scm cleanly.

index at:
100644 3bdbf36f9dfac18351d6e5033b163c4c8087f451	gnu/packages/vlang.scm

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).