1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
4 ;;; This file is part of GNU Guix.
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.
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.
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/>.
19 (define-module (gnu packages perl6)
20 #:use-module ((guix licenses) #:prefix license:)
21 #:use-module (guix download)
22 #:use-module (guix git-download)
23 #:use-module (guix packages)
24 #:use-module (guix build-system perl)
25 #:use-module (guix build-system rakudo)
26 #:use-module (gnu packages bdw-gc)
27 #:use-module (gnu packages libevent)
28 #:use-module (gnu packages libffi)
29 #:use-module (gnu packages multiprecision)
30 #:use-module (gnu packages pkg-config)
31 #:use-module (gnu packages tls))
40 (uri (string-append "https://moarvm.org/releases/MoarVM-"
44 "017w1zvr6yl0cgjfc1b3ddlc6vjw9q8p7alw1vvsckw95190xc14"))
45 (modules '((guix build utils)))
48 ;(delete-file-recursively "3rdparty/dynasm") ; JIT
49 (delete-file-recursively "3rdparty/dyncall")
50 (delete-file-recursively "3rdparty/freebsd")
51 (delete-file-recursively "3rdparty/libatomicops")
52 (delete-file-recursively "3rdparty/libuv")
53 (delete-file-recursively "3rdparty/libtommath")
54 (delete-file-recursively "3rdparty/msinttypes")
56 (build-system perl-build-system)
59 (modify-phases %standard-phases
61 (lambda* (#:key inputs outputs #:allow-other-keys)
62 (let ((out (assoc-ref outputs "out"))
63 (pkg-config (assoc-ref inputs "pkg-config")))
64 (setenv "LDFLAGS" (string-append "-Wl,-rpath=" out "/lib"))
65 (invoke "perl" "Configure.pl"
67 "--pkgconfig" (string-append pkg-config "/bin/pkg-config")
72 (home-page "https://moarvm.org/")
73 ;; These should be inputs but moar.h can't find them when building rakudo
75 `(("libatomic-ops" ,libatomic-ops)
76 ("libtommath" ,libtommath-1.0)
79 `(("libffi" ,libffi)))
81 `(("pkg-config" ,pkg-config)))
82 (synopsis "VM for NQP And Rakudo Perl 6")
84 "Short for \"Metamodel On A Runtime\", MoarVM is a modern virtual machine
85 built for the Rakudo Perl 6 compiler and the NQP Compiler Toolchain. Highlights
89 @item Great Unicode support, with strings represented at grapheme level
90 @item Dynamic analysis of running code to identify hot functions and loops, and
91 perform a range of optimizations, including type specialization and inlining
92 @item Support for threads, a range of concurrency control constructs, and
93 asynchronous sockets, timers, processes, and more
94 @item Generational, parallel, garbage collection
95 @item Support for numerous language features, including first class functions,
96 exceptions, continuations, runtime loading of code, big integers and interfacing
97 with native libraries.
99 (license license:artistic2.0)))
108 (uri (string-append "https://rakudo.perl6.org/downloads/nqp/nqp-"
112 "183zhll13fx416s3hkg4bkvib77kyr857h0nydgrl643fpacxp83"))
113 (modules '((guix build utils)))
116 (delete-file-recursively "3rdparty") #t))))
117 (build-system perl-build-system)
120 (modify-phases %standard-phases
121 (add-after 'patch-source-shebangs 'patch-more-shebangs
123 (substitute* '("tools/build/install-jvm-runner.pl.in"
124 "tools/build/gen-js-cross-runner.pl"
125 "tools/build/gen-js-runner.pl"
126 "tools/build/install-js-runner.pl"
127 "tools/build/install-moar-runner.pl"
128 "tools/build/gen-moar-runner.pl"
129 "t/nqp/111-spawnprocasync.t"
130 "t/nqp/113-run-command.t")
131 (("/bin/sh") (which "sh")))
133 (add-after 'unpack 'patch-source-date
135 (substitute* "tools/build/gen-version.pl"
136 (("gmtime") "gmtime(0)"))
138 (add-after 'unpack 'remove-failing-test
139 ;; One subtest fails for unknown reasons
141 (delete-file "t/nqp/019-file-ops.t")
144 (lambda* (#:key inputs outputs #:allow-other-keys)
145 (let ((out (assoc-ref outputs "out"))
146 (moar (assoc-ref inputs "moarvm")))
147 (invoke "perl" "Configure.pl"
149 "--with-moar" (string-append moar "/bin/moar")
150 "--prefix" out)))))))
152 `(("moarvm" ,moarvm)))
153 (home-page "https://github.com/perl6/nqp")
154 (synopsis "Not Quite Perl")
155 (description "This is \"Not Quite Perl\" -- a lightweight Perl 6-like
156 environment for virtual machines. The key feature of NQP is that it's designed
157 to be a very small environment (as compared with, say, perl6 or Rakudo) and is
158 focused on being a high-level way to create compilers and libraries for virtual
159 machines like MoarVM, the JVM, and others.
161 Unlike a full-fledged implementation of Perl 6, NQP strives to have as small a
162 runtime footprint as it can, while still providing a Perl 6 object model and
163 regular expression engine for the virtual machine.")
164 (license license:artistic2.0)))
166 (define-public rakudo
169 (version "2019.03.1")
173 (uri (string-append "https://rakudo.perl6.org/downloads/rakudo/rakudo-"
177 "1nllf69v8xr6v3kkj7pmryg11n5m3ajfkr7j72pvhrgnjy8lv3r1"))))
178 (build-system perl-build-system)
181 (modify-phases %standard-phases
182 (add-after 'unpack 'patch-source-date
184 (substitute* "tools/build/gen-version.pl"
185 (("gmtime") "gmtime(0)"))
187 (add-after 'patch-source-shebangs 'patch-more-shebangs
189 (substitute* '("tools/build/create-js-runner.pl"
190 "tools/build/create-moar-runner.p6"
191 "tools/build/create-jvm-runner.pl"
193 (("/bin/sh") (which "sh")))
196 (lambda* (#:key inputs outputs #:allow-other-keys)
197 (let ((out (assoc-ref outputs "out"))
198 (nqp (assoc-ref inputs "nqp")))
199 (invoke "perl" "./Configure.pl"
201 "--with-nqp" (string-append nqp "/bin/nqp")
203 ;; This is the recommended tool for distro maintainers to install perl6
204 ;; modules systemwide. See: https://github.com/ugexe/zef/issues/117
205 (add-after 'install 'install-dist-tool
206 (lambda* (#:key outputs #:allow-other-keys)
207 (let* ((out (assoc-ref outputs "out"))
208 (dest (string-append out "/share/perl6/tools")))
209 (install-file "tools/install-dist.p6" dest)
210 (substitute* (string-append dest "/install-dist.p6")
211 (("/usr/bin/env perl6")
212 (string-append out "/bin/perl6"))))
217 ("openssl" ,openssl)))
218 (home-page "https://rakudo.org/")
220 (list (search-path-specification
221 (variable "PERL6LIB")
223 (files '("share/perl6/lib"
224 "share/perl6/site/lib"
225 "share/perl6/vendor/lib")))))
226 (synopsis "Perl 6 Compiler")
227 (description "Rakudo Perl is a compiler that implements the Perl 6
228 specification and runs on top of several virtual machines.")
229 (license license:artistic2.0)))
231 (define-public perl6-json-fast
233 (name "perl6-json-fast")
239 (url "https://github.com/timo/json_fast.git")
241 (file-name (git-file-name name version))
244 "1fif081gdxdnja14vkj523p9dyzdcdj81lmjv9fvfazvpagb6dg2"))))
245 (build-system rakudo-build-system)
246 (arguments '(#:with-zef? #f))
247 (home-page "https://github.com/timo/json_fast")
248 (synopsis "Perl6 json parser")
249 (description "A naive imperative json parser in pure perl6 (but with direct
250 access to @code{nqp::} ops), to evaluate performance against @code{JSON::Tiny}.
251 It is a drop-in replacement for @code{JSON::Tiny}'s from-json and to-json subs,
252 but it offers a few extra features.")
253 (license license:artistic2.0)))
255 (define-public perl6-tap-harness
257 (name "perl6-tap-harness")
263 (url "https://github.com/perl6/tap-harness6.git")
264 (commit (string-append "v" version))))
265 (file-name (git-file-name name version))
268 "1lig8i0my3fgqvlay9532xslbf3iis2d7wz89gniwvwqffi2kh6r"))))
269 (build-system rakudo-build-system)
274 (modify-phases %standard-phases
277 (invoke "perl6" "-Ilib" "bin/prove6" "-l" "t"))))))
278 (home-page "https://github.com/perl6/tap-harness6/")
279 (synopsis "TAP harness for perl6")
280 (description "This module provides the @command{prove6} command which runs a
281 TAP based test suite and prints a report. The @command{prove6} command is a
282 minimal wrapper around an instance of this module.")
283 (license license:artistic2.0)))
285 (define-public perl6-uri
293 (url "https://github.com/perl6-community-modules/uri.git")
295 (file-name (git-file-name name version))
298 "0h318g75jqn2ckw051g35iqyfxz1mps0jyg5z6pd857y3kacbkpl"))))
299 (build-system rakudo-build-system)
300 (arguments '(#:with-zef? #f))
301 (home-page "https://github.com/perl6-community-modules/uri")
302 (synopsis "URI implementation using Perl 6")
303 (description "A URI implementation using Perl 6 grammars to implement RFC
304 3986 BNF. Currently only implements parsing. Includes @code{URI::Escape} to
305 (un?)escape characters that aren't otherwise allowed in a URI with % and a hex
306 character numbering.")
307 (license license:artistic2.0)))
309 (define-public perl6-zef
317 (url "https://github.com/ugexe/zef.git")
318 (commit (string-append "v" version))))
319 (file-name (git-file-name name version))
322 "07n7g1xw2c4g860rs890gx85vyhdq0ysgwbrnzw6q905jph2bkv7"))))
323 (build-system rakudo-build-system)
327 (modify-phases %standard-phases
330 (setenv "HOME" "/tmp")
331 (invoke "perl6" "-I." "bin/zef" "--debug"
332 "--tap-harness" "test" "."))))))
333 (home-page "https://github.com/ugexe/zef")
334 (synopsis "Perl6 Module Management")
335 (description "Zef is a Perl 6 package (module) manager. It can be used to
336 download and install Perl 6 modules in your home directory or as a system-wide
338 (license license:artistic2.0)))