gnu: Add nqp.
[jackhill/guix/guix.git] / gnu / packages / perl6.scm
CommitLineData
abc12b0d
EF
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (gnu packages perl6)
20 #:use-module ((guix licenses) #:prefix license:)
21 #:use-module (guix download)
22 #:use-module (guix packages)
23 #:use-module (guix build-system perl)
24 #:use-module (gnu packages bdw-gc)
25 #:use-module (gnu packages libevent)
26 #:use-module (gnu packages libffi)
27 #:use-module (gnu packages multiprecision)
28 #:use-module (gnu packages pkg-config))
29
30(define-public moarvm
31 (package
32 (name "moarvm")
33 (version "2019.03")
34 (source
35 (origin
36 (method url-fetch)
37 (uri (string-append "https://moarvm.org/releases/MoarVM-"
38 version ".tar.gz"))
39 (sha256
40 (base32
41 "017w1zvr6yl0cgjfc1b3ddlc6vjw9q8p7alw1vvsckw95190xc14"))
42 (modules '((guix build utils)))
43 (snippet
44 '(begin
45 ;(delete-file-recursively "3rdparty/dynasm") ; JIT
46 (delete-file-recursively "3rdparty/dyncall")
47 (delete-file-recursively "3rdparty/freebsd")
48 (delete-file-recursively "3rdparty/libatomicops")
49 (delete-file-recursively "3rdparty/libuv")
50 (delete-file-recursively "3rdparty/libtommath")
51 (delete-file-recursively "3rdparty/msinttypes")
52 #t))))
53 (build-system perl-build-system)
54 (arguments
55 '(#:phases
56 (modify-phases %standard-phases
57 (replace 'configure
58 (lambda* (#:key inputs outputs #:allow-other-keys)
59 (let ((out (assoc-ref outputs "out"))
60 (pkg-config (assoc-ref inputs "pkg-config")))
61 (setenv "LDFLAGS" (string-append "-Wl,-rpath=" out "/lib"))
62 (invoke "perl" "Configure.pl"
63 "--prefix" out
64 "--pkgconfig" (string-append pkg-config "/bin/pkg-config")
65 "--has-libtommath"
66 "--has-libatomic_ops"
67 "--has-libffi"
68 "--has-libuv")))))))
69 (home-page "https://moarvm.org/")
70 ;; These should be inputs but moar.h can't find them when building rakudo
71 (propagated-inputs
72 `(("libatomic-ops" ,libatomic-ops)
73 ("libtommath" ,libtommath-1.0)
74 ("libuv" ,libuv)))
75 (inputs
76 `(("libffi" ,libffi)))
77 (native-inputs
78 `(("pkg-config" ,pkg-config)))
79 (synopsis "VM for NQP And Rakudo Perl 6")
80 (description
81 "Short for \"Metamodel On A Runtime\", MoarVM is a modern virtual machine
82built for the Rakudo Perl 6 compiler and the NQP Compiler Toolchain. Highlights
83include:
84
85@itemize
86@item Great Unicode support, with strings represented at grapheme level
87@item Dynamic analysis of running code to identify hot functions and loops, and
88perform a range of optimizations, including type specialization and inlining
89@item Support for threads, a range of concurrency control constructs, and
90asynchronous sockets, timers, processes, and more
91@item Generational, parallel, garbage collection
92@item Support for numerous language features, including first class functions,
93exceptions, continuations, runtime loading of code, big integers and interfacing
94with native libraries.
95@end itemize")
96 (license license:artistic2.0)))
af2dec5b
EF
97
98(define-public nqp
99 (package
100 (name "nqp")
101 (version "2019.03")
102 (source
103 (origin
104 (method url-fetch)
105 (uri (string-append "https://rakudo.perl6.org/downloads/nqp/nqp-"
106 version ".tar.gz"))
107 (sha256
108 (base32
109 "183zhll13fx416s3hkg4bkvib77kyr857h0nydgrl643fpacxp83"))
110 (modules '((guix build utils)))
111 (snippet
112 '(begin
113 (delete-file-recursively "3rdparty") #t))))
114 (build-system perl-build-system)
115 (arguments
116 '(#:phases
117 (modify-phases %standard-phases
118 (add-after 'patch-source-shebangs 'patch-more-shebangs
119 (lambda _
120 (substitute* '("tools/build/install-jvm-runner.pl.in"
121 "tools/build/gen-js-cross-runner.pl"
122 "tools/build/gen-js-runner.pl"
123 "tools/build/install-js-runner.pl"
124 "tools/build/install-moar-runner.pl"
125 "tools/build/gen-moar-runner.pl"
126 "t/nqp/111-spawnprocasync.t"
127 "t/nqp/113-run-command.t")
128 (("/bin/sh") (which "sh")))
129 #t))
130 (add-after 'unpack 'patch-source-date
131 (lambda _
132 (substitute* "tools/build/gen-version.pl"
133 (("gmtime") "gmtime(0)"))
134 #t))
135 (add-after 'unpack 'remove-failing-test
136 ;; One subtest fails for unknown reasons
137 (lambda _
138 (delete-file "t/nqp/019-file-ops.t")
139 #t))
140 (replace 'configure
141 (lambda* (#:key inputs outputs #:allow-other-keys)
142 (let ((out (assoc-ref outputs "out"))
143 (moar (assoc-ref inputs "moarvm")))
144 (invoke "perl" "Configure.pl"
145 "--backends=moar"
146 "--with-moar" (string-append moar "/bin/moar")
147 "--prefix" out)))))))
148 (inputs
149 `(("moarvm" ,moarvm)))
150 (home-page "https://github.com/perl6/nqp")
151 (synopsis "Not Quite Perl")
152 (description "This is \"Not Quite Perl\" -- a lightweight Perl 6-like
153environment for virtual machines. The key feature of NQP is that it's designed
154to be a very small environment (as compared with, say, perl6 or Rakudo) and is
155focused on being a high-level way to create compilers and libraries for virtual
156machines like MoarVM, the JVM, and others.
157
158Unlike a full-fledged implementation of Perl 6, NQP strives to have as small a
159runtime footprint as it can, while still providing a Perl 6 object model and
160regular expression engine for the virtual machine.")
161 (license license:artistic2.0)))