gnu: libretro-lowresnx: Update to 1.2.
[jackhill/guix/guix.git] / gnu / packages / javascript.scm
CommitLineData
a3d3b7a4
AI
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
ac80cbfa 3;;; Copyright © 2017, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
6ba730cf 4;;; Copyright © 2017, 2018, 2020, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
89c75601 5;;; Copyright © 2017, 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
11b43f99 6;;; Copyright © 2018 Nicolas Goaziou <mail@nicolasgoaziou.fr>
b509a071 7;;; Copyright © 2021 Pierre Neidhardt <mail@ambrevar.xyz>
a3d3b7a4
AI
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix is free software; you can redistribute it and/or modify it
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
16;;; GNU Guix is distributed in the hope that it will be useful, but
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24(define-module (gnu packages javascript)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages base)
28 #:use-module (gnu packages compression)
88f06fd0 29 #:use-module (gnu packages lisp-xyz)
99863166 30 #:use-module (gnu packages readline)
ac80cbfa 31 #:use-module (gnu packages web)
a3d3b7a4
AI
32 #:use-module (guix packages)
33 #:use-module (guix download)
68ffb6c5 34 #:use-module (guix git-download)
89ba894e 35 #:use-module (guix build-system gnu)
ab58b2cc 36 #:use-module (guix build-system cmake)
68ffb6c5 37 #:use-module (guix build-system trivial)
4a74499c
TGR
38 #:use-module (guix build-system minify)
39 #:use-module (guix utils))
a3d3b7a4 40
ab58b2cc
RP
41(define-public cjson
42 (package
43 (name "cjson")
44 (version "1.7.14")
45 (source (origin
46 (method git-fetch)
47 (uri (git-reference
48 (url "https://github.com/DaveGamble/cJSON")
49 (commit (string-append "v" version))))
50 (file-name (git-file-name name version))
51 (sha256
52 (base32 "1rlnailhjm180zb6pc17jwphjwivw8kfpqgixjfgq4iyryq46sah"))))
53 (build-system cmake-build-system)
54 (arguments
55 `(#:configure-flags '("-DENABLE_CJSON_UTILS=On")))
56 (home-page "https://github.com/DaveGamble/cJSON")
57 (synopsis "JSON parser written in ANSI C")
58 (description "This library provides a portable embeddable JSON parser.")
59 (license license:expat)))
60
ac80cbfa
RW
61(define-public js-context-menu
62 (package
63 (name "js-context-menu")
64 (version "0.6.1")
65 (source
66 (origin
67 (method git-fetch)
68 (uri (git-reference
69 (url "https://github.com/zorkow/context-menu")
70 (commit (string-append "v" version))))
71 (file-name (git-file-name name version))
72 (sha256
73 (base32
74 "1q063l6477z285j6h5wvccp6iswvlp0jmb96sgk32sh0lf7nhknh"))))
75 (build-system trivial-build-system)
76 (arguments
77 `(#:modules ((guix build utils))
78 #:builder
79 (begin
80 (use-modules (guix build utils))
81 (chdir (assoc-ref %build-inputs "source"))
82 (let ((target (string-append %output "/share/javascript/context-menu")))
83 (apply invoke (string-append (assoc-ref %build-inputs "esbuild")
84 "/bin/esbuild")
85 "--bundle"
86 "--tsconfig=tsconfig.json"
87 (string-append "--outdir=" target)
88 (find-files "ts" "\\.ts$"))))))
89 (native-inputs
90 `(("esbuild" ,esbuild)))
91 (home-page "https://github.com/zorkow/context-menu")
92 (synopsis "Generic context menu")
93 (description "This package provides a reimplementation of the MathJax
94context menu in TypeScript.")
95 (license license:asl2.0)))
96
649c438c
LC
97(define-public font-mathjax
98 (package
99 (name "font-mathjax")
d6a7268b 100 (version "2.7.2")
649c438c
LC
101 (source
102 (origin
89c75601
EF
103 (method git-fetch)
104 (uri (git-reference
105 (url "https://github.com/mathjax/MathJax")
106 (commit version)))
107 (file-name (git-file-name name version))
649c438c
LC
108 (sha256
109 (base32
89c75601 110 "127j12g7v2hx6k7r00b8cp49s7nkrwhxy6l8p03pw34xpxbgbimm"))))
649c438c
LC
111 (build-system trivial-build-system)
112 (arguments
113 `(#:modules ((guix build utils))
114 #:builder
115 (begin
116 (use-modules (guix build utils)
117 (ice-9 match))
649c438c
LC
118 (let ((install-directory (string-append %output "/share/fonts/mathjax")))
119 (mkdir-p install-directory)
89c75601
EF
120 (copy-recursively (string-append (assoc-ref %build-inputs "source")
121 "/fonts")
122 install-directory)))))
649c438c
LC
123 (home-page "https://www.mathjax.org/")
124 (synopsis "Fonts for MathJax")
125 (description "This package contains the fonts required for MathJax.")
126 (license license:asl2.0)))
127
a3d3b7a4
AI
128(define-public js-mathjax
129 (package
130 (inherit font-mathjax)
131 (name "js-mathjax")
132 (arguments
133 `(#:modules ((guix build utils))
134 #:builder
135 (begin
136 (use-modules (guix build utils)
137 (ice-9 match)
138 (ice-9 popen)
139 (ice-9 regex))
140 (set-path-environment-variable
141 "PATH" '("bin") (map (match-lambda
142 ((_ . input)
143 input))
144 %build-inputs))
145 (set-path-environment-variable
146 "GUIX_LOCPATH" '("lib/locale")
147 (list (assoc-ref %build-inputs "glibc-utf8-locales")))
148 (setenv "LANG" "en_US.UTF-8")
149 (let ((install-directory (string-append %output "/share/javascript/mathjax")))
89c75601
EF
150 (copy-recursively (string-append (assoc-ref %build-inputs "source") "/unpacked")
151 "MathJax-unpacked")
a3d3b7a4
AI
152 (mkdir-p install-directory)
153 (symlink (string-append (assoc-ref %build-inputs "font-mathjax")
154 "/share/fonts/mathjax")
155 (string-append install-directory "/fonts"))
156
157 (for-each
158 (lambda (file)
159 (let ((installed (string-append install-directory
89c75601
EF
160 ;; remove prefix "./MathJax-unpacked"
161 (string-drop file 18))))
a3d3b7a4
AI
162 (format #t "~a -> ~a~%" file installed)
163 (cond
164 ((string-match "\\.js$" file)
165 (mkdir-p (dirname installed))
166 (let ((minified (open-pipe* OPEN_READ "uglify-js" file)))
167 (call-with-output-file installed
168 (lambda (port)
9da2dd90
LC
169 (dump-port minified port)))
170
171 (let ((exit (close-pipe minified)))
172 (unless (zero? exit)
173 (error "dear, uglify-js failed" exit)))))
a3d3b7a4
AI
174 (else
175 (install-file file (dirname installed))))))
e3cfef22
MW
176 (find-files "."))
177
178 #t))))
a3d3b7a4
AI
179 (native-inputs
180 `(("font-mathjax" ,font-mathjax)
181 ("glibc-utf8-locales" ,glibc-utf8-locales)
182 ("uglify-js" ,uglify-js)
183 ,@(package-native-inputs font-mathjax)))
184 (synopsis "JavaScript display engine for LaTeX, MathML, and AsciiMath")
185 (description "MathJax is a JavaScript display engine for LaTeX, MathML,
186and AsciiMath notation that works in all modern browsers. It requires no
187plugins or software to be installed on the browser. So the page author can
188write web documents that include mathematics and be confident that readers will
189be able to view it naturally and easily.")))
b37b48f8 190
4408c4d0
RW
191(define-public js-commander
192 (package
193 (name "js-commander")
194 (version "6.2.1")
195 (source
196 (origin
197 (method git-fetch)
198 (uri (git-reference
199 (url "https://github.com/tj/commander.js")
200 (commit (string-append "v" version))))
201 (file-name (git-file-name name version))
202 (sha256
203 (base32
204 "126m25s6mxpxmdj4aw5awz06b47r8r798lcf1c5bnmmh39cik5i1"))))
205 (build-system trivial-build-system)
206 (arguments
207 `(#:modules ((guix build utils))
208 #:builder
209 (begin
210 (use-modules (guix build utils))
211 (chdir (assoc-ref %build-inputs "source"))
212 (let ((esbuild (string-append (assoc-ref %build-inputs "esbuild")
213 "/bin/esbuild"))
214 (target (string-append %output "/share/javascript/commander")))
215 (invoke esbuild
216 "--bundle"
217 "--minify"
218 "--tsconfig=tsconfig.json"
219 "--platform=node"
220 (string-append "--outfile=" target "/index.min.js")
221 "index.js")))))
222 (native-inputs
223 `(("esbuild" ,esbuild)))
224 (home-page "https://github.com/tj/commander.js")
225 (synopsis "Library for node.js command-line interfaces")
226 (description "Commander.js aims to be the complete solution for node.js
227command-line interfaces. ")
228 (license license:expat)))
229
2005aa4b
RW
230(define-public js-xmldom-sre
231 ;; This commit corresponds to the untagged release 0.1.32
232 (let ((commit "3c79325bc2c9e5d27e3ba44b680fa8c5dd6a381d")
233 (revision "1"))
234 (package
235 (name "js-xmldom-sre")
236 (version "0.1.32")
237 (source
238 (origin
239 (method git-fetch)
240 (uri (git-reference
241 (url "https://github.com/zorkow/xmldom/")
242 (commit commit)))
243 (file-name (git-file-name name version))
244 (sha256
245 (base32
246 "0a88v0id3mjflpvjqhv8a28br0xvaaszxbf7alg6pxfbnkb69yyq"))))
247 (build-system trivial-build-system)
248 (arguments
249 `(#:modules ((guix build utils))
250 #:builder
251 (begin
252 (use-modules (guix build utils))
253 (chdir (assoc-ref %build-inputs "source"))
254 (let ((esbuild (string-append (assoc-ref %build-inputs "esbuild")
255 "/bin/esbuild"))
256 (target (string-append %output "/share/javascript/xmldom-sre")))
257 (invoke esbuild
258 "--bundle"
259 "--minify"
260 "--platform=node"
261 (string-append "--outfile=" target "/dom-parser.min.js")
262 "dom-parser.js")))))
263 (native-inputs
264 `(("esbuild" ,esbuild)))
265 (home-page "https://github.com/zorkow/xmldom/")
266 (synopsis "DOM parser and XML serializer")
267 (description "This is a fork of the xmldom library. It allows the use
268of wicked-good-xpath together with xmldom.")
269 ;; One of these licenses may be selected.
270 (license (list license:expat
271 license:lgpl2.0)))))
272
b37b48f8
RW
273(define-public js-respond
274 (package
275 (name "js-respond")
276 (version "1.4.2")
277 (source (origin
97f6004c
EF
278 (method git-fetch)
279 (uri (git-reference
280 (url "https://github.com/scottjehl/Respond")
281 (commit version)))
282 (file-name (git-file-name name version))
b37b48f8
RW
283 (sha256
284 (base32
97f6004c 285 "00xid731rirc7sdy1gc8qal3v9g0agr2qx15hm4x97l1lcbylyn2"))))
367d0833 286 (build-system minify-build-system)
b37b48f8 287 (arguments
367d0833
EF
288 `(#:javascript-files '("src/matchmedia.addListener.js"
289 "src/matchmedia.polyfill.js"
290 "src/respond.js")))
b37b48f8 291 (home-page "https://github.com/scottjehl/Respond")
b37b48f8
RW
292 (synopsis "Polyfill for min/max-width CSS3 Media Queries")
293 (description "The goal of this script is to provide a fast and lightweight
294script to enable responsive web designs in browsers that don't support CSS3
295Media Queries.")
296 (license license:expat)))
ed69963b
RW
297
298(define-public js-html5shiv
299 (package
300 (name "js-html5shiv")
301 (version "3.7.3")
302 (source (origin
8a35e58a
EF
303 (method git-fetch)
304 (uri (git-reference
305 (url "https://github.com/aFarkas/html5shiv")
306 (commit version)))
307 (file-name (git-file-name name version))
ed69963b
RW
308 (sha256
309 (base32
8a35e58a 310 "0y1c5nyq0brl9fjdihhax33vks4s1ij9iv113879sg3zflmgqpd0"))))
ed69963b
RW
311 (build-system minify-build-system)
312 (home-page "https://github.com/aFarkas/html5shiv")
313 (synopsis "Enable HTML5 sectioning elements in legacy browsers")
314 (description "The HTML5 Shiv enables use of HTML5 sectioning elements in
315legacy Internet Explorer and provides basic HTML5 styling for Internet
316Explorer 6-9, Safari 4.x (and iPhone 3.x), and Firefox 3.x.")
317 ;; From the file "MIT and GPL2 licenses.md":
318 ;;
319 ;; This software is licensed under a dual license system (MIT or GPL
320 ;; version 2). This means you are free to choose with which of both
321 ;; licenses (MIT or GPL version 2) you want to use this library.
322 (license (list license:expat license:gpl2))))
68ffb6c5
RW
323
324(define-public js-json2
325 (let ((commit "031b1d9e6971bd4c433ca85e216cc853f5a867bd")
326 (revision "1"))
327 (package
328 (name "js-json2")
329 (version (string-append "2016-10-28." revision "-" (string-take commit 7)))
330 (source (origin
331 (method git-fetch)
332 (uri (git-reference
b0e7b699 333 (url "https://github.com/douglascrockford/JSON-js")
68ffb6c5
RW
334 (commit commit)))
335 (file-name (string-append name "-" version "-checkout"))
336 (sha256
337 (base32
338 "1fvb6b2y5sd3sqdgcj683sdxcbxdii34q0ysc9wg0dq1sy81l11v"))))
339 (build-system minify-build-system)
340 (arguments
341 `(#:javascript-files '("json2.js"
342 "json_parse.js"
343 "json_parse_state.js"
344 "cycle.js")))
345 (home-page "https://github.com/douglascrockford/JSON-js")
346 (synopsis "JSON encoders and decoders")
347 (description "The files in this collection implement JSON
348encoders/decoders in JavaScript.
349
350@code{json2.js}: This file creates a JSON property in the global object, if
351there isn't already one, setting its value to an object containing a stringify
352method and a parse method. The @code{parse} method uses the @code{eval}
353method to do the parsing, guarding it with several regular expressions to
354defend against accidental code execution hazards. On current browsers, this
355file does nothing, preferring the built-in JSON object.
356
357@code{json_parse.js}: This file contains an alternative JSON @code{parse}
358function that uses recursive descent instead of @code{eval}.
359
360@code{json_parse_state.js}: This files contains an alternative JSON
361@code{parse} function that uses a state machine instead of @code{eval}.
362
363@code{cycle.js}: This file contains two functions, @code{JSON.decycle} and
364@code{JSON.retrocycle}, which make it possible to encode cyclical structures
365and DAGs in JSON, and to then recover them. This is a capability that is not
366provided by ES5. @code{JSONPath} is used to represent the links.")
367 (license license:public-domain))))
3f48403a
RW
368
369(define-public js-strftime
370 (package
371 (name "js-strftime")
372 (version "0.10.0")
373 (source (origin
16df2914
EF
374 (method git-fetch)
375 (uri (git-reference
376 (url"https://github.com/samsonjs/strftime")
377 (commit (string-append "v" version))))
378 (file-name (git-file-name name version))
3f48403a
RW
379 (sha256
380 (base32
16df2914 381 "131nmlivazwxyba25kh9lda99749fq4xsyin6lzfalaaydviby4p"))))
3f48403a
RW
382 (build-system minify-build-system)
383 (arguments
384 `(#:javascript-files '("strftime.js")))
385 (home-page "https://github.com/samsonjs/strftime")
386 (synopsis "Implementation of strftime to JavaScript")
387 (description "This is an implementation of the @code{strftime} procedure
388for JavaScript. It works in (at least) node.js and browsers. It supports
389localization and timezones. Most standard specifiers from C are supported as
390well as some other extensions from Ruby.")
391 (license license:expat)))
a6bbb2a0
RW
392
393(define-public js-highlight
394 (package
395 (name "js-highlight")
396 (version "9.12.0")
397 (source (origin
778f4430
EF
398 (method git-fetch)
399 (uri (git-reference
400 (url "https://github.com/isagalaev/highlight.js")
401 (commit version)))
402 (file-name (git-file-name name version))
a6bbb2a0
RW
403 (sha256
404 (base32
778f4430 405 "12qz22qjpd6svj58pwgcwg2x2rzhihfdrxg6lgj39nfpaln6dris"))))
a6bbb2a0
RW
406 (build-system minify-build-system)
407 (arguments
408 `(#:javascript-files '("src/highlight.js")))
409 (home-page "https://github.com/isagalaev/highlight.js")
410 (synopsis "Syntax highlighting for JavaScript")
411 (description "Highlight.js is a syntax highlighter written in JavaScript.
412It works in the browser as well as on the server. It works with pretty much
413any markup, doesn’t depend on any framework and has automatic language
414detection.")
415 (license license:bsd-3)))
c4abc94d
RW
416
417(define-public js-datatables
418 (package
419 (name "js-datatables")
0920b41c 420 (version "1.10.19")
c4abc94d
RW
421 (source (origin
422 (method url-fetch)
423 (uri (string-append "https://datatables.net/releases/DataTables-"
424 version ".zip"))
425 (sha256
426 (base32
0920b41c 427 "0cff8a1g7pjwbjdqq0yzqd963ar7pfi4splmm6rwdzganr77rkhb"))))
c4abc94d
RW
428 (build-system minify-build-system)
429 (arguments
430 `(#:javascript-files '("media/js/dataTables.bootstrap.js"
431 "media/js/jquery.dataTables.js")))
432 (native-inputs
433 `(("unzip" ,unzip)))
434 (home-page "https://datatables.net")
435 (synopsis "DataTables plug-in for jQuery")
436 (description "DataTables is a table enhancing plug-in for the jQuery
437Javascript library, adding sorting, paging and filtering abilities to plain
438HTML tables with minimal effort.")
439 (license license:expat)))
4f65067b 440
4112ff7e
RW
441(define-public js-requirejs
442 (package
443 (name "js-requirejs")
444 (version "2.3.6")
445 (source (origin
446 (method git-fetch)
447 (uri (git-reference
b0e7b699 448 (url "https://github.com/requirejs/requirejs")
4112ff7e
RW
449 (commit version)))
450 (file-name (git-file-name name version))
451 (sha256
452 (base32
453 "0cvd5y2mb3h6yil3niqn3gjqrzixdsxcz4rvc2f0hg4kzp5y0w86"))))
454 (build-system minify-build-system)
455 (arguments `(#:javascript-files '("require.js")))
456 (home-page "https://github.com/requirejs/requirejs/")
457 (synopsis "File and module loader for JavaScript")
458 (description "RequireJS loads plain JavaScript files as well as more
459defined modules. It is optimized for in-browser use, including in a Web
460Worker, but it can be used in other JavaScript environments.")
461 (license license:expat)))
462
4f65067b
RW
463(define-public js-selectize
464 (package
465 (name "js-selectize")
3500cb58 466 (version "0.12.6")
4f65067b 467 (source (origin
41514478
EF
468 (method git-fetch)
469 (uri (git-reference
470 (url "https://github.com/selectize/selectize.js")
471 (commit (string-append "v" version))))
472 (file-name (git-file-name name version))
4f65067b
RW
473 (sha256
474 (base32
3500cb58 475 "15gichl8wi6yxag2ps723nxrgyan15976dzsnvw9h9py8sbyyzjn"))))
4f65067b
RW
476 (build-system minify-build-system)
477 (arguments `(#:javascript-files '("src/selectize.js")))
00c967f6 478 (home-page "https://selectize.github.io/selectize.js/")
4f65067b
RW
479 (synopsis "Hybrid widget between a textbox and <select> box")
480 (description "Selectize is the hybrid of a textbox and @code{<select>}
481box. It's jQuery based and it has autocomplete and native-feeling keyboard
482navigation; it is useful for tagging, contact lists, etc.")
483 (license license:asl2.0)))
0b0aa76f
RW
484
485(define-public js-es5-shim
486 (package
487 (name "js-es5-shim")
9cf60dec 488 (version "4.5.13")
0b0aa76f 489 (source (origin
2209a447
EF
490 (method git-fetch)
491 (uri (git-reference
492 (url "https://github.com/es-shims/es5-shim")
493 (commit (string-append "v" version))))
494 (file-name (git-file-name name version))
0b0aa76f
RW
495 (sha256
496 (base32
9cf60dec 497 "142w384fbyllq4yggv173g82lw3wix4jqcg6hkhx1ymq89vvnpmh"))))
0b0aa76f
RW
498 (build-system minify-build-system)
499 (arguments `(#:javascript-files
500 '("es5-sham.js"
501 "es5-shim.js")))
502 (home-page "https://github.com/es-shims/es5-shim")
503 (synopsis "ECMAScript 5 compatibility shims for legacy JavaScript engines")
504 (description "@code{es5-shim.js} patches a JavaScript context to contain
505all ECMAScript 5 methods that can be faithfully emulated with a legacy
506JavaScript engine. @code{es5-sham.js} patches other ES5 methods as closely as
507possible. Many of these shams are intended only to allow code to be written
508to ES5 without causing run-time errors in older engines. In many cases, this
509means that these shams cause many ES5 methods to silently fail.")
510 (license license:expat)))
89ba894e 511
11b43f99
NG
512(define-public js-filesaver
513 (package
514 (name "js-filesaver")
515 (version "1.3.8")
516 (source (origin
e452c69a
EF
517 (method git-fetch)
518 (uri (git-reference
519 (url "https://github.com/eligrey/FileSaver.js")
520 (commit version)))
521 (file-name (git-file-name name version))
11b43f99
NG
522 (sha256
523 (base32
e452c69a 524 "0gvqk0hnr8fig0n4da7vj7q6z31bcyv52916xz3rbmdj3pgpiv1d"))))
11b43f99
NG
525 (build-system minify-build-system)
526 (arguments
527 `(#:phases
528 (modify-phases %standard-phases
529 (add-after 'unpack 'fix-uglification
530 ;; Remove "export" keyword which prevents the file from being
531 ;; uglified by uglify-js. Moreover, that keyword is not present in
532 ;; the minified version of the library some projects are using,
533 ;; e.g.,
534 ;; <https://github.com/jmoenig/Snap--Build-Your-Own-Blocks/blob/master/FileSaver.min.js>
535 (lambda _
536 (substitute* "src/FileSaver.js"
537 (("export ") ""))
d8c71fd9
EF
538 #t))
539 (add-after 'install 'install-unminified-version
540 (lambda* (#:key outputs #:allow-other-keys)
541 (install-file "src/FileSaver.js"
542 (string-append (assoc-ref outputs "out")
543 "/share/javascript"))
11b43f99
NG
544 #t)))))
545 (home-page
546 "https://eligrey.com/blog/saving-generated-files-on-the-client-side/")
547 (synopsis "HTML5 saveAs() FileSaver implementation")
548 (description "@file{FileSaver.js} implements the @code{saveAs()}
549FileSaver interface in browsers that do not natively support it.
550
551@file{FileSaver.js} is the solution to saving files on the
552client-side, and is perfect for webapps that need to generate files,
553or for saving sensitive information that shouldn't be sent to an
554external server.")
555 (license license:expat)))
556
89ba894e
EF
557(define-public mujs
558 (package
559 (name "mujs")
6ba730cf 560 (version "1.1.1")
d3e6f41a
TGR
561 (source
562 (origin
563 (method git-fetch)
564 (uri (git-reference
565 (url "https://github.com/ccxvii/mujs")
566 (commit version)))
567 (file-name (git-file-name name version))
568 (sha256
6ba730cf 569 (base32 "0ivqz06fq8v36p2gkjh64vgv0gm7nghds0n42vrv7vm46phdffvb"))))
89ba894e
EF
570 (build-system gnu-build-system)
571 (arguments
d3e6f41a 572 `(#:phases
f8ddf719 573 (modify-phases %standard-phases
d3e6f41a 574 (delete 'configure) ; no configure script
94147d67 575 (replace 'install
cb5b5149
EF
576 (lambda* (#:key (make-flags '()) #:allow-other-keys)
577 (apply invoke "make" "install-shared" make-flags))))
d3e6f41a
TGR
578 #:make-flags
579 (list ,(string-append "VERSION=" version)
4a74499c 580 ,(string-append "CC=" (cc-for-target))
d3e6f41a 581 (string-append "prefix=" (assoc-ref %outputs "out")))
99863166
TGR
582 #:tests? #f)) ; no tests
583 (inputs
584 `(("readline" ,readline)))
cb5b5149 585 (home-page "https://mujs.com/")
89ba894e
EF
586 (synopsis "JavaScript interpreter written in C")
587 (description "MuJS is a lightweight Javascript interpreter designed for
588embedding in other software to extend them with scripting capabilities. MuJS
589was designed with a focus on small size, correctness, and simplicity. It is
590written in portable C and implements ECMAScript as specified by ECMA-262. The
591interface for binding with native code is designed to be as simple as possible
592to use, and is very similar to Lua. There is no need to interact with byzantine
593C++ template mechanisms, or worry about marking and unmarking garbage collection
594roots, or wrestle with obscure build systems.")
595 (license license:isc)))
4a2cb3fa
RP
596
597(define-public quickjs
598 (package
599 (name "quickjs")
c9b852a9 600 (version "2021-03-27")
4a2cb3fa
RP
601 (source (origin
602 (method url-fetch)
603 (uri (string-append "https://bellard.org/quickjs/quickjs-"
604 version ".tar.xz"))
605 (sha256
606 (base32
c9b852a9 607 "06pywwpmfwjz225h59wf90q96a2fd66qfcw5xa6m6y9k9k7glnx4"))))
4a2cb3fa
RP
608 (build-system gnu-build-system)
609 (arguments
610 `(#:make-flags
611 (list "prefix="
612 (string-append "DESTDIR=" %output))
613 #:phases
614 (modify-phases %standard-phases
615 (delete 'configure)
616 (replace 'check
617 (lambda _
618 (invoke "make" "microbench"))))))
619 (home-page "https://bellard.org/quickjs/")
620 (synopsis "Small embeddable Javascript engine")
621 (description "QuickJS supports the ES2020 specification including modules,
622asynchronous generators, proxies, BigInt and BigDecimal. It can compile
623Javascript sources to executables with no external dependency. It includes a
624command line interpreter with contextual colorization implemented in
625Javascript and a small built-in standard library with C library wrappers.")
626 (license license:expat)))
b509a071
PN
627
628(define-public duktape
629 (package
630 (name "duktape")
631 (version "2.6.0")
632 (source (origin
633 (method url-fetch)
634 (uri (string-append "https://duktape.org/duktape-"
635 version ".tar.xz"))
636 (sha256
637 (base32
638 "19szwxzvl2g65fw95ggvb8h0ma5bd9vvnnccn59hwnc4dida1x4n"))))
639 (build-system gnu-build-system)
640 (arguments
641 '(#:tests? #f ; No tests.
642 #:make-flags (list "-f" "Makefile.sharedlibrary"
643 (string-append "INSTALL_PREFIX=" %output))
644 #:phases
645 (modify-phases %standard-phases
646 (delete 'configure))))
647 (home-page "https://duktape.org/")
648 (synopsis "Small embeddable Javascript engine")
649 (description "Duktape is an embeddable Javascript engine, with a focus on
650portability and compact footprint. Duktape is easy to integrate into a C/C++
651project: add @file{duktape.c}, @file{duktape.h}, and @file{duk_config.h} to
652your build, and use the Duktape API to call ECMAScript functions from C code
653and vice versa.")
654 (license license:expat)))