unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 212862cb1d6d0fca440be8acc4bd8b78366fc97a 7387 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
 
;;; 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 glib)
  #:use-module (gnu packages linux)
  #: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 (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"))))
   (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-makefile
          (lambda _
            (substitute* "Makefile"
              (("rm -rf") "true")
              (("--branch") ""))))
        (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)))
   (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 212862cb1d ...
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/1] 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

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

index at:
100644 212862cb1d6d0fca440be8acc4bd8b78366fc97a	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).