unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#41415] [PATCH 0/1] Add v compiler
@ 2020-05-20  3:18 Ryan Prior via Guix-patches via
  2020-05-20  3:23 ` [bug#41415] [PATCH 1/1] gnu: Add v Ryan Prior via Guix-patches via
  0 siblings, 1 reply; 3+ messages in thread
From: Ryan Prior via Guix-patches via @ 2020-05-20  3:18 UTC (permalink / raw)
  To: 41415

v is a systems programming language that's evolving rapidly right now. This
patch contains a bootstrap package for the v compiler.

Ryan Prior (1):
  gnu: Add v.

 gnu/local.mk           |   1 +
 gnu/packages/vlang.scm | 116 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 117 insertions(+)
 create mode 100644 gnu/packages/vlang.scm

-- 
2.26.2






^ permalink raw reply	[flat|nested] 3+ messages in thread

* [bug#41415] [PATCH 1/1] gnu: Add v.
  2020-05-20  3:18 [bug#41415] [PATCH 0/1] Add v compiler Ryan Prior via Guix-patches via
@ 2020-05-20  3:23 ` Ryan Prior via Guix-patches via
  2020-06-23 22:04   ` bug#41415: " Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Ryan Prior via Guix-patches via @ 2020-05-20  3:23 UTC (permalink / raw)
  To: 41415

* gnu/packages/vlang.scm: New file.
* gnu/packages/vlang.scm (v): New variable.
* gnu/local.mk: Add vlang.scm.
---
 gnu/local.mk           |   1 +
 gnu/packages/vlang.scm | 116 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 117 insertions(+)
 create mode 100644 gnu/packages/vlang.scm

diff --git a/gnu/local.mk b/gnu/local.mk
index 2e12c5a873..4c389fd772 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -533,6 +533,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/vim.scm				\
   %D%/packages/virtualization.scm		\
   %D%/packages/visidata.scm			\
+  %D%/packages/vlang.scm			\
   %D%/packages/vnc.scm				\
   %D%/packages/vpn.scm				\
   %D%/packages/vulkan.scm			\
diff --git a/gnu/packages/vlang.scm b/gnu/packages/vlang.scm
new file mode 100644
index 0000000000..d73dd566c5
--- /dev/null
+++ b/gnu/packages/vlang.scm
@@ -0,0 +1,116 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 Ryan Prior <rprior@protonmail.com>
+;;;
+;;; 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 c)
+  #:use-module (gnu packages gcc)
+  #:use-module (gnu packages glib)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix git-download)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix packages))
+
+(define-public v
+  (package
+   (name "v")
+   (version "0.1.27")
+   (source
+    (origin
+     (method git-fetch)
+     (uri (git-reference
+           (url "https://github.com/vlang/v.git")
+           (commit version)))
+     (file-name (git-file-name name version))
+     (sha256
+      (base32 "1d9qhacllvkqif42jaayixhjyhx7pzslh8p1yr5p19447q763fq1"))))
+   (build-system gnu-build-system)
+   (arguments
+    '(#:tests? #f ; tests are broken in v 0.1.27
+      #:make-flags
+      `("CC=gcc"
+        "GITCLEANPULL=true"
+        "GITFASTCLONE=mkdir -p"
+        "TCCREPO="
+        "TMPTCC=tcc"
+        ,(string-append "TMPVC=" (assoc-ref %build-inputs "vc"))
+        "VCREPO="
+        "VERBOSE=1"
+        "V_ALWAYS_CLEAN_TMP=false")
+      #:phases
+      (modify-phases %standard-phases
+        (delete 'configure)
+        (add-before 'build 'patch-makefile
+          (lambda _
+            (substitute* "Makefile"
+              (("rm -rf") "true")
+              (("v self") "v -cc gcc cmd/v"))
+            #t))
+        ;; A few tests are broken in v 0.1.27. This function should be
+        ;; enabled to run tests in the next release.
+        ;; (replace 'check
+        ;;   (lambda _
+        ;;     (let* ((tmpbin "tmp/bin")
+        ;;            (gcc (which "gcc")))
+        ;;       (mkdir-p tmpbin)
+        ;;       (symlink gcc (string-append tmpbin "/cc"))
+        ;;       (setenv "PATH" (string-append tmpbin ":" (getenv "PATH")))
+        ;;       (invoke "./v" "test-fixed"))
+        ;;     #t))
+        (replace 'install
+          (lambda _
+            (let* ((bin (string-append (assoc-ref %outputs "out") "/bin"))
+                   (tools (string-append bin "/cmd/tools"))
+                   (thirdparty (string-append bin "/thirdparty"))
+                   (vlib (string-append bin "/vlib"))
+                   (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/tools" tools)
+              (copy-recursively "thirdparty" thirdparty)
+              (copy-recursively "vlib" vlib)
+              (copy-file "v.mod" vmod))
+            #t)))))
+   (inputs
+    `(("glib" ,glib)
+      ("gcc" ,gcc)))
+   (native-inputs
+    `(("vc"
+       ,(let ((vc-version "0884d7092f4c2a4f8ca16da6f1792efa235247be"))
+          ;; 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.git")
+                  (commit vc-version)))
+            (file-name (git-file-name "vc" vc-version))
+            (sha256
+             (base32 "17bs09iwxfd0si70j48n9nd16gfgcj8imd0azypk3xzzbz4wybnz")))))))
+   (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)))
-- 
2.26.2






^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#41415: [PATCH 1/1] gnu: Add v.
  2020-05-20  3:23 ` [bug#41415] [PATCH 1/1] gnu: Add v Ryan Prior via Guix-patches via
@ 2020-06-23 22:04   ` Ludovic Courtès
  0 siblings, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2020-06-23 22:04 UTC (permalink / raw)
  To: Ryan Prior; +Cc: 41415-done

Hi Ryna,

Ryan Prior <rprior@protonmail.com> skribis:

> * gnu/packages/vlang.scm: New file.
> * gnu/packages/vlang.scm (v): New variable.
> * gnu/local.mk: Add vlang.scm.

Finally applied, thank you.

> +   (native-inputs
> +    `(("vc"
> +       ,(let ((vc-version "0884d7092f4c2a4f8ca16da6f1792efa235247be"))
> +          ;; 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.git")
> +                  (commit vc-version)))

Thanks for taking the time to write this explanation.  The file ‘v.c’ is
1.2MB though, and it’s definitely not the preferred form for edition.

What’s the 15KB above referring to?  I’d welcome a patch to adjust the
comment, unless I’m missing something.  :-)

It would be great if you could bring up this issue with upstream,
perhaps mentioning <https://bootstrappable.org/>.

Thanks, and sorry for the long delay!

Ludo’.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-23 22:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20  3:18 [bug#41415] [PATCH 0/1] Add v compiler Ryan Prior via Guix-patches via
2020-05-20  3:23 ` [bug#41415] [PATCH 1/1] gnu: Add v Ryan Prior via Guix-patches via
2020-06-23 22:04   ` bug#41415: " Ludovic Courtès

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).